[Scummvm-cvs-logs] SF.net SVN: scummvm: [27344] scummvm/trunk/gui

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Jun 11 09:35:53 CEST 2007


Revision: 27344
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27344&view=rev
Author:   sev
Date:     2007-06-11 00:35:52 -0700 (Mon, 11 Jun 2007)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/gui/options.h

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2007-06-11 07:01:56 UTC (rev 27343)
+++ scummvm/trunk/gui/launcher.cpp	2007-06-11 07:35:52 UTC (rev 27344)
@@ -124,15 +124,11 @@
 
 	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 @@
 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 @@
 
 	// 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 @@
 
 		_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::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 @@
 		_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 @@
 	_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 @@
 			ConfMan.removeKey("platform", _domain);
 		else
 			ConfMan.set("platform", Common::getPlatformCode(platform), _domain);
+	}
+	OptionsDialog::close();
 }
 
 void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2007-06-11 07:01:56 UTC (rev 27343)
+++ scummvm/trunk/gui/options.cpp	2007-06-11 07:35:52 UTC (rev 27344)
@@ -122,11 +122,7 @@
 
 	// Reset result value
 	setResult(0);
-	
-	loadConfigToWidgets();
-}
 
-void OptionsDialog::loadConfigToWidgets() {
 	// Graphic options
 	if (_fullscreenCheckbox) {
 		_gfxPopUp->setSelected(0);
@@ -255,16 +251,7 @@
 
 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 @@
 				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 @@
 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,31 +754,9 @@
 #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();
-	}
+void GlobalOptionsDialog::open() {
+	OptionsDialog::open();
 
-	OptionsDialog::reflowLayout();
-
-	// FIXME/HACK to workaround bug #1677997, part #2
-	{
-		loadConfigToWidgets();
-	}
-}
-
-void GlobalOptionsDialog::loadConfigToWidgets() {
-
-	OptionsDialog::loadConfigToWidgets();
-
 #if !( defined(__DC__) || defined(__GP32__) || defined(__PLAYSTATION2__) )
 	// Set _savePath to the current save path
 	Common::String savePath(ConfMan.get("savepath", _domain));
@@ -836,9 +791,8 @@
 	}
 }
 
-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 @@
 			ConfMan.removeKey("extrapath", _domain);
 
 		ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);
+	}
+	OptionsDialog::close();
 }
 
 void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2007-06-11 07:01:56 UTC (rev 27343)
+++ scummvm/trunk/gui/options.h	2007-06-11 07:35:52 UTC (rev 27344)
@@ -81,10 +81,6 @@
 	void setVolumeSettingsState(bool enabled);
 	void setSubtitleSettingsState(bool enabled);
 
-	//virtual void setupWidgets();
-	virtual void loadConfigToWidgets();
-	virtual void saveConfigFromWidgets();
-
 private:
 	//
 	// Graphics controls
@@ -151,10 +147,10 @@
 	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 @@
 	StaticTextWidget *_curTheme;
 
 	PopUpWidget *_autosavePeriodPopUp;
-
-	void setupWidgets();
-	virtual void loadConfigToWidgets();
-	virtual void saveConfigFromWidgets();
 };
 
 } // End of namespace GUI


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list