The theme transitions menu entry is now grayed out if there are no transitions to choose between.

This commit is contained in:
Leon Styhre 2023-02-01 20:00:36 +01:00
parent 192f218bd5
commit 9dab1557ca
2 changed files with 19 additions and 6 deletions

View file

@ -393,6 +393,23 @@ void GuiMenu::openUIOptions()
} }
if (themeTransitions->getSelectedObjects().size() == 0) if (themeTransitions->getSelectedObjects().size() == 0)
themeTransitions->selectEntry(0); themeTransitions->selectEntry(0);
if (themeTransitions->getNumEntries() == 1) {
themeTransitions->setEnabled(false);
themeTransitions->setOpacity(DISABLED_OPACITY);
themeTransitions->getParent()
->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY);
}
else {
themeTransitions->setEnabled(true);
themeTransitions->setOpacity(1.0f);
themeTransitions->getParent()
->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(1.0f);
}
LOG(LogError) << "SELECTABLE ENTRIES: " << themeTransitions->getNumEntries();
} }
}; };
@ -916,12 +933,6 @@ void GuiMenu::openUIOptions()
->getChild(gamelistViewStyle->getChildIndex() - 1) ->getChild(gamelistViewStyle->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
themeTransitions->setEnabled(true);
themeTransitions->setOpacity(1.0f);
themeTransitions->getParent()
->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(1.0f);
legacyThemeTransitions->setEnabled(false); legacyThemeTransitions->setEnabled(false);
legacyThemeTransitions->setOpacity(DISABLED_OPACITY); legacyThemeTransitions->setOpacity(DISABLED_OPACITY);
legacyThemeTransitions->getParent() legacyThemeTransitions->getParent()

View file

@ -156,6 +156,8 @@ public:
return GuiComponent::input(config, input); return GuiComponent::input(config, input);
} }
const int getNumEntries() { return mEntries.size(); }
std::vector<T> getSelectedObjects() std::vector<T> getSelectedObjects()
{ {
std::vector<T> ret; std::vector<T> ret;