From 61c96353cf0cc5b418ad64af2c607309221409d4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 28 Oct 2007 12:04:38 +0000 Subject: [PATCH] Patch v5.2 from #1752243: "backends lib patches" svn-id: r29283 --- common/system.h | 11 +++++++++++ gui/ThemeClassic.cpp | 2 +- gui/ThemeModern.cpp | 2 +- gui/theme-config.cpp | 11 +++++++++++ gui/theme.h | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/common/system.h b/common/system.h index 600b2ed76e6..f19f6efc2ce 100644 --- a/common/system.h +++ b/common/system.h @@ -886,6 +886,17 @@ public: */ virtual Common::SaveFileManager *getSavefileManager() = 0; + + /** + * Return String which is used for backend-specific addition to theme + * config. + * + * Typical usage is to disable unneeded GUI widgets or defining + * theme-specific tab. + */ + virtual Common::String getExtraThemeConfig() { + return ""; + } //@} }; diff --git a/gui/ThemeClassic.cpp b/gui/ThemeClassic.cpp index c46965c1914..558acafb242 100644 --- a/gui/ThemeClassic.cpp +++ b/gui/ThemeClassic.cpp @@ -70,7 +70,7 @@ bool ThemeClassic::init() { if (isThemeLoadingRequired()) { loadTheme(_defaultConfig); - loadTheme(_configFile, false); + loadTheme(_configFile, false, true); setupConfig(); } diff --git a/gui/ThemeModern.cpp b/gui/ThemeModern.cpp index a5b6e682cb6..cdafd587ca4 100644 --- a/gui/ThemeModern.cpp +++ b/gui/ThemeModern.cpp @@ -135,7 +135,7 @@ bool ThemeModern::init() { if (isThemeLoadingRequired()) { loadTheme(_defaultConfig); - loadTheme(_configFile, false); // Don't reset + loadTheme(_configFile, false, true); // Don't reset processExtraValues(); } diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 8da2be99e17..0428e600279 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -765,5 +765,16 @@ void Theme::loadTheme(Common::ConfigFile &config, bool reset) { debug(3, "Number of variables: %d", _evaluator->getNumVars()); } +void Theme::loadTheme(Common::ConfigFile &config, bool reset, bool doBackendSpecificPostProcessing) { + loadTheme(config, reset); + + if (doBackendSpecificPostProcessing && !g_system->getExtraThemeConfig().empty()) { + Common::ConfigFile myConfig; + Common::String myConfigINI = g_system->getExtraThemeConfig(); + Common::MemoryReadStream s((const byte *)myConfigINI.c_str(), strlen(myConfigINI.c_str())); + myConfig.loadFromStream(s); + loadTheme(myConfig, false); + } +} } // End of namespace GUI diff --git a/gui/theme.h b/gui/theme.h index 8fd560603c2..b5b8d037f0d 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -210,7 +210,7 @@ public: bool isThemeLoadingRequired(); bool sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h); void loadTheme(Common::ConfigFile &config, bool reset = true); - + void loadTheme(Common::ConfigFile &config, bool reset, bool doBackendSpecificPostProcessing); Eval *_evaluator; static bool themeConfigUseable(const Common::String &file, const Common::String &style="", Common::String *cStyle=0, Common::ConfigFile *cfg=0);