From c483cf600e74e7d38a7c0cc7d80435e97040c76c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 20 Mar 2013 12:19:11 +0300 Subject: Add channel name to chat tabs. --- src/game.cpp | 4 ++-- src/gui/widgets/battletab.cpp | 2 +- src/gui/widgets/chattab.cpp | 6 ++++-- src/gui/widgets/chattab.h | 10 +++++++++- src/gui/widgets/gmtab.cpp | 2 +- src/gui/widgets/guildchattab.cpp | 2 +- src/gui/widgets/tradetab.cpp | 2 +- src/gui/widgets/whispertab.cpp | 2 +- src/net/ea/gui/guildtab.cpp | 2 +- src/net/ea/gui/partytab.cpp | 2 +- 10 files changed, 22 insertions(+), 12 deletions(-) (limited to 'src') 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)); -- cgit v1.2.3-70-g09d2