Changed 'Theme transition animations' to 'Theme transitions'.

This commit is contained in:
Leon Styhre 2023-01-16 22:43:56 +01:00
parent 7e30f3f3cf
commit 8273cb5a8f
3 changed files with 89 additions and 91 deletions

View file

@ -289,45 +289,44 @@ void GuiMenu::openUIOptions()
themeAspectRatiosFunc(Settings::getInstance()->getString("ThemeSet"), themeAspectRatiosFunc(Settings::getInstance()->getString("ThemeSet"),
Settings::getInstance()->getString("ThemeAspectRatio")); Settings::getInstance()->getString("ThemeAspectRatio"));
// Theme transition animations. // Theme transitions.
auto themeTransitionAnimations = std::make_shared<OptionListComponent<std::string>>( auto themeTransitions = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "THEME TRANSITION ANIMS", false); getHelpStyle(), "THEME TRANSITIONS", false);
std::string selectedAnim {Settings::getInstance()->getString("ThemeTransitionAnimations")}; std::string selectedThemeTransitions {Settings::getInstance()->getString("ThemeTransitions")};
themeTransitionAnimations->add("AUTOMATIC", "automatic", selectedAnim == "automatic"); themeTransitions->add("AUTOMATIC", "automatic", selectedThemeTransitions == "automatic");
// If there are no objects returned, then there must be a manually modified entry in the // If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the animation type to "automatic" in this case. // configuration file. Simply set theme transitions to "automatic" in this case.
if (themeTransitionAnimations->getSelectedObjects().size() == 0) if (themeTransitions->getSelectedObjects().size() == 0)
themeTransitionAnimations->selectEntry(0); themeTransitions->selectEntry(0);
s->addWithLabel("THEME TRANSITION ANIMATIONS", themeTransitionAnimations); s->addWithLabel("THEME TRANSITIONS", themeTransitions);
s->addSaveFunc([themeTransitionAnimations, s] { s->addSaveFunc([themeTransitions, s] {
if (themeTransitionAnimations->getSelected() != if (themeTransitions->getSelected() !=
Settings::getInstance()->getString("ThemeTransitionAnimations")) { Settings::getInstance()->getString("ThemeTransitions")) {
Settings::getInstance()->setString("ThemeTransitionAnimations", Settings::getInstance()->setString("ThemeTransitions", themeTransitions->getSelected());
themeTransitionAnimations->getSelected());
ThemeData::setThemeTransitions(); ThemeData::setThemeTransitions();
s->setNeedsSaving(); s->setNeedsSaving();
} }
}); });
auto themeTransitionAnimationsFunc = [=](const std::string& selectedTheme, auto themeTransitionsFunc = [=](const std::string& selectedTheme,
const std::string& selectedTransitionAnimation) { const std::string& selectedThemeTransitions) {
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
currentSet {themeSets.find(selectedTheme)}; currentSet {themeSets.find(selectedTheme)};
if (currentSet == themeSets.cend()) if (currentSet == themeSets.cend())
return; return;
// We need to recreate the OptionListComponent entries. // We need to recreate the OptionListComponent entries.
themeTransitionAnimations->clearEntries(); themeTransitions->clearEntries();
if (currentSet->second.capabilities.legacyTheme) { if (currentSet->second.capabilities.legacyTheme) {
themeTransitionAnimations->add("Legacy theme set", "automatic", true); themeTransitions->add("Legacy theme set", "automatic", true);
themeTransitionAnimations->setEnabled(false); themeTransitions->setEnabled(false);
themeTransitionAnimations->setOpacity(DISABLED_OPACITY); themeTransitions->setOpacity(DISABLED_OPACITY);
themeTransitionAnimations->getParent() themeTransitions->getParent()
->getChild(themeTransitionAnimations->getChildIndex() - 1) ->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
} }
else { else {
themeTransitionAnimations->add("AUTOMATIC", "automatic", themeTransitions->add("AUTOMATIC", "automatic",
"automatic" == selectedTransitionAnimation); "automatic" == selectedThemeTransitions);
if (currentSet->second.capabilities.transitions.size() == 1 && if (currentSet->second.capabilities.transitions.size() == 1 &&
currentSet->second.capabilities.transitions.front().selectable) { currentSet->second.capabilities.transitions.front().selectable) {
std::string label; std::string label;
@ -335,10 +334,9 @@ void GuiMenu::openUIOptions()
label = "THEME PROFILE"; label = "THEME PROFILE";
else else
label = currentSet->second.capabilities.transitions.front().label; label = currentSet->second.capabilities.transitions.front().label;
const std::string transitionAnim { const std::string transitions {
currentSet->second.capabilities.transitions.front().name}; currentSet->second.capabilities.transitions.front().name};
themeTransitionAnimations->add(label, transitionAnim, themeTransitions->add(label, transitions, transitions == selectedThemeTransitions);
transitionAnim == selectedTransitionAnimation);
} }
else { else {
for (size_t i {0}; i < currentSet->second.capabilities.transitions.size(); ++i) { for (size_t i {0}; i < currentSet->second.capabilities.transitions.size(); ++i) {
@ -349,40 +347,40 @@ void GuiMenu::openUIOptions()
label = "THEME PROFILE " + std::to_string(i + 1); label = "THEME PROFILE " + std::to_string(i + 1);
else else
label = currentSet->second.capabilities.transitions[i].label; label = currentSet->second.capabilities.transitions[i].label;
const std::string transitionAnim { const std::string transitions {
currentSet->second.capabilities.transitions[i].name}; currentSet->second.capabilities.transitions[i].name};
themeTransitionAnimations->add(label, transitionAnim, themeTransitions->add(label, transitions,
transitionAnim == selectedTransitionAnimation); transitions == selectedThemeTransitions);
} }
} }
if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(), if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(),
currentSet->second.capabilities.suppressedTransitionProfiles.cend(), currentSet->second.capabilities.suppressedTransitionProfiles.cend(),
"builtin-instant") == "builtin-instant") ==
currentSet->second.capabilities.suppressedTransitionProfiles.cend()) { currentSet->second.capabilities.suppressedTransitionProfiles.cend()) {
themeTransitionAnimations->add("INSTANT (BUILT-IN)", "builtin-instant", themeTransitions->add("INSTANT (BUILT-IN)", "builtin-instant",
"builtin-instant" == selectedTransitionAnimation); "builtin-instant" == selectedThemeTransitions);
} }
if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(), if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(),
currentSet->second.capabilities.suppressedTransitionProfiles.cend(), currentSet->second.capabilities.suppressedTransitionProfiles.cend(),
"builtin-slide") == "builtin-slide") ==
currentSet->second.capabilities.suppressedTransitionProfiles.cend()) { currentSet->second.capabilities.suppressedTransitionProfiles.cend()) {
themeTransitionAnimations->add("SLIDE (BUILT-IN)", "builtin-slide", themeTransitions->add("SLIDE (BUILT-IN)", "builtin-slide",
"builtin-slide" == selectedTransitionAnimation); "builtin-slide" == selectedThemeTransitions);
} }
if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(), if (std::find(currentSet->second.capabilities.suppressedTransitionProfiles.cbegin(),
currentSet->second.capabilities.suppressedTransitionProfiles.cend(), currentSet->second.capabilities.suppressedTransitionProfiles.cend(),
"builtin-fade") == "builtin-fade") ==
currentSet->second.capabilities.suppressedTransitionProfiles.cend()) { currentSet->second.capabilities.suppressedTransitionProfiles.cend()) {
themeTransitionAnimations->add("FADE (BUILT-IN)", "builtin-fade", themeTransitions->add("FADE (BUILT-IN)", "builtin-fade",
"builtin-fade" == selectedTransitionAnimation); "builtin-fade" == selectedThemeTransitions);
} }
if (themeTransitionAnimations->getSelectedObjects().size() == 0) if (themeTransitions->getSelectedObjects().size() == 0)
themeTransitionAnimations->selectEntry(0); themeTransitions->selectEntry(0);
} }
}; };
themeTransitionAnimationsFunc(Settings::getInstance()->getString("ThemeSet"), themeTransitionsFunc(Settings::getInstance()->getString("ThemeSet"),
Settings::getInstance()->getString("ThemeTransitionAnimations")); Settings::getInstance()->getString("ThemeTransitions"));
// Legacy gamelist view style. // Legacy gamelist view style.
auto gamelistViewStyle = std::make_shared<OptionListComponent<std::string>>( auto gamelistViewStyle = std::make_shared<OptionListComponent<std::string>>(
@ -408,27 +406,27 @@ void GuiMenu::openUIOptions()
} }
}); });
// Legacy transition animations. // Legacy theme transitions.
auto legacyTransitionAnimations = std::make_shared<OptionListComponent<std::string>>( auto legacyThemeTransitions = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "LEGACY TRANSITION ANIMS", false); getHelpStyle(), "LEGACY THEME TRANSITIONS", false);
const std::string& selectedLegacyAnimations { const std::string& selectedLegacyThemeTransitions {
Settings::getInstance()->getString("LegacyTransitionAnimations")}; Settings::getInstance()->getString("LegacyThemeTransitions")};
legacyTransitionAnimations->add("INSTANT", "builtin-instant", legacyThemeTransitions->add("INSTANT", "builtin-instant",
selectedLegacyAnimations == "builtin-instant"); selectedLegacyThemeTransitions == "builtin-instant");
legacyTransitionAnimations->add("SLIDE", "builtin-slide", legacyThemeTransitions->add("SLIDE", "builtin-slide",
selectedLegacyAnimations == "builtin-slide"); selectedLegacyThemeTransitions == "builtin-slide");
legacyTransitionAnimations->add("FADE", "builtin-fade", legacyThemeTransitions->add("FADE", "builtin-fade",
selectedLegacyAnimations == "builtin-fade"); selectedLegacyThemeTransitions == "builtin-fade");
// If there are no objects returned, then there must be a manually modified entry in the // If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the animations to "builtin-instant" in this case. // configuration file. Simply set legacy theme transitions to "builtin-instant" in this case.
if (legacyTransitionAnimations->getSelectedObjects().size() == 0) if (legacyThemeTransitions->getSelectedObjects().size() == 0)
legacyTransitionAnimations->selectEntry(0); legacyThemeTransitions->selectEntry(0);
s->addWithLabel("LEGACY TRANSITION ANIMATIONS", legacyTransitionAnimations); s->addWithLabel("LEGACY THEME TRANSITIONS", legacyThemeTransitions);
s->addSaveFunc([legacyTransitionAnimations, s] { s->addSaveFunc([legacyThemeTransitions, s] {
if (legacyTransitionAnimations->getSelected() != if (legacyThemeTransitions->getSelected() !=
Settings::getInstance()->getString("LegacyTransitionAnimations")) { Settings::getInstance()->getString("LegacyThemeTransitions")) {
Settings::getInstance()->setString("LegacyTransitionAnimations", Settings::getInstance()->setString("LegacyThemeTransitions",
legacyTransitionAnimations->getSelected()); legacyThemeTransitions->getSelected());
ThemeData::setThemeTransitions(); ThemeData::setThemeTransitions();
s->setNeedsSaving(); s->setNeedsSaving();
} }
@ -828,7 +826,7 @@ void GuiMenu::openUIOptions()
themeVariantsFunc(themeName, themeVariant->getSelected()); themeVariantsFunc(themeName, themeVariant->getSelected());
themeColorSchemesFunc(themeName, themeColorScheme->getSelected()); themeColorSchemesFunc(themeName, themeColorScheme->getSelected());
themeAspectRatiosFunc(themeName, themeAspectRatio->getSelected()); themeAspectRatiosFunc(themeName, themeAspectRatio->getSelected());
themeTransitionAnimationsFunc(themeName, themeTransitionAnimations->getSelected()); themeTransitionsFunc(themeName, themeTransitions->getSelected());
} }
int selectableVariants {0}; int selectableVariants {0};
for (auto& variant : selectedSet->second.capabilities.variants) { for (auto& variant : selectedSet->second.capabilities.variants) {
@ -886,16 +884,16 @@ void GuiMenu::openUIOptions()
->getChild(gamelistViewStyle->getChildIndex() - 1) ->getChild(gamelistViewStyle->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
themeTransitionAnimations->setEnabled(true); themeTransitions->setEnabled(true);
themeTransitionAnimations->setOpacity(1.0f); themeTransitions->setOpacity(1.0f);
themeTransitionAnimations->getParent() themeTransitions->getParent()
->getChild(themeTransitionAnimations->getChildIndex() - 1) ->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(1.0f); ->setOpacity(1.0f);
legacyTransitionAnimations->setEnabled(false); legacyThemeTransitions->setEnabled(false);
legacyTransitionAnimations->setOpacity(DISABLED_OPACITY); legacyThemeTransitions->setOpacity(DISABLED_OPACITY);
legacyTransitionAnimations->getParent() legacyThemeTransitions->getParent()
->getChild(legacyTransitionAnimations->getChildIndex() - 1) ->getChild(legacyThemeTransitions->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
// Pillarboxes are theme-controlled for newer themes. // Pillarboxes are theme-controlled for newer themes.
@ -919,16 +917,16 @@ void GuiMenu::openUIOptions()
->getChild(gamelistViewStyle->getChildIndex() - 1) ->getChild(gamelistViewStyle->getChildIndex() - 1)
->setOpacity(1.0f); ->setOpacity(1.0f);
themeTransitionAnimations->setEnabled(false); themeTransitions->setEnabled(false);
themeTransitionAnimations->setOpacity(DISABLED_OPACITY); themeTransitions->setOpacity(DISABLED_OPACITY);
themeTransitionAnimations->getParent() themeTransitions->getParent()
->getChild(themeTransitionAnimations->getChildIndex() - 1) ->getChild(themeTransitions->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
legacyTransitionAnimations->setEnabled(true); legacyThemeTransitions->setEnabled(true);
legacyTransitionAnimations->setOpacity(1.0f); legacyThemeTransitions->setOpacity(1.0f);
legacyTransitionAnimations->getParent() legacyThemeTransitions->getParent()
->getChild(legacyTransitionAnimations->getChildIndex() - 1) ->getChild(legacyThemeTransitions->getChildIndex() - 1)
->setOpacity(1.0f); ->setOpacity(1.0f);
gamelistVideoPillarbox->setEnabled(true); gamelistVideoPillarbox->setEnabled(true);

View file

@ -156,9 +156,9 @@ void Settings::setDefaults()
mStringMap["ThemeVariant"] = {"", ""}; mStringMap["ThemeVariant"] = {"", ""};
mStringMap["ThemeColorScheme"] = {"", ""}; mStringMap["ThemeColorScheme"] = {"", ""};
mStringMap["ThemeAspectRatio"] = {"", ""}; mStringMap["ThemeAspectRatio"] = {"", ""};
mStringMap["ThemeTransitionAnimations"] = {"automatic", "automatic"}; mStringMap["ThemeTransitions"] = {"automatic", "automatic"};
mStringMap["GamelistViewStyle"] = {"automatic", "automatic"}; mStringMap["GamelistViewStyle"] = {"automatic", "automatic"};
mStringMap["LegacyTransitionAnimations"] = {"builtin-instant", "builtin-instant"}; mStringMap["LegacyThemeTransitions"] = {"builtin-instant", "builtin-instant"};
mStringMap["QuickSystemSelect"] = {"leftrightshoulders", "leftrightshoulders"}; mStringMap["QuickSystemSelect"] = {"leftrightshoulders", "leftrightshoulders"};
mStringMap["StartupSystem"] = {"", ""}; mStringMap["StartupSystem"] = {"", ""};
mStringMap["DefaultSortOrder"] = {"filename, ascending", "filename, ascending"}; mStringMap["DefaultSortOrder"] = {"filename, ascending", "filename, ascending"};

View file

@ -860,28 +860,28 @@ void ThemeData::setThemeTransitions()
setTransitionsFunc(transitionAnim); setTransitionsFunc(transitionAnim);
if (mCurrentThemeSet->second.capabilities.legacyTheme) { if (mCurrentThemeSet->second.capabilities.legacyTheme) {
const std::string& legacyTransitionSetting { const std::string& legacyTransitionsSetting {
Settings::getInstance()->getString("LegacyTransitionAnimations")}; Settings::getInstance()->getString("LegacyThemeTransitions")};
if (legacyTransitionSetting == "builtin-slide") if (legacyTransitionsSetting == "builtin-slide")
transitionAnim = static_cast<int>(ViewTransitionAnimation::SLIDE); transitionAnim = static_cast<int>(ViewTransitionAnimation::SLIDE);
else if (legacyTransitionSetting == "builtin-fade") else if (legacyTransitionsSetting == "builtin-fade")
transitionAnim = static_cast<int>(ViewTransitionAnimation::FADE); transitionAnim = static_cast<int>(ViewTransitionAnimation::FADE);
setTransitionsFunc(transitionAnim); setTransitionsFunc(transitionAnim);
} }
else { else {
const std::string& transitionSetting { const std::string& transitionsSetting {
Settings::getInstance()->getString("ThemeTransitionAnimations")}; Settings::getInstance()->getString("ThemeTransitions")};
std::string profile; std::string profile;
size_t profileEntry {0}; size_t profileEntry {0};
if (transitionSetting == "automatic") { if (transitionsSetting == "automatic") {
if (mVariantDefinedTransitions != "") if (mVariantDefinedTransitions != "")
profile = mVariantDefinedTransitions; profile = mVariantDefinedTransitions;
else if (!mCurrentThemeSet->second.capabilities.transitions.empty()) else if (!mCurrentThemeSet->second.capabilities.transitions.empty())
profile = mCurrentThemeSet->second.capabilities.transitions.front().name; profile = mCurrentThemeSet->second.capabilities.transitions.front().name;
} }
else { else {
profile = transitionSetting; profile = transitionsSetting;
} }
auto it = std::find_if( auto it = std::find_if(
@ -916,16 +916,16 @@ void ThemeData::setThemeTransitions()
Settings::getInstance()->setInt("TransitionsStartupToGamelist", Settings::getInstance()->setInt("TransitionsStartupToGamelist",
transitionMap[ViewTransition::STARTUP_TO_GAMELIST]); transitionMap[ViewTransition::STARTUP_TO_GAMELIST]);
} }
else if (transitionSetting == "builtin-slide" || transitionSetting == "builtin-fade") { else if (transitionsSetting == "builtin-slide" || transitionsSetting == "builtin-fade") {
if (std::find( if (std::find(
mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cbegin(), mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cbegin(),
mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend(), mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend(),
transitionSetting) == transitionsSetting) ==
mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend()) { mCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend()) {
if (transitionSetting == "builtin-slide") { if (transitionsSetting == "builtin-slide") {
transitionAnim = static_cast<int>(ViewTransitionAnimation::SLIDE); transitionAnim = static_cast<int>(ViewTransitionAnimation::SLIDE);
} }
else if (transitionSetting == "builtin-fade") { else if (transitionsSetting == "builtin-fade") {
transitionAnim = static_cast<int>(ViewTransitionAnimation::FADE); transitionAnim = static_cast<int>(ViewTransitionAnimation::FADE);
} }
setTransitionsFunc(transitionAnim); setTransitionsFunc(transitionAnim);