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