mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +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)
|
if(*iter == f)
|
||||||
{
|
{
|
||||||
|
delete *iter;
|
||||||
iter = mFileVector.erase(iter);
|
iter = mFileVector.erase(iter);
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,11 @@ bool GuiGameList::input(InputConfig* config, Input input)
|
||||||
searchParams.system = mSystem;
|
searchParams.system = mSystem;
|
||||||
mWindow->pushGui(new GuiMetaDataEd(mWindow, game->metadata(), mSystem->getGameMDD(), searchParams, game->getBaseName(),
|
mWindow->pushGui(new GuiMetaDataEd(mWindow, game->metadata(), mSystem->getGameMDD(), searchParams, game->getBaseName(),
|
||||||
[&] { updateDetailData(); },
|
[&] { updateDetailData(); },
|
||||||
[game, root, this] { root->removeFileRecursive(game); updateList(); }
|
[game, root, this] {
|
||||||
));
|
boost::filesystem::remove(game->getPath());
|
||||||
|
root->removeFileRecursive(game);
|
||||||
|
updateList();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
return true;
|
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.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()
|
int GuiGameScraper::getSelectedIndex()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../Settings.h"
|
#include "../Settings.h"
|
||||||
#include "GuiGameScraper.h"
|
#include "GuiGameScraper.h"
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include "GuiMsgBoxYesNo.h"
|
||||||
|
|
||||||
#define MDED_RESERVED_ROWS 3
|
#define MDED_RESERVED_ROWS 3
|
||||||
|
|
||||||
|
@ -30,7 +31,11 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
||||||
//initialize buttons
|
//initialize buttons
|
||||||
mDeleteButton.setText("DELETE", mDeleteFunc ? 0xFF0000FF : 0x555555FF);
|
mDeleteButton.setText("DELETE", mDeleteFunc ? 0xFF0000FF : 0x555555FF);
|
||||||
if(mDeleteFunc)
|
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.setText("FETCH", 0x00FF00FF);
|
||||||
mFetchButton.setPressedFunc(std::bind(&GuiMetaDataEd::fetch, this));
|
mFetchButton.setPressedFunc(std::bind(&GuiMetaDataEd::fetch, this));
|
||||||
|
@ -164,3 +169,18 @@ void GuiMetaDataEd::fetchDone(MetaDataList result)
|
||||||
mEditors.at(i)->setValue(result.get(key));
|
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);
|
const std::string& header, std::function<void()> savedCallback, std::function<void()> deleteFunc);
|
||||||
virtual ~GuiMetaDataEd();
|
virtual ~GuiMetaDataEd();
|
||||||
|
|
||||||
|
bool input(InputConfig* config, Input input) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void save();
|
void save();
|
||||||
void fetch();
|
void fetch();
|
||||||
|
|
Loading…
Reference in a new issue