[Scummvm-cvs-logs] SF.net SVN: scummvm:[41233] scummvm/trunk

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Jun 6 19:36:07 CEST 2009


Revision: 41233
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41233&view=rev
Author:   sev
Date:     2009-06-06 17:36:06 +0000 (Sat, 06 Jun 2009)

Log Message:
-----------
Implement feature request #1180217: "GUI: Mute option"

Modified Paths:
--------------
    scummvm/trunk/backends/events/default/default-events.cpp
    scummvm/trunk/backends/platform/sdl/events.cpp
    scummvm/trunk/common/events.h
    scummvm/trunk/engines/engine.cpp
    scummvm/trunk/engines/engine.h
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/gui/options.h
    scummvm/trunk/gui/themes/scummclassic.zip
    scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
    scummvm/trunk/gui/themes/scummmodern.zip

Modified: scummvm/trunk/backends/events/default/default-events.cpp
===================================================================
--- scummvm/trunk/backends/events/default/default-events.cpp	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/backends/events/default/default-events.cpp	2009-06-06 17:36:06 UTC (rev 41233)
@@ -553,6 +553,11 @@
 				_shouldRTL = true;
 			break;
 
+		case Common::EVENT_MUTE:
+			if (g_engine)
+				g_engine->flipMute();
+			break;
+
 		case Common::EVENT_QUIT:
 			if (ConfMan.getBool("confirm_exit")) {
 				if (_confirmExitDialogActive) {

Modified: scummvm/trunk/backends/platform/sdl/events.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/events.cpp	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/backends/platform/sdl/events.cpp	2009-06-06 17:36:06 UTC (rev 41233)
@@ -252,6 +252,11 @@
 			}
 #endif
 
+			if ((ev.key.keysym.mod & KMOD_CTRL) && ev.key.keysym.sym == 'u') {
+				event.type = Common::EVENT_MUTE;
+				return true;
+			}
+
 			// Ctrl-Alt-<key> will change the GFX mode
 			if ((b & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
 

Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/common/events.h	2009-06-06 17:36:06 UTC (rev 41233)
@@ -61,6 +61,7 @@
 
 	EVENT_MAINMENU = 15,
 	EVENT_RTL = 16,
+	EVENT_MUTE = 17,
 
 	EVENT_QUIT = 10,
 	EVENT_SCREEN_CHANGED = 11,

Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/engines/engine.cpp	2009-06-06 17:36:06 UTC (rev 41233)
@@ -304,11 +304,27 @@
 	int soundVolumeSFX = ConfMan.getInt("sfx_volume");
 	int soundVolumeSpeech = ConfMan.getInt("speech_volume");
 
-	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
+	bool mute = false;
+	if (ConfMan.hasKey("mute"))
+		mute = ConfMan.getBool("mute");
+
+	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (mute ? 0 : soundVolumeMusic));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (mute ? 0 : soundVolumeSFX));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (mute ? 0 : soundVolumeSpeech));
 }
 
+void Engine::flipMute() {
+	bool mute = false;
+
+	if (ConfMan.hasKey("mute")) {
+		mute = !ConfMan.getBool("mute");
+	}
+	
+	ConfMan.setBool("mute", mute);
+
+	syncSoundSettings();
+}
+
 Common::Error Engine::loadGameState(int slot) {
 	// Do nothing by default
 	return Common::kNoError;

Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/engines/engine.h	2009-06-06 17:36:06 UTC (rev 41233)
@@ -176,6 +176,11 @@
 	virtual void syncSoundSettings();
 
 	/**
+	 * Flip mute all sound option.
+	 */
+	virtual void flipMute();
+
+	/**
 	 * Load a game state.
 	 * @param slot	the slot from which a savestate should be loaded
 	 * @return returns kNoError on success, else an error code.

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/gui/options.cpp	2009-06-06 17:36:06 UTC (rev 41233)
@@ -119,6 +119,7 @@
 	_speechVolumeDesc = 0;
 	_speechVolumeSlider = 0;
 	_speechVolumeLabel = 0;
+	_muteCheckbox = 0;
 	_subToggleDesc = 0;
 	_subToggleButton = 0;
 	_subSpeedDesc = 0;
@@ -240,12 +241,19 @@
 		vol = ConfMan.getInt("speech_volume", _domain);
 		_speechVolumeSlider->setValue(vol);
 		_speechVolumeLabel->setValue(vol);
+
+		bool val = false;
+		if (ConfMan.hasKey("mute", _domain)) {
+			val = ConfMan.getBool("mute", _domain);
+		} else {
+			ConfMan.setBool("mute", false);
+		}
+		_muteCheckbox->setState(val);
 	}
 
 	// Subtitle options
 	if (_subToggleButton) {
-		int speed;
-		int sliderMaxValue = _subSpeedSlider->getMaxValue();
+		int speed;		int sliderMaxValue = _subSpeedSlider->getMaxValue();
 
 		_subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
 		_subToggleButton->setLabel(_subModeDesc[_subMode]);
@@ -300,10 +308,12 @@
 				ConfMan.setInt("music_volume", _musicVolumeSlider->getValue(), _domain);
 				ConfMan.setInt("sfx_volume", _sfxVolumeSlider->getValue(), _domain);
 				ConfMan.setInt("speech_volume", _speechVolumeSlider->getValue(), _domain);
+				ConfMan.setBool("mute", _muteCheckbox->getState(), _domain);
 			} else {
 				ConfMan.removeKey("music_volume", _domain);
 				ConfMan.removeKey("sfx_volume", _domain);
 				ConfMan.removeKey("speech_volume", _domain);
+				ConfMan.removeKey("mute", _domain);
 			}
 		}
 
@@ -514,6 +524,7 @@
 	_speechVolumeDesc->setEnabled(enabled);
 	_speechVolumeSlider->setEnabled(enabled);
 	_speechVolumeLabel->setEnabled(enabled);
+	_muteCheckbox->setEnabled(enabled);
 }
 
 void OptionsDialog::setSubtitleSettingsState(bool enabled) {
@@ -640,6 +651,9 @@
 	_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
 
+	_muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", "Mute All", 0, 0);
+
+
 	_sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:");
 	_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
 	_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%");

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/gui/options.h	2009-06-06 17:36:06 UTC (rev 41233)
@@ -145,6 +145,8 @@
 	StaticTextWidget *_speechVolumeDesc;
 	SliderWidget *_speechVolumeSlider;
 	StaticTextWidget *_speechVolumeLabel;
+
+	CheckboxWidget *_muteCheckbox;
 };
 
 

Modified: scummvm/trunk/gui/themes/scummclassic.zip
===================================================================
(Binary files differ)

Modified: scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx
===================================================================
--- scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx	2009-06-06 17:21:50 UTC (rev 41232)
+++ scummvm/trunk/gui/themes/scummmodern/scummmodern_layout.stx	2009-06-06 17:36:06 UTC (rev 41233)
@@ -252,7 +252,12 @@
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
+						width = "40"
 				/>
+				<space/>
+				<widget name = 'vcMuteCheckbox'
+						type = 'Checkbox'
+				/>
 			</layout>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0'>
 				<widget name = 'vcSpeechText'
@@ -592,8 +597,12 @@
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
+						width = "40"
 				/>
 			</layout>
+				<widget name = 'vcMuteCheckbox'
+						type = 'Checkbox'
+				/>
 			<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '8'>
 				<widget name = 'vcSpeechText'
 						type = 'OptionsLabel'

Modified: scummvm/trunk/gui/themes/scummmodern.zip
===================================================================
(Binary files differ)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list