A transition now always takes place to the System view when changing theme sets.

Also fixed an issue where the camera would not move until after the menu was closed.
This commit is contained in:
Leon Styhre 2021-04-05 10:05:08 +02:00
parent 510f428b52
commit e0e1a05f1e
3 changed files with 17 additions and 2 deletions

View file

@ -183,14 +183,16 @@ void GuiMenu::openUISettings()
for (auto it = themeSets.cbegin(); it != themeSets.cend(); it++)
theme_set->add(it->first, it->first, it == selectedSet);
s->addWithLabel("THEME SET", theme_set);
s->addSaveFunc([theme_set, s] {
s->addSaveFunc([this, theme_set, s] {
if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) {
Scripting::fireEvent("theme-changed", theme_set->getSelected(),
Settings::getInstance()->getString("ThemeSet"));
Settings::getInstance()->setString("ThemeSet", theme_set->getSelected());
CollectionSystemsManager::get()->updateSystemsList();
mWindow->setChangedThemeSet();
s->setNeedsSaving();
s->setNeedsReloading();
s->setNeedsGoToStart();
s->setInvalidateCachedBackground();
}
});

View file

@ -38,7 +38,8 @@ Window::Window()
mInvalidatedCachedBackground(false),
mTopOpacity(0),
mTopScale(0.5),
mListScrollOpacity(0)
mListScrollOpacity(0),
mChangedThemeSet(false)
{
mHelp = new HelpComponent(this);
mBackgroundOverlay = new ImageComponent(this);
@ -292,6 +293,15 @@ void Window::update(int deltaTime)
if (peekGui())
peekGui()->update(deltaTime);
// If the theme set changed, we need to update the background once so that the camera
// will be moved. This is required as theme set changes always makes a transition to
// the system view. If we wouldn't make this update, the camera movement would only
// take place once the menu has been closed.
if (mChangedThemeSet && mGuiStack.size() > 1) {
mGuiStack.front()->update(deltaTime);
mChangedThemeSet = false;
}
// Update the screensaver.
if (mScreensaver)
mScreensaver->update(deltaTime);

View file

@ -106,6 +106,8 @@ public:
void setAllowTextScrolling(bool setting) { mAllowTextScrolling = setting; };
bool getAllowTextScrolling() { return mAllowTextScrolling; };
void setChangedThemeSet() { mChangedThemeSet = true; };
private:
void onSleep();
void onWake();
@ -143,6 +145,7 @@ private:
unsigned char mTopOpacity;
float mTopScale;
bool mRenderedHelpPrompts;
bool mChangedThemeSet;
};
#endif // ES_CORE_WINDOW_H