aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorTorbjörn Andersson2012-12-27 22:11:35 +0100
committerJohannes Schickel2013-01-26 13:52:32 +0100
commitc780df51758df99d8eb18513573882a4b1291f21 (patch)
tree1b7b18966e69d95fff4a9782590aa558375a6fda /gui
parent45c1296021bc6c0d816d8652f868e3bff49c32e3 (diff)
downloadscummvm-rg350-c780df51758df99d8eb18513573882a4b1291f21.tar.gz
scummvm-rg350-c780df51758df99d8eb18513573882a4b1291f21.tar.bz2
scummvm-rg350-c780df51758df99d8eb18513573882a4b1291f21.zip
GUI: Add "Reset" button to FluidSynth settings dialog
This resets the FluidSynth settings to their default values.
Diffstat (limited to 'gui')
-rw-r--r--gui/ThemeEngine.h2
-rw-r--r--gui/fluidsynth-dialog.cpp194
-rw-r--r--gui/fluidsynth-dialog.h8
-rw-r--r--gui/themes/default.inc6
-rw-r--r--gui/themes/scummclassic.zipbin103608 -> 103728 bytes
-rw-r--r--gui/themes/scummclassic/THEMERC2
-rw-r--r--gui/themes/scummclassic/classic_layout.stx3
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx3
-rw-r--r--gui/themes/scummmodern.zipbin1461913 -> 1462033 bytes
-rw-r--r--gui/themes/scummmodern/THEMERC2
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx3
-rw-r--r--gui/themes/scummmodern/scummmodern_layout_lowres.stx3
12 files changed, 145 insertions, 81 deletions
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 18eed5f2e6..c422ed5253 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -35,7 +35,7 @@
#include "graphics/pixelformat.h"
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.17"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.18"
class OSystem;
diff --git a/gui/fluidsynth-dialog.cpp b/gui/fluidsynth-dialog.cpp
index eefe8c558e..eb5bac9645 100644
--- a/gui/fluidsynth-dialog.cpp
+++ b/gui/fluidsynth-dialog.cpp
@@ -20,6 +20,7 @@
*/
#include "gui/fluidsynth-dialog.h"
+#include "gui/message.h"
#include "gui/widgets/tab.h"
#include "gui/widgets/popup.h"
@@ -40,7 +41,9 @@ enum {
kReverbRoomSizeChangedCmd = 'rrsc',
kReverbDampingChangedCmd = 'rdac',
kReverbWidthChangedCmd = 'rwic',
- kReverbLevelChangedCmd = 'rlec'
+ kReverbLevelChangedCmd = 'rlec',
+
+ kResetSettingsCmd = 'rese'
};
enum {
@@ -141,6 +144,8 @@ FluidSynthSettingsDialog::FluidSynthSettingsDialog()
_miscInterpolationPopUp->appendEntry(_("Fourth-order"), kInterpolation4thOrder);
_miscInterpolationPopUp->appendEntry(_("Seventh-order"), kInterpolation7thOrder);
+ new ButtonWidget(_tabWidget, "FluidSynthSettings_Misc.ResetSettings", _("Reset"), _("Reset all FluidSynth settings to their default values."), kResetSettingsCmd);
+
_tabWidget->setActiveTab(0);
new ButtonWidget(this, "FluidSynthSettings.Cancel", _("Cancel"), 0, kCloseCmd);
@@ -156,86 +161,12 @@ void FluidSynthSettingsDialog::open() {
// Reset result value
setResult(0);
- _chorusVoiceCountSlider->setValue(ConfMan.getInt("fluidsynth_chorus_nr", _domain));
- _chorusVoiceCountLabel->setLabel(Common::String::format("%d", _chorusVoiceCountSlider->getValue()));
- _chorusLevelSlider->setValue(ConfMan.getInt("fluidsynth_chorus_level", _domain));
- _chorusLevelLabel->setLabel(Common::String::format("%d", _chorusLevelSlider->getValue()));
- _chorusSpeedSlider->setValue(ConfMan.getInt("fluidsynth_chorus_speed", _domain));
- _chorusSpeedLabel->setLabel(Common::String::format("%d", _chorusSpeedSlider->getValue()));
- _chorusDepthSlider->setValue(ConfMan.getInt("fluidsynth_chorus_depth", _domain));
- _chorusDepthLabel->setLabel(Common::String::format("%d", _chorusDepthSlider->getValue()));
-
- Common::String waveForm = ConfMan.get("fluidsynth_chorus_waveform", _domain);
- if (waveForm == "sine") {
- _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeSine);
- } else if (waveForm == "triangle") {
- _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeTriangle);
- }
-
- _reverbRoomSizeSlider->setValue(ConfMan.getInt("fluidsynth_reverb_roomsize", _domain));
- _reverbRoomSizeLabel->setLabel(Common::String::format("%d", _reverbRoomSizeSlider->getValue()));
- _reverbDampingSlider->setValue(ConfMan.getInt("fluidsynth_reverb_damping", _domain));
- _reverbDampingLabel->setLabel(Common::String::format("%d", _reverbDampingSlider->getValue()));
- _reverbWidthSlider->setValue(ConfMan.getInt("fluidsynth_reverb_width", _domain));
- _reverbWidthLabel->setLabel(Common::String::format("%d", _reverbWidthSlider->getValue()));
- _reverbLevelSlider->setValue(ConfMan.getInt("fluidsynth_reverb_level", _domain));
- _reverbLevelLabel->setLabel(Common::String::format("%d", _reverbLevelSlider->getValue()));
-
- Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation", _domain);
- if (interpolation == "none") {
- _miscInterpolationPopUp->setSelectedTag(kInterpolationNone);
- } else if (interpolation == "linear") {
- _miscInterpolationPopUp->setSelectedTag(kInterpolationLinear);
- } else if (interpolation == "4th") {
- _miscInterpolationPopUp->setSelectedTag(kInterpolation4thOrder);
- } else if (interpolation == "7th") {
- _miscInterpolationPopUp->setSelectedTag(kInterpolation7thOrder);
- }
-
- // This may trigger redrawing, so don't do it until all sliders have
- // their proper values. Otherwise, the dialog may crash because of
- // invalid slider values.
- _chorusActivate->setState(ConfMan.getBool("fluidsynth_chorus_activate", _domain));
- _reverbActivate->setState(ConfMan.getBool("fluidsynth_reverb_activate", _domain));
+ readSettings();
}
void FluidSynthSettingsDialog::close() {
if (getResult()) {
- ConfMan.setBool("fluidsynth_chorus_activate", _chorusActivate->getState());
- ConfMan.setInt("fluidsynth_chorus_nr", _chorusVoiceCountSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_chorus_level", _chorusLevelSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_chorus_speed", _chorusSpeedSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_chorus_depth", _chorusDepthSlider->getValue(), _domain);
-
- uint32 waveForm = _chorusWaveFormTypePopUp->getSelectedTag();
- if (waveForm == kWaveFormTypeSine) {
- ConfMan.set("fluidsynth_chorus_waveform", "sine", _domain);
- } else if (waveForm == kWaveFormTypeTriangle) {
- ConfMan.set("fluidsynth_chorus_waveform", "triangle", _domain);
- } else {
- ConfMan.removeKey("fluidsynth_chorus_waveform", _domain);
- }
-
- ConfMan.setBool("fluidsynth_reverb_activate", _reverbActivate->getState());
- ConfMan.setInt("fluidsynth_reverb_roomsize", _reverbRoomSizeSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_reverb_damping", _reverbDampingSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_reverb_width", _reverbWidthSlider->getValue(), _domain);
- ConfMan.setInt("fluidsynth_reverb_level", _reverbLevelSlider->getValue(), _domain);
-
- uint32 interpolation = _miscInterpolationPopUp->getSelectedTag();
- if (interpolation == kInterpolationNone) {
- ConfMan.set("fluidsynth_misc_interpolation", "none", _domain);
- } else if (interpolation == kInterpolationLinear) {
- ConfMan.set("fluidsynth_misc_interpolation", "linear", _domain);
- } else if (interpolation == kInterpolation4thOrder) {
- ConfMan.set("fluidsynth_misc_interpolation", "4th", _domain);
- } else if (interpolation == kInterpolation7thOrder) {
- ConfMan.set("fluidsynth_misc_interpolation", "7th", _domain);
- } else {
- ConfMan.removeKey("fluidsynth_misc_interpolation", _domain);
- }
-
- // The main options dialog is responsible for writing the config file.
+ writeSettings();
}
Dialog::close();
@@ -281,6 +212,15 @@ void FluidSynthSettingsDialog::handleCommand(CommandSender *sender, uint32 cmd,
_reverbLevelLabel->setLabel(Common::String::format("%d", _reverbLevelSlider->getValue()));
_reverbLevelLabel->draw();
break;
+ case kResetSettingsCmd: {
+ MessageDialog alert(_("Do you really want to reset all FluidSynth settings to their default values?"), _("Yes"), _("No"));
+ if (alert.runModal() == GUI::kMessageOK) {
+ resetSettings();
+ readSettings();
+ draw();
+ }
+ break;
+ }
case kOKCmd:
setResult(1);
close();
@@ -323,4 +263,104 @@ void FluidSynthSettingsDialog::setReverbSettingsState(bool enabled) {
_reverbLevelLabel->setEnabled(enabled);
}
+void FluidSynthSettingsDialog::readSettings() {
+ _chorusVoiceCountSlider->setValue(ConfMan.getInt("fluidsynth_chorus_nr", _domain));
+ _chorusVoiceCountLabel->setLabel(Common::String::format("%d", _chorusVoiceCountSlider->getValue()));
+ _chorusLevelSlider->setValue(ConfMan.getInt("fluidsynth_chorus_level", _domain));
+ _chorusLevelLabel->setLabel(Common::String::format("%d", _chorusLevelSlider->getValue()));
+ _chorusSpeedSlider->setValue(ConfMan.getInt("fluidsynth_chorus_speed", _domain));
+ _chorusSpeedLabel->setLabel(Common::String::format("%d", _chorusSpeedSlider->getValue()));
+ _chorusDepthSlider->setValue(ConfMan.getInt("fluidsynth_chorus_depth", _domain));
+ _chorusDepthLabel->setLabel(Common::String::format("%d", _chorusDepthSlider->getValue()));
+
+ Common::String waveForm = ConfMan.get("fluidsynth_chorus_waveform", _domain);
+ if (waveForm == "sine") {
+ _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeSine);
+ } else if (waveForm == "triangle") {
+ _chorusWaveFormTypePopUp->setSelectedTag(kWaveFormTypeTriangle);
+ }
+
+ _reverbRoomSizeSlider->setValue(ConfMan.getInt("fluidsynth_reverb_roomsize", _domain));
+ _reverbRoomSizeLabel->setLabel(Common::String::format("%d", _reverbRoomSizeSlider->getValue()));
+ _reverbDampingSlider->setValue(ConfMan.getInt("fluidsynth_reverb_damping", _domain));
+ _reverbDampingLabel->setLabel(Common::String::format("%d", _reverbDampingSlider->getValue()));
+ _reverbWidthSlider->setValue(ConfMan.getInt("fluidsynth_reverb_width", _domain));
+ _reverbWidthLabel->setLabel(Common::String::format("%d", _reverbWidthSlider->getValue()));
+ _reverbLevelSlider->setValue(ConfMan.getInt("fluidsynth_reverb_level", _domain));
+ _reverbLevelLabel->setLabel(Common::String::format("%d", _reverbLevelSlider->getValue()));
+
+ Common::String interpolation = ConfMan.get("fluidsynth_misc_interpolation", _domain);
+ if (interpolation == "none") {
+ _miscInterpolationPopUp->setSelectedTag(kInterpolationNone);
+ } else if (interpolation == "linear") {
+ _miscInterpolationPopUp->setSelectedTag(kInterpolationLinear);
+ } else if (interpolation == "4th") {
+ _miscInterpolationPopUp->setSelectedTag(kInterpolation4thOrder);
+ } else if (interpolation == "7th") {
+ _miscInterpolationPopUp->setSelectedTag(kInterpolation7thOrder);
+ }
+
+ // This may trigger redrawing, so don't do it until all sliders have
+ // their proper values. Otherwise, the dialog may crash because of
+ // invalid slider values.
+ _chorusActivate->setState(ConfMan.getBool("fluidsynth_chorus_activate", _domain));
+ _reverbActivate->setState(ConfMan.getBool("fluidsynth_reverb_activate", _domain));
+}
+
+void FluidSynthSettingsDialog::writeSettings() {
+ ConfMan.setBool("fluidsynth_chorus_activate", _chorusActivate->getState());
+ ConfMan.setInt("fluidsynth_chorus_nr", _chorusVoiceCountSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_chorus_level", _chorusLevelSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_chorus_speed", _chorusSpeedSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_chorus_depth", _chorusDepthSlider->getValue(), _domain);
+
+ uint32 waveForm = _chorusWaveFormTypePopUp->getSelectedTag();
+ if (waveForm == kWaveFormTypeSine) {
+ ConfMan.set("fluidsynth_chorus_waveform", "sine", _domain);
+ } else if (waveForm == kWaveFormTypeTriangle) {
+ ConfMan.set("fluidsynth_chorus_waveform", "triangle", _domain);
+ } else {
+ ConfMan.removeKey("fluidsynth_chorus_waveform", _domain);
+ }
+
+ ConfMan.setBool("fluidsynth_reverb_activate", _reverbActivate->getState());
+ ConfMan.setInt("fluidsynth_reverb_roomsize", _reverbRoomSizeSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_reverb_damping", _reverbDampingSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_reverb_width", _reverbWidthSlider->getValue(), _domain);
+ ConfMan.setInt("fluidsynth_reverb_level", _reverbLevelSlider->getValue(), _domain);
+
+ uint32 interpolation = _miscInterpolationPopUp->getSelectedTag();
+ if (interpolation == kInterpolationNone) {
+ ConfMan.set("fluidsynth_misc_interpolation", "none", _domain);
+ } else if (interpolation == kInterpolationLinear) {
+ ConfMan.set("fluidsynth_misc_interpolation", "linear", _domain);
+ } else if (interpolation == kInterpolation4thOrder) {
+ ConfMan.set("fluidsynth_misc_interpolation", "4th", _domain);
+ } else if (interpolation == kInterpolation7thOrder) {
+ ConfMan.set("fluidsynth_misc_interpolation", "7th", _domain);
+ } else {
+ ConfMan.removeKey("fluidsynth_misc_interpolation", _domain);
+ }
+
+ // The main options dialog is responsible for writing the config file.
+ // That's why we don't actually flush the settings to the file here.
+}
+
+void FluidSynthSettingsDialog::resetSettings() {
+ ConfMan.removeKey("fluidsynth_chorus_activate", _domain);
+ ConfMan.removeKey("fluidsynth_chorus_nr", _domain);
+ ConfMan.removeKey("fluidsynth_chorus_level", _domain);
+ ConfMan.removeKey("fluidsynth_chorus_speed", _domain);
+ ConfMan.removeKey("fluidsynth_chorus_depth", _domain);
+ ConfMan.removeKey("fluidsynth_chorus_waveform", _domain);
+
+ ConfMan.removeKey("fluidsynth_reverb_activate", _domain);
+ ConfMan.removeKey("fluidsynth_reverb_roomsize", _domain);
+ ConfMan.removeKey("fluidsynth_reverb_damping", _domain);
+ ConfMan.removeKey("fluidsynth_reverb_width", _domain);
+ ConfMan.removeKey("fluidsynth_reverb_level", _domain);
+
+ ConfMan.removeKey("fluidsynth_misc_interpolation", _domain);
+}
+
} // End of namespace GUI
diff --git a/gui/fluidsynth-dialog.h b/gui/fluidsynth-dialog.h
index 445c1fffc8..4d74c9f93e 100644
--- a/gui/fluidsynth-dialog.h
+++ b/gui/fluidsynth-dialog.h
@@ -40,11 +40,17 @@ public:
void open();
void close();
- void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+ void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+protected:
void setChorusSettingsState(bool enabled);
void setReverbSettingsState(bool enabled);
+ void readSettings();
+ void writeSettings();
+
+ void resetSettings();
+
private:
Common::String _domain;
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index e5a31776a9..5298732154 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1505,6 +1505,9 @@
"type='PopUp' "
"/> "
"</layout> "
+"<widget name='ResetSettings' "
+"type='Button' "
+"/> "
"</layout> "
"</dialog> "
"<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> "
@@ -2617,6 +2620,9 @@
"type='PopUp' "
"/> "
"</layout> "
+"<widget name='ResetSettings' "
+"type='Button' "
+"/> "
"</layout> "
"</dialog> "
"<dialog name='SaveLoadChooser' overlays='screen' inset='8' shading='dim'> "
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 95455dfb11..6ff035b5b7 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC
index 98c68d3044..e60278629d 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.17:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.8.18:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 5891b93c44..8e26096869 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -943,6 +943,9 @@
type = 'PopUp'
/>
</layout>
+ <widget name = 'ResetSettings'
+ type = 'Button'
+ />
</layout>
</dialog>
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index c9d576a9cf..325ac8896e 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -954,6 +954,9 @@
type = 'PopUp'
/>
</layout>
+ <widget name = 'ResetSettings'
+ type = 'Button'
+ />
</layout>
</dialog>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 15c79848be..aadd3eac18 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index d62977cee2..ce4e4ab0ff 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.17:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.8.18:ScummVM Modern Theme:No Author]
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index a6a2da9f37..ba723aee40 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -957,6 +957,9 @@
type = 'PopUp'
/>
</layout>
+ <widget name = 'ResetSettings'
+ type = 'Button'
+ />
</layout>
</dialog>
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 7e614caaeb..ab96c14ad5 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -953,6 +953,9 @@
type = 'PopUp'
/>
</layout>
+ <widget name = 'ResetSettings'
+ type = 'Button'
+ />
</layout>
</dialog>