From bbf5743dd18e78298376da6f78c71ae2a524c766 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2012 22:16:23 +0300 Subject: Fix some sound event. Replace hardcoded sound names to constants. Add party/guild sound. --- src/gui/widgets/chattab.cpp | 21 +++++++++++++++++++-- src/gui/widgets/chattab.h | 2 ++ src/gui/widgets/guildchattab.cpp | 6 ++++++ src/gui/widgets/guildchattab.h | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets') 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); -- cgit v1.2.3-70-g09d2