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
This commit is contained in:
Eugene Sandulenko 2009-06-06 17:58:08 +00:00
parent eb909702af
commit bbac0f1eea
3 changed files with 63 additions and 14 deletions

View file

@ -277,6 +277,7 @@ ConfigDialog::ConfigDialog(bool subtitleControls)
// //
addVolumeControls(this, "ScummConfig."); addVolumeControls(this, "ScummConfig.");
setVolumeSettingsState(true); // could disable controls by GUI options
// //
// Subtitle speed and toggle controllers // Subtitle speed and toggle controllers
@ -285,6 +286,7 @@ ConfigDialog::ConfigDialog(bool subtitleControls)
if (subtitleControls) { if (subtitleControls) {
// Global talkspeed range of 0-255 // Global talkspeed range of 0-255
addSubtitleControls(this, "ScummConfig.", 255); addSubtitleControls(this, "ScummConfig.", 255);
setSubtitleSettingsState(true); // could disable controls by GUI options
} }
// //

View file

@ -125,6 +125,11 @@ void OptionsDialog::init() {
_subSpeedDesc = 0; _subSpeedDesc = 0;
_subSpeedSlider = 0; _subSpeedSlider = 0;
_subSpeedLabel = 0; _subSpeedLabel = 0;
// Retrieve game GUI options
_guioptions = 0;
if (ConfMan.hasKey("guioptions", _domain))
_guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
} }
void OptionsDialog::open() { void OptionsDialog::open() {
@ -133,6 +138,11 @@ void OptionsDialog::open() {
// Reset result value // Reset result value
setResult(0); setResult(0);
// Retrieve game GUI options
_guioptions = 0;
if (ConfMan.hasKey("guioptions", _domain))
_guioptions = parseGameGUIOptions(ConfMan.get("guioptions", _domain));
// Graphic options // Graphic options
if (_fullscreenCheckbox) { if (_fullscreenCheckbox) {
_gfxPopUp->setSelected(0); _gfxPopUp->setSelected(0);
@ -518,28 +528,55 @@ void OptionsDialog::setMIDISettingsState(bool enabled) {
} }
void OptionsDialog::setVolumeSettingsState(bool enabled) { void OptionsDialog::setVolumeSettingsState(bool enabled) {
bool ena;
_enableVolumeSettings = enabled; _enableVolumeSettings = enabled;
_musicVolumeDesc->setEnabled(enabled); ena = enabled;
_musicVolumeSlider->setEnabled(enabled); if (_guioptions & Common::GUIO_NOMUSIC)
_musicVolumeLabel->setEnabled(enabled); ena = false;
_sfxVolumeDesc->setEnabled(enabled);
_sfxVolumeSlider->setEnabled(enabled); _musicVolumeDesc->setEnabled(ena);
_sfxVolumeLabel->setEnabled(enabled); _musicVolumeSlider->setEnabled(ena);
_speechVolumeDesc->setEnabled(enabled); _musicVolumeLabel->setEnabled(ena);
_speechVolumeSlider->setEnabled(enabled);
_speechVolumeLabel->setEnabled(enabled); 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); _muteCheckbox->setEnabled(enabled);
} }
void OptionsDialog::setSubtitleSettingsState(bool enabled) { void OptionsDialog::setSubtitleSettingsState(bool enabled) {
bool ena;
_enableSubtitleSettings = enabled; _enableSubtitleSettings = enabled;
_subToggleButton->setEnabled(enabled); ena = enabled;
_subToggleDesc->setEnabled(enabled); if ((_guioptions & Common::GUIO_NOSUBTITLES) || (_guioptions & Common::GUIO_NOSPEECH))
_subSpeedDesc->setEnabled(enabled); ena = false;
_subSpeedSlider->setEnabled(enabled);
_subSpeedLabel->setEnabled(enabled); _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) { 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) { 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 if (!subtitles && !speech_mute) // Speech only
return 0; return 0;
else if (subtitles && !speech_mute) // Speech and subtitles else if (subtitles && !speech_mute) // Speech and subtitles

View file

@ -152,6 +152,11 @@ private:
StaticTextWidget *_speechVolumeLabel; StaticTextWidget *_speechVolumeLabel;
CheckboxWidget *_muteCheckbox; CheckboxWidget *_muteCheckbox;
//
// Game GUI options
//
uint32 _guioptions;
}; };