aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEngin Manap2011-04-15 17:00:47 +0300
committerEngin Manap2011-04-17 16:17:20 +0300
commita1509af8b67a8d1419eb81ce63aca2eee9932d88 (patch)
treee0be046d4222140e32fd5f650ff3af5652c7bbc4
parent82483cb5d1f246f1760acbf61d9531f51a36b53d (diff)
downloadscummvm-rg350-a1509af8b67a8d1419eb81ce63aca2eee9932d88.tar.gz
scummvm-rg350-a1509af8b67a8d1419eb81ce63aca2eee9932d88.tar.bz2
scummvm-rg350-a1509af8b67a8d1419eb81ce63aca2eee9932d88.zip
GUI: Fix theme change ignores cancel on options window.
add new protected value _oldTheme. It keeps theme at the init of options window, and cancel button reapplies old theme.
-rw-r--r--gui/options.cpp9
-rw-r--r--gui/options.h5
2 files changed, 12 insertions, 2 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index a540fbb9d1..5752702f5c 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -144,6 +144,7 @@ void OptionsDialog::init() {
_subSpeedDesc = 0;
_subSpeedSlider = 0;
_subSpeedLabel = 0;
+ _oldTheme = ConfMan.get("gui_theme");
// Retrieve game GUI options
_guioptions = 0;
@@ -509,6 +510,11 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
setResult(1);
close();
break;
+ case kCloseCmd:
+ g_gui.loadNewTheme(_oldTheme);
+ ConfMan.set("gui_theme", _oldTheme);
+ close();
+ break;
default:
Dialog::handleCommand(sender, cmd, data);
}
@@ -1316,7 +1322,6 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
#ifdef USE_TRANSLATION
Common::String lang = TransMan.getCurrentLanguage();
#endif
- Common::String oldTheme = g_gui.theme()->getThemeId();
if (g_gui.loadNewTheme(theme)) {
#ifdef USE_TRANSLATION
// If the charset has changed, it means the font were not found for the
@@ -1324,7 +1329,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
// language without restarting, we let the user know about this.
if (lang != TransMan.getCurrentLanguage()) {
TransMan.setLanguage(lang.c_str());
- g_gui.loadNewTheme(oldTheme);
+ g_gui.loadNewTheme(_oldTheme);
MessageDialog error(_("The theme you selected does not support your current language. If you want to use this theme you need to switch to another language first."));
error.runModal();
} else {
diff --git a/gui/options.h b/gui/options.h
index eba1779b69..5cc13b5cf6 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -174,6 +174,11 @@ protected:
//
uint32 _guioptions;
Common::String _guioptionsString;
+
+ //
+ //Theme Options
+ //
+ Common::String _oldTheme;
};