aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/options.cpp64
-rw-r--r--gui/options.h6
-rw-r--r--gui/themebrowser.cpp1
-rw-r--r--gui/themebrowser.h2
4 files changed, 35 insertions, 38 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index c867e922c0..120376c3b9 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -186,8 +186,6 @@ void OptionsDialog::init() {
_subSpeedSlider = 0;
_subSpeedLabel = 0;
- _oldTheme = g_gui.theme()->getThemeId();
-
// Retrieve game GUI options
_guioptions.clear();
if (ConfMan.hasKey("guioptions", _domain)) {
@@ -644,10 +642,6 @@ 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:
@@ -1522,8 +1516,8 @@ void GlobalOptionsDialog::apply() {
// Activate the selected language
TransMan.setLanguage(selLang);
- // FIXME: Actually, any changes (including the theme change) should
- // only become active *after* the options dialog has closed.
+ // FIXME: We need to update the labels for all the existing widget after
+ // the language has been changed.
g_gui.loadNewTheme(g_gui.theme()->getThemeId(), ThemeEngine::kGfxDisabled, true);
#else
MessageDialog error(_("You have to restart ScummVM before your changes will take effect."));
@@ -1575,6 +1569,33 @@ void GlobalOptionsDialog::apply() {
#endif // USE_SDL_NET
#endif // USE_CLOUD
+ if (!_newTheme.empty()) {
+#ifdef USE_TRANSLATION
+ Common::String lang = TransMan.getCurrentLanguage();
+#endif
+ Common::String oldTheme = g_gui.theme()->getThemeId();
+ if (g_gui.loadNewTheme(_newTheme)) {
+#ifdef USE_TRANSLATION
+ // If the charset has changed, it means the font were not found for the
+ // new theme. Since for the moment we do not support change of translation
+ // language without restarting, we let the user know about this.
+ if (lang != TransMan.getCurrentLanguage()) {
+ TransMan.setLanguage(lang.c_str());
+ g_gui.loadNewTheme(oldTheme);
+ _curTheme->setLabel(g_gui.theme()->getThemeName());
+ 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 {
+#endif
+ ConfMan.set("gui_theme", _newTheme);
+#ifdef USE_TRANSLATION
+ }
+#endif
+ }
+ draw();
+ _newTheme.clear();
+ }
+
OptionsDialog::apply();
}
@@ -1687,31 +1708,8 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
ThemeBrowser browser;
if (browser.runModal() > 0) {
// User made his choice...
- Common::String theme = browser.getSelected();
- // FIXME: Actually, any changes (including the theme change) should
- // only become active *after* the options dialog has closed.
-#ifdef USE_TRANSLATION
- Common::String lang = TransMan.getCurrentLanguage();
-#endif
- if (g_gui.loadNewTheme(theme)) {
-#ifdef USE_TRANSLATION
- // If the charset has changed, it means the font were not found for the
- // new theme. Since for the moment we do not support change of translation
- // language without restarting, we let the user know about this.
- if (lang != TransMan.getCurrentLanguage()) {
- TransMan.setLanguage(lang.c_str());
- 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 {
-#endif
- _curTheme->setLabel(g_gui.theme()->getThemeName());
- ConfMan.set("gui_theme", theme);
-#ifdef USE_TRANSLATION
- }
-#endif
- }
- draw();
+ _newTheme = browser.getSelected();
+ _curTheme->setLabel(browser.getSelectedName());
}
break;
}
diff --git a/gui/options.h b/gui/options.h
index a2ec702065..9b304204db 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -195,11 +195,6 @@ protected:
Common::String _guioptionsString;
//
- //Theme Options
- //
- Common::String _oldTheme;
-
- //
// Engine-specific controls
//
CheckboxWidgetList _engineCheckboxes;
@@ -220,6 +215,7 @@ public:
virtual void reflowLayout();
protected:
+ Common::String _newTheme;
LauncherDialog *_launcher;
#ifdef GUI_ENABLE_KEYSDIALOG
KeysDialog *_keysDialog;
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index d8bd5d6fe8..75be555e0a 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -84,6 +84,7 @@ void ThemeBrowser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
++sel;
_select = sel->id;
+ _selectName = sel->name;
setResult(1);
close();
break;
diff --git a/gui/themebrowser.h b/gui/themebrowser.h
index 2d94a7f423..bb0bec8c1a 100644
--- a/gui/themebrowser.h
+++ b/gui/themebrowser.h
@@ -42,9 +42,11 @@ public:
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
const Common::String &getSelected() const { return _select; }
+ const Common::String &getSelectedName() const { return _selectName; }
private:
ListWidget *_fileList;
Common::String _select;
+ Common::String _selectName;
typedef Common::List<ThemeEngine::ThemeDescriptor> ThemeDescList;
ThemeDescList _themes;