From a1509af8b67a8d1419eb81ce63aca2eee9932d88 Mon Sep 17 00:00:00 2001 From: Engin Manap Date: Fri, 15 Apr 2011 17:00:47 +0300 Subject: 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. --- gui/options.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gui/options.cpp') 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 { -- cgit v1.2.3 From 8463649f49fd07736389113e08c3f6a7b1e2bc73 Mon Sep 17 00:00:00 2001 From: Engin Manap Date: Fri, 15 Apr 2011 17:15:36 +0300 Subject: GUI: Fix apply old theme even if theme is not changed. There was no control if theme was changed. If you click cancel, it always changes theme to which options panel opened with. This is unneccessery if theme is not changed so a if statement added before applying old theme. --- gui/options.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui/options.cpp') diff --git a/gui/options.cpp b/gui/options.cpp index 5752702f5c..1dd358d7e4 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -511,8 +511,10 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data close(); break; case kCloseCmd: + if (g_gui.theme()->getThemeId() != _oldTheme ) { g_gui.loadNewTheme(_oldTheme); ConfMan.set("gui_theme", _oldTheme); + } close(); break; default: -- cgit v1.2.3 From d20a85d4f13acd641c8e59e2673095d393a82cad Mon Sep 17 00:00:00 2001 From: Engin Manap Date: Sun, 17 Apr 2011 16:22:24 +0300 Subject: GUI: Fix indentation problems. Remove unwanted space. All cosmetic changes, nothing changed. --- gui/options.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gui/options.cpp') diff --git a/gui/options.cpp b/gui/options.cpp index 1dd358d7e4..a12630a0e7 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -511,10 +511,10 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data close(); break; case kCloseCmd: - if (g_gui.theme()->getThemeId() != _oldTheme ) { - g_gui.loadNewTheme(_oldTheme); - ConfMan.set("gui_theme", _oldTheme); - } + if (g_gui.theme()->getThemeId() != _oldTheme) { + g_gui.loadNewTheme(_oldTheme); + ConfMan.set("gui_theme", _oldTheme); + } close(); break; default: -- cgit v1.2.3