The currently loaded theme set name is now logged to to es_log.txt on startup, reload and theme change.

This commit is contained in:
Leon Styhre 2022-08-14 20:24:26 +02:00
parent 5699988767
commit b69706fc35
4 changed files with 10 additions and 4 deletions

View file

@ -715,6 +715,8 @@ int main(int argc, char* argv[])
// This makes for no delays when accessing content, but a longer startup time. // This makes for no delays when accessing content, but a longer startup time.
ViewController::getInstance()->preload(); ViewController::getInstance()->preload();
LOG(LogInfo) << "Finished loading theme set \"" << ThemeData::getCurrentThemeSetName() << "\"";
if (splashScreen && splashScreenProgress) if (splashScreen && splashScreenProgress)
window->renderLoadingScreen("Done"); window->renderLoadingScreen("Done");

View file

@ -1072,6 +1072,8 @@ void ViewController::reloadAll()
if (!SystemData::sSystemVector.empty() && !themeSoundSupport) if (!SystemData::sSystemVector.empty() && !themeSoundSupport)
NavigationSounds::getInstance().loadThemeNavigationSounds(nullptr); NavigationSounds::getInstance().loadThemeNavigationSounds(nullptr);
LOG(LogInfo) << "Finished loading theme set \"" << ThemeData::getCurrentThemeSetName() << "\"";
mCurrentView->onShow(); mCurrentView->onShow();
updateHelpPrompts(); updateHelpPrompts();
} }

View file

@ -374,9 +374,9 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
// clang-format on // clang-format on
ThemeData::ThemeData() ThemeData::ThemeData()
: mCurrentThemeSet {} : mLegacyTheme {false}
, mLegacyTheme {false}
{ {
mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
} }
void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap, void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
@ -409,7 +409,6 @@ void ThemeData::loadFile(const std::map<std::string, std::string>& sysDataMap,
if (!root) if (!root)
throw error << ": Missing <theme> tag"; throw error << ": Missing <theme> tag";
mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
if (mCurrentThemeSet != mThemeSets.cend()) if (mCurrentThemeSet != mThemeSets.cend())
mLegacyTheme = mCurrentThemeSet->second.capabilities.legacyTheme; mLegacyTheme = mCurrentThemeSet->second.capabilities.legacyTheme;
@ -596,6 +595,7 @@ void ThemeData::populateThemeSets()
LOG(LogWarning) << "Couldn't find any theme sets, creating dummy entry"; LOG(LogWarning) << "Couldn't find any theme sets, creating dummy entry";
ThemeSet set {"no-theme-sets", ThemeCapability()}; ThemeSet set {"no-theme-sets", ThemeCapability()};
mThemeSets[set.getName()] = set; mThemeSets[set.getName()] = set;
mCurrentThemeSet = mThemeSets.begin();
} }
} }
@ -628,6 +628,7 @@ const std::string ThemeData::getThemeFromCurrentSet(const std::string& system)
<< "theme set \"" << set->first << "\" instead"; << "theme set \"" << set->first << "\" instead";
Settings::getInstance()->setString("ThemeSet", set->first); Settings::getInstance()->setString("ThemeSet", set->first);
mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet"));
} }
return set->second.getThemePath(system); return set->second.getThemePath(system);

View file

@ -221,6 +221,7 @@ public:
} }
const static std::string getThemeFromCurrentSet(const std::string& system); 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 mCurrentThemeSet->first; }
const bool isLegacyTheme() { return mLegacyTheme; } const bool isLegacyTheme() { return mLegacyTheme; }
@ -265,7 +266,7 @@ private:
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> mThemeSets; static inline std::map<std::string, ThemeSet, StringComparator> mThemeSets;
std::map<std::string, ThemeSet, StringComparator>::iterator mCurrentThemeSet; static inline std::map<std::string, ThemeSet, StringComparator>::iterator mCurrentThemeSet {};
std::map<std::string, ThemeView> mViews; std::map<std::string, ThemeView> mViews;
std::deque<std::string> mPaths; std::deque<std::string> mPaths;