diff options
author | Eugene Sandulenko | 2009-06-06 17:58:08 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2009-06-06 17:58:08 +0000 |
commit | bbac0f1eeae44519032f742e94ed6ea956f8a161 (patch) | |
tree | e64f2845b7ee4b4535775696874dc7c683f92892 | |
parent | eb909702af7a1fc48c77b000cc4b4e647ebf4e60 (diff) | |
download | scummvm-rg350-bbac0f1eeae44519032f742e94ed6ea956f8a161.tar.gz scummvm-rg350-bbac0f1eeae44519032f742e94ed6ea956f8a161.tar.bz2 scummvm-rg350-bbac0f1eeae44519032f742e94ed6ea956f8a161.zip |
Implement FR#862150: "GUI: Show subtitles/speech options only for speech games"
Add generic per-game GUI options support along the way ;)
svn-id: r41275
-rw-r--r-- | engines/dialogs.cpp | 2 | ||||
-rw-r--r-- | gui/options.cpp | 70 | ||||
-rw-r--r-- | gui/options.h | 5 |
3 files changed, 63 insertions, 14 deletions
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 97c947aef0..a923379c81 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -277,6 +277,7 @@ ConfigDialog::ConfigDialog(bool subtitleControls) // addVolumeControls(this, "ScummConfig."); + setVolumeSettingsState(true); // could disable controls by GUI options // // Subtitle speed and toggle controllers @@ -285,6 +286,7 @@ ConfigDialog::ConfigDialog(bool subtitleControls) if (subtitleControls) { // Global talkspeed range of 0-255 addSubtitleControls(this, "ScummConfig.", 255); + setSubtitleSettingsState(true); // could disable controls by GUI options } // diff --git a/gui/options.cpp b/gui/options.cpp index 5d603fa25e..1f3f703218 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -125,6 +125,11 @@ void OptionsDialog::init() { _subSpeedDesc = 0; _subSpeedSlider = 0; _subSpeedLabel = 0; + + // Retrieve game GUI options + _guioptions = 0; + if (ConfMan.hasKey("guioptions", _domain)) + _guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain)); } void OptionsDialog::open() { @@ -133,6 +138,11 @@ void OptionsDialog::open() { // Reset result value setResult(0); + // Retrieve game GUI options + _guioptions = 0; + if (ConfMan.hasKey("guioptions", _domain)) + _guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain)); + // Graphic options if (_fullscreenCheckbox) { _gfxPopUp->setSelected(0); @@ -518,28 +528,55 @@ void OptionsDialog::setMIDISettingsState(bool enabled) { } void OptionsDialog::setVolumeSettingsState(bool enabled) { + bool ena; + _enableVolumeSettings = enabled; - _musicVolumeDesc->setEnabled(enabled); - _musicVolumeSlider->setEnabled(enabled); - _musicVolumeLabel->setEnabled(enabled); - _sfxVolumeDesc->setEnabled(enabled); - _sfxVolumeSlider->setEnabled(enabled); - _sfxVolumeLabel->setEnabled(enabled); - _speechVolumeDesc->setEnabled(enabled); - _speechVolumeSlider->setEnabled(enabled); - _speechVolumeLabel->setEnabled(enabled); + ena = enabled; + if (_guioptions & Common::GUIO_NOMUSIC) + ena = false; + + _musicVolumeDesc->setEnabled(ena); + _musicVolumeSlider->setEnabled(ena); + _musicVolumeLabel->setEnabled(ena); + + ena = enabled; + if (_guioptions & Common::GUIO_NOSFX) + ena = false; + + _sfxVolumeDesc->setEnabled(ena); + _sfxVolumeSlider->setEnabled(ena); + _sfxVolumeLabel->setEnabled(ena); + + ena = enabled; + if (_guioptions & Common::GUIO_NOSPEECH) + ena = false; + + _speechVolumeDesc->setEnabled(ena); + _speechVolumeSlider->setEnabled(ena); + _speechVolumeLabel->setEnabled(ena); + _muteCheckbox->setEnabled(enabled); } void OptionsDialog::setSubtitleSettingsState(bool enabled) { + bool ena; _enableSubtitleSettings = enabled; - _subToggleButton->setEnabled(enabled); - _subToggleDesc->setEnabled(enabled); - _subSpeedDesc->setEnabled(enabled); - _subSpeedSlider->setEnabled(enabled); - _subSpeedLabel->setEnabled(enabled); + 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); } void OptionsDialog::addGraphicControls(GuiObject *boss, const String &prefix) { @@ -682,6 +719,11 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const String &prefix) { } int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { + if (_guioptions & Common::GUIO_NOSUBTITLES) + return 0; // Speech only + if (_guioptions & Common::GUIO_NOSPEECH) + return 2; // Subtitles only + if (!subtitles && !speech_mute) // Speech only return 0; else if (subtitles && !speech_mute) // Speech and subtitles diff --git a/gui/options.h b/gui/options.h index 3a5cd31c17..448c32a2fc 100644 --- a/gui/options.h +++ b/gui/options.h @@ -152,6 +152,11 @@ private: StaticTextWidget *_speechVolumeLabel; CheckboxWidget *_muteCheckbox; + + // + // Game GUI options + // + uint32 _guioptions; }; |