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/widgets | |
parent | 8a3adb5dc695fec3f4db5f0705c53687862fb801 (diff) | |
download | plus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.gz plus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.bz2 plus-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.xz plus-bbf5743dd18e78298376da6f78c71ae2a524c766.zip |
Fix some sound event.
Replace hardcoded sound names to constants.
Add party/guild sound.
Diffstat (limited to 'src/gui/widgets')
-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 |
4 files changed, 29 insertions, 2 deletions
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); |