mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Changed the concept of 'theme set' to simply 'theme' everywhere in the code
This commit is contained in:
parent
7cef859a77
commit
481e2869ec
|
@ -540,10 +540,10 @@ const bool CollectionSystemsManager::isThemeCustomCollectionCompatible(
|
|||
return true;
|
||||
|
||||
// Get theme path.
|
||||
auto themeSets = ThemeData::getThemeSets();
|
||||
auto set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||
if (set != themeSets.cend()) {
|
||||
std::string defaultThemeFilePath {set->second.path + "/theme.xml"};
|
||||
auto themes = ThemeData::getThemes();
|
||||
auto theme = themes.find(Settings::getInstance()->getString("Theme"));
|
||||
if (theme != themes.cend()) {
|
||||
std::string defaultThemeFilePath {theme->second.path + "/theme.xml"};
|
||||
if (Utils::FileSystem::exists(defaultThemeFilePath))
|
||||
return true;
|
||||
}
|
||||
|
@ -1475,19 +1475,19 @@ std::vector<std::string> CollectionSystemsManager::getSystemsFromTheme()
|
|||
{
|
||||
std::vector<std::string> systems;
|
||||
|
||||
auto themeSets = ThemeData::getThemeSets();
|
||||
if (themeSets.empty())
|
||||
return systems; // No theme sets available.
|
||||
auto themes = ThemeData::getThemes();
|
||||
if (themes.empty())
|
||||
return systems; // No themes available.
|
||||
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator set {
|
||||
themeSets.find(Settings::getInstance()->getString("ThemeSet"))};
|
||||
if (set == themeSets.cend()) {
|
||||
// Currently selected theme set is missing, so just pick the first available set.
|
||||
set = themeSets.cbegin();
|
||||
Settings::getInstance()->setString("ThemeSet", set->first);
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator theme {
|
||||
themes.find(Settings::getInstance()->getString("Theme"))};
|
||||
if (theme == themes.cend()) {
|
||||
// Currently selected theme is missing, so just pick the first available one.
|
||||
theme = themes.cbegin();
|
||||
Settings::getInstance()->setString("Theme", theme->first);
|
||||
}
|
||||
|
||||
std::string themePath {set->second.path};
|
||||
std::string themePath {theme->second.path};
|
||||
|
||||
if (Utils::FileSystem::exists(themePath)) {
|
||||
Utils::FileSystem::StringList dirContent {Utils::FileSystem::getDirContent(themePath)};
|
||||
|
@ -1497,7 +1497,7 @@ std::vector<std::string> CollectionSystemsManager::getSystemsFromTheme()
|
|||
if (Utils::FileSystem::isDirectory(*it)) {
|
||||
std::string folder {*it};
|
||||
folder = folder.substr(themePath.size() + 1);
|
||||
if (Utils::FileSystem::exists(set->second.getThemePath(folder)))
|
||||
if (Utils::FileSystem::exists(theme->second.getThemePath(folder)))
|
||||
systems.push_back(folder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1308,19 +1308,19 @@ std::string SystemData::getGamelistPath(bool forWrite) const
|
|||
|
||||
std::string SystemData::getThemePath() const
|
||||
{
|
||||
// Check for the presence of [CURRENT_THEME_PATH]/[SYSTEM]/theme.xml and if this does not
|
||||
// exist, then try the default file for the theme, i.e. [CURRENT_THEME_PATH]/theme.xml
|
||||
std::string themePath {ThemeData::getThemeFromCurrentSet(mThemeFolder)};
|
||||
// Check for the presence of the system theme file ./systemname/theme.xml and if this does not
|
||||
// exist, then try the default file for the theme, i.e. ./theme.xml
|
||||
std::string systemThemeFile {ThemeData::getSystemThemeFile(mThemeFolder)};
|
||||
|
||||
if (Utils::FileSystem::exists(themePath))
|
||||
return themePath;
|
||||
if (Utils::FileSystem::exists(systemThemeFile))
|
||||
return systemThemeFile;
|
||||
|
||||
themePath = Utils::FileSystem::getParent(Utils::FileSystem::getParent(themePath));
|
||||
systemThemeFile = Utils::FileSystem::getParent(Utils::FileSystem::getParent(systemThemeFile));
|
||||
|
||||
if (themePath != "") {
|
||||
themePath.append("/theme.xml");
|
||||
if (Utils::FileSystem::exists(themePath))
|
||||
return themePath;
|
||||
if (systemThemeFile != "") {
|
||||
systemThemeFile.append("/theme.xml");
|
||||
if (Utils::FileSystem::exists(systemThemeFile))
|
||||
return systemThemeFile;
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -1501,7 +1501,7 @@ void SystemData::loadTheme(ThemeTriggers::TriggerType trigger)
|
|||
if (!mIsCustomCollectionSystem) {
|
||||
LOG(LogWarning) << "There is no \"" << mThemeFolder
|
||||
<< "\" configuration available for the selected theme \""
|
||||
<< Settings::getInstance()->getString("ThemeSet")
|
||||
<< Settings::getInstance()->getString("Theme")
|
||||
<< "\", system will be unthemed";
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -111,13 +111,12 @@ void GuiMenu::openUIOptions()
|
|||
|
||||
// Theme options section.
|
||||
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator> themeSets {
|
||||
ThemeData::getThemeSets()};
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
selectedSet;
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator> themes {
|
||||
ThemeData::getThemes()};
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
selectedTheme;
|
||||
|
||||
auto themeSet =
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "THEME SET", false);
|
||||
auto theme = std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "THEME", false);
|
||||
|
||||
ComponentListRow themeDownloaderInputRow;
|
||||
themeDownloaderInputRow.elements.clear();
|
||||
|
@ -131,40 +130,39 @@ void GuiMenu::openUIOptions()
|
|||
std::bind(&GuiMenu::openThemeDownloader, this, s));
|
||||
s->addRow(themeDownloaderInputRow);
|
||||
|
||||
// Theme set.
|
||||
if (!themeSets.empty()) {
|
||||
selectedSet = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||
if (selectedSet == themeSets.cend())
|
||||
selectedSet = themeSets.cbegin();
|
||||
std::vector<std::pair<std::string, std::pair<std::string, ThemeData::ThemeSet>>>
|
||||
themeSetsSorted;
|
||||
// Theme.
|
||||
if (!themes.empty()) {
|
||||
selectedTheme = themes.find(Settings::getInstance()->getString("Theme"));
|
||||
if (selectedTheme == themes.cend())
|
||||
selectedTheme = themes.cbegin();
|
||||
std::vector<std::pair<std::string, std::pair<std::string, ThemeData::Theme>>> themesSorted;
|
||||
std::string sortName;
|
||||
for (auto& theme : themeSets) {
|
||||
for (auto& theme : themes) {
|
||||
if (theme.second.capabilities.themeName != "")
|
||||
sortName = theme.second.capabilities.themeName;
|
||||
else
|
||||
sortName = theme.first;
|
||||
themeSetsSorted.emplace_back(std::make_pair(Utils::String::toUpper(sortName),
|
||||
std::make_pair(theme.first, theme.second)));
|
||||
themesSorted.emplace_back(std::make_pair(Utils::String::toUpper(sortName),
|
||||
std::make_pair(theme.first, theme.second)));
|
||||
}
|
||||
std::sort(themeSetsSorted.begin(), themeSetsSorted.end(),
|
||||
std::sort(themesSorted.begin(), themesSorted.end(),
|
||||
[](const auto& a, const auto& b) { return a.first < b.first; });
|
||||
for (auto it = themeSetsSorted.cbegin(); it != themeSetsSorted.cend(); ++it) {
|
||||
// If required, abbreviate the theme set name so it doesn't overlap the setting name.
|
||||
for (auto it = themesSorted.cbegin(); it != themesSorted.cend(); ++it) {
|
||||
// If required, abbreviate the theme name so it doesn't overlap the setting name.
|
||||
const float maxNameLength {mSize.x * 0.62f};
|
||||
std::string themeName {(*it).first};
|
||||
themeSet->add(themeName, it->second.first, (*it).second.first == selectedSet->first,
|
||||
maxNameLength);
|
||||
theme->add(themeName, it->second.first, (*it).second.first == selectedTheme->first,
|
||||
maxNameLength);
|
||||
}
|
||||
s->addWithLabel("THEME SET", themeSet);
|
||||
s->addSaveFunc([this, themeSet, s] {
|
||||
if (themeSet->getSelected() != Settings::getInstance()->getString("ThemeSet")) {
|
||||
Scripting::fireEvent("theme-changed", themeSet->getSelected(),
|
||||
Settings::getInstance()->getString("ThemeSet"));
|
||||
Settings::getInstance()->setString("ThemeSet", themeSet->getSelected());
|
||||
mWindow->setChangedThemeSet();
|
||||
s->addWithLabel("THEME", theme);
|
||||
s->addSaveFunc([this, theme, s] {
|
||||
if (theme->getSelected() != Settings::getInstance()->getString("Theme")) {
|
||||
Scripting::fireEvent("theme-changed", theme->getSelected(),
|
||||
Settings::getInstance()->getString("Theme"));
|
||||
Settings::getInstance()->setString("Theme", theme->getSelected());
|
||||
mWindow->setChangedTheme();
|
||||
// This is required so that the custom collection system does not disappear
|
||||
// if the user is editing a custom collection when switching theme sets.
|
||||
// if the user is editing a custom collection when switching themes.
|
||||
if (CollectionSystemsManager::getInstance()->isEditing())
|
||||
CollectionSystemsManager::getInstance()->exitEditMode();
|
||||
s->setNeedsSaving();
|
||||
|
@ -191,9 +189,9 @@ void GuiMenu::openUIOptions()
|
|||
|
||||
auto themeVariantsFunc = [=](const std::string& selectedTheme,
|
||||
const std::string& selectedVariant) {
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themeSets.find(selectedTheme)};
|
||||
if (currentSet == themeSets.cend())
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themes.find(selectedTheme)};
|
||||
if (currentSet == themes.cend())
|
||||
return;
|
||||
// We need to recreate the OptionListComponent entries.
|
||||
themeVariant->clearEntries();
|
||||
|
@ -225,7 +223,7 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
};
|
||||
|
||||
themeVariantsFunc(Settings::getInstance()->getString("ThemeSet"),
|
||||
themeVariantsFunc(Settings::getInstance()->getString("Theme"),
|
||||
Settings::getInstance()->getString("ThemeVariant"));
|
||||
|
||||
// Theme color schemes.
|
||||
|
@ -244,9 +242,9 @@ void GuiMenu::openUIOptions()
|
|||
|
||||
auto themeColorSchemesFunc = [=](const std::string& selectedTheme,
|
||||
const std::string& selectedColorScheme) {
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themeSets.find(selectedTheme)};
|
||||
if (currentSet == themeSets.cend())
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themes.find(selectedTheme)};
|
||||
if (currentSet == themes.cend())
|
||||
return;
|
||||
// We need to recreate the OptionListComponent entries.
|
||||
themeColorScheme->clearEntries();
|
||||
|
@ -271,7 +269,7 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
};
|
||||
|
||||
themeColorSchemesFunc(Settings::getInstance()->getString("ThemeSet"),
|
||||
themeColorSchemesFunc(Settings::getInstance()->getString("Theme"),
|
||||
Settings::getInstance()->getString("ThemeColorScheme"));
|
||||
|
||||
// Theme aspect ratios.
|
||||
|
@ -290,9 +288,9 @@ void GuiMenu::openUIOptions()
|
|||
|
||||
auto themeAspectRatiosFunc = [=](const std::string& selectedTheme,
|
||||
const std::string& selectedAspectRatio) {
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themeSets.find(selectedTheme)};
|
||||
if (currentSet == themeSets.cend())
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themes.find(selectedTheme)};
|
||||
if (currentSet == themes.cend())
|
||||
return;
|
||||
// We need to recreate the OptionListComponent entries.
|
||||
themeAspectRatio->clearEntries();
|
||||
|
@ -313,7 +311,7 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
};
|
||||
|
||||
themeAspectRatiosFunc(Settings::getInstance()->getString("ThemeSet"),
|
||||
themeAspectRatiosFunc(Settings::getInstance()->getString("Theme"),
|
||||
Settings::getInstance()->getString("ThemeAspectRatio"));
|
||||
|
||||
// Theme transitions.
|
||||
|
@ -337,9 +335,9 @@ void GuiMenu::openUIOptions()
|
|||
|
||||
auto themeTransitionsFunc = [=](const std::string& selectedTheme,
|
||||
const std::string& selectedThemeTransitions) {
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themeSets.find(selectedTheme)};
|
||||
if (currentSet == themeSets.cend())
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
currentSet {themes.find(selectedTheme)};
|
||||
if (currentSet == themes.cend())
|
||||
return;
|
||||
// We need to recreate the OptionListComponent entries.
|
||||
themeTransitions->clearEntries();
|
||||
|
@ -408,7 +406,7 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
};
|
||||
|
||||
themeTransitionsFunc(Settings::getInstance()->getString("ThemeSet"),
|
||||
themeTransitionsFunc(Settings::getInstance()->getString("Theme"),
|
||||
Settings::getInstance()->getString("ThemeTransitions"));
|
||||
|
||||
// Quick system select (navigate between systems in the gamelist view).
|
||||
|
@ -868,10 +866,10 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
});
|
||||
|
||||
// When the theme set entries are scrolled or selected, update the relevant rows.
|
||||
auto scrollThemeSetFunc = [=](const std::string& themeName, bool firstRun = false) {
|
||||
auto selectedSet = themeSets.find(themeName);
|
||||
if (selectedSet == themeSets.cend())
|
||||
// When the theme entries are scrolled or selected, update the relevant rows.
|
||||
auto scrollThemeFunc = [=](const std::string& themeName, bool firstRun = false) {
|
||||
auto selectedTheme = themes.find(themeName);
|
||||
if (selectedTheme == themes.cend())
|
||||
return;
|
||||
if (!firstRun) {
|
||||
themeVariantsFunc(themeName, themeVariant->getSelected());
|
||||
|
@ -880,7 +878,7 @@ void GuiMenu::openUIOptions()
|
|||
themeTransitionsFunc(themeName, themeTransitions->getSelected());
|
||||
}
|
||||
int selectableVariants {0};
|
||||
for (auto& variant : selectedSet->second.capabilities.variants) {
|
||||
for (auto& variant : selectedTheme->second.capabilities.variants) {
|
||||
if (variant.selectable)
|
||||
++selectableVariants;
|
||||
}
|
||||
|
@ -898,7 +896,7 @@ void GuiMenu::openUIOptions()
|
|||
->getChild(themeVariant->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
}
|
||||
if (selectedSet->second.capabilities.colorSchemes.size() > 0) {
|
||||
if (selectedTheme->second.capabilities.colorSchemes.size() > 0) {
|
||||
themeColorScheme->setEnabled(true);
|
||||
themeColorScheme->setOpacity(1.0f);
|
||||
themeColorScheme->getParent()
|
||||
|
@ -912,7 +910,7 @@ void GuiMenu::openUIOptions()
|
|||
->getChild(themeColorScheme->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
}
|
||||
if (selectedSet->second.capabilities.aspectRatios.size() > 0) {
|
||||
if (selectedTheme->second.capabilities.aspectRatios.size() > 0) {
|
||||
themeAspectRatio->setEnabled(true);
|
||||
themeAspectRatio->setOpacity(1.0f);
|
||||
themeAspectRatio->getParent()
|
||||
|
@ -928,8 +926,8 @@ void GuiMenu::openUIOptions()
|
|||
}
|
||||
};
|
||||
|
||||
scrollThemeSetFunc(selectedSet->first, true);
|
||||
themeSet->setCallback(scrollThemeSetFunc);
|
||||
scrollThemeFunc(selectedTheme->first, true);
|
||||
theme->setCallback(scrollThemeFunc);
|
||||
|
||||
s->setSize(mSize);
|
||||
mWindow->pushGui(s);
|
||||
|
|
|
@ -198,7 +198,7 @@ GuiThemeDownloader::~GuiThemeDownloader()
|
|||
|
||||
if (mHasThemeUpdates) {
|
||||
LOG(LogInfo) << "GuiThemeDownloader: There are updates, repopulating the themes";
|
||||
ThemeData::populateThemeSets();
|
||||
ThemeData::populateThemes();
|
||||
ViewController::getInstance()->reloadAll();
|
||||
if (mUpdateCallback)
|
||||
mUpdateCallback();
|
||||
|
@ -465,7 +465,7 @@ void GuiThemeDownloader::resetRepository(git_repository* repository)
|
|||
|
||||
void GuiThemeDownloader::makeInventory()
|
||||
{
|
||||
for (auto& theme : mThemeSets) {
|
||||
for (auto& theme : mThemes) {
|
||||
const std::string path {mThemeDirectory + theme.reponame};
|
||||
theme.invalidRepository = false;
|
||||
theme.corruptRepository = false;
|
||||
|
@ -601,11 +601,11 @@ void GuiThemeDownloader::parseThemesList()
|
|||
}
|
||||
}
|
||||
|
||||
if (doc.HasMember("themeSets") && doc["themeSets"].IsArray()) {
|
||||
const rapidjson::Value& themeSets {doc["themeSets"]};
|
||||
for (int i {0}; i < static_cast<int>(themeSets.Size()); ++i) {
|
||||
if (doc.HasMember("themes") && doc["themes"].IsArray()) {
|
||||
const rapidjson::Value& themes {doc["themes"]};
|
||||
for (int i {0}; i < static_cast<int>(themes.Size()); ++i) {
|
||||
ThemeEntry themeEntry;
|
||||
const rapidjson::Value& theme {themeSets[i]};
|
||||
const rapidjson::Value& theme {themes[i]};
|
||||
|
||||
if (theme.HasMember("name") && theme["name"].IsString())
|
||||
themeEntry.name = theme["name"].GetString();
|
||||
|
@ -661,20 +661,20 @@ void GuiThemeDownloader::parseThemesList()
|
|||
}
|
||||
}
|
||||
|
||||
mThemeSets.emplace_back(themeEntry);
|
||||
mThemes.emplace_back(themeEntry);
|
||||
}
|
||||
}
|
||||
|
||||
LOG(LogDebug) << "GuiThemeDownloader::parseThemesList(): Parsed " << mThemeSets.size()
|
||||
LOG(LogDebug) << "GuiThemeDownloader::parseThemesList(): Parsed " << mThemes.size()
|
||||
<< " themes";
|
||||
}
|
||||
|
||||
void GuiThemeDownloader::populateGUI()
|
||||
{
|
||||
if (mThemeSets.empty())
|
||||
if (mThemes.empty())
|
||||
return;
|
||||
|
||||
for (auto& theme : mThemeSets) {
|
||||
for (auto& theme : mThemes) {
|
||||
std::string themeName {Utils::String::toUpper(theme.name)};
|
||||
if (theme.newEntry && !theme.isCloned)
|
||||
themeName.append(" ").append(ViewController::BRANCH_CHAR);
|
||||
|
@ -831,16 +831,16 @@ void GuiThemeDownloader::updateGUI()
|
|||
updateInfoPane();
|
||||
updateHelpPrompts();
|
||||
|
||||
for (size_t i {0}; i < mThemeSets.size(); ++i) {
|
||||
std::string themeName {Utils::String::toUpper(mThemeSets[i].name)};
|
||||
if (mThemeSets[i].newEntry && !mThemeSets[i].isCloned)
|
||||
for (size_t i {0}; i < mThemes.size(); ++i) {
|
||||
std::string themeName {Utils::String::toUpper(mThemes[i].name)};
|
||||
if (mThemes[i].newEntry && !mThemes[i].isCloned)
|
||||
themeName.append(" ").append(ViewController::BRANCH_CHAR);
|
||||
if (mThemeSets[i].isCloned)
|
||||
if (mThemes[i].isCloned)
|
||||
themeName.append(" ").append(ViewController::TICKMARK_CHAR);
|
||||
if (mThemeSets[i].manuallyDownloaded || mThemeSets[i].invalidRepository ||
|
||||
mThemeSets[i].corruptRepository || mThemeSets[i].shallowRepository)
|
||||
if (mThemes[i].manuallyDownloaded || mThemes[i].invalidRepository ||
|
||||
mThemes[i].corruptRepository || mThemes[i].shallowRepository)
|
||||
themeName.append(" ").append(ViewController::CROSSEDCIRCLE_CHAR);
|
||||
if (mThemeSets[i].hasLocalChanges)
|
||||
if (mThemes[i].hasLocalChanges)
|
||||
themeName.append(" ").append(ViewController::EXCLAMATION_CHAR);
|
||||
|
||||
mThemeGUIEntries[i].themeName->setText(themeName);
|
||||
|
@ -849,43 +849,43 @@ void GuiThemeDownloader::updateGUI()
|
|||
|
||||
void GuiThemeDownloader::updateInfoPane()
|
||||
{
|
||||
assert(static_cast<size_t>(mList->size()) == mThemeSets.size());
|
||||
if (!mThemeSets[mList->getCursorId()].screenshots.empty())
|
||||
assert(static_cast<size_t>(mList->size()) == mThemes.size());
|
||||
if (!mThemes[mList->getCursorId()].screenshots.empty())
|
||||
mScreenshot->setImage(mThemeDirectory + "themes-list/" +
|
||||
mThemeSets[mList->getCursorId()].screenshots.front().image);
|
||||
mThemes[mList->getCursorId()].screenshots.front().image);
|
||||
else
|
||||
mScreenshot->setImage("");
|
||||
|
||||
if (mThemeSets[mList->getCursorId()].isCloned) {
|
||||
if (mThemes[mList->getCursorId()].isCloned) {
|
||||
mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED");
|
||||
mDownloadStatus->setColor(mMenuColorGreen);
|
||||
mDownloadStatus->setOpacity(1.0f);
|
||||
}
|
||||
else if (mThemeSets[mList->getCursorId()].invalidRepository ||
|
||||
mThemeSets[mList->getCursorId()].manuallyDownloaded) {
|
||||
else if (mThemes[mList->getCursorId()].invalidRepository ||
|
||||
mThemes[mList->getCursorId()].manuallyDownloaded) {
|
||||
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " MANUAL DOWNLOAD");
|
||||
mDownloadStatus->setColor(mMenuColorRed);
|
||||
mDownloadStatus->setOpacity(1.0f);
|
||||
}
|
||||
else if (mThemeSets[mList->getCursorId()].corruptRepository) {
|
||||
else if (mThemes[mList->getCursorId()].corruptRepository) {
|
||||
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " CORRUPT");
|
||||
mDownloadStatus->setColor(mMenuColorRed);
|
||||
mDownloadStatus->setOpacity(1.0f);
|
||||
}
|
||||
else if (mThemeSets[mList->getCursorId()].shallowRepository) {
|
||||
else if (mThemes[mList->getCursorId()].shallowRepository) {
|
||||
mDownloadStatus->setText(ViewController::CROSSEDCIRCLE_CHAR + " SHALLOW");
|
||||
mDownloadStatus->setColor(mMenuColorRed);
|
||||
mDownloadStatus->setOpacity(1.0f);
|
||||
}
|
||||
else {
|
||||
if (mThemeSets[mList->getCursorId()].newEntry)
|
||||
if (mThemes[mList->getCursorId()].newEntry)
|
||||
mDownloadStatus->setText("NOT INSTALLED (NEW)");
|
||||
else
|
||||
mDownloadStatus->setText("NOT INSTALLED");
|
||||
mDownloadStatus->setColor(mMenuColorPrimary);
|
||||
mDownloadStatus->setOpacity(0.7f);
|
||||
}
|
||||
if (mThemeSets[mList->getCursorId()].hasLocalChanges) {
|
||||
if (mThemes[mList->getCursorId()].hasLocalChanges) {
|
||||
mLocalChanges->setText(ViewController::EXCLAMATION_CHAR + " LOCAL CHANGES");
|
||||
mLocalChanges->setColor(mMenuColorRed);
|
||||
}
|
||||
|
@ -893,18 +893,15 @@ void GuiThemeDownloader::updateInfoPane()
|
|||
mLocalChanges->setText("");
|
||||
}
|
||||
|
||||
mVariantCount->setText(std::to_string(mThemeSets[mList->getCursorId()].variants.size()));
|
||||
mColorSchemesCount->setText(
|
||||
std::to_string(mThemeSets[mList->getCursorId()].colorSchemes.size()));
|
||||
mAspectRatiosCount->setText(
|
||||
std::to_string(mThemeSets[mList->getCursorId()].aspectRatios.size()));
|
||||
mAuthor->setText("CREATED BY " +
|
||||
Utils::String::toUpper(mThemeSets[mList->getCursorId()].author));
|
||||
mVariantCount->setText(std::to_string(mThemes[mList->getCursorId()].variants.size()));
|
||||
mColorSchemesCount->setText(std::to_string(mThemes[mList->getCursorId()].colorSchemes.size()));
|
||||
mAspectRatiosCount->setText(std::to_string(mThemes[mList->getCursorId()].aspectRatios.size()));
|
||||
mAuthor->setText("CREATED BY " + Utils::String::toUpper(mThemes[mList->getCursorId()].author));
|
||||
}
|
||||
|
||||
void GuiThemeDownloader::setupFullscreenViewer()
|
||||
{
|
||||
if (mThemeSets.empty())
|
||||
if (mThemes.empty())
|
||||
return;
|
||||
|
||||
mViewerScreenshots.clear();
|
||||
|
@ -912,7 +909,7 @@ void GuiThemeDownloader::setupFullscreenViewer()
|
|||
mFullscreenViewerIndex = 0;
|
||||
mFullscreenViewing = true;
|
||||
|
||||
for (auto& screenshot : mThemeSets[mList->getCursorId()].screenshots) {
|
||||
for (auto& screenshot : mThemes[mList->getCursorId()].screenshots) {
|
||||
auto image = std::make_shared<ImageComponent>(false, false);
|
||||
image->setLinearInterpolation(true);
|
||||
image->setMaxSize(mRenderer->getScreenWidth() * 0.86f,
|
||||
|
@ -968,7 +965,7 @@ void GuiThemeDownloader::update(int deltaTime)
|
|||
mFetching = false;
|
||||
if (mRepositoryError != RepositoryError::NO_REPO_ERROR) {
|
||||
std::string errorMessage {"ERROR: "};
|
||||
if (mThemeSets.empty()) {
|
||||
if (mThemes.empty()) {
|
||||
errorMessage.append("COULDN'T DOWNLOAD THEMES LIST, ");
|
||||
mGrid.removeEntry(mCenterGrid);
|
||||
mGrid.setCursorTo(mButtons);
|
||||
|
@ -980,12 +977,12 @@ void GuiThemeDownloader::update(int deltaTime)
|
|||
mMessage = "";
|
||||
getHelpPrompts();
|
||||
}
|
||||
if (mThemeSets.empty() && mLatestThemesList) {
|
||||
if (mThemes.empty() && mLatestThemesList) {
|
||||
parseThemesList();
|
||||
makeInventory();
|
||||
populateGUI();
|
||||
}
|
||||
else if (!mThemeSets.empty()) {
|
||||
else if (!mThemes.empty()) {
|
||||
makeInventory();
|
||||
updateGUI();
|
||||
}
|
||||
|
@ -1149,15 +1146,15 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
|
|||
}
|
||||
|
||||
if (config->isMappedTo("y", input) && input.value &&
|
||||
mGrid.getSelectedComponent() == mCenterGrid && mThemeSets[mList->getCursorId()].isCloned) {
|
||||
mGrid.getSelectedComponent() == mCenterGrid && mThemes[mList->getCursorId()].isCloned) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
getHelpStyle(),
|
||||
"THIS WILL COMPLETELY DELETE THE THEME INCLUDING ANY "
|
||||
"LOCAL CUSTOMIZATIONS",
|
||||
"PROCEED",
|
||||
[this] {
|
||||
const std::filesystem::path themeDirectory {
|
||||
mThemeDirectory + mThemeSets[mList->getCursorId()].reponame};
|
||||
const std::filesystem::path themeDirectory {mThemeDirectory +
|
||||
mThemes[mList->getCursorId()].reponame};
|
||||
LOG(LogInfo) << "Deleting theme directory \"" << themeDirectory.string() << "\"";
|
||||
if (!Utils::FileSystem::removeDirectory(themeDirectory.string(), true)) {
|
||||
mWindow->pushGui(new GuiMsgBox(
|
||||
|
@ -1192,7 +1189,7 @@ std::vector<HelpPrompt> GuiThemeDownloader::getHelpPrompts()
|
|||
if (mGrid.getSelectedComponent() == mCenterGrid)
|
||||
prompts.push_back(HelpPrompt("x", "view screenshots"));
|
||||
|
||||
if (mThemeSets[mList->getCursorId()].isCloned) {
|
||||
if (mThemes[mList->getCursorId()].isCloned) {
|
||||
prompts.push_back(HelpPrompt("a", "fetch updates"));
|
||||
if (mGrid.getSelectedComponent() == mCenterGrid)
|
||||
prompts.push_back(HelpPrompt("y", "delete"));
|
||||
|
|
|
@ -143,7 +143,7 @@ private:
|
|||
bool mHasThemeUpdates;
|
||||
static inline std::atomic<float> mReceivedObjectsProgress {0.0f};
|
||||
static inline std::atomic<float> mResolveDeltaProgress {0.0f};
|
||||
std::vector<ThemeEntry> mThemeSets;
|
||||
std::vector<ThemeEntry> mThemes;
|
||||
StatusType mStatusType;
|
||||
std::string mStatusText;
|
||||
bool mFullscreenViewing;
|
||||
|
|
|
@ -760,7 +760,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
MameNames::getInstance();
|
||||
ThemeData::populateThemeSets();
|
||||
ThemeData::populateThemes();
|
||||
loadSystemsReturnCode loadSystemsStatus {loadSystemConfigFile()};
|
||||
|
||||
if (!SystemData::sStartupExitSignal) {
|
||||
|
|
|
@ -108,11 +108,11 @@ void GamelistView::onTransition()
|
|||
|
||||
void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||
{
|
||||
auto themeSets = ThemeData::getThemeSets();
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
selectedSet {themeSets.find(Settings::getInstance()->getString("ThemeSet"))};
|
||||
auto themes = ThemeData::getThemes();
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
selectedTheme {themes.find(Settings::getInstance()->getString("Theme"))};
|
||||
|
||||
assert(selectedSet != themeSets.cend());
|
||||
assert(selectedTheme != themes.cend());
|
||||
|
||||
mStaticVideoAudio = false;
|
||||
const bool isStartupSystem {Settings::getInstance()->getString("StartupSystem") ==
|
||||
|
|
|
@ -459,11 +459,11 @@ void SystemView::populate()
|
|||
|
||||
LOG(LogDebug) << "SystemView::populate(): Populating primary element...";
|
||||
|
||||
auto themeSets = ThemeData::getThemeSets();
|
||||
std::map<std::string, ThemeData::ThemeSet, ThemeData::StringComparator>::const_iterator
|
||||
selectedSet {themeSets.find(Settings::getInstance()->getString("ThemeSet"))};
|
||||
auto themes = ThemeData::getThemes();
|
||||
std::map<std::string, ThemeData::Theme, ThemeData::StringComparator>::const_iterator
|
||||
selectedTheme {themes.find(Settings::getInstance()->getString("Theme"))};
|
||||
|
||||
assert(selectedSet != themeSets.cend());
|
||||
assert(selectedTheme != themes.cend());
|
||||
|
||||
for (auto it : SystemData::sSystemVector) {
|
||||
const std::shared_ptr<ThemeData>& theme {it->getTheme()};
|
||||
|
|
|
@ -945,7 +945,7 @@ std::shared_ptr<GamelistView> ViewController::getGamelistView(SystemData* system
|
|||
std::shared_ptr<GamelistView> view;
|
||||
|
||||
if (Settings::getInstance()->getBool("ThemeVariantTriggers")) {
|
||||
const auto overrides = system->getTheme()->getCurrentThemeSetSelectedVariantOverrides();
|
||||
const auto overrides = system->getTheme()->getCurrentThemeSelectedVariantOverrides();
|
||||
|
||||
if (!overrides.empty()) {
|
||||
ThemeTriggers::TriggerType noVideosTriggerType {ThemeTriggers::TriggerType::NONE};
|
||||
|
@ -1141,7 +1141,7 @@ bool ViewController::input(InputConfig* config, Input input)
|
|||
|
||||
void ViewController::update(int deltaTime)
|
||||
{
|
||||
if (mWindow->getChangedThemeSet())
|
||||
if (mWindow->getChangedTheme())
|
||||
cancelViewTransitions();
|
||||
|
||||
if (mCurrentView)
|
||||
|
|
|
@ -51,8 +51,7 @@ public:
|
|||
{
|
||||
reloadGamelistView(getGamelistView(system).get(), reloadTheme);
|
||||
}
|
||||
// Reload everything with a theme.
|
||||
// Used when the "ThemeSet" setting changes.
|
||||
// Reload everything with a theme, used when the "Theme" setting changes.
|
||||
void reloadAll();
|
||||
|
||||
// Rescan the ROM directory for any changes to games and systems.
|
||||
|
|
|
@ -157,7 +157,7 @@ void Settings::setDefaults()
|
|||
mBoolMap["ScraperRegionFallback"] = {true, true};
|
||||
|
||||
// UI settings.
|
||||
mStringMap["ThemeSet"] = {"slate-es-de", "slate-es-de"};
|
||||
mStringMap["Theme"] = {"slate-es-de", "slate-es-de"};
|
||||
mStringMap["ThemeVariant"] = {"", ""};
|
||||
mStringMap["ThemeColorScheme"] = {"", ""};
|
||||
mStringMap["ThemeAspectRatio"] = {"", ""};
|
||||
|
|
|
@ -203,12 +203,11 @@ void NavigationSounds::loadThemeNavigationSounds(ThemeData* const theme)
|
|||
{
|
||||
if (theme) {
|
||||
LOG(LogDebug) << "NavigationSounds::loadThemeNavigationSounds(): "
|
||||
"Theme set includes navigation sound support, loading custom sounds";
|
||||
"Theme includes navigation sound support, loading custom sounds";
|
||||
}
|
||||
else {
|
||||
LOG(LogDebug)
|
||||
<< "NavigationSounds::loadThemeNavigationSounds(): "
|
||||
"Theme set does not include navigation sound support, using fallback sounds";
|
||||
LOG(LogDebug) << "NavigationSounds::loadThemeNavigationSounds(): "
|
||||
"Theme does not include navigation sound support, using fallback sounds";
|
||||
}
|
||||
|
||||
mNavigationSounds.push_back(Sound::getFromTheme(theme, "all", "sound_systembrowse"));
|
||||
|
|
|
@ -499,7 +499,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
ThemeData::ThemeData()
|
||||
: mCustomCollection {false}
|
||||
{
|
||||
sCurrentThemeSet = sThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||
sCurrentTheme = sThemes.find(Settings::getInstance()->getString("Theme"));
|
||||
sVariantDefinedTransitions = "";
|
||||
}
|
||||
|
||||
|
@ -542,8 +542,8 @@ void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
|
|||
if (root.child("formatVersion") != nullptr)
|
||||
throw error << ": Legacy <formatVersion> tag found";
|
||||
|
||||
if (sCurrentThemeSet->second.capabilities.variants.size() > 0) {
|
||||
for (auto& variant : sCurrentThemeSet->second.capabilities.variants)
|
||||
if (sCurrentTheme->second.capabilities.variants.size() > 0) {
|
||||
for (auto& variant : sCurrentTheme->second.capabilities.variants)
|
||||
mVariants.emplace_back(variant.name);
|
||||
|
||||
if (std::find(mVariants.cbegin(), mVariants.cend(),
|
||||
|
@ -555,14 +555,14 @@ void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
|
|||
mVariants.emplace_back("all");
|
||||
|
||||
if (trigger != ThemeTriggers::TriggerType::NONE) {
|
||||
auto overrides = getCurrentThemeSetSelectedVariantOverrides();
|
||||
auto overrides = getCurrentThemeSelectedVariantOverrides();
|
||||
if (overrides.find(trigger) != overrides.end())
|
||||
mOverrideVariant = overrides.at(trigger).first;
|
||||
}
|
||||
}
|
||||
|
||||
if (sCurrentThemeSet->second.capabilities.colorSchemes.size() > 0) {
|
||||
for (auto& colorScheme : sCurrentThemeSet->second.capabilities.colorSchemes)
|
||||
if (sCurrentTheme->second.capabilities.colorSchemes.size() > 0) {
|
||||
for (auto& colorScheme : sCurrentTheme->second.capabilities.colorSchemes)
|
||||
mColorSchemes.emplace_back(colorScheme.name);
|
||||
|
||||
if (std::find(mColorSchemes.cbegin(), mColorSchemes.cend(),
|
||||
|
@ -575,22 +575,22 @@ void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
|
|||
|
||||
sAspectRatioMatch = false;
|
||||
|
||||
if (sCurrentThemeSet->second.capabilities.aspectRatios.size() > 0) {
|
||||
if (std::find(sCurrentThemeSet->second.capabilities.aspectRatios.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.aspectRatios.cend(),
|
||||
if (sCurrentTheme->second.capabilities.aspectRatios.size() > 0) {
|
||||
if (std::find(sCurrentTheme->second.capabilities.aspectRatios.cbegin(),
|
||||
sCurrentTheme->second.capabilities.aspectRatios.cend(),
|
||||
Settings::getInstance()->getString("ThemeAspectRatio")) !=
|
||||
sCurrentThemeSet->second.capabilities.aspectRatios.cend())
|
||||
sCurrentTheme->second.capabilities.aspectRatios.cend())
|
||||
sSelectedAspectRatio = Settings::getInstance()->getString("ThemeAspectRatio");
|
||||
else
|
||||
sSelectedAspectRatio = sCurrentThemeSet->second.capabilities.aspectRatios.front();
|
||||
sSelectedAspectRatio = sCurrentTheme->second.capabilities.aspectRatios.front();
|
||||
|
||||
if (sSelectedAspectRatio == "automatic") {
|
||||
// Auto-detect the closest aspect ratio based on what's available in the theme set.
|
||||
// Auto-detect the closest aspect ratio based on what's available in the theme config.
|
||||
sSelectedAspectRatio = "16:9";
|
||||
const float screenAspectRatio {Renderer::getScreenAspectRatio()};
|
||||
float diff {std::fabs(sAspectRatioMap["16:9"] - screenAspectRatio)};
|
||||
|
||||
for (auto& aspectRatio : sCurrentThemeSet->second.capabilities.aspectRatios) {
|
||||
for (auto& aspectRatio : sCurrentTheme->second.capabilities.aspectRatios) {
|
||||
if (aspectRatio == "automatic")
|
||||
continue;
|
||||
|
||||
|
@ -647,10 +647,10 @@ const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view,
|
|||
return &elemIt->second;
|
||||
}
|
||||
|
||||
void ThemeData::populateThemeSets()
|
||||
void ThemeData::populateThemes()
|
||||
{
|
||||
sThemeSets.clear();
|
||||
LOG(LogInfo) << "Checking for available theme sets...";
|
||||
sThemes.clear();
|
||||
LOG(LogInfo) << "Checking for available themes...";
|
||||
|
||||
// Check for themes first under the user theme directory (which is in the ES-DE home directory
|
||||
// by default), then under the data installation directory (Unix only) and last under the ES-DE
|
||||
|
@ -720,10 +720,10 @@ void ThemeData::populateThemeSets()
|
|||
continue;
|
||||
|
||||
#if defined(_WIN64)
|
||||
LOG(LogDebug) << "Loading theme set capabilities for \""
|
||||
LOG(LogDebug) << "Loading theme capabilities for \""
|
||||
<< Utils::String::replace(*it, "/", "\\") << "\"...";
|
||||
#else
|
||||
LOG(LogDebug) << "Loading theme set capabilities for \"" << *it << "\"...";
|
||||
LOG(LogDebug) << "Loading theme capabilities for \"" << *it << "\"...";
|
||||
#endif
|
||||
ThemeCapability capabilities {parseThemeCapabilities(*it)};
|
||||
|
||||
|
@ -732,21 +732,19 @@ void ThemeData::populateThemeSets()
|
|||
|
||||
std::string themeName;
|
||||
if (capabilities.themeName != "") {
|
||||
themeName.append(" (theme name \"")
|
||||
.append(capabilities.themeName)
|
||||
.append("\")");
|
||||
themeName.append(" (\"").append(capabilities.themeName).append("\")");
|
||||
}
|
||||
|
||||
#if defined(_WIN64)
|
||||
LOG(LogInfo) << "Added theme set \"" << Utils::String::replace(*it, "/", "\\")
|
||||
<< "\"" << themeName;
|
||||
LOG(LogInfo) << "Added theme \"" << Utils::String::replace(*it, "/", "\\") << "\""
|
||||
<< themeName;
|
||||
#else
|
||||
LOG(LogInfo) << "Added theme set \"" << *it << "\"" << themeName;
|
||||
LOG(LogInfo) << "Added theme \"" << *it << "\"" << themeName;
|
||||
#endif
|
||||
int aspectRatios {0};
|
||||
if (capabilities.aspectRatios.size() > 0)
|
||||
aspectRatios = static_cast<int>(capabilities.aspectRatios.size()) - 1;
|
||||
LOG(LogDebug) << "Theme set includes support for " << capabilities.variants.size()
|
||||
LOG(LogDebug) << "Theme includes support for " << capabilities.variants.size()
|
||||
<< " variant" << (capabilities.variants.size() != 1 ? "s" : "")
|
||||
<< ", " << capabilities.colorSchemes.size() << " color scheme"
|
||||
<< (capabilities.colorSchemes.size() != 1 ? "s" : "") << ", "
|
||||
|
@ -754,53 +752,51 @@ void ThemeData::populateThemeSets()
|
|||
<< " and " << capabilities.transitions.size() << " transition"
|
||||
<< (capabilities.transitions.size() != 1 ? "s" : "");
|
||||
|
||||
ThemeSet set {*it, capabilities};
|
||||
sThemeSets[set.getName()] = set;
|
||||
Theme theme {*it, capabilities};
|
||||
sThemes[theme.getName()] = theme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sThemeSets.empty()) {
|
||||
LOG(LogWarning) << "Couldn't find any theme sets, creating dummy entry";
|
||||
ThemeSet set {"no-theme-sets", ThemeCapability()};
|
||||
sThemeSets[set.getName()] = set;
|
||||
sCurrentThemeSet = sThemeSets.begin();
|
||||
if (sThemes.empty()) {
|
||||
LOG(LogWarning) << "Couldn't find any themes, creating dummy entry";
|
||||
Theme theme {"no-themes", ThemeCapability()};
|
||||
sThemes[theme.getName()] = theme;
|
||||
sCurrentTheme = sThemes.begin();
|
||||
}
|
||||
}
|
||||
|
||||
const std::string ThemeData::getThemeFromCurrentSet(const std::string& system)
|
||||
const std::string ThemeData::getSystemThemeFile(const std::string& system)
|
||||
{
|
||||
if (sThemeSets.empty())
|
||||
getThemeSets();
|
||||
if (sThemes.empty())
|
||||
getThemes();
|
||||
|
||||
if (sThemeSets.empty())
|
||||
// No theme sets available.
|
||||
if (sThemes.empty())
|
||||
return "";
|
||||
|
||||
std::map<std::string, ThemeSet, StringComparator>::const_iterator set {
|
||||
sThemeSets.find(Settings::getInstance()->getString("ThemeSet"))};
|
||||
if (set == sThemeSets.cend()) {
|
||||
// Currently configured theme set is missing, attempt to load the default theme set
|
||||
// slate-es-de instead, and if that's also missing then pick the first available set.
|
||||
std::map<std::string, Theme, StringComparator>::const_iterator theme {
|
||||
sThemes.find(Settings::getInstance()->getString("Theme"))};
|
||||
if (theme == sThemes.cend()) {
|
||||
// Currently configured theme is missing, attempt to load the default theme slate-es-de
|
||||
// instead, and if that's also missing then pick the first available one.
|
||||
bool defaultSetFound {true};
|
||||
|
||||
set = sThemeSets.find("slate-es-de");
|
||||
theme = sThemes.find("slate-es-de");
|
||||
|
||||
if (set == sThemeSets.cend()) {
|
||||
set = sThemeSets.cbegin();
|
||||
if (theme == sThemes.cend()) {
|
||||
theme = sThemes.cbegin();
|
||||
defaultSetFound = false;
|
||||
}
|
||||
|
||||
LOG(LogWarning) << "Configured theme set \""
|
||||
<< Settings::getInstance()->getString("ThemeSet")
|
||||
LOG(LogWarning) << "Configured theme \"" << Settings::getInstance()->getString("Theme")
|
||||
<< "\" does not exist, loading" << (defaultSetFound ? " default " : " ")
|
||||
<< "theme set \"" << set->first << "\" instead";
|
||||
<< "theme \"" << theme->first << "\" instead";
|
||||
|
||||
Settings::getInstance()->setString("ThemeSet", set->first);
|
||||
sCurrentThemeSet = sThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||
Settings::getInstance()->setString("Theme", theme->first);
|
||||
sCurrentTheme = sThemes.find(Settings::getInstance()->getString("Theme"));
|
||||
}
|
||||
|
||||
return set->second.getThemePath(system);
|
||||
return theme->second.getThemePath(system);
|
||||
}
|
||||
|
||||
const std::string ThemeData::getAspectRatioLabel(const std::string& aspectRatio)
|
||||
|
@ -836,25 +832,25 @@ void ThemeData::setThemeTransitions()
|
|||
if (transitionsSetting == "automatic") {
|
||||
if (sVariantDefinedTransitions != "")
|
||||
profile = sVariantDefinedTransitions;
|
||||
else if (!sCurrentThemeSet->second.capabilities.transitions.empty())
|
||||
profile = sCurrentThemeSet->second.capabilities.transitions.front().name;
|
||||
else if (!sCurrentTheme->second.capabilities.transitions.empty())
|
||||
profile = sCurrentTheme->second.capabilities.transitions.front().name;
|
||||
}
|
||||
else {
|
||||
profile = transitionsSetting;
|
||||
}
|
||||
|
||||
auto it = std::find_if(
|
||||
sCurrentThemeSet->second.capabilities.transitions.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.transitions.cend(),
|
||||
sCurrentTheme->second.capabilities.transitions.cbegin(),
|
||||
sCurrentTheme->second.capabilities.transitions.cend(),
|
||||
[&profile](const ThemeTransitions transitions) { return transitions.name == profile; });
|
||||
if (it != sCurrentThemeSet->second.capabilities.transitions.cend())
|
||||
if (it != sCurrentTheme->second.capabilities.transitions.cend())
|
||||
profileEntry = static_cast<size_t>(
|
||||
std::distance(sCurrentThemeSet->second.capabilities.transitions.cbegin(), it) + 1);
|
||||
std::distance(sCurrentTheme->second.capabilities.transitions.cbegin(), it) + 1);
|
||||
|
||||
if (profileEntry != 0 &&
|
||||
sCurrentThemeSet->second.capabilities.transitions.size() > profileEntry - 1) {
|
||||
sCurrentTheme->second.capabilities.transitions.size() > profileEntry - 1) {
|
||||
auto transitionMap =
|
||||
sCurrentThemeSet->second.capabilities.transitions[profileEntry - 1].animations;
|
||||
sCurrentTheme->second.capabilities.transitions[profileEntry - 1].animations;
|
||||
if (transitionMap.find(ViewTransition::SYSTEM_TO_SYSTEM) != transitionMap.end())
|
||||
Settings::getInstance()->setInt("TransitionsSystemToSystem",
|
||||
transitionMap[ViewTransition::SYSTEM_TO_SYSTEM]);
|
||||
|
@ -875,10 +871,10 @@ void ThemeData::setThemeTransitions()
|
|||
transitionMap[ViewTransition::STARTUP_TO_GAMELIST]);
|
||||
}
|
||||
else if (transitionsSetting == "builtin-slide" || transitionsSetting == "builtin-fade") {
|
||||
if (std::find(sCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend(),
|
||||
if (std::find(sCurrentTheme->second.capabilities.suppressedTransitionProfiles.cbegin(),
|
||||
sCurrentTheme->second.capabilities.suppressedTransitionProfiles.cend(),
|
||||
transitionsSetting) ==
|
||||
sCurrentThemeSet->second.capabilities.suppressedTransitionProfiles.cend()) {
|
||||
sCurrentTheme->second.capabilities.suppressedTransitionProfiles.cend()) {
|
||||
if (transitionsSetting == "builtin-slide") {
|
||||
transitionAnim = static_cast<int>(ViewTransitionAnimation::SLIDE);
|
||||
}
|
||||
|
@ -891,14 +887,14 @@ void ThemeData::setThemeTransitions()
|
|||
}
|
||||
|
||||
const std::map<ThemeTriggers::TriggerType, std::pair<std::string, std::vector<std::string>>>
|
||||
ThemeData::getCurrentThemeSetSelectedVariantOverrides()
|
||||
ThemeData::getCurrentThemeSelectedVariantOverrides()
|
||||
{
|
||||
const auto variantIter = std::find_if(
|
||||
sCurrentThemeSet->second.capabilities.variants.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.variants.cend(),
|
||||
sCurrentTheme->second.capabilities.variants.cbegin(),
|
||||
sCurrentTheme->second.capabilities.variants.cend(),
|
||||
[this](ThemeVariant currVariant) { return currVariant.name == mSelectedVariant; });
|
||||
|
||||
if (variantIter != sCurrentThemeSet->second.capabilities.variants.cend() &&
|
||||
if (variantIter != sCurrentTheme->second.capabilities.variants.cend() &&
|
||||
!(*variantIter).overrides.empty())
|
||||
return (*variantIter).overrides;
|
||||
else
|
||||
|
@ -907,7 +903,7 @@ ThemeData::getCurrentThemeSetSelectedVariantOverrides()
|
|||
|
||||
const void ThemeData::themeLoadedLogOutput()
|
||||
{
|
||||
LOG(LogInfo) << "Finished loading theme set \"" << sCurrentThemeSet->first << "\"";
|
||||
LOG(LogInfo) << "Finished loading theme \"" << sCurrentTheme->first << "\"";
|
||||
if (sSelectedAspectRatio != "") {
|
||||
const bool autoDetect {Settings::getInstance()->getString("ThemeAspectRatio") ==
|
||||
"automatic"};
|
||||
|
@ -1373,7 +1369,7 @@ ThemeData::ThemeCapability ThemeData::parseThemeCapabilities(const std::string&
|
|||
else {
|
||||
capabilities.validTheme = false;
|
||||
LOG(LogWarning)
|
||||
<< "No capabilities.xml file found, this does not appear to be a valid theme set: \""
|
||||
<< "No capabilities.xml file found, this does not appear to be a valid theme: \""
|
||||
#if defined(_WIN64)
|
||||
<< Utils::String::replace(path, "/", "\\") << "\"";
|
||||
#else
|
||||
|
@ -1497,7 +1493,7 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
|
|||
|
||||
void ThemeData::parseVariants(const pugi::xml_node& root)
|
||||
{
|
||||
if (sCurrentThemeSet == sThemeSets.end())
|
||||
if (sCurrentTheme == sThemes.end())
|
||||
return;
|
||||
|
||||
if (mSelectedVariant == "")
|
||||
|
@ -1543,7 +1539,7 @@ void ThemeData::parseVariants(const pugi::xml_node& root)
|
|||
|
||||
void ThemeData::parseColorSchemes(const pugi::xml_node& root)
|
||||
{
|
||||
if (sCurrentThemeSet == sThemeSets.end())
|
||||
if (sCurrentTheme == sThemes.end())
|
||||
return;
|
||||
|
||||
if (mSelectedColorScheme == "")
|
||||
|
@ -1582,7 +1578,7 @@ void ThemeData::parseColorSchemes(const pugi::xml_node& root)
|
|||
|
||||
void ThemeData::parseAspectRatios(const pugi::xml_node& root)
|
||||
{
|
||||
if (sCurrentThemeSet == sThemeSets.end())
|
||||
if (sCurrentTheme == sThemes.end())
|
||||
return;
|
||||
|
||||
if (sSelectedAspectRatio == "")
|
||||
|
@ -1607,9 +1603,9 @@ void ThemeData::parseAspectRatios(const pugi::xml_node& root)
|
|||
prevOff = nameAttr.find_first_not_of(delim, off);
|
||||
off = nameAttr.find_first_of(delim, prevOff);
|
||||
|
||||
if (std::find(sCurrentThemeSet->second.capabilities.aspectRatios.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.aspectRatios.cend(),
|
||||
viewKey) == sCurrentThemeSet->second.capabilities.aspectRatios.cend()) {
|
||||
if (std::find(sCurrentTheme->second.capabilities.aspectRatios.cbegin(),
|
||||
sCurrentTheme->second.capabilities.aspectRatios.cend(),
|
||||
viewKey) == sCurrentTheme->second.capabilities.aspectRatios.cend()) {
|
||||
throw error << ": <aspectRatio> value \"" << viewKey
|
||||
<< "\" is not defined in capabilities.xml";
|
||||
}
|
||||
|
@ -1633,11 +1629,11 @@ void ThemeData::parseTransitions(const pugi::xml_node& root)
|
|||
const pugi::xml_node& transitions {root.child("transitions")};
|
||||
if (transitions != nullptr) {
|
||||
const std::string& transitionsValue {transitions.text().as_string()};
|
||||
if (std::find_if(sCurrentThemeSet->second.capabilities.transitions.cbegin(),
|
||||
sCurrentThemeSet->second.capabilities.transitions.cend(),
|
||||
if (std::find_if(sCurrentTheme->second.capabilities.transitions.cbegin(),
|
||||
sCurrentTheme->second.capabilities.transitions.cend(),
|
||||
[&transitionsValue](const ThemeTransitions transitions) {
|
||||
return transitions.name == transitionsValue;
|
||||
}) == sCurrentThemeSet->second.capabilities.transitions.cend()) {
|
||||
}) == sCurrentTheme->second.capabilities.transitions.cend()) {
|
||||
throw error << ": <transitions> value \"" << transitionsValue
|
||||
<< "\" is not matching any defined transitions";
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
bool validTheme;
|
||||
};
|
||||
|
||||
struct ThemeSet {
|
||||
struct Theme {
|
||||
std::string path;
|
||||
ThemeCapability capabilities;
|
||||
|
||||
|
@ -219,18 +219,14 @@ public:
|
|||
const std::string& element,
|
||||
const std::string& expectedType) const;
|
||||
|
||||
static void populateThemeSets();
|
||||
const static std::map<std::string, ThemeSet, StringComparator>& getThemeSets()
|
||||
{
|
||||
return sThemeSets;
|
||||
}
|
||||
const static std::string getThemeFromCurrentSet(const std::string& system);
|
||||
static void populateThemes();
|
||||
const static std::map<std::string, Theme, StringComparator>& getThemes() { return sThemes; }
|
||||
const static std::string getSystemThemeFile(const std::string& system);
|
||||
const static std::string getAspectRatioLabel(const std::string& aspectRatio);
|
||||
const static std::string getCurrentThemeSetName() { return sCurrentThemeSet->first; }
|
||||
static void setThemeTransitions();
|
||||
|
||||
const std::map<ThemeTriggers::TriggerType, std::pair<std::string, std::vector<std::string>>>
|
||||
getCurrentThemeSetSelectedVariantOverrides();
|
||||
getCurrentThemeSelectedVariantOverrides();
|
||||
const static void themeLoadedLogOutput();
|
||||
|
||||
enum ElementPropertyType {
|
||||
|
@ -274,8 +270,8 @@ private:
|
|||
static std::map<std::string, std::map<std::string, std::string>> sPropertyAttributeMap;
|
||||
static std::map<std::string, std::map<std::string, ElementPropertyType>> sElementMap;
|
||||
|
||||
static inline std::map<std::string, ThemeSet, StringComparator> sThemeSets;
|
||||
static inline std::map<std::string, ThemeSet, StringComparator>::iterator sCurrentThemeSet {};
|
||||
static inline std::map<std::string, Theme, StringComparator> sThemes;
|
||||
static inline std::map<std::string, Theme, StringComparator>::iterator sCurrentTheme {};
|
||||
static inline std::string sVariantDefinedTransitions;
|
||||
|
||||
std::map<std::string, ThemeView> mViews;
|
||||
|
|
|
@ -52,7 +52,7 @@ Window::Window() noexcept
|
|||
, mVideoPlayerCount {0}
|
||||
, mTopScale {0.5f}
|
||||
, mRenderedHelpPrompts {false}
|
||||
, mChangedThemeSet {false}
|
||||
, mChangedTheme {false}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -465,13 +465,13 @@ 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
|
||||
// If the theme changed, we need to update the background once so that the camera
|
||||
// will be moved. This is required as theme changes always make a transition to
|
||||
// the system view. If we wouldn't make this update, the camera movement would take
|
||||
// place once the menu has been closed.
|
||||
if (mChangedThemeSet) {
|
||||
if (mChangedTheme) {
|
||||
mGuiStack.front()->update(deltaTime);
|
||||
mChangedThemeSet = false;
|
||||
mChangedTheme = false;
|
||||
}
|
||||
|
||||
if (mMediaViewer && mRenderMediaViewer)
|
||||
|
|
|
@ -175,8 +175,8 @@ public:
|
|||
void setAllowFileAnimation(bool value) { mAllowFileAnimation = value; }
|
||||
bool getAllowFileAnimation() { return mAllowFileAnimation; }
|
||||
|
||||
void setChangedThemeSet() { mChangedThemeSet = true; }
|
||||
bool getChangedThemeSet() { return mChangedThemeSet; }
|
||||
void setChangedTheme() { mChangedTheme = true; }
|
||||
bool getChangedTheme() { return mChangedTheme; }
|
||||
|
||||
private:
|
||||
Window() noexcept;
|
||||
|
@ -244,7 +244,7 @@ private:
|
|||
|
||||
float mTopScale;
|
||||
bool mRenderedHelpPrompts;
|
||||
bool mChangedThemeSet;
|
||||
bool mChangedTheme;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_WINDOW_H
|
||||
|
|
Loading…
Reference in a new issue