Skip to content

Commit

Permalink
GUI: Add Apply button in global options dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
criezy committed Oct 30, 2016
1 parent 9615364 commit 59675d2
Show file tree
Hide file tree
Showing 14 changed files with 368 additions and 339 deletions.
2 changes: 1 addition & 1 deletion gui/ThemeEngine.h
Expand Up @@ -37,7 +37,7 @@
#include "graphics/pixelformat.h"


#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.22"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.23"

class OSystem;

Expand Down
74 changes: 36 additions & 38 deletions gui/editgamedialog.cpp
Expand Up @@ -381,45 +381,43 @@ void EditGameDialog::open() {
_platformPopUp->setSelected(sel);
}


void EditGameDialog::close() {
if (getResult()) {
ConfMan.set("description", _descriptionWidget->getEditString(), _domain);

Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
if (lang < 0)
ConfMan.removeKey("language", _domain);
else
ConfMan.set("language", Common::getLanguageCode(lang), _domain);

String gamePath(_gamePathWidget->getLabel());
if (!gamePath.empty())
ConfMan.set("path", gamePath, _domain);

String extraPath(_extraPathWidget->getLabel());
if (!extraPath.empty() && (extraPath != _c("None", "path")))
ConfMan.set("extrapath", extraPath, _domain);
else
ConfMan.removeKey("extrapath", _domain);

String savePath(_savePathWidget->getLabel());
if (!savePath.empty() && (savePath != _("Default")))
ConfMan.set("savepath", savePath, _domain);
else
ConfMan.removeKey("savepath", _domain);

Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
if (platform < 0)
ConfMan.removeKey("platform", _domain);
else
ConfMan.set("platform", Common::getPlatformCode(platform), _domain);

// Set the state of engine-specific checkboxes
for (uint i = 0; i < _engineOptions.size(); i++) {
ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain);
}
void EditGameDialog::apply() {
ConfMan.set("description", _descriptionWidget->getEditString(), _domain);

Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
if (lang < 0)
ConfMan.removeKey("language", _domain);
else
ConfMan.set("language", Common::getLanguageCode(lang), _domain);

String gamePath(_gamePathWidget->getLabel());
if (!gamePath.empty())
ConfMan.set("path", gamePath, _domain);

String extraPath(_extraPathWidget->getLabel());
if (!extraPath.empty() && (extraPath != _c("None", "path")))
ConfMan.set("extrapath", extraPath, _domain);
else
ConfMan.removeKey("extrapath", _domain);

String savePath(_savePathWidget->getLabel());
if (!savePath.empty() && (savePath != _("Default")))
ConfMan.set("savepath", savePath, _domain);
else
ConfMan.removeKey("savepath", _domain);

Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
if (platform < 0)
ConfMan.removeKey("platform", _domain);
else
ConfMan.set("platform", Common::getPlatformCode(platform), _domain);

// Set the state of engine-specific checkboxes
for (uint i = 0; i < _engineOptions.size(); i++) {
ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain);
}
OptionsDialog::close();

OptionsDialog::apply();
}

void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
Expand Down
2 changes: 1 addition & 1 deletion gui/editgamedialog.h
Expand Up @@ -65,7 +65,7 @@ class EditGameDialog : public OptionsDialog {
EditGameDialog(const String &domain, const String &desc);

void open();
void close();
virtual void apply();
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);

protected:
Expand Down

0 comments on commit 59675d2

Please sign in to comment.