diff options
| author | Eugene Sandulenko | 2007-02-13 21:06:45 +0000 | 
|---|---|---|
| committer | Eugene Sandulenko | 2007-02-13 21:06:45 +0000 | 
| commit | 474d49dc146876b773bfef80335b740d1b1fa8a7 (patch) | |
| tree | e8e8ab7cc81729d8fbfa97450708b7b1b3143a5c /gui/options.cpp | |
| parent | 75fab28be2b34d62ef81de7e695a8b805bfac097 (diff) | |
| download | scummvm-rg350-474d49dc146876b773bfef80335b740d1b1fa8a7.tar.gz scummvm-rg350-474d49dc146876b773bfef80335b740d1b1fa8a7.tar.bz2 scummvm-rg350-474d49dc146876b773bfef80335b740d1b1fa8a7.zip | |
Implement FR#1611172: GUI: Add autosave period widgets
svn-id: r25563
Diffstat (limited to 'gui/options.cpp')
| -rw-r--r-- | gui/options.cpp | 22 | 
1 files changed, 22 insertions, 0 deletions
| diff --git a/gui/options.cpp b/gui/options.cpp index aff32dbf4f..fb41c4bfcc 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -81,6 +81,10 @@ enum {  };  #endif +static const char *savePeriodLabels[] = { "Never", "each 5 mins", "each 10 mins", "each 15 mins", "each 30 mins", 0 }; +static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 }; + +  OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h)  	: Dialog(x, y, w, h), _domain(domain) { @@ -697,6 +701,14 @@ GlobalOptionsDialog::GlobalOptionsDialog()  	new ButtonWidget(tab, "globaloptions_themebutton2", "Theme:", kChooseThemeCmd, 0);  	_curTheme = new StaticTextWidget(tab, "globaloptions_curtheme", g_gui.theme()->getThemeName()); +	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW"); + +	_autosavePeriodPopUp = new PopUpWidget(tab, "globaloptions_autosaveperiod", "Autosave: ", labelWidth); + +	for (int i = 0; savePeriodLabels[i]; i++) { +		_autosavePeriodPopUp->appendEntry(savePeriodLabels[i], savePeriodValues[i]); +	} +  	// TODO: joystick setting @@ -748,6 +760,14 @@ void GlobalOptionsDialog::open() {  		_extraPath->setLabel(extraPath);  	}  #endif + +	// Misc Tab +	_autosavePeriodPopUp->setSelected(1); +	int value = ConfMan.getInt("autosave_period"); +	for (int i = 0; savePeriodLabels[i]; i++) { +		if (value == savePeriodValues[i]) +			_autosavePeriodPopUp->setSelected(i); +	}  }  void GlobalOptionsDialog::close() { @@ -762,6 +782,8 @@ void GlobalOptionsDialog::close() {  		String extraPath(_extraPath->getLabel());  		if (!extraPath.empty() && (extraPath != "None"))  			ConfMan.set("extrapath", extraPath, _domain); + +		ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);  	}  	OptionsDialog::close();  } | 
