aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2007-06-11 07:35:52 +0000
committerEugene Sandulenko2007-06-11 07:35:52 +0000
commit7f7abe8706cc24e6bca0eb33c6199e6a218019fd (patch)
tree179590ffd4e622d3d51eb65fe4fc1a404eaf75f1
parent8dcbd6434748cbfd5d8241e83855b5705eb91fea (diff)
downloadscummvm-rg350-7f7abe8706cc24e6bca0eb33c6199e6a218019fd.tar.gz
scummvm-rg350-7f7abe8706cc24e6bca0eb33c6199e6a218019fd.tar.bz2
scummvm-rg350-7f7abe8706cc24e6bca0eb33c6199e6a218019fd.zip
Revert commits:
r27175: Added partial workaround for bug #1677997 r27311: Extended the fix for bug #1677997 to also cover the global options dialog; also made the code a bit more flexible r27312: Oops, fix crash when opening globals options dialog svn-id: r27344
-rw-r--r--gui/launcher.cpp63
-rw-r--r--gui/options.cpp68
-rw-r--r--gui/options.h12
3 files changed, 31 insertions, 112 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 39d0fe2560..eba5498318 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -124,15 +124,11 @@ public:
virtual void reflowLayout();
+ void open();
+ void close();
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected:
- void setupWidgets();
- virtual void loadConfigToWidgets();
- virtual void saveConfigFromWidgets();
-
- String _desc;
-
EditTextWidget *_descriptionWidget;
DomainEditTextWidget *_domainWidget;
@@ -152,25 +148,19 @@ protected:
EditGameDialog::EditGameDialog(const String &domain, const String &desc)
: OptionsDialog(domain, "gameoptions") {
- // GAME: Determine the description string
- _desc = ConfMan.get("description", domain);
- if (_desc.empty() && !desc.empty()) {
- _desc = desc;
- }
-
- // FIXME: Disable the setupWidgets() call here for now. See reflowLayout()
- // for details.
- //setupWidgets();
-}
-
-void EditGameDialog::setupWidgets() {
int labelWidth = g_gui.evaluator()->getVar("gameOptionsLabelWidth");
-
+
// GAME: Path to game data (r/o), extra data (r/o), and save data (r/w)
String gamePath(ConfMan.get("path", _domain));
String extraPath(ConfMan.get("extrapath", _domain));
String savePath(ConfMan.get("savepath", _domain));
+ // GAME: Determine the description string
+ String description(ConfMan.get("description", domain));
+ if (description.empty() && !desc.empty()) {
+ description = desc;
+ }
+
// GUI: Add tab widget
TabWidget *tab = new TabWidget(this, "gameoptions_tabwidget");
tab->setHints(THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND);
@@ -186,7 +176,7 @@ void EditGameDialog::setupWidgets() {
// GUI: Label & edit widget for the description
new StaticTextWidget(tab, "gameoptions_name", "Name: ");
- _descriptionWidget = new EditTextWidget(tab, "gameoptions_desc", _desc);
+ _descriptionWidget = new EditTextWidget(tab, "gameoptions_desc", description);
// Language popup
_langPopUp = new PopUpWidget(tab, "gameoptions_lang", "Language: ", labelWidth);
@@ -235,9 +225,6 @@ void EditGameDialog::setupWidgets() {
_globalVolumeOverride = new CheckboxWidget(tab, "gameoptions_volumeCheckbox", "Override global volume settings", kCmdGlobalVolumeOverride, 0);
} else {
- // FIXME/TODO: It's unfortunate that you get a more fine grained control over which settings
- // are overriden and which are not when using the *smaller* resolution than with the bigger!
- // I guess we should simply offer the "volume override" checkbox in the big resolution, too.
_globalVolumeOverride = NULL;
}
@@ -287,26 +274,8 @@ void EditGameDialog::setupWidgets() {
}
void EditGameDialog::reflowLayout() {
- // FIXME/HACK to workaround bug #1677997: Tear down the whole dialog and
- // recreate it on the fly when a resolution/theme change occurs. Not nice
- // at all, but works well enough.
- {
- delete _firstWidget;
- _firstWidget = 0;
- _mouseWidget = 0;
- _focusedWidget = 0;
- _dragWidget = 0;
- setupWidgets();
- loadConfigToWidgets();
- }
-
OptionsDialog::reflowLayout();
- // FIXME/HACK to workaround bug #1677997, part #2
- {
- loadConfigToWidgets();
- }
-
int labelWidth = g_gui.evaluator()->getVar("gameOptionsLabelWidth");
if (_langPopUp)
@@ -315,12 +284,12 @@ void EditGameDialog::reflowLayout() {
_platformPopUp->changeLabelWidth(labelWidth);
}
-void EditGameDialog::loadConfigToWidgets() {
+void EditGameDialog::open() {
+ OptionsDialog::open();
+
int sel, i;
bool e, f;
- OptionsDialog::loadConfigToWidgets();
-
// En-/disable dialog items depending on whether overrides are active or not.
e = ConfMan.hasKey("gfx_mode", _domain) ||
@@ -377,9 +346,9 @@ void EditGameDialog::loadConfigToWidgets() {
_platformPopUp->setSelected(sel);
}
-void EditGameDialog::saveConfigFromWidgets() {
- OptionsDialog::saveConfigFromWidgets();
+void EditGameDialog::close() {
+ if (getResult()) {
ConfMan.set("description", _descriptionWidget->getEditString(), _domain);
Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
@@ -405,6 +374,8 @@ void EditGameDialog::saveConfigFromWidgets() {
ConfMan.removeKey("platform", _domain);
else
ConfMan.set("platform", Common::getPlatformCode(platform), _domain);
+ }
+ OptionsDialog::close();
}
void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
diff --git a/gui/options.cpp b/gui/options.cpp
index 9e461d1f9b..8a85368e90 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -122,11 +122,7 @@ void OptionsDialog::open() {
// Reset result value
setResult(0);
-
- loadConfigToWidgets();
-}
-void OptionsDialog::loadConfigToWidgets() {
// Graphic options
if (_fullscreenCheckbox) {
_gfxPopUp->setSelected(0);
@@ -255,16 +251,7 @@ void OptionsDialog::loadConfigToWidgets() {
void OptionsDialog::close() {
if (getResult()) {
- saveConfigFromWidgets();
-
- // Save config file
- ConfMan.flushToDisk();
- }
-
- Dialog::close();
-}
-void OptionsDialog::saveConfigFromWidgets() {
// Graphic options
if (_fullscreenCheckbox) {
if (_enableGraphicSettings) {
@@ -394,6 +381,12 @@ void OptionsDialog::saveConfigFromWidgets() {
ConfMan.removeKey("speech_mute", _domain);
}
}
+
+ // Save config file
+ ConfMan.flushToDisk();
+ }
+
+ Dialog::close();
}
void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -667,22 +660,6 @@ void OptionsDialog::reflowLayout() {
GlobalOptionsDialog::GlobalOptionsDialog()
: OptionsDialog(Common::ConfigManager::kApplicationDomain, "globaloptions") {
-#ifdef SMALL_SCREEN_DEVICE
- _keysDialog = 0;
-#endif
- _savePath = 0;
- _themePath = 0;
- _extraPath = 0;
- _curTheme = 0;
- _autosavePeriodPopUp = 0;
-
- // FIXME: Disable the setupWidgets() call here for now. See reflowLayout()
- // for details.
- //setupWidgets();
-}
-
-void GlobalOptionsDialog::setupWidgets() {
-
// The tab widget
TabWidget *tab = new TabWidget(this, "globaloptions_tabwidget");
tab->setHints(THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND);
@@ -777,30 +754,8 @@ GlobalOptionsDialog::~GlobalOptionsDialog() {
#endif
}
-void GlobalOptionsDialog::reflowLayout() {
- // FIXME/HACK to workaround bug #1677997: Tear down the whole dialog and
- // recreate it on the fly when a resolution/theme change occurs. Not nice
- // at all, but works well enough.
- {
- delete _firstWidget;
- _firstWidget = 0;
- _mouseWidget = 0;
- _focusedWidget = 0;
- _dragWidget = 0;
- setupWidgets();
- }
-
- OptionsDialog::reflowLayout();
-
- // FIXME/HACK to workaround bug #1677997, part #2
- {
- loadConfigToWidgets();
- }
-}
-
-void GlobalOptionsDialog::loadConfigToWidgets() {
-
- OptionsDialog::loadConfigToWidgets();
+void GlobalOptionsDialog::open() {
+ OptionsDialog::open();
#if !( defined(__DC__) || defined(__GP32__) || defined(__PLAYSTATION2__) )
// Set _savePath to the current save path
@@ -836,9 +791,8 @@ void GlobalOptionsDialog::loadConfigToWidgets() {
}
}
-void GlobalOptionsDialog::saveConfigFromWidgets() {
- OptionsDialog::saveConfigFromWidgets();
-
+void GlobalOptionsDialog::close() {
+ if (getResult()) {
String savePath(_savePath->getLabel());
if (!savePath.empty() && (savePath != "None"))
ConfMan.set("savepath", savePath, _domain);
@@ -856,6 +810,8 @@ void GlobalOptionsDialog::saveConfigFromWidgets() {
ConfMan.removeKey("extrapath", _domain);
ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);
+ }
+ OptionsDialog::close();
}
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
diff --git a/gui/options.h b/gui/options.h
index 7b8b6abe46..8743528f12 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -81,10 +81,6 @@ protected:
void setVolumeSettingsState(bool enabled);
void setSubtitleSettingsState(bool enabled);
- //virtual void setupWidgets();
- virtual void loadConfigToWidgets();
- virtual void saveConfigFromWidgets();
-
private:
//
// Graphics controls
@@ -151,10 +147,10 @@ public:
GlobalOptionsDialog();
~GlobalOptionsDialog();
+ void open();
+ void close();
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
- virtual void reflowLayout();
-
protected:
#ifdef SMALL_SCREEN_DEVICE
KeysDialog *_keysDialog;
@@ -169,10 +165,6 @@ protected:
StaticTextWidget *_curTheme;
PopUpWidget *_autosavePeriodPopUp;
-
- void setupWidgets();
- virtual void loadConfigToWidgets();
- virtual void saveConfigFromWidgets();
};
} // End of namespace GUI