diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-28 22:16:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-28 22:16:23 +0300 |
commit | bbf5743dd18e78298376da6f78c71ae2a524c766 (patch) | |
tree | 64ff82f070ce5022b6adc26c5c1727fb38f13794 /src/gui | |
parent | 8a3adb5dc695fec3f4db5f0705c53687862fb801 (diff) | |
download | manaplus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.gz manaplus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.bz2 manaplus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.xz manaplus-bbf5743dd18e78298376da6f78c71ae2a524c766.zip |
Fix some sound event.
Replace hardcoded sound names to constants.
Add party/guild sound.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/confirmdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/okdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/setup_audio.cpp | 3 | ||||
-rw-r--r-- | src/gui/shopwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 21 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.h | 2 |
8 files changed, 36 insertions, 6 deletions
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index b6645db3c..a2fb7b6cc 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -97,7 +97,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, } setVisible(true); yesButton->requestFocus(); - sound.playGuiSound("soundrequest"); + sound.playGuiSound(SOUND_REQUEST); } void ConfirmDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index fe22cf008..3259cb6d6 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -76,9 +76,9 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, okButton->requestFocus(); if (soundEvent == DIALOG_OK) - sound.playGuiSound("soundinfo"); + sound.playGuiSound(SOUND_INFO); else if (soundEvent == DIALOG_ERROR) - sound.playGuiSound("sounderror"); + sound.playGuiSound(SOUND_ERROR); } void OkDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index a4c3110d9..69ca4e759 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -91,6 +91,9 @@ Setup_Audio::Setup_Audio() new SetupItemSound(_("Whisper message sound"), "", "soundwhisper", this, "soundwhisperEvent", mSoundModel); + new SetupItemSound(_("Guild / Party message sound"), "", + "soundguild", this, "soundguildEvent", mSoundModel); + new SetupItemSound(_("Highlight message sound"), "", "soundhighlight", this, "soundhighlightEvent", mSoundModel); diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 33ab32ca5..01b589ab6 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -753,7 +753,7 @@ void ShopWindow::processRequest(std::string nick, std::string data, int mode) if (config.getBoolValue("autoShop")) { - sound.playGuiSound("soundtrade"); + sound.playGuiSound(SOUND_TRADE); startTrade(); } else diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 53842e887..be6a31164 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -289,9 +289,19 @@ void ChatTab::chatLog(std::string line, Own own, if (getFlash() == 0) { if (chatWindow && chatWindow->findHighlight(tmp.text)) + { setFlash(2); + sound.playGuiSound(SOUND_HIGHLIGHT); + } else + { setFlash(1); + } + } + else if (getFlash() == 2) + { + if (chatWindow && chatWindow->findHighlight(tmp.text)) + sound.playGuiSound(SOUND_HIGHLIGHT); } } @@ -300,8 +310,10 @@ void ChatTab::chatLog(std::string line, Own own, || (Client::getIsMinimized() || (!Client::getMouseFocused() && !Client::getInputFocused())))) { - if (own != BY_SERVER) - sound.playGuiSound("soundwhisper"); + if (own == BY_GM) + sound.playGuiSound(SOUND_GLOBAL); + else if (own != BY_SERVER) + playNewMessageSound(); } } } @@ -468,3 +480,8 @@ void ChatTab::addNewRow(std::string &line) } mScrollArea->logic(); } + +void ChatTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_WHISPER); +} diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 912305a63..d67f56b54 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -162,6 +162,8 @@ class ChatTab : public Tab void addNewRow(std::string &line); + virtual void playNewMessageSound(); + protected: friend class ChatWindow; friend class WhisperWindow; diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index a95fca3cf..bad34cfb3 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -27,6 +27,7 @@ #include "guild.h" #include "guildmanager.h" #include "localplayer.h" +#include "sound.h" #include "gui/theme.h" @@ -126,3 +127,8 @@ void GuildChatTab::saveToLogFile(std::string &msg) if (chatLogger) chatLogger->log("#Guild", msg); } + +void GuildChatTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_GUILD); +} diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index be6f4d034..e729844f4 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -44,6 +44,8 @@ class GuildChatTab : public ChatTab int getType() const { return ChatTab::TAB_GUILD; } + void playNewMessageSound(); + protected: void handleInput(const std::string &msg); |