Changed "B" to "Back" in the metadata editor.

"Start" closes all windows.
This commit is contained in:
Aloshi 2014-05-16 15:42:37 -05:00
parent 0743828b77
commit 90cc0991a3
3 changed files with 23 additions and 9 deletions

View file

@ -54,7 +54,6 @@ void GuiGamelistOptions::openMetaDataEd()
mGamelist->onFileChanged(file, FILE_REMOVED); //tell the view
delete file; //free it
}));
delete this;
}
bool GuiGamelistOptions::input(InputConfig* config, Input input)

View file

@ -3,6 +3,7 @@
#include "../Log.h"
#include "../components/AsyncReqComponent.h"
#include "../Settings.h"
#include "../views/ViewController.h"
#include "GuiGameScraper.h"
#include "GuiMsgBox.h"
#include <boost/filesystem.hpp>
@ -195,7 +196,7 @@ void GuiMetaDataEd::fetchDone(const ScraperSearchResult& result)
}
}
void GuiMetaDataEd::close()
void GuiMetaDataEd::close(bool closeAllWindows)
{
// find out if the user made any changes
bool dirty = false;
@ -209,16 +210,29 @@ void GuiMetaDataEd::close()
}
}
std::function<void()> closeFunc;
if(closeAllWindows)
{
closeFunc = [this] { delete this; };
}else{
Window* window = mWindow;
closeFunc = [window, this] {
while(window->peekGui() != window->getViewController())
delete window->peekGui();
};
}
if(dirty)
{
// changes were made, ask if the user wants to save them
mWindow->pushGui(new GuiMsgBox(mWindow,
"SAVE CHANGES?",
"YES", [&] { save(); delete this; },
"NO", [&] { delete this; }
"YES", [this, closeFunc] { save(); closeFunc(); },
"NO", closeFunc
));
}else{
delete this;
closeFunc();
}
}
@ -227,9 +241,10 @@ bool GuiMetaDataEd::input(InputConfig* config, Input input)
if(GuiComponent::input(config, input))
return true;
if(input.value != 0 && (config->isMappedTo("b", input) || config->isMappedTo("start", input)))
const bool isStart = config->isMappedTo("start", input);
if(input.value != 0 && (config->isMappedTo("b", input) || isStart))
{
close();
close(isStart);
return true;
}
@ -239,7 +254,7 @@ bool GuiMetaDataEd::input(InputConfig* config, Input input)
std::vector<HelpPrompt> GuiMetaDataEd::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
prompts.push_back(HelpPrompt("b", "close"));
prompts.push_back(HelpPrompt("b", "back"));
prompts.push_back(HelpPrompt("start", "close"));
return prompts;
}

View file

@ -21,7 +21,7 @@ private:
void save();
void fetch();
void fetchDone(const ScraperSearchResult& result);
void close();
void close(bool closeAllWindows);
NinePatchComponent mBackground;
ComponentGrid mGrid;