Commit 330f20f3 authored by Aloshi's avatar Aloshi

Added Ctrl-R shortcut to reload current gamelist view if in debug mode.

parent b7b29987
......@@ -77,6 +77,8 @@ Or, you can create your own elements by adding `extra="true"` (as is done in the
Advanced Features
=================
It is recommended that if you are writing a theme you launch EmulationStation with the `--debug` and `--windowed` switches. This way you can read error messages without having to check the log file. You can also reload the current gamelist view with `Ctrl-R` if `--debug` is specified.
### The `<include>` tag
You can include theme files within theme files, similar to `#include` in C (though the mechanism is different, the effect is the same). Example:
......
......@@ -46,15 +46,7 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, con
mRootFolder->sort(FileSorts::SortTypes.at(0));
mTheme = std::make_shared<ThemeData>();
try
{
mTheme->loadFile(getThemePath());
} catch(ThemeException& e)
{
LOG(LogError) << e.what();
mTheme = std::make_shared<ThemeData>(); // reset to empty
}
loadTheme();
}
SystemData::~SystemData()
......@@ -384,3 +376,16 @@ unsigned int SystemData::getGameCount() const
{
return mRootFolder->getFilesRecursive(GAME).size();
}
void SystemData::loadTheme()
{
mTheme = std::make_shared<ThemeData>();
try
{
mTheme->loadFile(getThemePath());
} catch(ThemeException& e)
{
LOG(LogError) << e.what();
mTheme = std::make_shared<ThemeData>(); // reset to empty
}
}
......@@ -58,6 +58,9 @@ public:
return *it;
}
// Load or re-load theme.
void loadTheme();
private:
std::string mName;
std::string mFullName;
......
......@@ -226,7 +226,7 @@ void ViewController::preload()
}
}
void ViewController::reloadGameListView(IGameListView* view)
void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
{
for(auto it = mGameListViews.begin(); it != mGameListViews.end(); it++)
{
......@@ -237,6 +237,9 @@ void ViewController::reloadGameListView(IGameListView* view)
FileData* cursor = view->getCursor();
mGameListViews.erase(it);
if(reloadTheme)
system->loadTheme();
std::shared_ptr<IGameListView> newView = getGameListView(system);
newView->setCursor(cursor);
......
......@@ -16,7 +16,7 @@ public:
// If a basic view detected a metadata change, it can request to recreate
// the current gamelist view (as it may change to be detailed).
void reloadGameListView(IGameListView* gamelist);
void reloadGameListView(IGameListView* gamelist, bool reloadTheme = false);
// Navigation.
void goToNextGameList();
......
......@@ -4,9 +4,11 @@
#include "../../components/GuiMenu.h"
#include "../../components/GuiFastSelect.h"
#include "../ViewController.h"
#include "../../Settings.h"
bool IGameListView::input(InputConfig* config, Input input)
{
// F3 to open metadata editor
if(config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_F3 && input.value != 0)
{
// open metadata editor
......@@ -23,6 +25,15 @@ bool IGameListView::input(InputConfig* config, Input input)
}));
Sound::getFromTheme(mTheme, getName(), "menuOpen")->play();
return true;
// Ctrl-R to reload a view when debugging
}else if(Settings::getInstance()->getBool("DEBUG") && config->getDeviceId() == DEVICE_KEYBOARD &&
(SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r && input.value != 0)
{
LOG(LogDebug) << "reloading view";
mWindow->getViewController()->reloadGameListView(this, true);
return true;
// select opens the fast select GUI
}else if(config->isMappedTo("select", input) && input.value != 0)
{
// open fast select
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment