From 782dabbcd399b0582df73ff82107ffca70abb0f7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 15 Mar 2004 02:21:04 +0000 Subject: ...and mor. Next big thing should be to document the overlay stuff, but that'll have to wait till after I slept :-) svn-id: r13295 --- gui/launcher.cpp | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'gui/launcher.cpp') diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 0ab29f97c9..53772c67d4 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -86,8 +86,6 @@ class EditGameDialog : public OptionsDialog { public: EditGameDialog(const String &domain, GameSettings target); - void open(); - void close(); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); protected: @@ -100,6 +98,10 @@ protected: CheckboxWidget *_globalGraphicsOverride; CheckboxWidget *_globalAudioOverride; CheckboxWidget *_globalVolumeOverride; + + virtual void applySettings(); + virtual void loadSettings(); + virtual void saveSettings(); }; EditGameDialog::EditGameDialog(const String &domain, GameSettings target) @@ -203,11 +205,17 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) // Add OK & Cancel buttons addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); - addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); + addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kSaveCmd, 0); +} + +void EditGameDialog::applySettings() { + // Do *never* apply settings from the EditGameDialog! + // After all, we are editing a game target in the launcher; that target + // can definitely not be the active target, since we are in the launcher. } -void EditGameDialog::open() { - OptionsDialog::open(); +void EditGameDialog::loadSettings() { + OptionsDialog::loadSettings(); int sel, i; bool e; @@ -251,24 +259,22 @@ void EditGameDialog::open() { _platformPopUp->setSelected(sel); } +void EditGameDialog::saveSettings() { + ConfMan.set("description", _descriptionWidget->getLabel(), _domain); -void EditGameDialog::close() { - if (getResult()) { - ConfMan.set("description", _descriptionWidget->getLabel(), _domain); + Common::Language lang = (Common::Language)_langPopUp->getSelectedTag(); + if (lang < 0) + ConfMan.removeKey("language", _domain); + else + ConfMan.set("language", Common::getLanguageCode(lang), _domain); - Common::Language lang = (Common::Language)_langPopUp->getSelectedTag(); - if (lang < 0) - ConfMan.removeKey("language", _domain); - else - ConfMan.set("language", Common::getLanguageCode(lang), _domain); + Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag(); + if (platform < 0) + ConfMan.removeKey("platform", _domain); + else + ConfMan.set("platform", Common::getPlatformCode(platform), _domain); - Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag(); - if (platform < 0) - ConfMan.removeKey("platform", _domain); - else - ConfMan.set("platform", Common::getPlatformCode(platform), _domain); - } - OptionsDialog::close(); + OptionsDialog::saveSettings(); } void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { @@ -285,7 +291,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat setVolumeSettingsState(data != 0); draw(); break; - case kOKCmd: { + case kSaveCmd: { // Write back changes made to config object String newDomain(_domainWidget->getLabel()); if (newDomain != _domain) { -- cgit v1.2.3