mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added Ctrl-R shortcut to reload current gamelist view if in debug mode.
This commit is contained in:
parent
b7b2998720
commit
330f20f375
|
@ -77,6 +77,8 @@ Or, you can create your own elements by adding `extra="true"` (as is done in the
|
||||||
Advanced Features
|
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
|
### 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:
|
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));
|
mRootFolder->sort(FileSorts::SortTypes.at(0));
|
||||||
|
|
||||||
mTheme = std::make_shared<ThemeData>();
|
loadTheme();
|
||||||
try
|
|
||||||
{
|
|
||||||
mTheme->loadFile(getThemePath());
|
|
||||||
} catch(ThemeException& e)
|
|
||||||
{
|
|
||||||
LOG(LogError) << e.what();
|
|
||||||
mTheme = std::make_shared<ThemeData>(); // reset to empty
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemData::~SystemData()
|
SystemData::~SystemData()
|
||||||
|
@ -384,3 +376,16 @@ unsigned int SystemData::getGameCount() const
|
||||||
{
|
{
|
||||||
return mRootFolder->getFilesRecursive(GAME).size();
|
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;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load or re-load theme.
|
||||||
|
void loadTheme();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::string mFullName;
|
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++)
|
for(auto it = mGameListViews.begin(); it != mGameListViews.end(); it++)
|
||||||
{
|
{
|
||||||
|
@ -237,6 +237,9 @@ void ViewController::reloadGameListView(IGameListView* view)
|
||||||
FileData* cursor = view->getCursor();
|
FileData* cursor = view->getCursor();
|
||||||
mGameListViews.erase(it);
|
mGameListViews.erase(it);
|
||||||
|
|
||||||
|
if(reloadTheme)
|
||||||
|
system->loadTheme();
|
||||||
|
|
||||||
std::shared_ptr<IGameListView> newView = getGameListView(system);
|
std::shared_ptr<IGameListView> newView = getGameListView(system);
|
||||||
newView->setCursor(cursor);
|
newView->setCursor(cursor);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
|
|
||||||
// If a basic view detected a metadata change, it can request to recreate
|
// If a basic view detected a metadata change, it can request to recreate
|
||||||
// the current gamelist view (as it may change to be detailed).
|
// the current gamelist view (as it may change to be detailed).
|
||||||
void reloadGameListView(IGameListView* gamelist);
|
void reloadGameListView(IGameListView* gamelist, bool reloadTheme = false);
|
||||||
|
|
||||||
// Navigation.
|
// Navigation.
|
||||||
void goToNextGameList();
|
void goToNextGameList();
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
#include "../../components/GuiMenu.h"
|
#include "../../components/GuiMenu.h"
|
||||||
#include "../../components/GuiFastSelect.h"
|
#include "../../components/GuiFastSelect.h"
|
||||||
#include "../ViewController.h"
|
#include "../ViewController.h"
|
||||||
|
#include "../../Settings.h"
|
||||||
|
|
||||||
bool IGameListView::input(InputConfig* config, Input input)
|
bool IGameListView::input(InputConfig* config, Input input)
|
||||||
{
|
{
|
||||||
|
// F3 to open metadata editor
|
||||||
if(config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_F3 && input.value != 0)
|
if(config->getDeviceId() == DEVICE_KEYBOARD && input.id == SDLK_F3 && input.value != 0)
|
||||||
{
|
{
|
||||||
// open metadata editor
|
// open metadata editor
|
||||||
|
@ -23,6 +25,15 @@ bool IGameListView::input(InputConfig* config, Input input)
|
||||||
}));
|
}));
|
||||||
Sound::getFromTheme(mTheme, getName(), "menuOpen")->play();
|
Sound::getFromTheme(mTheme, getName(), "menuOpen")->play();
|
||||||
return true;
|
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)
|
}else if(config->isMappedTo("select", input) && input.value != 0)
|
||||||
{
|
{
|
||||||
// open fast select
|
// open fast select
|
||||||
|
|
Loading…
Reference in a new issue