Added "Reload" menu option.

As usual, it's undertested, please report any problems.
This commit is contained in:
Aloshi 2013-01-26 11:47:43 -06:00
parent 9a27a868bb
commit f336eece75
4 changed files with 20 additions and 6 deletions

View file

@ -1,7 +1,10 @@
January 8, 2012
January 26, 2013
-Added "Reload" option to the menu. This option reloads all game data.
January 8, 2013
-Made a value of zero for "list selected color" mean no change.
January 6, 2012
January 6, 2013
-Added <basicTheme> tag support.
December 20, 2012

View file

@ -14,7 +14,7 @@
//This is where the magic happens - GuiGameList is the parent of almost every graphical element in ES at the moment.
//It has a GuiList child that handles the game list, a GuiTheme that handles the theming system, and a GuiImage for game images.
class GuiGameList : GuiComponent
class GuiGameList : public GuiComponent
{
public:
GuiGameList(bool useDetail = false);

View file

@ -2,11 +2,13 @@
#include <iostream>
#include <SDL/SDL.h>
#include "../Log.h"
#include "../SystemData.h"
#include "GuiGameList.h"
//defined in main.cpp
extern bool DONTSHOWEXIT;
GuiMenu::GuiMenu(GuiComponent* parent)
GuiMenu::GuiMenu(GuiGameList* parent)
{
mParent = parent;
parent->pause();
@ -58,6 +60,11 @@ void GuiMenu::executeCommand(std::string command)
SDL_Event* event = new SDL_Event();
event->type = SDL_QUIT;
SDL_PushEvent(event);
}else if(command == "es_reload")
{
//reload the game list
SystemData::loadConfig();
mParent->setSystemId(0);
}else{
if(system(command.c_str()) != 0)
{
@ -78,6 +85,8 @@ void GuiMenu::populateList()
mList->addObject("Restart", "sudo shutdown -r now", 0x0000FFFF);
mList->addObject("Shutdown", "sudo shutdown -h now", 0x0000FFFF);
mList->addObject("Reload", "es_reload", 0x0000FFFF);
if(!DONTSHOWEXIT)
mList->addObject("Exit", "exit", 0xFF0000FF); //a special case; pushes an SDL quit event to the event stack instead of being called by system()
}

View file

@ -4,18 +4,20 @@
#include "../GuiComponent.h"
#include "GuiList.h"
class GuiGameList;
//This is a very simple menu that is opened by pressing the Menu key.
class GuiMenu : public GuiComponent
{
public:
GuiMenu(GuiComponent* parent);
GuiMenu(GuiGameList* parent);
~GuiMenu();
void onInput(InputManager::InputButton button, bool keyDown);
void onRender();
private:
GuiComponent* mParent;
GuiGameList* mParent;
GuiList<std::string>* mList;
void populateList();