mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fixed memory leak with FolderData::removeFileRecursive.
Made "DELETE" actually work in GuiMetaDataEd. "DELETE" option also now asks if you're sure. GuiMetaDataEd can be closed with the "b" button now. GuiGameScraper now tries to put the cursor on the first game if there is one when a search completes.
This commit is contained in:
parent
9867e902de
commit
a554fea973
|
@ -180,6 +180,7 @@ void FolderData::removeFileRecursive(FileData* f)
|
|||
{
|
||||
if(*iter == f)
|
||||
{
|
||||
delete *iter;
|
||||
iter = mFileVector.erase(iter);
|
||||
}else{
|
||||
|
||||
|
|
|
@ -151,8 +151,11 @@ bool GuiGameList::input(InputConfig* config, Input input)
|
|||
searchParams.system = mSystem;
|
||||
mWindow->pushGui(new GuiMetaDataEd(mWindow, game->metadata(), mSystem->getGameMDD(), searchParams, game->getBaseName(),
|
||||
[&] { updateDetailData(); },
|
||||
[game, root, this] { root->removeFileRecursive(game); updateList(); }
|
||||
));
|
||||
[game, root, this] {
|
||||
boost::filesystem::remove(game->getPath());
|
||||
root->removeFileRecursive(game);
|
||||
updateList();
|
||||
}));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -120,6 +120,9 @@ void GuiGameScraper::onSearchDone(std::vector<MetaDataList> results)
|
|||
mList.setEntry(Eigen::Vector2i(0, 6 + i), Eigen::Vector2i(1, 1), &mResultNames.at(i), true, ComponentListComponent::AlignLeft);
|
||||
}
|
||||
}
|
||||
|
||||
mList.resetCursor();
|
||||
mList.moveCursor(Eigen::Vector2i(0, 1)); //move cursor to first game if there is one
|
||||
}
|
||||
|
||||
int GuiGameScraper::getSelectedIndex()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../Settings.h"
|
||||
#include "GuiGameScraper.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "GuiMsgBoxYesNo.h"
|
||||
|
||||
#define MDED_RESERVED_ROWS 3
|
||||
|
||||
|
@ -30,7 +31,11 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
|||
//initialize buttons
|
||||
mDeleteButton.setText("DELETE", mDeleteFunc ? 0xFF0000FF : 0x555555FF);
|
||||
if(mDeleteFunc)
|
||||
mDeleteButton.setPressedFunc([&] { mDeleteFunc(); delete this; });
|
||||
{
|
||||
std::function<void()> deleteFileAndSelf = [&] { mDeleteFunc(); delete this; };
|
||||
std::function<void()> pressedFunc = [this, deleteFileAndSelf] { mWindow->pushGui(new GuiMsgBoxYesNo(mWindow, "This will delete a file!\nAre you sure?", deleteFileAndSelf)); };
|
||||
mDeleteButton.setPressedFunc(pressedFunc);
|
||||
}
|
||||
|
||||
mFetchButton.setText("FETCH", 0x00FF00FF);
|
||||
mFetchButton.setPressedFunc(std::bind(&GuiMetaDataEd::fetch, this));
|
||||
|
@ -164,3 +169,18 @@ void GuiMetaDataEd::fetchDone(MetaDataList result)
|
|||
mEditors.at(i)->setValue(result.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GuiMetaDataEd::input(InputConfig* config, Input input)
|
||||
{
|
||||
if(GuiComponent::input(config, input))
|
||||
return true;
|
||||
|
||||
if(input.value != 0 && config->isMappedTo("b", input))
|
||||
{
|
||||
delete this;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
const std::string& header, std::function<void()> savedCallback, std::function<void()> deleteFunc);
|
||||
virtual ~GuiMetaDataEd();
|
||||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
|
||||
private:
|
||||
void save();
|
||||
void fetch();
|
||||
|
|
Loading…
Reference in a new issue