diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 9c09c3303..830da597c 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -715,6 +715,8 @@ int main(int argc, char* argv[]) // This makes for no delays when accessing content, but a longer startup time. ViewController::getInstance()->preload(); + LOG(LogInfo) << "Finished loading theme set \"" << ThemeData::getCurrentThemeSetName() << "\""; + if (splashScreen && splashScreenProgress) window->renderLoadingScreen("Done"); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 35728612a..bd7324d9a 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -1072,6 +1072,8 @@ void ViewController::reloadAll() if (!SystemData::sSystemVector.empty() && !themeSoundSupport) NavigationSounds::getInstance().loadThemeNavigationSounds(nullptr); + LOG(LogInfo) << "Finished loading theme set \"" << ThemeData::getCurrentThemeSetName() << "\""; + mCurrentView->onShow(); updateHelpPrompts(); } diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 71288ede3..6976c379f 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -374,9 +374,9 @@ std::map> // clang-format on ThemeData::ThemeData() - : mCurrentThemeSet {} - , mLegacyTheme {false} + : mLegacyTheme {false} { + mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet")); } void ThemeData::loadFile(const std::map& sysDataMap, @@ -409,7 +409,6 @@ void ThemeData::loadFile(const std::map& sysDataMap, if (!root) throw error << ": Missing tag"; - mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet")); if (mCurrentThemeSet != mThemeSets.cend()) mLegacyTheme = mCurrentThemeSet->second.capabilities.legacyTheme; @@ -596,6 +595,7 @@ void ThemeData::populateThemeSets() LOG(LogWarning) << "Couldn't find any theme sets, creating dummy entry"; ThemeSet set {"no-theme-sets", ThemeCapability()}; 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"; Settings::getInstance()->setString("ThemeSet", set->first); + mCurrentThemeSet = mThemeSets.find(Settings::getInstance()->getString("ThemeSet")); } return set->second.getThemePath(system); diff --git a/es-core/src/ThemeData.h b/es-core/src/ThemeData.h index 7d5795f6a..b7ca5ab2e 100644 --- a/es-core/src/ThemeData.h +++ b/es-core/src/ThemeData.h @@ -221,6 +221,7 @@ public: } const static std::string getThemeFromCurrentSet(const std::string& system); const static std::string getAspectRatioLabel(const std::string& aspectRatio); + const static std::string getCurrentThemeSetName() { return mCurrentThemeSet->first; } const bool isLegacyTheme() { return mLegacyTheme; } @@ -265,7 +266,7 @@ private: static std::map> sElementMap; static inline std::map mThemeSets; - std::map::iterator mCurrentThemeSet; + static inline std::map::iterator mCurrentThemeSet {}; std::map mViews; std::deque mPaths;