summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-28 22:16:23 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-28 22:16:23 +0300
commitbbf5743dd18e78298376da6f78c71ae2a524c766 (patch)
tree64ff82f070ce5022b6adc26c5c1727fb38f13794
parent8a3adb5dc695fec3f4db5f0705c53687862fb801 (diff)
downloadmanaverse-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.gz
manaverse-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.bz2
manaverse-bbf5743dd18e78298376da6f78c71ae2a524c766.tar.xz
manaverse-bbf5743dd18e78298376da6f78c71ae2a524c766.zip
Fix some sound event.
Replace hardcoded sound names to constants. Add party/guild sound.
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/confirmdialog.cpp2
-rw-r--r--src/gui/okdialog.cpp4
-rw-r--r--src/gui/setup_audio.cpp3
-rw-r--r--src/gui/shopwindow.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp21
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/guildchattab.cpp6
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/net/ea/gui/guildtab.cpp6
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp5
-rw-r--r--src/net/ea/gui/partytab.h2
-rw-r--r--src/sound.h9
15 files changed, 62 insertions, 7 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index cd2911192..3e53506b4 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -236,6 +236,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "soundtrade", "start");
AddDEF(configData, "soundinfo", "notify");
AddDEF(configData, "soundrequest", "attention");
+ AddDEF(configData, "soundguild", "newmessage");
return configData;
}
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);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index de1304240..f88423f8e 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -4148,7 +4148,7 @@ void LocalPlayer::checkNewName(Being *being)
if (!mWaitFor.empty() && mWaitFor == nick)
{
debugMsg(_("You see ") + mWaitFor);
- sound.playGuiSound("soundinfo");
+ sound.playGuiSound(SOUND_INFO);
mWaitFor = "";
}
}
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index 87fc34d94..bd1521b21 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -26,6 +26,7 @@
#include "commandhandler.h"
#include "guild.h"
#include "localplayer.h"
+#include "sound.h"
#include "gui/theme.h"
@@ -151,4 +152,9 @@ void GuildTab::saveToLogFile(std::string &msg)
chatLogger->log("#Guild", msg);
}
+void GuildTab::playNewMessageSound()
+{
+ sound.playGuiSound(SOUND_GUILD);
+}
+
} // namespace Ea
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 81d971161..22a41ce80 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -47,6 +47,8 @@ class GuildTab : public ChatTab
int getType() const
{ return ChatTab::TAB_GUILD; }
+ void playNewMessageSound();
+
protected:
void handleInput(const std::string &msg);
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index d5e344ac2..e69207842 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -26,6 +26,7 @@
#include "commandhandler.h"
#include "localplayer.h"
#include "party.h"
+#include "sound.h"
#include "gui/theme.h"
@@ -241,4 +242,8 @@ void PartyTab::saveToLogFile(std::string &msg)
chatLogger->log("#Party", msg);
}
+void PartyTab::playNewMessageSound()
+{
+ sound.playGuiSound(SOUND_GUILD);
+}
} // namespace Ea
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index 029d71ac7..931b283dd 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -47,6 +47,8 @@ class PartyTab : public ChatTab
void saveToLogFile(std::string &msg);
+ void playNewMessageSound();
+
protected:
void handleInput(const std::string &msg);
diff --git a/src/sound.h b/src/sound.h
index cfa847a0b..a967d0a92 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -31,6 +31,15 @@
class Music;
+const static std::string SOUND_INFO = "soundinfo";
+const static std::string SOUND_ERROR = "sounderror";
+const static std::string SOUND_REQUEST = "soundrequest";
+const static std::string SOUND_TRADE = "soundtrade";
+const static std::string SOUND_WHISPER = "soundwhisper";
+const static std::string SOUND_HIGHLIGHT = "soundhighlight";
+const static std::string SOUND_GLOBAL = "soundglobal";
+const static std::string SOUND_GUILD = "soundguild";
+
/** Sound engine
*
* \ingroup CORE