From c85d939d9b3f6c10288dc86ffa7811408e349657 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2012 02:14:15 +0300 Subject: Add different sound effects for different events. Can be configured in audio tab in settings. --- src/gui/setup_audio.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/gui/setup_audio.cpp') diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 1f7db484c..a4c3110d9 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -25,9 +25,11 @@ #include "configuration.h" #include "sound.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" @@ -35,6 +37,19 @@ #include "debug.h" +class SoundsModel : public NamesModel +{ +public: + SoundsModel() + { + mNames.push_back(gettext("(no sound)")); + Theme::fillSoundsList(mNames); + } + + virtual ~SoundsModel() + { } +}; + Setup_Audio::Setup_Audio() { setName(_("Audio")); @@ -44,6 +59,10 @@ Setup_Audio::Setup_Audio() ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, mScroll, 10, 10); + mSoundModel = new SoundsModel(); + + new SetupItemLabel(_("Basic settings"), "", this); + new SetupItemCheckBox(_("Enable Audio"), "", "sound", this, "soundEvent"); new SetupItemCheckBox(_("Enable music"), "", @@ -61,6 +80,31 @@ Setup_Audio::Setup_Audio() new SetupItemSlider(_("Music volume"), "", "musicVolume", this, "musicVolumeEvent", 0, sound.getMaxVolume(), 150, true); + new SetupItemLabel(_("Sound effects"), "", this); + + new SetupItemSound(_("Information dialog sound"), "", + "soundinfo", this, "soundinfoEvent", mSoundModel); + + new SetupItemSound(_("Request dialog sound"), "", + "soundrequest", this, "soundrequestEvent", mSoundModel); + + new SetupItemSound(_("Whisper message sound"), "", + "soundwhisper", this, "soundwhisperEvent", mSoundModel); + + new SetupItemSound(_("Highlight message sound"), "", + "soundhighlight", this, "soundhighlightEvent", mSoundModel); + + new SetupItemSound(_("Global message sound"), "", + "soundglobal", this, "soundglobalEvent", mSoundModel); + + new SetupItemSound(_("Error message sound"), "", + "sounderror", this, "sounderrorEvent", mSoundModel); + + new SetupItemSound(_("Trade request sound"), "", + "soundtrade", this, "soundtradeEvent", mSoundModel); + + new SetupItemLabel(_("Other"), "", this); + new SetupItemCheckBox(_("Enable mumble voice chat"), "", "enableMumble", this, "enableMumbleEvent"); @@ -70,6 +114,12 @@ Setup_Audio::Setup_Audio() setDimension(gcn::Rectangle(0, 0, 550, 350)); } +Setup_Audio::~Setup_Audio() +{ + delete mSoundModel; + mSoundModel = nullptr; +} + void Setup_Audio::apply() { SetupTabScroll::apply(); -- cgit v1.2.3-70-g09d2