summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-20 12:19:11 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-21 21:09:08 +0300
commitc483cf600e74e7d38a7c0cc7d80435e97040c76c (patch)
treeba33088840361d3393398d6c9d52ebcfc894dd06
parent11619eed54e7b9df06c01cae46bd22aadc3f8dc7 (diff)
downloadmanaplus-c483cf600e74e7d38a7c0cc7d80435e97040c76c.tar.gz
manaplus-c483cf600e74e7d38a7c0cc7d80435e97040c76c.tar.bz2
manaplus-c483cf600e74e7d38a7c0cc7d80435e97040c76c.tar.xz
manaplus-c483cf600e74e7d38a7c0cc7d80435e97040c76c.zip
Add channel name to chat tabs.
-rw-r--r--src/game.cpp4
-rw-r--r--src/gui/widgets/battletab.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp6
-rw-r--r--src/gui/widgets/chattab.h10
-rw-r--r--src/gui/widgets/gmtab.cpp2
-rw-r--r--src/gui/widgets/guildchattab.cpp2
-rw-r--r--src/gui/widgets/tradetab.cpp2
-rw-r--r--src/gui/widgets/whispertab.cpp2
-rw-r--r--src/net/ea/gui/guildtab.cpp2
-rw-r--r--src/net/ea/gui/partytab.cpp2
10 files changed, 22 insertions, 12 deletions
diff --git a/src/game.cpp b/src/game.cpp
index c614a96ac..d2537c091 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -252,12 +252,12 @@ static void createGuiWindows()
if (serverVersion >= 6)
questsWindow = new QuestsWindow;
- localChatTab = new ChatTab(chatWindow, _("General"));
+ localChatTab = new ChatTab(chatWindow, _("General"), GENERAL_CHANNEL);
localChatTab->setAllowHighlight(false);
if (config.getBoolValue("showChatHistory"))
localChatTab->loadFromLogFile("#General");
- debugChatTab = new ChatTab(chatWindow, _("Debug"));
+ debugChatTab = new ChatTab(chatWindow, _("Debug"), "");
debugChatTab->setAllowHighlight(false);
if (config.getBoolValue("enableTradeTab"))
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp
index b888945a8..96e964b67 100644
--- a/src/gui/widgets/battletab.cpp
+++ b/src/gui/widgets/battletab.cpp
@@ -38,7 +38,7 @@
#include "debug.h"
BattleTab::BattleTab(const Widget2 *const widget) :
- ChatTab(widget, _("Battle"))
+ ChatTab(widget, _("Battle"), "")
{
if (config.getBoolValue("showChatHistory"))
loadFromLogFile("#Battle");
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index ae18740a9..2b360789a 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -49,14 +49,16 @@
static const unsigned int MAX_WORD_SIZE = 50;
-ChatTab::ChatTab(const Widget2 *const widget, const std::string &name) :
+ChatTab::ChatTab(const Widget2 *const widget, const std::string &name,
+ const std::string &channel) :
Tab(widget),
mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP)),
mScrollArea(new ScrollArea(mTextOutput, false)),
mAllowHightlight(true),
mRemoveNames(false),
mNoAway(false),
- mShowOnline(false)
+ mShowOnline(false),
+ mChannelName(channel)
{
setCaption(name);
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 24afffc0f..0ac55811d 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -32,6 +32,9 @@
class ScrollArea;
+const std::string GENERAL_CHANNEL = "\000\000\000";
+const std::string TRADE_CHANNEL = "\000\000\001";
+
/**
* A tab for the chat window. This is special to ease chat handling.
*/
@@ -54,7 +57,8 @@ class ChatTab : public Tab
/**
* Constructor.
*/
- ChatTab(const Widget2 *const widget, const std::string &name);
+ ChatTab(const Widget2 *const widget, const std::string &name,
+ const std::string &channel);
A_DELETE_COPY(ChatTab)
@@ -171,6 +175,9 @@ class ChatTab : public Tab
virtual void playNewMessageSound();
+ std::string getChannelName()
+ { return mChannelName; }
+
protected:
friend class ChatWindow;
friend class WhisperWindow;
@@ -195,6 +202,7 @@ class ChatTab : public Tab
bool mRemoveNames;
bool mNoAway;
bool mShowOnline;
+ std::string mChannelName;
};
extern ChatTab *localChatTab;
diff --git a/src/gui/widgets/gmtab.cpp b/src/gui/widgets/gmtab.cpp
index d129c9043..9a28622a9 100644
--- a/src/gui/widgets/gmtab.cpp
+++ b/src/gui/widgets/gmtab.cpp
@@ -32,7 +32,7 @@
#include "debug.h"
GmTab::GmTab(const Widget2 *const widget) :
- ChatTab(widget, _("GM"))
+ ChatTab(widget, _("GM"), "")
{
setTabColor(&getThemeColor(Theme::GM_CHAT_TAB),
&getThemeColor(Theme::GM_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp
index c960b4798..5917fbda4 100644
--- a/src/gui/widgets/guildchattab.cpp
+++ b/src/gui/widgets/guildchattab.cpp
@@ -37,7 +37,7 @@
#include "debug.h"
GuildChatTab::GuildChatTab(const Widget2 *const widget) :
- ChatTab(widget, _("Guild"))
+ ChatTab(widget, _("Guild"), "")
{
setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB),
&getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp
index 96a45e339..380b11f06 100644
--- a/src/gui/widgets/tradetab.cpp
+++ b/src/gui/widgets/tradetab.cpp
@@ -36,7 +36,7 @@
#include "debug.h"
TradeTab::TradeTab(const Widget2 *const widget) :
- ChatTab(widget, _("Trade"))
+ ChatTab(widget, _("Trade"), TRADE_CHANNEL)
{
}
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 58219f019..95c2fa505 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -34,7 +34,7 @@
#include "debug.h"
WhisperTab::WhisperTab(const Widget2 *const widget, const std::string &nick) :
- ChatTab(widget, nick),
+ ChatTab(widget, nick, ""),
mNick(nick)
{
setWhisperTabColors();
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index b764a9f85..6dd53745e 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -44,7 +44,7 @@ namespace Ea
extern Guild *taGuild;
GuildTab::GuildTab(const Widget2 *const widget) :
- ChatTab(widget, _("Guild"))
+ ChatTab(widget, _("Guild"), "")
{
setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB),
&getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE));
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 73cef8b5f..da26591a5 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -44,7 +44,7 @@ namespace Ea
{
PartyTab::PartyTab(const Widget2 *const widget) :
- ChatTab(widget, _("Party"))
+ ChatTab(widget, _("Party"), "")
{
setTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB),
&getThemeColor(Theme::PARTY_CHAT_TAB_OUTLINE));