aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-11 08:56:16 +0100
committerGitHub2017-02-11 08:56:16 +0100
commit3d5d279bed2556cba0286185fcafbf85743d1d03 (patch)
tree43afb2b2ed8fd892fb186e6d54befde38bc28541 /gui
parent74222486250c777624c3d510b2d57024dba569b8 (diff)
parentd1fe6476fe800b2ea796757a54dd2b974e7be365 (diff)
downloadscummvm-rg350-3d5d279bed2556cba0286185fcafbf85743d1d03.tar.gz
scummvm-rg350-3d5d279bed2556cba0286185fcafbf85743d1d03.tar.bz2
scummvm-rg350-3d5d279bed2556cba0286185fcafbf85743d1d03.zip
Merge pull request #895 from csnover/gui-volume-options
GUI: Add three new options for volume slider controls
Diffstat (limited to 'gui')
-rw-r--r--gui/options.cpp66
-rw-r--r--gui/options.h3
2 files changed, 63 insertions, 6 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index 371a949c35..aa5f7b46bb 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -627,18 +627,51 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
_midiGainLabel->setLabel(Common::String::format("%.2f", (double)_midiGainSlider->getValue() / 100.0));
_midiGainLabel->draw();
break;
- case kMusicVolumeChanged:
- _musicVolumeLabel->setValue(_musicVolumeSlider->getValue());
+ case kMusicVolumeChanged: {
+ const int newValue = _musicVolumeSlider->getValue();
+ _musicVolumeLabel->setValue(newValue);
_musicVolumeLabel->draw();
+
+ if (_guioptions.contains(GUIO_LINKMUSICTOSFX)) {
+ updateSfxVolume(newValue);
+
+ if (_guioptions.contains(GUIO_LINKSPEECHTOSFX)) {
+ updateSpeechVolume(newValue);
+ }
+ }
+
break;
- case kSfxVolumeChanged:
+ }
+ case kSfxVolumeChanged: {
+ const int newValue = _sfxVolumeSlider->getValue();
_sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue());
_sfxVolumeLabel->draw();
+
+ if (_guioptions.contains(GUIO_LINKMUSICTOSFX)) {
+ updateMusicVolume(newValue);
+ }
+
+ if (_guioptions.contains(GUIO_LINKSPEECHTOSFX)) {
+ updateSpeechVolume(newValue);
+ }
+
break;
- case kSpeechVolumeChanged:
- _speechVolumeLabel->setValue(_speechVolumeSlider->getValue());
+ }
+ case kSpeechVolumeChanged: {
+ const int newValue = _speechVolumeSlider->getValue();
+ _speechVolumeLabel->setValue(newValue);
_speechVolumeLabel->draw();
+
+ if (_guioptions.contains(GUIO_LINKSPEECHTOSFX)) {
+ updateSfxVolume(newValue);
+
+ if (_guioptions.contains(GUIO_LINKMUSICTOSFX)) {
+ updateMusicVolume(newValue);
+ }
+ }
+
break;
+ }
case kMuteAllChanged:
// 'true' because if control is disabled then event do not pass
setVolumeSettingsState(true);
@@ -769,7 +802,7 @@ void OptionsDialog::setVolumeSettingsState(bool enabled) {
// Disable speech volume slider, when we are in subtitle only mode.
if (_subToggleGroup)
ena = ena && _subToggleGroup->getValue() != kSubtitlesSubs;
- if (_guioptions.contains(GUIO_NOSPEECH))
+ if (_guioptions.contains(GUIO_NOSPEECH) || _guioptions.contains(GUIO_NOSPEECHVOLUME))
ena = false;
_speechVolumeDesc->setEnabled(ena);
@@ -1142,6 +1175,27 @@ int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
return kSubtitlesSubs;
}
+void OptionsDialog::updateMusicVolume(const int newValue) const {
+ _musicVolumeLabel->setValue(newValue);
+ _musicVolumeSlider->setValue(newValue);
+ _musicVolumeLabel->draw();
+ _musicVolumeSlider->draw();
+}
+
+void OptionsDialog::updateSfxVolume(const int newValue) const {
+ _sfxVolumeLabel->setValue(newValue);
+ _sfxVolumeSlider->setValue(newValue);
+ _sfxVolumeLabel->draw();
+ _sfxVolumeSlider->draw();
+}
+
+void OptionsDialog::updateSpeechVolume(const int newValue) const {
+ _speechVolumeLabel->setValue(newValue);
+ _speechVolumeSlider->setValue(newValue);
+ _speechVolumeLabel->draw();
+ _speechVolumeSlider->draw();
+}
+
void OptionsDialog::reflowLayout() {
if (_graphicsTabId != -1 && _tabWidget)
_tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
diff --git a/gui/options.h b/gui/options.h
index a6eebe5748..1b15258ab5 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -175,6 +175,9 @@ private:
//
// Volume controls
//
+ void updateMusicVolume(const int newValue) const;
+ void updateSfxVolume(const int newValue) const;
+ void updateSpeechVolume(const int newValue) const;
bool _enableVolumeSettings;
StaticTextWidget *_musicVolumeDesc;