summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-12 15:21:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-12 15:21:51 +0300
commit2b6198dc9c4a52094bad3b39dbfb06c168a55ca2 (patch)
treeec5e1ca6e69e81e05ade883bfe644deb6d19c1ef /src
parent6cbd617a811b85f7685266907b129180134620b8 (diff)
downloadmanaverse-2b6198dc9c4a52094bad3b39dbfb06c168a55ca2.tar.gz
manaverse-2b6198dc9c4a52094bad3b39dbfb06c168a55ca2.tar.bz2
manaverse-2b6198dc9c4a52094bad3b39dbfb06c168a55ca2.tar.xz
manaverse-2b6198dc9c4a52094bad3b39dbfb06c168a55ca2.zip
Move chat tab type into ChatTab.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp5
-rw-r--r--src/gui/widgets/tabs/chat/battletab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/battletab.h3
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp16
-rw-r--r--src/gui/widgets/tabs/chat/chattab.h9
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.h3
-rw-r--r--src/gui/widgets/tabs/chat/gmtab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/gmtab.h3
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.h3
-rw-r--r--src/gui/widgets/tabs/chat/langtab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/langtab.h3
-rw-r--r--src/gui/widgets/tabs/chat/partytab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/partytab.h3
-rw-r--r--src/gui/widgets/tabs/chat/tradetab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/tradetab.h3
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.h3
19 files changed, 21 insertions, 49 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 36dddf659..57bed1baf 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -231,7 +231,8 @@ static void createGuiWindows()
questsWindow = new QuestsWindow;
// TRANSLATORS: chat tab header
- localChatTab = new ChatTab(chatWindow, _("General"), GENERAL_CHANNEL);
+ localChatTab = new ChatTab(chatWindow, _("General"),
+ GENERAL_CHANNEL, ChatTabType::INPUT);
localChatTab->setAllowHighlight(false);
if (config.getBoolValue("showChatHistory"))
localChatTab->loadFromLogFile("#General");
@@ -248,7 +249,7 @@ static void createGuiWindows()
}
// TRANSLATORS: chat tab header
- debugChatTab = new ChatTab(chatWindow, _("Debug"), "");
+ debugChatTab = new ChatTab(chatWindow, _("Debug"), "", ChatTabType::DEBUG);
debugChatTab->setAllowHighlight(false);
if (config.getBoolValue("enableTradeTab"))
diff --git a/src/gui/widgets/tabs/chat/battletab.cpp b/src/gui/widgets/tabs/chat/battletab.cpp
index 47a68e9d0..21bbf6430 100644
--- a/src/gui/widgets/tabs/chat/battletab.cpp
+++ b/src/gui/widgets/tabs/chat/battletab.cpp
@@ -33,7 +33,7 @@ BattleTab *battleChatTab = nullptr;
BattleTab::BattleTab(const Widget2 *const widget) :
// TRANSLATORS: battle chat tab name
- ChatTab(widget, _("Battle"), "")
+ ChatTab(widget, _("Battle"), "", ChatTabType::BATTLE)
{
if (config.getBoolValue("showChatHistory"))
loadFromLogFile("#Battle");
diff --git a/src/gui/widgets/tabs/chat/battletab.h b/src/gui/widgets/tabs/chat/battletab.h
index 0d933e740..c948a2684 100644
--- a/src/gui/widgets/tabs/chat/battletab.h
+++ b/src/gui/widgets/tabs/chat/battletab.h
@@ -38,9 +38,6 @@ class BattleTab final : public ChatTab
~BattleTab();
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::BATTLE; }
-
void saveToLogFile(const std::string &msg) const override final;
};
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 88df68774..783df0416 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -40,8 +40,6 @@
#include "gui/widgets/itemlinkhandler.h"
#include "gui/widgets/tabbedarea.h"
-#include "gui/widgets/tabs/chat/chattabtype.h"
-
#include "input/inputmanager.h"
#include "net/chathandler.h"
@@ -63,12 +61,14 @@ static const unsigned int MAX_WORD_SIZE = 50;
ChatTab::ChatTab(const Widget2 *const widget,
const std::string &name,
- const std::string &channel) :
+ const std::string &channel,
+ const ChatTabType::Type &type) :
Tab(widget),
mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true,
"browserbox.xml")),
mScrollArea(new ScrollArea(this, mTextOutput, false)),
mChannelName(channel),
+ mType(type),
mAllowHightlight(true),
mRemoveNames(false),
mNoAway(false),
@@ -477,16 +477,6 @@ void ChatTab::saveToLogFile(const std::string &msg) const
}
}
-int ChatTab::getType() const
-{
- if (getCaption() == "General" || getCaption() == _("General"))
- return ChatTabType::INPUT;
- else if (getCaption() == "Debug" || getCaption() == _("Debug"))
- return ChatTabType::DEBUG;
- else
- return ChatTabType::UNKNOWN;
-}
-
void ChatTab::addRow(std::string &line)
{
if (line.find("[@@http") == std::string::npos)
diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h
index 055c0a3e6..b6c3d9af3 100644
--- a/src/gui/widgets/tabs/chat/chattab.h
+++ b/src/gui/widgets/tabs/chat/chattab.h
@@ -29,6 +29,8 @@
#include "gui/widgets/tabs/tab.h"
+#include "gui/widgets/tabs/chat/chattabtype.h"
+
#include "localconsts.h"
class ScrollArea;
@@ -48,7 +50,8 @@ class ChatTab notfinal : public Tab
*/
ChatTab(const Widget2 *const widget,
const std::string &name,
- const std::string &channel);
+ const std::string &channel,
+ const ChatTabType::Type &type);
A_DELETE_COPY(ChatTab)
@@ -122,7 +125,8 @@ class ChatTab notfinal : public Tab
/**
* Returns type of the being.
*/
- virtual int getType() const A_WARN_UNUSED;
+ int getType() const A_WARN_UNUSED
+ { return mType; }
virtual void saveToLogFile(const std::string &msg) const;
@@ -186,6 +190,7 @@ class ChatTab notfinal : public Tab
BrowserBox *mTextOutput;
ScrollArea *mScrollArea;
std::string mChannelName;
+ ChatTabType::Type mType;
bool mAllowHightlight;
bool mRemoveNames;
bool mNoAway;
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
index 9c8eb7085..a3d41d481 100644
--- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp
+++ b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
@@ -36,7 +36,7 @@
EmulateGuildTab::EmulateGuildTab(const Widget2 *const widget) :
// TRANSLATORS: guild chat tab name
- ChatTab(widget, _("Guild"), "")
+ ChatTab(widget, _("Guild"), "", ChatTabType::GUILD)
{
setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB),
&getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.h b/src/gui/widgets/tabs/chat/emulateguildtab.h
index f614fb092..8a7b8c749 100644
--- a/src/gui/widgets/tabs/chat/emulateguildtab.h
+++ b/src/gui/widgets/tabs/chat/emulateguildtab.h
@@ -44,9 +44,6 @@ class EmulateGuildTab final : public ChatTab,
void saveToLogFile(const std::string &msg) const override final;
- int getType() const override A_WARN_UNUSED
- { return ChatTabType::GUILD; }
-
void playNewMessageSound() const override final;
void optionChanged(const std::string &value) override final;
diff --git a/src/gui/widgets/tabs/chat/gmtab.cpp b/src/gui/widgets/tabs/chat/gmtab.cpp
index 2a80b4fd3..77dc0b065 100644
--- a/src/gui/widgets/tabs/chat/gmtab.cpp
+++ b/src/gui/widgets/tabs/chat/gmtab.cpp
@@ -30,7 +30,7 @@ GmTab *gmChatTab = nullptr;
GmTab::GmTab(const Widget2 *const widget) :
// TRANSLATORS: gb tab name
- ChatTab(widget, _("GM"), "")
+ ChatTab(widget, _("GM"), "", ChatTabType::GM)
{
setTabColor(&getThemeColor(Theme::GM_CHAT_TAB),
&getThemeColor(Theme::GM_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/tabs/chat/gmtab.h b/src/gui/widgets/tabs/chat/gmtab.h
index f71f7e14f..6fdd88c68 100644
--- a/src/gui/widgets/tabs/chat/gmtab.h
+++ b/src/gui/widgets/tabs/chat/gmtab.h
@@ -36,9 +36,6 @@ class GmTab final : public ChatTab
~GmTab();
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::GM; }
-
void saveToLogFile(const std::string &msg) const override final;
protected:
diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp
index 109c2459b..b6e95cb77 100644
--- a/src/gui/widgets/tabs/chat/guildtab.cpp
+++ b/src/gui/widgets/tabs/chat/guildtab.cpp
@@ -43,7 +43,7 @@ namespace Ea
GuildTab::GuildTab(const Widget2 *const widget) :
// TRANSLATORS: guild chat tab name
- ChatTab(widget, _("Guild"), "")
+ ChatTab(widget, _("Guild"), "", ChatTabType::GUILD)
{
setTabColor(&getThemeColor(Theme::GUILD_CHAT_TAB),
&getThemeColor(Theme::GUILD_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/tabs/chat/guildtab.h b/src/gui/widgets/tabs/chat/guildtab.h
index e7c38368d..5c32f5c0a 100644
--- a/src/gui/widgets/tabs/chat/guildtab.h
+++ b/src/gui/widgets/tabs/chat/guildtab.h
@@ -44,9 +44,6 @@ class GuildTab notfinal : public ChatTab,
void saveToLogFile(const std::string &msg) const override final;
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::GUILD; }
-
void playNewMessageSound() const override final;
void optionChanged(const std::string &value) override final;
diff --git a/src/gui/widgets/tabs/chat/langtab.cpp b/src/gui/widgets/tabs/chat/langtab.cpp
index a97a46da1..57eb68670 100644
--- a/src/gui/widgets/tabs/chat/langtab.cpp
+++ b/src/gui/widgets/tabs/chat/langtab.cpp
@@ -31,7 +31,7 @@ LangTab *langChatTab = nullptr;
LangTab::LangTab(const Widget2 *const widget,
const std::string &lang) :
// TRANSLATORS: lang chat tab name
- ChatTab(widget, _("Lang"), lang + " ")
+ ChatTab(widget, _("Lang"), lang + " ", ChatTabType::LANG)
{
}
diff --git a/src/gui/widgets/tabs/chat/langtab.h b/src/gui/widgets/tabs/chat/langtab.h
index e4abc68bf..d2444f73b 100644
--- a/src/gui/widgets/tabs/chat/langtab.h
+++ b/src/gui/widgets/tabs/chat/langtab.h
@@ -34,9 +34,6 @@ class LangTab final : public ChatTab
~LangTab();
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::LANG; }
-
void saveToLogFile(const std::string &msg) const override final;
};
diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp
index 23c3a7bff..ee8099623 100644
--- a/src/gui/widgets/tabs/chat/partytab.cpp
+++ b/src/gui/widgets/tabs/chat/partytab.cpp
@@ -43,7 +43,7 @@ PartyTab *partyTab = nullptr;
PartyTab::PartyTab(const Widget2 *const widget) :
// TRANSLATORS: party chat tab name
- ChatTab(widget, _("Party"), "")
+ ChatTab(widget, _("Party"), "", ChatTabType::PARTY)
{
setTabColor(&getThemeColor(Theme::PARTY_CHAT_TAB),
&getThemeColor(Theme::PARTY_CHAT_TAB_OUTLINE));
diff --git a/src/gui/widgets/tabs/chat/partytab.h b/src/gui/widgets/tabs/chat/partytab.h
index 13f38cf0e..12af1c8a9 100644
--- a/src/gui/widgets/tabs/chat/partytab.h
+++ b/src/gui/widgets/tabs/chat/partytab.h
@@ -42,9 +42,6 @@ class PartyTab notfinal : public ChatTab,
bool handleCommand(const std::string &restrict type,
const std::string &restrict args) override final;
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::PARTY; }
-
void saveToLogFile(const std::string &msg) const override final;
void playNewMessageSound() const override final;
diff --git a/src/gui/widgets/tabs/chat/tradetab.cpp b/src/gui/widgets/tabs/chat/tradetab.cpp
index 2f5f0421c..7812a86b8 100644
--- a/src/gui/widgets/tabs/chat/tradetab.cpp
+++ b/src/gui/widgets/tabs/chat/tradetab.cpp
@@ -34,7 +34,7 @@ TradeTab *tradeChatTab = nullptr;
TradeTab::TradeTab(const Widget2 *const widget) :
// TRANSLATORS: trade chat tab name
- ChatTab(widget, _("Trade"), TRADE_CHANNEL)
+ ChatTab(widget, _("Trade"), TRADE_CHANNEL, ChatTabType::TRADE)
{
}
diff --git a/src/gui/widgets/tabs/chat/tradetab.h b/src/gui/widgets/tabs/chat/tradetab.h
index 1acd9294b..9a4dace18 100644
--- a/src/gui/widgets/tabs/chat/tradetab.h
+++ b/src/gui/widgets/tabs/chat/tradetab.h
@@ -38,9 +38,6 @@ class TradeTab final : public ChatTab
~TradeTab();
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::TRADE; }
-
void saveToLogFile(const std::string &msg) const override final;
protected:
diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp
index f7b49dee8..a77a2e410 100644
--- a/src/gui/widgets/tabs/chat/whispertab.cpp
+++ b/src/gui/widgets/tabs/chat/whispertab.cpp
@@ -38,7 +38,7 @@
WhisperTab::WhisperTab(const Widget2 *const widget,
const std::string &nick) :
- ChatTab(widget, nick, ""),
+ ChatTab(widget, nick, "", ChatTabType::WHISPER),
mNick(nick)
{
setWhisperTabColors();
diff --git a/src/gui/widgets/tabs/chat/whispertab.h b/src/gui/widgets/tabs/chat/whispertab.h
index 5817ff8d6..4fa85c0be 100644
--- a/src/gui/widgets/tabs/chat/whispertab.h
+++ b/src/gui/widgets/tabs/chat/whispertab.h
@@ -40,9 +40,6 @@ class WhisperTab final : public ChatTab
bool handleCommand(const std::string &restrict type,
const std::string &restrict args) override final;
- int getType() const override final A_WARN_UNUSED
- { return ChatTabType::WHISPER; }
-
void saveToLogFile(const std::string &msg) const override final;
void setWhisperTabColors();