[Scummvm-git-logs] scummvm master -> 44245eebbcce16bed769cf77b894eeecbeda94ad

sluicebox 22204938+sluicebox at users.noreply.github.com
Fri Oct 15 18:25:37 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
44245eebbc GUI: Don't apply values from disabled subtitle toggle


Commit: 44245eebbcce16bed769cf77b894eeecbeda94ad
    https://github.com/scummvm/scummvm/commit/44245eebbcce16bed769cf77b894eeecbeda94ad
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-10-15T13:25:34-05:00

Commit Message:
GUI: Don't apply values from disabled subtitle toggle

When the subtitle toggle controls are disabled for a game, don't
read the value and then set config values based on it.
This caused "Override global audio settings" to always set "subtitles"
and "mute_speech" even when the controls were disabled.

Fixes bug #13007 where "Override global audio settings" always
mutes the speech clips in Hoyle4.

Changed paths:
    gui/options.cpp
    gui/options.h


diff --git a/gui/options.cpp b/gui/options.cpp
index 7362d958d1..3f179313ef 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -231,6 +231,7 @@ void OptionsDialog::init() {
 	_speechVolumeLabel = nullptr;
 	_muteCheckbox = nullptr;
 	_enableSubtitleSettings = false;
+	_enableSubtitleToggle = false;
 	_subToggleDesc = nullptr;
 	_subToggleGroup = nullptr;
 	_subToggleSubOnly = nullptr;
@@ -909,11 +910,9 @@ void OptionsDialog::apply() {
 	// Subtitle options
 	if (_subToggleGroup) {
 		if (_enableSubtitleSettings) {
-			bool subtitles, speech_mute;
-			int talkspeed;
-			int sliderMaxValue = _subSpeedSlider->getMaxValue();
-
-			switch (_subToggleGroup->getValue()) {
+			if (_enableSubtitleToggle) {
+				bool subtitles, speech_mute;
+				switch (_subToggleGroup->getValue()) {
 				case kSubtitlesSpeech:
 					subtitles = speech_mute = false;
 					break;
@@ -925,14 +924,19 @@ void OptionsDialog::apply() {
 				default:
 					subtitles = speech_mute = true;
 					break;
-			}
+				}
 
-			ConfMan.setBool("subtitles", subtitles, _domain);
-			ConfMan.setBool("speech_mute", speech_mute, _domain);
+				ConfMan.setBool("subtitles", subtitles, _domain);
+				ConfMan.setBool("speech_mute", speech_mute, _domain);
+			} else {
+				ConfMan.removeKey("subtitles", _domain);
+				ConfMan.removeKey("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;
+			int sliderMaxValue = _subSpeedSlider->getMaxValue();
+			int talkspeed = (_subSpeedSlider->getValue() * 255 + sliderMaxValue / 2) / sliderMaxValue;
 			ConfMan.setInt("talkspeed", talkspeed, _domain);
 
 		} else {
@@ -1218,6 +1222,7 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) {
 	if ((_guioptions.contains(GUIO_NOSUBTITLES)) || (_guioptions.contains(GUIO_NOSPEECH)))
 		ena = false;
 
+	_enableSubtitleToggle = ena;
 	_subToggleGroup->setEnabled(ena);
 	_subToggleDesc->setEnabled(ena);
 
@@ -1678,6 +1683,7 @@ void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &p
 	_subSpeedLabel->setFlags(WIDGET_CLEARBG);
 
 	_enableSubtitleSettings = true;
+	_enableSubtitleToggle = true;
 }
 
 void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &prefix) {
diff --git a/gui/options.h b/gui/options.h
index 7a189a42d6..175a4dd21e 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -208,6 +208,7 @@ private:
 	//
 	int getSubtitleMode(bool subtitles, bool speech_mute);
 	bool _enableSubtitleSettings;
+	bool _enableSubtitleToggle;
 	StaticTextWidget *_subToggleDesc;
 	RadiobuttonGroup *_subToggleGroup;
 	RadiobuttonWidget *_subToggleSubOnly;




More information about the Scummvm-git-logs mailing list