2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-12-12 23:22:48 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-12-12 23:22:48 +00:00
|
|
|
*
|
2006-02-11 10:08:56 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-12-12 23:22:48 +00:00
|
|
|
*/
|
|
|
|
|
2003-10-02 22:52:57 +00:00
|
|
|
#include "gui/browser.h"
|
2006-10-08 18:22:28 +00:00
|
|
|
#include "gui/themebrowser.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
#include "gui/chooser.h"
|
2007-06-14 18:40:27 +00:00
|
|
|
#include "gui/message.h"
|
2009-01-02 03:21:40 +00:00
|
|
|
#include "gui/GuiManager.h"
|
2008-08-08 18:30:16 +00:00
|
|
|
#include "gui/ThemeEval.h"
|
2003-10-02 22:52:57 +00:00
|
|
|
#include "gui/options.h"
|
|
|
|
#include "gui/PopUpWidget.h"
|
2003-11-03 00:24:04 +00:00
|
|
|
#include "gui/TabWidget.h"
|
2002-12-12 23:22:48 +00:00
|
|
|
|
2006-06-24 08:07:48 +00:00
|
|
|
#include "common/fs.h"
|
2003-10-08 21:59:23 +00:00
|
|
|
#include "common/config-manager.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2010-06-15 10:44:51 +00:00
|
|
|
#include "common/translation.h"
|
2006-06-24 08:07:48 +00:00
|
|
|
|
|
|
|
#include "graphics/scaler.h"
|
|
|
|
|
2003-10-02 22:52:57 +00:00
|
|
|
#include "sound/mididrv.h"
|
2004-12-27 23:58:04 +00:00
|
|
|
#include "sound/mixer.h"
|
2009-05-12 18:42:44 +00:00
|
|
|
#include "sound/fmopl.h"
|
2002-12-12 23:22:48 +00:00
|
|
|
|
2003-11-10 23:40:48 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2002-12-12 23:22:48 +00:00
|
|
|
enum {
|
2006-06-11 20:51:14 +00:00
|
|
|
kMidiGainChanged = 'mgch',
|
2003-03-25 15:32:36 +00:00
|
|
|
kMusicVolumeChanged = 'muvc',
|
|
|
|
kSfxVolumeChanged = 'sfvc',
|
2009-08-08 18:01:44 +00:00
|
|
|
kMuteAllChanged = 'mute',
|
2006-05-13 17:30:04 +00:00
|
|
|
kSubtitleToggle = 'sttg',
|
|
|
|
kSubtitleSpeedChanged = 'stsc',
|
2004-12-25 23:43:05 +00:00
|
|
|
kSpeechVolumeChanged = 'vcvc',
|
2005-04-10 14:33:44 +00:00
|
|
|
kChooseSoundFontCmd = 'chsf',
|
2007-02-13 19:55:20 +00:00
|
|
|
kClearSoundFontCmd = 'clsf',
|
2004-11-15 04:41:51 +00:00
|
|
|
kChooseSaveDirCmd = 'chos',
|
2006-06-11 20:40:22 +00:00
|
|
|
kChooseThemeDirCmd = 'chth',
|
2006-10-08 18:22:28 +00:00
|
|
|
kChooseExtraDirCmd = 'chex',
|
2008-05-09 01:58:12 +00:00
|
|
|
kChoosePluginsDirCmd = 'chpl',
|
2006-10-08 18:22:28 +00:00
|
|
|
kChooseThemeCmd = 'chtf'
|
2002-12-12 23:22:48 +00:00
|
|
|
};
|
|
|
|
|
2005-07-05 20:22:56 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
2005-01-27 21:35:14 +00:00
|
|
|
enum {
|
|
|
|
kChooseKeyMappingCmd = 'chma'
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 };
|
2007-02-13 21:06:45 +00:00
|
|
|
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
|
2010-06-15 10:44:51 +00:00
|
|
|
static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
|
2009-07-29 09:19:56 +00:00
|
|
|
static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 };
|
2007-02-13 21:06:45 +00:00
|
|
|
|
|
|
|
|
2005-01-27 21:35:14 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
OptionsDialog::OptionsDialog(const Common::String &domain, int x, int y, int w, int h)
|
2008-08-14 23:17:41 +00:00
|
|
|
: Dialog(x, y, w, h), _domain(domain), _graphicsTabId(-1), _tabWidget(0) {
|
2006-03-07 19:02:42 +00:00
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
OptionsDialog::OptionsDialog(const Common::String &domain, const Common::String &name)
|
2008-08-14 23:17:41 +00:00
|
|
|
: Dialog(name), _domain(domain), _graphicsTabId(-1), _tabWidget(0) {
|
2006-03-07 19:02:42 +00:00
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
const char *OptionsDialog::_subModeDesc[] = {
|
2010-06-15 10:44:51 +00:00
|
|
|
_s("Speech Only"),
|
|
|
|
_s("Speech and Subtitles"),
|
|
|
|
_s("Subtitles Only")
|
2006-05-13 17:30:04 +00:00
|
|
|
};
|
|
|
|
|
2008-08-15 19:10:37 +00:00
|
|
|
const char *OptionsDialog::_lowresSubModeDesc[] = {
|
2010-06-15 10:44:51 +00:00
|
|
|
_s("Speech Only"),
|
|
|
|
_s("Speech & Subs"),
|
|
|
|
_s("Subtitles Only")
|
2008-08-15 19:10:37 +00:00
|
|
|
};
|
|
|
|
|
2006-03-07 19:02:42 +00:00
|
|
|
void OptionsDialog::init() {
|
|
|
|
_enableGraphicSettings = false;
|
|
|
|
_gfxPopUp = 0;
|
|
|
|
_renderModePopUp = 0;
|
|
|
|
_fullscreenCheckbox = 0;
|
|
|
|
_aspectCheckbox = 0;
|
|
|
|
_enableAudioSettings = false;
|
2006-04-04 22:32:43 +00:00
|
|
|
_midiPopUp = 0;
|
2009-05-12 18:42:44 +00:00
|
|
|
_oplPopUp = 0;
|
2007-03-10 13:39:38 +00:00
|
|
|
_outputRatePopUp = 0;
|
2006-03-07 19:02:42 +00:00
|
|
|
_enableMIDISettings = false;
|
|
|
|
_multiMidiCheckbox = 0;
|
|
|
|
_mt32Checkbox = 0;
|
|
|
|
_enableGSCheckbox = 0;
|
|
|
|
_enableVolumeSettings = false;
|
2006-05-13 17:30:04 +00:00
|
|
|
_musicVolumeDesc = 0;
|
2006-03-07 19:02:42 +00:00
|
|
|
_musicVolumeSlider = 0;
|
|
|
|
_musicVolumeLabel = 0;
|
2006-05-13 17:30:04 +00:00
|
|
|
_sfxVolumeDesc = 0;
|
2006-03-07 19:02:42 +00:00
|
|
|
_sfxVolumeSlider = 0;
|
|
|
|
_sfxVolumeLabel = 0;
|
2006-05-13 17:30:04 +00:00
|
|
|
_speechVolumeDesc = 0;
|
2006-03-07 19:02:42 +00:00
|
|
|
_speechVolumeSlider = 0;
|
|
|
|
_speechVolumeLabel = 0;
|
2009-06-06 17:36:06 +00:00
|
|
|
_muteCheckbox = 0;
|
2006-05-13 17:30:04 +00:00
|
|
|
_subToggleDesc = 0;
|
|
|
|
_subToggleButton = 0;
|
|
|
|
_subSpeedDesc = 0;
|
|
|
|
_subSpeedSlider = 0;
|
|
|
|
_subSpeedLabel = 0;
|
2009-06-06 17:58:08 +00:00
|
|
|
|
|
|
|
// Retrieve game GUI options
|
|
|
|
_guioptions = 0;
|
|
|
|
if (ConfMan.hasKey("guioptions", _domain))
|
|
|
|
_guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2003-11-03 00:24:04 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
void OptionsDialog::open() {
|
|
|
|
Dialog::open();
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Reset result value
|
|
|
|
setResult(0);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2009-06-06 17:58:08 +00:00
|
|
|
// Retrieve game GUI options
|
|
|
|
_guioptions = 0;
|
|
|
|
if (ConfMan.hasKey("guioptions", _domain))
|
|
|
|
_guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// Graphic options
|
2003-11-07 16:01:51 +00:00
|
|
|
if (_fullscreenCheckbox) {
|
|
|
|
_gfxPopUp->setSelected(0);
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2004-03-15 02:28:47 +00:00
|
|
|
if (ConfMan.hasKey("gfx_mode", _domain)) {
|
2004-02-24 22:39:42 +00:00
|
|
|
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String gfxMode(ConfMan.get("gfx_mode", _domain));
|
2004-03-15 02:28:47 +00:00
|
|
|
int gfxCount = 1;
|
2004-01-16 16:28:56 +00:00
|
|
|
while (gm->name) {
|
2004-02-24 22:39:42 +00:00
|
|
|
gfxCount++;
|
2004-01-16 16:28:56 +00:00
|
|
|
|
|
|
|
if (scumm_stricmp(gm->name, gfxMode.c_str()) == 0)
|
|
|
|
_gfxPopUp->setSelected(gfxCount);
|
|
|
|
|
|
|
|
gm++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-20 00:17:22 +00:00
|
|
|
_renderModePopUp->setSelected(0);
|
|
|
|
|
|
|
|
if (ConfMan.hasKey("render_mode", _domain)) {
|
|
|
|
const Common::RenderModeDescription *p = Common::g_renderModes;
|
|
|
|
const Common::RenderMode renderMode = Common::parseRenderMode(ConfMan.get("render_mode", _domain));
|
|
|
|
int sel = 0;
|
|
|
|
for (int i = 0; p->code; ++p, ++i) {
|
|
|
|
if (renderMode == p->id)
|
|
|
|
sel = i + 2;
|
|
|
|
}
|
|
|
|
_renderModePopUp->setSelected(sel);
|
|
|
|
}
|
|
|
|
|
2008-12-16 22:54:38 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
|
|
|
_fullscreenCheckbox->setState(true);
|
|
|
|
_fullscreenCheckbox->setEnabled(false);
|
|
|
|
_aspectCheckbox->setEnabled(false);
|
|
|
|
#else // !SMALL_SCREEN_DEVICE
|
2003-11-07 16:01:51 +00:00
|
|
|
// Fullscreen setting
|
2004-03-15 02:28:47 +00:00
|
|
|
_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
// Aspect ratio setting
|
2004-03-15 02:28:47 +00:00
|
|
|
_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio", _domain));
|
2008-12-16 22:54:38 +00:00
|
|
|
#endif // SMALL_SCREEN_DEVICE
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// Audio options
|
|
|
|
if (_midiPopUp) {
|
2003-11-07 16:01:51 +00:00
|
|
|
// Music driver
|
2009-03-26 13:52:43 +00:00
|
|
|
MidiDriverType id = MidiDriver::parseMusicDriver(ConfMan.get("music_driver", _domain));
|
|
|
|
_midiPopUp->setSelectedTag(id);
|
2005-04-13 00:11:49 +00:00
|
|
|
}
|
|
|
|
|
2009-05-12 19:36:09 +00:00
|
|
|
if (_oplPopUp) {
|
|
|
|
OPL::Config::DriverId id = MAX<OPL::Config::DriverId>(OPL::Config::parse(ConfMan.get("opl_driver", _domain)), 0);
|
|
|
|
_oplPopUp->setSelectedTag(id);
|
|
|
|
}
|
2009-05-12 18:42:44 +00:00
|
|
|
|
2007-03-10 13:39:38 +00:00
|
|
|
if (_outputRatePopUp) {
|
|
|
|
_outputRatePopUp->setSelected(1);
|
|
|
|
int value = ConfMan.getInt("output_rate", _domain);
|
|
|
|
for (int i = 0; outputRateLabels[i]; i++) {
|
|
|
|
if (value == outputRateValues[i])
|
|
|
|
_outputRatePopUp->setSelected(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
if (_multiMidiCheckbox) {
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
// Multi midi setting
|
|
|
|
_multiMidiCheckbox->setState(ConfMan.getBool("multi_midi", _domain));
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
// Native mt32 setting
|
|
|
|
_mt32Checkbox->setState(ConfMan.getBool("native_mt32", _domain));
|
2004-01-17 13:21:15 +00:00
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
// GS extensions setting
|
|
|
|
_enableGSCheckbox->setState(ConfMan.getBool("enable_gs", _domain));
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String soundFont(ConfMan.get("soundfont", _domain));
|
2007-02-13 21:41:49 +00:00
|
|
|
if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_soundFont->setLabel(_("None"));
|
2007-02-13 21:41:49 +00:00
|
|
|
_soundFontClearButton->setEnabled(false);
|
|
|
|
} else {
|
2006-04-16 18:17:53 +00:00
|
|
|
_soundFont->setLabel(soundFont);
|
2007-02-13 21:41:49 +00:00
|
|
|
_soundFontClearButton->setEnabled(true);
|
|
|
|
}
|
2006-06-11 20:51:14 +00:00
|
|
|
|
|
|
|
// MIDI gain setting
|
|
|
|
char buf[10];
|
|
|
|
|
|
|
|
_midiGainSlider->setValue(ConfMan.getInt("midi_gain", _domain));
|
|
|
|
sprintf(buf, "%.2f", (double)_midiGainSlider->getValue() / 100.0);
|
|
|
|
_midiGainLabel->setLabel(buf);
|
2006-04-16 18:17:53 +00:00
|
|
|
}
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2006-04-16 18:17:53 +00:00
|
|
|
// Volume options
|
2004-12-25 23:43:05 +00:00
|
|
|
if (_musicVolumeSlider) {
|
2003-11-07 16:01:51 +00:00
|
|
|
int vol;
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
vol = ConfMan.getInt("music_volume", _domain);
|
|
|
|
_musicVolumeSlider->setValue(vol);
|
|
|
|
_musicVolumeLabel->setValue(vol);
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
vol = ConfMan.getInt("sfx_volume", _domain);
|
|
|
|
_sfxVolumeSlider->setValue(vol);
|
|
|
|
_sfxVolumeLabel->setValue(vol);
|
2004-04-05 18:24:36 +00:00
|
|
|
|
2004-04-06 11:50:35 +00:00
|
|
|
vol = ConfMan.getInt("speech_volume", _domain);
|
|
|
|
_speechVolumeSlider->setValue(vol);
|
|
|
|
_speechVolumeLabel->setValue(vol);
|
2009-06-06 17:36:06 +00:00
|
|
|
|
|
|
|
bool val = false;
|
|
|
|
if (ConfMan.hasKey("mute", _domain)) {
|
|
|
|
val = ConfMan.getBool("mute", _domain);
|
|
|
|
} else {
|
|
|
|
ConfMan.setBool("mute", false);
|
|
|
|
}
|
|
|
|
_muteCheckbox->setState(val);
|
2003-11-07 16:01:51 +00:00
|
|
|
}
|
2006-05-13 17:30:04 +00:00
|
|
|
|
|
|
|
// Subtitle options
|
|
|
|
if (_subToggleButton) {
|
2009-06-06 17:36:06 +00:00
|
|
|
int speed; int sliderMaxValue = _subSpeedSlider->getMaxValue();
|
2006-05-13 17:30:04 +00:00
|
|
|
|
2007-06-20 14:29:45 +00:00
|
|
|
_subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
|
2010-06-15 10:44:51 +00:00
|
|
|
_subToggleButton->setLabel(_(_subModeDesc[_subMode]));
|
2006-05-13 17:30:04 +00:00
|
|
|
|
|
|
|
// Engines that reuse the subtitle speed widget set their own max value.
|
|
|
|
// Scale the config value accordingly (see addSubtitleControls)
|
|
|
|
speed = (ConfMan.getInt("talkspeed", _domain) * sliderMaxValue + 255 / 2) / 255;
|
|
|
|
_subSpeedSlider->setValue(speed);
|
|
|
|
_subSpeedLabel->setValue(speed);
|
|
|
|
}
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 02:28:47 +00:00
|
|
|
void OptionsDialog::close() {
|
|
|
|
if (getResult()) {
|
2006-05-13 17:30:04 +00:00
|
|
|
|
|
|
|
// Graphic options
|
2004-03-15 02:28:47 +00:00
|
|
|
if (_fullscreenCheckbox) {
|
|
|
|
if (_enableGraphicSettings) {
|
2006-04-16 19:23:14 +00:00
|
|
|
ConfMan.setBool("fullscreen", _fullscreenCheckbox->getState(), _domain);
|
|
|
|
ConfMan.setBool("aspect_ratio", _aspectCheckbox->getState(), _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
|
2006-05-30 01:41:49 +00:00
|
|
|
bool isSet = false;
|
|
|
|
|
2006-05-18 15:40:44 +00:00
|
|
|
if ((int32)_gfxPopUp->getSelectedTag() >= 0) {
|
|
|
|
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
|
|
|
|
|
|
|
while (gm->name) {
|
|
|
|
if (gm->id == (int)_gfxPopUp->getSelectedTag()) {
|
|
|
|
ConfMan.set("gfx_mode", gm->name, _domain);
|
2006-05-30 01:41:49 +00:00
|
|
|
isSet = true;
|
2006-05-18 15:40:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-05-18 19:38:54 +00:00
|
|
|
gm++;
|
2006-05-18 15:40:44 +00:00
|
|
|
}
|
|
|
|
}
|
2006-05-30 01:41:49 +00:00
|
|
|
if (!isSet)
|
|
|
|
ConfMan.removeKey("gfx_mode", _domain);
|
2005-02-20 00:17:22 +00:00
|
|
|
|
|
|
|
if ((int32)_renderModePopUp->getSelectedTag() >= 0)
|
2005-03-02 21:46:51 +00:00
|
|
|
ConfMan.set("render_mode", Common::getRenderModeCode((Common::RenderMode)_renderModePopUp->getSelectedTag()), _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("fullscreen", _domain);
|
|
|
|
ConfMan.removeKey("aspect_ratio", _domain);
|
|
|
|
ConfMan.removeKey("gfx_mode", _domain);
|
2005-02-20 00:17:22 +00:00
|
|
|
ConfMan.removeKey("render_mode", _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
}
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// Volume options
|
2004-12-25 23:43:05 +00:00
|
|
|
if (_musicVolumeSlider) {
|
2004-03-15 02:28:47 +00:00
|
|
|
if (_enableVolumeSettings) {
|
2006-04-16 19:23:14 +00:00
|
|
|
ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain);
|
|
|
|
ConfMan.setInt("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
|
|
|
|
ConfMan.setInt("speech_volume", _speechVolumeSlider->getValue(), _domain);
|
2009-06-06 17:36:06 +00:00
|
|
|
ConfMan.setBool("mute", _muteCheckbox->getState(), _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("music_volume", _domain);
|
|
|
|
ConfMan.removeKey("sfx_volume", _domain);
|
2004-04-06 11:50:35 +00:00
|
|
|
ConfMan.removeKey("speech_volume", _domain);
|
2009-06-06 17:36:06 +00:00
|
|
|
ConfMan.removeKey("mute", _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
}
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2003-11-03 00:24:04 +00:00
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// Audio options
|
|
|
|
if (_midiPopUp) {
|
2004-03-15 02:28:47 +00:00
|
|
|
if (_enableAudioSettings) {
|
2004-12-02 00:33:42 +00:00
|
|
|
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
|
2004-03-15 02:28:47 +00:00
|
|
|
while (md->name && md->id != (int)_midiPopUp->getSelectedTag())
|
|
|
|
md++;
|
|
|
|
if (md->name)
|
|
|
|
ConfMan.set("music_driver", md->name, _domain);
|
|
|
|
else
|
|
|
|
ConfMan.removeKey("music_driver", _domain);
|
|
|
|
} else {
|
2003-11-05 12:25:42 +00:00
|
|
|
ConfMan.removeKey("music_driver", _domain);
|
2004-03-15 02:28:47 +00:00
|
|
|
}
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2004-03-15 02:28:47 +00:00
|
|
|
|
2009-05-12 18:42:44 +00:00
|
|
|
if (_oplPopUp) {
|
|
|
|
if (_enableAudioSettings) {
|
|
|
|
const OPL::Config::EmulatorDescription *ed = OPL::Config::getAvailable();
|
|
|
|
while (ed->name && ed->id != (int)_oplPopUp->getSelectedTag())
|
|
|
|
++ed;
|
|
|
|
|
|
|
|
if (ed->name)
|
|
|
|
ConfMan.set("opl_driver", ed->name, _domain);
|
|
|
|
else
|
|
|
|
ConfMan.removeKey("opl_driver", _domain);
|
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("opl_driver", _domain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-10 13:39:38 +00:00
|
|
|
if (_outputRatePopUp) {
|
|
|
|
if (_enableAudioSettings) {
|
|
|
|
if (_outputRatePopUp->getSelectedTag() != 0)
|
|
|
|
ConfMan.setInt("output_rate", _outputRatePopUp->getSelectedTag(), _domain);
|
|
|
|
else
|
|
|
|
ConfMan.removeKey("output_rate", _domain);
|
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("output_rate", _domain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-16 18:17:53 +00:00
|
|
|
// MIDI options
|
2005-04-13 00:11:49 +00:00
|
|
|
if (_multiMidiCheckbox) {
|
|
|
|
if (_enableMIDISettings) {
|
2006-04-16 19:23:14 +00:00
|
|
|
ConfMan.setBool("multi_midi", _multiMidiCheckbox->getState(), _domain);
|
|
|
|
ConfMan.setBool("native_mt32", _mt32Checkbox->getState(), _domain);
|
|
|
|
ConfMan.setBool("enable_gs", _enableGSCheckbox->getState(), _domain);
|
2006-06-11 20:51:14 +00:00
|
|
|
ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
|
2006-04-16 18:17:53 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String soundFont(_soundFont->getLabel());
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!soundFont.empty() && (soundFont != _("None")))
|
2006-04-16 18:17:53 +00:00
|
|
|
ConfMan.set("soundfont", soundFont, _domain);
|
2007-02-13 19:55:20 +00:00
|
|
|
else
|
|
|
|
ConfMan.removeKey("soundfont", _domain);
|
2005-04-13 00:11:49 +00:00
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("multi_midi", _domain);
|
|
|
|
ConfMan.removeKey("native_mt32", _domain);
|
|
|
|
ConfMan.removeKey("enable_gs", _domain);
|
2006-06-11 20:51:14 +00:00
|
|
|
ConfMan.removeKey("midi_gain", _domain);
|
2006-04-16 18:17:53 +00:00
|
|
|
ConfMan.removeKey("soundfont", _domain);
|
2005-04-13 00:11:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// Subtitle options
|
|
|
|
if (_subToggleButton) {
|
|
|
|
if (_enableSubtitleSettings) {
|
|
|
|
bool subtitles, speech_mute;
|
|
|
|
int talkspeed;
|
|
|
|
int sliderMaxValue = _subSpeedSlider->getMaxValue();
|
|
|
|
|
|
|
|
switch (_subMode) {
|
|
|
|
case 0:
|
|
|
|
subtitles = speech_mute = false;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
subtitles = true;
|
|
|
|
speech_mute = false;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
default:
|
|
|
|
subtitles = speech_mute = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
ConfMan.setBool("subtitles", subtitles, _domain);
|
2006-05-13 17:30:04 +00:00
|
|
|
ConfMan.setBool("speech_mute", speech_mute, _domain);
|
|
|
|
|
|
|
|
// Engines that reuse the subtitle speed widget set their own max value.
|
|
|
|
// Scale the config value accordingly (see addSubtitleControls)
|
|
|
|
talkspeed = (_subSpeedSlider->getValue() * 255 + sliderMaxValue / 2) / sliderMaxValue;
|
|
|
|
ConfMan.setInt("talkspeed", talkspeed, _domain);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ConfMan.removeKey("subtitles", _domain);
|
|
|
|
ConfMan.removeKey("talkspeed", _domain);
|
|
|
|
ConfMan.removeKey("speech_mute", _domain);
|
|
|
|
}
|
|
|
|
}
|
2007-06-11 07:35:52 +00:00
|
|
|
|
|
|
|
// Save config file
|
|
|
|
ConfMan.flushToDisk();
|
|
|
|
}
|
|
|
|
|
|
|
|
Dialog::close();
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
2006-06-11 20:51:14 +00:00
|
|
|
char buf[10];
|
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
switch (cmd) {
|
2006-06-11 20:51:14 +00:00
|
|
|
case kMidiGainChanged:
|
|
|
|
sprintf(buf, "%.2f", (double)_midiGainSlider->getValue() / 100.0);
|
|
|
|
_midiGainLabel->setLabel(buf);
|
|
|
|
_midiGainLabel->draw();
|
|
|
|
break;
|
2003-11-05 12:25:42 +00:00
|
|
|
case kMusicVolumeChanged:
|
|
|
|
_musicVolumeLabel->setValue(_musicVolumeSlider->getValue());
|
|
|
|
_musicVolumeLabel->draw();
|
|
|
|
break;
|
|
|
|
case kSfxVolumeChanged:
|
|
|
|
_sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue());
|
|
|
|
_sfxVolumeLabel->draw();
|
|
|
|
break;
|
2004-04-06 11:50:35 +00:00
|
|
|
case kSpeechVolumeChanged:
|
|
|
|
_speechVolumeLabel->setValue(_speechVolumeSlider->getValue());
|
|
|
|
_speechVolumeLabel->draw();
|
2004-04-05 18:24:36 +00:00
|
|
|
break;
|
2009-08-08 18:01:44 +00:00
|
|
|
case kMuteAllChanged:
|
|
|
|
// 'true' because if control is disabled then event do not pass
|
|
|
|
setVolumeSettingsState(true);
|
|
|
|
break;
|
2006-05-13 17:30:04 +00:00
|
|
|
case kSubtitleToggle:
|
|
|
|
if (_subMode < 2)
|
|
|
|
_subMode++;
|
|
|
|
else
|
2007-09-19 08:40:12 +00:00
|
|
|
_subMode = 0;
|
2006-05-13 17:30:04 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_subToggleButton->setLabel(g_system->getOverlayWidth() > 320 ? _(_subModeDesc[_subMode]) : _(_lowresSubModeDesc[_subMode]));
|
2006-05-13 17:30:04 +00:00
|
|
|
_subToggleButton->draw();
|
|
|
|
_subSpeedDesc->draw();
|
|
|
|
_subSpeedSlider->draw();
|
|
|
|
_subSpeedLabel->draw();
|
|
|
|
break;
|
|
|
|
case kSubtitleSpeedChanged:
|
|
|
|
_subSpeedLabel->setValue(_subSpeedSlider->getValue());
|
|
|
|
_subSpeedLabel->draw();
|
|
|
|
break;
|
2009-01-14 18:17:19 +00:00
|
|
|
case kClearSoundFontCmd:
|
2010-06-15 10:44:51 +00:00
|
|
|
_soundFont->setLabel(_("None"));
|
2009-01-14 18:17:19 +00:00
|
|
|
_soundFontClearButton->setEnabled(false);
|
|
|
|
draw();
|
|
|
|
break;
|
2004-03-15 02:28:47 +00:00
|
|
|
case kOKCmd:
|
|
|
|
setResult(1);
|
2003-11-05 12:25:42 +00:00
|
|
|
close();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Dialog::handleCommand(sender, cmd, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
void OptionsDialog::setGraphicSettingsState(bool enabled) {
|
|
|
|
_enableGraphicSettings = enabled;
|
|
|
|
|
2009-06-06 17:52:44 +00:00
|
|
|
_gfxPopUpDesc->setEnabled(enabled);
|
2004-01-16 16:28:56 +00:00
|
|
|
_gfxPopUp->setEnabled(enabled);
|
2009-06-06 17:52:44 +00:00
|
|
|
_renderModePopUpDesc->setEnabled(enabled);
|
2005-02-20 00:17:22 +00:00
|
|
|
_renderModePopUp->setEnabled(enabled);
|
2005-07-05 20:22:56 +00:00
|
|
|
#ifndef SMALL_SCREEN_DEVICE
|
2003-11-07 16:01:51 +00:00
|
|
|
_fullscreenCheckbox->setEnabled(enabled);
|
|
|
|
_aspectCheckbox->setEnabled(enabled);
|
2004-01-26 07:36:47 +00:00
|
|
|
#endif
|
2003-11-07 16:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OptionsDialog::setAudioSettingsState(bool enabled) {
|
|
|
|
_enableAudioSettings = enabled;
|
|
|
|
|
2009-06-06 17:52:44 +00:00
|
|
|
_midiPopUpDesc->setEnabled(enabled);
|
2003-11-07 16:01:51 +00:00
|
|
|
_midiPopUp->setEnabled(enabled);
|
2009-06-06 17:52:44 +00:00
|
|
|
_oplPopUpDesc->setEnabled(enabled);
|
2009-05-12 18:42:44 +00:00
|
|
|
_oplPopUp->setEnabled(enabled);
|
2009-06-06 17:52:44 +00:00
|
|
|
_outputRatePopUpDesc->setEnabled(enabled);
|
2007-03-10 13:39:38 +00:00
|
|
|
_outputRatePopUp->setEnabled(enabled);
|
2005-04-13 00:11:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OptionsDialog::setMIDISettingsState(bool enabled) {
|
2009-06-06 18:21:07 +00:00
|
|
|
if (_guioptions & Common::GUIO_NOMIDI)
|
|
|
|
enabled = false;
|
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
_enableMIDISettings = enabled;
|
|
|
|
|
2005-05-16 06:33:33 +00:00
|
|
|
_soundFontButton->setEnabled(enabled);
|
|
|
|
_soundFont->setEnabled(enabled);
|
2007-02-13 21:41:49 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != _("None")))
|
2007-02-13 21:41:49 +00:00
|
|
|
_soundFontClearButton->setEnabled(enabled);
|
|
|
|
else
|
|
|
|
_soundFontClearButton->setEnabled(false);
|
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
_multiMidiCheckbox->setEnabled(enabled);
|
|
|
|
_mt32Checkbox->setEnabled(enabled);
|
2005-04-13 00:11:49 +00:00
|
|
|
_enableGSCheckbox->setEnabled(enabled);
|
2006-06-11 20:51:14 +00:00
|
|
|
_midiGainDesc->setEnabled(enabled);
|
|
|
|
_midiGainSlider->setEnabled(enabled);
|
|
|
|
_midiGainLabel->setEnabled(enabled);
|
2003-11-07 16:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OptionsDialog::setVolumeSettingsState(bool enabled) {
|
2009-06-06 17:58:08 +00:00
|
|
|
bool ena;
|
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
_enableVolumeSettings = enabled;
|
|
|
|
|
2009-08-08 18:01:44 +00:00
|
|
|
ena = enabled && !_muteCheckbox->getState();
|
2009-06-06 17:58:08 +00:00
|
|
|
if (_guioptions & Common::GUIO_NOMUSIC)
|
|
|
|
ena = false;
|
|
|
|
|
|
|
|
_musicVolumeDesc->setEnabled(ena);
|
|
|
|
_musicVolumeSlider->setEnabled(ena);
|
|
|
|
_musicVolumeLabel->setEnabled(ena);
|
|
|
|
|
2009-08-08 18:01:44 +00:00
|
|
|
ena = enabled && !_muteCheckbox->getState();
|
2009-06-06 17:58:08 +00:00
|
|
|
if (_guioptions & Common::GUIO_NOSFX)
|
|
|
|
ena = false;
|
|
|
|
|
|
|
|
_sfxVolumeDesc->setEnabled(ena);
|
|
|
|
_sfxVolumeSlider->setEnabled(ena);
|
|
|
|
_sfxVolumeLabel->setEnabled(ena);
|
|
|
|
|
2009-08-08 18:01:44 +00:00
|
|
|
ena = enabled && !_muteCheckbox->getState();
|
2009-06-06 17:58:08 +00:00
|
|
|
if (_guioptions & Common::GUIO_NOSPEECH)
|
|
|
|
ena = false;
|
|
|
|
|
|
|
|
_speechVolumeDesc->setEnabled(ena);
|
|
|
|
_speechVolumeSlider->setEnabled(ena);
|
|
|
|
_speechVolumeLabel->setEnabled(ena);
|
|
|
|
|
2009-06-06 17:36:06 +00:00
|
|
|
_muteCheckbox->setEnabled(enabled);
|
2003-11-07 16:01:51 +00:00
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
void OptionsDialog::setSubtitleSettingsState(bool enabled) {
|
2009-06-06 17:58:08 +00:00
|
|
|
bool ena;
|
2006-05-13 17:30:04 +00:00
|
|
|
_enableSubtitleSettings = enabled;
|
|
|
|
|
2009-06-06 17:58:08 +00:00
|
|
|
ena = enabled;
|
|
|
|
if ((_guioptions & Common::GUIO_NOSUBTITLES) || (_guioptions & Common::GUIO_NOSPEECH))
|
|
|
|
ena = false;
|
|
|
|
|
|
|
|
_subToggleButton->setEnabled(ena);
|
|
|
|
_subToggleDesc->setEnabled(ena);
|
|
|
|
|
|
|
|
ena = enabled;
|
|
|
|
if (_guioptions & Common::GUIO_NOSUBTITLES)
|
|
|
|
ena = false;
|
|
|
|
|
|
|
|
_subSpeedDesc->setEnabled(ena);
|
|
|
|
_subSpeedSlider->setEnabled(ena);
|
|
|
|
_subSpeedLabel->setEnabled(ena);
|
2006-05-13 17:30:04 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &prefix) {
|
2004-02-24 22:39:42 +00:00
|
|
|
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
|
2003-11-05 12:25:42 +00:00
|
|
|
|
|
|
|
// The GFX mode popup
|
2010-06-15 10:44:51 +00:00
|
|
|
_gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", _("Graphics mode:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup");
|
2003-11-03 05:27:53 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_gfxPopUp->appendEntry(_("<default>"));
|
2003-11-05 01:15:10 +00:00
|
|
|
_gfxPopUp->appendEntry("");
|
2004-02-24 22:39:42 +00:00
|
|
|
while (gm->name) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_gfxPopUp->appendEntry(_(gm->description), gm->id);
|
2004-02-24 22:39:42 +00:00
|
|
|
gm++;
|
|
|
|
}
|
2003-11-05 12:25:42 +00:00
|
|
|
|
2005-02-20 00:17:22 +00:00
|
|
|
// RenderMode popup
|
2010-06-15 10:44:51 +00:00
|
|
|
_renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup");
|
2010-06-15 10:44:51 +00:00
|
|
|
_renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
|
2005-02-20 00:17:22 +00:00
|
|
|
_renderModePopUp->appendEntry("");
|
|
|
|
const Common::RenderModeDescription *rm = Common::g_renderModes;
|
|
|
|
for (; rm->code; ++rm) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_renderModePopUp->appendEntry(_(rm->description), rm->id);
|
2005-02-20 00:17:22 +00:00
|
|
|
}
|
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Fullscreen checkbox
|
2010-06-15 10:44:51 +00:00
|
|
|
_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), 0, 0);
|
2003-11-04 21:17:33 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Aspect ratio checkbox
|
2010-06-15 10:44:51 +00:00
|
|
|
_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), 0, 0);
|
2004-02-24 21:56:16 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
_enableGraphicSettings = true;
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2003-11-03 00:24:04 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &prefix) {
|
2002-12-12 23:22:48 +00:00
|
|
|
// The MIDI mode popup & a label
|
2010-06-15 10:44:51 +00:00
|
|
|
_midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", _("Music driver:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup");
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2002-12-13 23:29:18 +00:00
|
|
|
// Populate it
|
2004-12-02 00:33:42 +00:00
|
|
|
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
|
2002-12-13 23:29:18 +00:00
|
|
|
while (md->name) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_midiPopUp->appendEntry(_(md->description), md->id);
|
2002-12-13 23:29:18 +00:00
|
|
|
md++;
|
|
|
|
}
|
2005-04-10 14:33:44 +00:00
|
|
|
|
2009-05-12 18:42:44 +00:00
|
|
|
// The OPL emulator popup & a label
|
2010-06-15 10:44:51 +00:00
|
|
|
_oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", _("AdLib emulator:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_oplPopUp = new PopUpWidget(boss, prefix + "auOPLPopup");
|
2009-05-12 18:42:44 +00:00
|
|
|
|
|
|
|
// Populate it
|
|
|
|
const OPL::Config::EmulatorDescription *ed = OPL::Config::getAvailable();
|
|
|
|
while (ed->name) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_oplPopUp->appendEntry(_(ed->description), ed->id);
|
2009-05-12 18:42:44 +00:00
|
|
|
++ed;
|
|
|
|
}
|
|
|
|
|
2007-03-10 13:39:38 +00:00
|
|
|
// Sample rate settings
|
2010-06-15 10:44:51 +00:00
|
|
|
_outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", _("Output rate:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup");
|
2007-03-10 13:39:38 +00:00
|
|
|
|
|
|
|
for (int i = 0; outputRateLabels[i]; i++) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_outputRatePopUp->appendEntry(_(outputRateLabels[i]), outputRateValues[i]);
|
2007-03-10 13:39:38 +00:00
|
|
|
}
|
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
_enableAudioSettings = true;
|
|
|
|
}
|
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefix) {
|
2005-04-10 14:33:44 +00:00
|
|
|
// SoundFont
|
2010-06-15 10:44:51 +00:00
|
|
|
_soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", _("SoundFont:"), kChooseSoundFontCmd, 0);
|
|
|
|
_soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", _("None"));
|
2007-02-13 19:55:20 +00:00
|
|
|
_soundFontClearButton = new ButtonWidget(boss, prefix + "mcFontClearButton", "C", kClearSoundFontCmd, 0);
|
2005-04-13 00:11:49 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Multi midi setting
|
2010-06-15 10:44:51 +00:00
|
|
|
_multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", _("Mixed AdLib/MIDI mode"), 0, 0);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Native mt32 setting
|
2010-06-15 10:44:51 +00:00
|
|
|
_mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _("True Roland MT-32 (disable GM emulation)"), 0, 0);
|
2004-01-17 13:21:15 +00:00
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
// GS Extensions setting
|
2010-06-15 10:44:51 +00:00
|
|
|
_enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), 0, 0);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-06-11 20:51:14 +00:00
|
|
|
// MIDI gain setting (FluidSynth uses this)
|
2010-06-15 10:44:51 +00:00
|
|
|
_midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", _("MIDI gain:"));
|
2006-06-11 20:51:14 +00:00
|
|
|
_midiGainSlider = new SliderWidget(boss, prefix + "mcMidiGainSlider", kMidiGainChanged);
|
|
|
|
_midiGainSlider->setMinValue(0);
|
|
|
|
_midiGainSlider->setMaxValue(1000);
|
|
|
|
_midiGainLabel = new StaticTextWidget(boss, prefix + "mcMidiGainLabel", "1.00");
|
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
_enableMIDISettings = true;
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
// The function has an extra slider range parameter, since both the launcher and SCUMM engine
|
|
|
|
// make use of the widgets. The launcher range is 0-255. SCUMM's 0-9
|
2010-04-06 09:26:59 +00:00
|
|
|
void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &prefix, int maxSliderVal) {
|
2006-05-13 17:30:04 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", _("Text and Speech:"));
|
2006-05-13 17:30:04 +00:00
|
|
|
_subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0);
|
|
|
|
|
|
|
|
// Subtitle speed
|
2010-06-15 10:44:51 +00:00
|
|
|
_subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", _("Subtitle speed:"));
|
2006-05-13 17:30:04 +00:00
|
|
|
_subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged);
|
|
|
|
_subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%");
|
|
|
|
_subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal);
|
|
|
|
_subSpeedLabel->setFlags(WIDGET_CLEARBG);
|
|
|
|
|
|
|
|
_enableSubtitleSettings = true;
|
|
|
|
}
|
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &prefix) {
|
2005-05-18 16:17:25 +00:00
|
|
|
|
2003-11-03 00:24:04 +00:00
|
|
|
// Volume controllers
|
2010-06-15 10:44:51 +00:00
|
|
|
_musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _("Music volume:"));
|
2006-03-08 01:42:02 +00:00
|
|
|
_musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged);
|
2006-03-24 01:24:26 +00:00
|
|
|
_musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%");
|
2005-05-18 15:58:39 +00:00
|
|
|
_musicVolumeSlider->setMinValue(0);
|
|
|
|
_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
|
2003-03-25 15:32:36 +00:00
|
|
|
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
|
2003-11-01 22:21:18 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", _("Mute All"), kMuteAllChanged, 0);
|
2009-06-06 17:36:06 +00:00
|
|
|
|
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _("SFX volume:"));
|
2006-03-08 01:42:02 +00:00
|
|
|
_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
|
2006-03-24 01:24:26 +00:00
|
|
|
_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%");
|
2005-05-18 15:58:39 +00:00
|
|
|
_sfxVolumeSlider->setMinValue(0);
|
|
|
|
_sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
|
2003-03-25 15:32:36 +00:00
|
|
|
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _("Speech volume:"));
|
2006-03-08 01:42:02 +00:00
|
|
|
_speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged);
|
2006-03-24 01:24:26 +00:00
|
|
|
_speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%");
|
2005-05-18 15:58:39 +00:00
|
|
|
_speechVolumeSlider->setMinValue(0);
|
|
|
|
_speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
|
2004-04-06 11:50:35 +00:00
|
|
|
_speechVolumeLabel->setFlags(WIDGET_CLEARBG);
|
2004-04-05 18:24:36 +00:00
|
|
|
|
2003-11-07 16:01:51 +00:00
|
|
|
_enableVolumeSettings = true;
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
|
2009-06-06 17:58:08 +00:00
|
|
|
if (_guioptions & Common::GUIO_NOSUBTITLES)
|
|
|
|
return 0; // Speech only
|
|
|
|
if (_guioptions & Common::GUIO_NOSPEECH)
|
|
|
|
return 2; // Subtitles only
|
|
|
|
|
2006-05-13 17:30:04 +00:00
|
|
|
if (!subtitles && !speech_mute) // Speech only
|
|
|
|
return 0;
|
|
|
|
else if (subtitles && !speech_mute) // Speech and subtitles
|
|
|
|
return 1;
|
|
|
|
else if (subtitles && speech_mute) // Subtitles only
|
|
|
|
return 2;
|
2007-09-19 08:40:12 +00:00
|
|
|
else
|
2006-05-13 17:30:04 +00:00
|
|
|
warning("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only");
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2006-08-04 13:55:53 +00:00
|
|
|
void OptionsDialog::reflowLayout() {
|
2008-08-14 23:17:41 +00:00
|
|
|
if (_graphicsTabId != -1 && _tabWidget)
|
2010-06-15 10:44:51 +00:00
|
|
|
_tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
|
2009-08-16 05:38:03 +00:00
|
|
|
|
|
|
|
Dialog::reflowLayout();
|
2006-04-19 01:05:28 +00:00
|
|
|
}
|
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
2002-12-12 23:22:48 +00:00
|
|
|
|
2005-04-22 21:20:22 +00:00
|
|
|
GlobalOptionsDialog::GlobalOptionsDialog()
|
2008-08-05 23:58:45 +00:00
|
|
|
: OptionsDialog(Common::ConfigManager::kApplicationDomain, "GlobalOptions") {
|
2007-06-10 14:23:26 +00:00
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// The tab widget
|
2008-08-05 23:58:45 +00:00
|
|
|
TabWidget *tab = new TabWidget(this, "GlobalOptions.TabWidget");
|
2003-11-05 12:25:42 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// 1) The graphics tab
|
|
|
|
//
|
2010-06-15 10:44:51 +00:00
|
|
|
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
|
2008-08-05 23:58:45 +00:00
|
|
|
addGraphicControls(tab, "GlobalOptions_Graphics.");
|
2003-11-05 12:25:42 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// 2) The audio tab
|
|
|
|
//
|
2010-06-15 10:44:51 +00:00
|
|
|
tab->addTab(_("Audio"));
|
2008-08-06 10:50:28 +00:00
|
|
|
addAudioControls(tab, "GlobalOptions_Audio.");
|
2008-08-05 23:58:45 +00:00
|
|
|
addSubtitleControls(tab, "GlobalOptions_Audio.");
|
2006-05-30 17:49:53 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
tab->addTab(_("Volume"));
|
2008-08-05 23:58:45 +00:00
|
|
|
addVolumeControls(tab, "GlobalOptions_Volume.");
|
2006-05-30 17:35:57 +00:00
|
|
|
|
2003-11-05 01:22:19 +00:00
|
|
|
// TODO: cd drive setting
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-04-13 00:11:49 +00:00
|
|
|
//
|
|
|
|
// 3) The MIDI tab
|
|
|
|
//
|
2010-06-15 10:44:51 +00:00
|
|
|
tab->addTab(_("MIDI"));
|
2008-08-05 23:58:45 +00:00
|
|
|
addMIDIControls(tab, "GlobalOptions_MIDI.");
|
2002-12-12 23:22:48 +00:00
|
|
|
|
2002-12-14 01:49:08 +00:00
|
|
|
//
|
2005-04-13 00:11:49 +00:00
|
|
|
// 4) The miscellaneous tab
|
2002-12-14 01:49:08 +00:00
|
|
|
//
|
2010-06-15 10:44:51 +00:00
|
|
|
tab->addTab(_("Paths"));
|
2003-11-03 00:24:04 +00:00
|
|
|
|
|
|
|
#if !( defined(__DC__) || defined(__GP32__) )
|
2005-08-17 20:29:21 +00:00
|
|
|
// These two buttons have to be extra wide, or the text will be
|
|
|
|
// truncated in the small version of the GUI.
|
|
|
|
|
2003-11-03 00:24:04 +00:00
|
|
|
// Save game path
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", _("Save Path: "), kChooseSaveDirCmd, 0);
|
2008-08-05 23:58:45 +00:00
|
|
|
_savePath = new StaticTextWidget(tab, "GlobalOptions_Paths.SavePath", "/foo/bar");
|
2004-11-15 04:41:51 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", _("Theme Path:"), kChooseThemeDirCmd, 0);
|
|
|
|
_themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", _("None"));
|
2006-06-11 20:40:22 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", _("Extra Path:"), kChooseExtraDirCmd, 0);
|
|
|
|
_extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", _("None"));
|
2008-05-09 01:58:12 +00:00
|
|
|
|
|
|
|
#ifdef DYNAMIC_MODULES
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", _("Plugins Path:"), kChoosePluginsDirCmd, 0);
|
|
|
|
_pluginsPath = new StaticTextWidget(tab, "GlobalOptions_Paths.PluginsPath", _("None"));
|
2008-05-09 01:58:12 +00:00
|
|
|
#endif
|
2003-04-03 16:01:03 +00:00
|
|
|
#endif
|
2004-11-15 04:41:51 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
tab->addTab(_("Misc"));
|
2006-10-08 18:22:28 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), kChooseThemeCmd, 0);
|
2008-08-05 23:58:45 +00:00
|
|
|
_curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName());
|
2008-12-22 11:22:15 +00:00
|
|
|
|
2006-10-08 18:22:28 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_rendererPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.RendererPopupDesc", _("GUI Renderer:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.RendererPopup");
|
2008-12-22 11:22:15 +00:00
|
|
|
|
2008-10-29 20:45:28 +00:00
|
|
|
for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i)
|
2010-06-15 10:44:51 +00:00
|
|
|
_rendererPopUp->appendEntry(_(GUI::ThemeEngine::_rendererModes[i].name), GUI::ThemeEngine::_rendererModes[i].mode);
|
2008-12-22 11:22:15 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
_autosavePeriodPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopupDesc", _("Autosave:"));
|
2009-06-06 17:52:44 +00:00
|
|
|
_autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopup");
|
2007-02-13 21:06:45 +00:00
|
|
|
|
|
|
|
for (int i = 0; savePeriodLabels[i]; i++) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_autosavePeriodPopUp->appendEntry(_(savePeriodLabels[i]), savePeriodValues[i]);
|
2007-02-13 21:06:45 +00:00
|
|
|
}
|
|
|
|
|
2008-12-17 21:19:46 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), kChooseKeyMappingCmd, 0);
|
2008-12-17 21:19:46 +00:00
|
|
|
#endif
|
|
|
|
|
2003-11-03 00:24:04 +00:00
|
|
|
// TODO: joystick setting
|
|
|
|
|
2003-11-08 23:22:16 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
#ifdef TRANSLATION
|
|
|
|
_guiLanguagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.GuiLanguagePopupDesc", _("Language:"));
|
|
|
|
_guiLanguagePopUp = new PopUpWidget(tab, "GlobalOptions_Misc.GuiLanguagePopup");
|
|
|
|
#ifdef DETECTLANG
|
|
|
|
_guiLanguagePopUp->appendEntry(_("<default>"), Common::kTranslationAutodetectId);
|
|
|
|
#endif // DETECTLANG
|
|
|
|
_guiLanguagePopUp->appendEntry(_("English"), Common::kTranslationBuiltinId);
|
|
|
|
_guiLanguagePopUp->appendEntry("", 0);
|
|
|
|
Common::TLangArray languages = TransMan.getSupportedLanguages();
|
|
|
|
Common::TLangArray::iterator lang = languages.begin();
|
|
|
|
while (lang != languages.end()) {
|
|
|
|
_guiLanguagePopUp->appendEntry(lang->name, lang->id);
|
|
|
|
lang++;
|
|
|
|
}
|
|
|
|
_guiLanguagePopUp->setSelectedTag(TransMan.parseLanguage(ConfMan.get("gui_language").c_str()));
|
|
|
|
|
|
|
|
#endif // TRANSLATION
|
|
|
|
|
2003-11-05 12:25:42 +00:00
|
|
|
// Activate the first tab
|
|
|
|
tab->setActiveTab(0);
|
2008-08-14 23:17:41 +00:00
|
|
|
_tabWidget = tab;
|
2002-12-14 01:49:08 +00:00
|
|
|
|
2002-12-12 23:22:48 +00:00
|
|
|
// Add OK & Cancel buttons
|
2010-06-15 10:44:51 +00:00
|
|
|
new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), kCloseCmd, 0);
|
|
|
|
new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), kOKCmd, 0);
|
2003-03-25 15:32:36 +00:00
|
|
|
|
2005-07-05 20:22:56 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
|
|
|
_keysDialog = new KeysDialog();
|
2005-01-10 20:53:16 +00:00
|
|
|
#endif
|
2002-12-12 23:22:48 +00:00
|
|
|
}
|
|
|
|
|
2003-03-06 19:52:54 +00:00
|
|
|
GlobalOptionsDialog::~GlobalOptionsDialog() {
|
2005-07-05 20:22:56 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
2005-01-10 20:53:16 +00:00
|
|
|
delete _keysDialog;
|
|
|
|
#endif
|
2003-03-25 15:32:36 +00:00
|
|
|
}
|
|
|
|
|
2007-06-11 07:35:52 +00:00
|
|
|
void GlobalOptionsDialog::open() {
|
|
|
|
OptionsDialog::open();
|
2003-11-01 22:21:18 +00:00
|
|
|
|
2009-03-06 00:28:39 +00:00
|
|
|
#if !( defined(__DC__) || defined(__GP32__) )
|
2003-11-05 12:25:42 +00:00
|
|
|
// Set _savePath to the current save path
|
2006-06-11 20:40:22 +00:00
|
|
|
Common::String savePath(ConfMan.get("savepath", _domain));
|
|
|
|
Common::String themePath(ConfMan.get("themepath", _domain));
|
2004-11-15 04:41:51 +00:00
|
|
|
Common::String extraPath(ConfMan.get("extrapath", _domain));
|
|
|
|
|
2007-03-08 17:05:58 +00:00
|
|
|
if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_savePath->setLabel(_("None"));
|
2003-11-05 12:25:42 +00:00
|
|
|
} else {
|
2007-03-08 17:05:58 +00:00
|
|
|
_savePath->setLabel(savePath);
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2004-11-15 04:41:51 +00:00
|
|
|
|
2006-06-11 20:40:22 +00:00
|
|
|
if (themePath.empty() || !ConfMan.hasKey("themepath", _domain)) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_themePath->setLabel(_("None"));
|
2006-06-11 20:40:22 +00:00
|
|
|
} else {
|
|
|
|
_themePath->setLabel(themePath);
|
|
|
|
}
|
|
|
|
|
2006-03-28 09:42:54 +00:00
|
|
|
if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_extraPath->setLabel(_("None"));
|
2004-11-15 04:41:51 +00:00
|
|
|
} else {
|
|
|
|
_extraPath->setLabel(extraPath);
|
|
|
|
}
|
2008-05-09 01:58:12 +00:00
|
|
|
|
|
|
|
#ifdef DYNAMIC_MODULES
|
|
|
|
Common::String pluginsPath(ConfMan.get("pluginspath", _domain));
|
|
|
|
if (pluginsPath.empty() || !ConfMan.hasKey("pluginspath", _domain)) {
|
2010-06-15 10:44:51 +00:00
|
|
|
_pluginsPath->setLabel(_("None"));
|
2008-05-09 01:58:12 +00:00
|
|
|
} else {
|
|
|
|
_pluginsPath->setLabel(pluginsPath);
|
|
|
|
}
|
|
|
|
#endif
|
2003-11-05 12:25:42 +00:00
|
|
|
#endif
|
2007-02-13 21:06:45 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
2008-12-22 11:22:15 +00:00
|
|
|
|
2008-10-29 20:45:28 +00:00
|
|
|
ThemeEngine::GraphicsMode mode = ThemeEngine::findMode(ConfMan.get("gui_renderer"));
|
|
|
|
if (mode == ThemeEngine::kGfxDisabled)
|
|
|
|
mode = ThemeEngine::_defaultRendererMode;
|
|
|
|
_rendererPopUp->setSelectedTag(mode);
|
2003-11-05 12:25:42 +00:00
|
|
|
}
|
2003-11-01 22:21:18 +00:00
|
|
|
|
2007-06-11 07:35:52 +00:00
|
|
|
void GlobalOptionsDialog::close() {
|
|
|
|
if (getResult()) {
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String savePath(_savePath->getLabel());
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!savePath.empty() && (savePath != _("None")))
|
2007-03-08 17:05:58 +00:00
|
|
|
ConfMan.set("savepath", savePath, _domain);
|
2004-11-15 04:41:51 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String themePath(_themePath->getLabel());
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!themePath.empty() && (themePath != _("None")))
|
2006-06-11 20:40:22 +00:00
|
|
|
ConfMan.set("themepath", themePath, _domain);
|
2007-03-10 13:39:38 +00:00
|
|
|
else
|
|
|
|
ConfMan.removeKey("themepath", _domain);
|
2006-06-11 20:40:22 +00:00
|
|
|
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String extraPath(_extraPath->getLabel());
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!extraPath.empty() && (extraPath != _("None")))
|
2004-11-15 04:41:51 +00:00
|
|
|
ConfMan.set("extrapath", extraPath, _domain);
|
2007-03-10 13:39:38 +00:00
|
|
|
else
|
|
|
|
ConfMan.removeKey("extrapath", _domain);
|
2007-02-13 21:06:45 +00:00
|
|
|
|
2008-05-09 01:58:12 +00:00
|
|
|
#ifdef DYNAMIC_MODULES
|
2010-04-06 09:26:59 +00:00
|
|
|
Common::String pluginsPath(_pluginsPath->getLabel());
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!pluginsPath.empty() && (pluginsPath != _("None")))
|
2008-05-09 01:58:12 +00:00
|
|
|
ConfMan.set("pluginspath", pluginsPath, _domain);
|
|
|
|
else
|
|
|
|
ConfMan.removeKey("pluginspath", _domain);
|
|
|
|
#endif
|
|
|
|
|
2007-02-13 21:06:45 +00:00
|
|
|
ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);
|
2008-12-22 11:22:15 +00:00
|
|
|
|
2008-10-29 20:45:28 +00:00
|
|
|
GUI::ThemeEngine::GraphicsMode selected = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag();
|
|
|
|
const char *cfg = GUI::ThemeEngine::findModeConfigName(selected);
|
|
|
|
if (!ConfMan.get("gui_renderer").equalsIgnoreCase(cfg)) {
|
2009-01-01 17:02:45 +00:00
|
|
|
// FIXME: Actually, any changes (including the theme change) should
|
|
|
|
// only become active *after* the options dialog has closed.
|
2009-01-01 21:41:55 +00:00
|
|
|
g_gui.loadNewTheme(g_gui.theme()->getThemeId(), selected);
|
2008-10-29 20:45:28 +00:00
|
|
|
ConfMan.set("gui_renderer", cfg, _domain);
|
2008-08-15 11:05:25 +00:00
|
|
|
}
|
2010-06-15 10:44:51 +00:00
|
|
|
#ifdef TRANSLATION
|
|
|
|
Common::String oldLang = ConfMan.get("gui_language");
|
|
|
|
int selLang = _guiLanguagePopUp->getSelectedTag();
|
|
|
|
|
|
|
|
ConfMan.set("gui_language", TransMan.getLangById(selLang));
|
|
|
|
|
|
|
|
Common::String newLang = ConfMan.get("gui_language").c_str();
|
|
|
|
if (newLang != oldLang) {
|
|
|
|
#if 0
|
|
|
|
// Activate the selected language
|
|
|
|
TransMan.setLanguage(selLang);
|
|
|
|
|
|
|
|
// FIXME: Actually, any changes (including the theme change) should
|
|
|
|
// only become active *after* the options dialog has closed.
|
|
|
|
g_gui.loadNewTheme(g_gui.theme()->getThemeId(), ThemeEngine::kGfxDisabled, true);
|
|
|
|
#else
|
|
|
|
MessageDialog error(_("You have to restart ScummVM to take the effect."));
|
|
|
|
error.runModal();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif // TRANSLATION
|
|
|
|
|
2007-06-11 07:35:52 +00:00
|
|
|
}
|
|
|
|
OptionsDialog::close();
|
2002-12-12 23:22:48 +00:00
|
|
|
}
|
|
|
|
|
2003-03-06 19:52:54 +00:00
|
|
|
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
|
2003-03-25 15:32:36 +00:00
|
|
|
switch (cmd) {
|
2005-08-10 18:30:55 +00:00
|
|
|
case kChooseSaveDirCmd: {
|
2010-06-15 10:44:51 +00:00
|
|
|
BrowserDialog browser(_("Select directory for savegames"), true);
|
2005-08-10 18:30:55 +00:00
|
|
|
if (browser.runModal() > 0) {
|
2003-03-25 15:32:36 +00:00
|
|
|
// User made his choice...
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode dir(browser.getResult());
|
2007-09-18 20:16:33 +00:00
|
|
|
if (dir.isWritable()) {
|
2007-06-14 18:40:27 +00:00
|
|
|
_savePath->setLabel(dir.getPath());
|
|
|
|
} else {
|
2010-06-15 10:44:51 +00:00
|
|
|
MessageDialog error(_("The chosen directory cannot be written to. Please select another one."));
|
2007-06-14 18:40:27 +00:00
|
|
|
error.runModal();
|
|
|
|
return;
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2005-04-16 17:55:09 +00:00
|
|
|
draw();
|
2003-03-25 15:32:36 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-08-10 18:30:55 +00:00
|
|
|
}
|
2006-06-11 20:40:22 +00:00
|
|
|
case kChooseThemeDirCmd: {
|
2010-06-15 10:44:51 +00:00
|
|
|
BrowserDialog browser(_("Select directory for GUI themes"), true);
|
2006-06-11 20:40:22 +00:00
|
|
|
if (browser.runModal() > 0) {
|
|
|
|
// User made his choice...
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode dir(browser.getResult());
|
2007-06-05 21:02:35 +00:00
|
|
|
_themePath->setLabel(dir.getPath());
|
2006-06-11 20:40:22 +00:00
|
|
|
draw();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-08-10 18:30:55 +00:00
|
|
|
case kChooseExtraDirCmd: {
|
2010-06-15 10:44:51 +00:00
|
|
|
BrowserDialog browser(_("Select directory for extra files"), true);
|
2005-08-10 18:30:55 +00:00
|
|
|
if (browser.runModal() > 0) {
|
2004-11-15 04:41:51 +00:00
|
|
|
// User made his choice...
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode dir(browser.getResult());
|
2007-06-05 21:02:35 +00:00
|
|
|
_extraPath->setLabel(dir.getPath());
|
2005-04-16 17:55:09 +00:00
|
|
|
draw();
|
2004-11-15 04:41:51 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-08-10 18:30:55 +00:00
|
|
|
}
|
2008-05-09 01:58:12 +00:00
|
|
|
#ifdef DYNAMIC_MODULES
|
|
|
|
case kChoosePluginsDirCmd: {
|
2010-06-15 10:44:51 +00:00
|
|
|
BrowserDialog browser(_("Select directory for plugins"), true);
|
2008-05-09 01:58:12 +00:00
|
|
|
if (browser.runModal() > 0) {
|
|
|
|
// User made his choice...
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode dir(browser.getResult());
|
2008-05-09 01:58:12 +00:00
|
|
|
_pluginsPath->setLabel(dir.getPath());
|
|
|
|
draw();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2005-08-10 18:30:55 +00:00
|
|
|
case kChooseSoundFontCmd: {
|
2010-06-15 10:44:51 +00:00
|
|
|
BrowserDialog browser(_("Select SoundFont"), false);
|
2005-08-10 18:30:55 +00:00
|
|
|
if (browser.runModal() > 0) {
|
2005-04-10 14:33:44 +00:00
|
|
|
// User made his choice...
|
2008-10-02 16:58:59 +00:00
|
|
|
Common::FSNode file(browser.getResult());
|
2007-06-05 21:02:35 +00:00
|
|
|
_soundFont->setLabel(file.getPath());
|
2007-02-13 21:41:49 +00:00
|
|
|
|
2010-06-15 10:44:51 +00:00
|
|
|
if (!file.getPath().empty() && (file.getPath() != _("None")))
|
2007-02-13 21:41:49 +00:00
|
|
|
_soundFontClearButton->setEnabled(true);
|
|
|
|
else
|
|
|
|
_soundFontClearButton->setEnabled(false);
|
|
|
|
|
2005-04-16 17:55:09 +00:00
|
|
|
draw();
|
2005-04-10 14:33:44 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-08-10 18:30:55 +00:00
|
|
|
}
|
2006-10-08 18:22:28 +00:00
|
|
|
case kChooseThemeCmd: {
|
|
|
|
ThemeBrowser browser;
|
|
|
|
if (browser.runModal() > 0) {
|
|
|
|
// User made his choice...
|
2009-01-01 17:02:45 +00:00
|
|
|
Common::String theme = browser.getSelected();
|
|
|
|
// FIXME: Actually, any changes (including the theme change) should
|
|
|
|
// only become active *after* the options dialog has closed.
|
|
|
|
if (g_gui.loadNewTheme(theme)) {
|
|
|
|
_curTheme->setLabel(g_gui.theme()->getThemeName());
|
|
|
|
ConfMan.set("gui_theme", theme);
|
|
|
|
}
|
2006-10-08 18:22:28 +00:00
|
|
|
draw();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-07-05 20:22:56 +00:00
|
|
|
#ifdef SMALL_SCREEN_DEVICE
|
2005-01-10 20:53:16 +00:00
|
|
|
case kChooseKeyMappingCmd:
|
|
|
|
_keysDialog->runModal();
|
|
|
|
break;
|
|
|
|
#endif
|
2003-03-25 15:32:36 +00:00
|
|
|
default:
|
2003-11-05 12:25:42 +00:00
|
|
|
OptionsDialog::handleCommand(sender, cmd, data);
|
2002-12-12 23:22:48 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-10 23:40:48 +00:00
|
|
|
|
|
|
|
} // End of namespace GUI
|