diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-15 12:59:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-15 12:59:29 +0300 |
commit | ab92ecc43d1b4d62e2ef3ac95c337dcee5f5fcc6 (patch) | |
tree | 1fc12b7dbe75471b4262483c36c13cc89f45facf /src/gui | |
parent | 324a3df386950a6f262f2382caa33177f085c03f (diff) | |
download | manaverse-ab92ecc43d1b4d62e2ef3ac95c337dcee5f5fcc6.tar.gz manaverse-ab92ecc43d1b4d62e2ef3ac95c337dcee5f5fcc6.tar.bz2 manaverse-ab92ecc43d1b4d62e2ef3ac95c337dcee5f5fcc6.tar.xz manaverse-ab92ecc43d1b4d62e2ef3ac95c337dcee5f5fcc6.zip |
Move chat tab types into separate file.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/battletab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chattab.cpp | 16 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chattab.h | 14 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chattabtype.h | 41 | ||||
-rw-r--r-- | src/gui/widgets/tabs/gmtab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/guildchattab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/langtab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/tradetab.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/whispertab.h | 3 |
10 files changed, 65 insertions, 30 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 7629bf9ed..3ecd0f333 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -615,7 +615,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBrowserBox->clearRows(); - if (tab->getType() == static_cast<int>(ChatTab::TAB_WHISPER)) + if (tab->getType() == static_cast<int>(ChatTabType::WHISPER)) { // TRANSLATORS: popup menu item // TRANSLATORS: close chat tab @@ -664,7 +664,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBrowserBox->addRow("disable away", _("Disable away")); } mBrowserBox->addRow("##3---"); - if (tab->getType() == static_cast<int>(ChatTab::TAB_PARTY)) + if (tab->getType() == static_cast<int>(ChatTabType::PARTY)) { // TRANSLATORS: popup menu item // TRANSLATORS: enable away messages in chat tab @@ -676,7 +676,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBrowserBox->addRow("chat clipboard", _("Copy to clipboard")); mBrowserBox->addRow("##3---"); - if (tab->getType() == static_cast<int>(ChatTab::TAB_WHISPER)) + if (tab->getType() == static_cast<int>(ChatTabType::WHISPER)) { const WhisperTab *const wTab = static_cast<WhisperTab*>(tab); std::string name = wTab->getNick(); diff --git a/src/gui/widgets/tabs/battletab.h b/src/gui/widgets/tabs/battletab.h index 52f44cf40..0f9a80609 100644 --- a/src/gui/widgets/tabs/battletab.h +++ b/src/gui/widgets/tabs/battletab.h @@ -24,6 +24,7 @@ #define GUI_WIDGETS_TABS_BATTLETAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" /** * A tab for a party chat channel. @@ -38,7 +39,7 @@ class BattleTab final : public ChatTab ~BattleTab(); int getType() const override final A_WARN_UNUSED - { return ChatTab::TAB_BATTLE; } + { return ChatTabType::BATTLE; } void saveToLogFile(const std::string &msg) const override final; }; diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index e52f935b3..fccc421ae 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -38,6 +38,8 @@ #include "gui/widgets/itemlinkhandler.h" #include "gui/widgets/tabbedarea.h" +#include "gui/widgets/tabs/chattabtype.h" + #include "net/chathandler.h" #include "net/net.h" @@ -276,8 +278,8 @@ void ChatTab::chatLog(std::string line, Own own, mScrollArea->logic(); if (own != BY_PLAYER) { - if (own == BY_SERVER && (getType() == TAB_PARTY - || getType() == TAB_GUILD)) + if (own == BY_SERVER && (getType() == ChatTabType::PARTY + || getType() == ChatTabType::GUILD)) { return; } @@ -446,11 +448,11 @@ void ChatTab::saveToLogFile(const std::string &msg) const { if (chatLogger) { - if (getType() == TAB_INPUT) + if (getType() == ChatTabType::INPUT) { chatLogger->log(msg); } - else if (getType() == TAB_DEBUG + else if (getType() == ChatTabType::DEBUG && config.getBoolValue("enableDebugLog")) { chatLogger->log("#Debug", msg); @@ -461,11 +463,11 @@ void ChatTab::saveToLogFile(const std::string &msg) const int ChatTab::getType() const { if (getCaption() == "General" || getCaption() == _("General")) - return TAB_INPUT; + return ChatTabType::INPUT; else if (getCaption() == "Debug" || getCaption() == _("Debug")) - return TAB_DEBUG; + return ChatTabType::DEBUG; else - return TAB_UNKNOWN; + return ChatTabType::UNKNOWN; } void ChatTab::addRow(std::string &line) diff --git a/src/gui/widgets/tabs/chattab.h b/src/gui/widgets/tabs/chattab.h index 84c00fdfc..da17f1501 100644 --- a/src/gui/widgets/tabs/chattab.h +++ b/src/gui/widgets/tabs/chattab.h @@ -38,20 +38,6 @@ class ScrollArea; class ChatTab : public Tab { public: - enum Type - { - TAB_UNKNOWN = 0, - TAB_INPUT, - TAB_WHISPER, - TAB_PARTY, - TAB_GUILD, - TAB_DEBUG, - TAB_TRADE, - TAB_BATTLE, - TAB_LANG, - TAB_GM - }; - /** * Constructor. */ diff --git a/src/gui/widgets/tabs/chattabtype.h b/src/gui/widgets/tabs/chattabtype.h new file mode 100644 index 000000000..802b33a43 --- /dev/null +++ b/src/gui/widgets/tabs/chattabtype.h @@ -0,0 +1,41 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GUI_WIDGETS_TABS_CHATTABTYPE_H +#define GUI_WIDGETS_TABS_CHATTABTYPE_H + +namespace ChatTabType +{ + enum Type + { + UNKNOWN = 0, + INPUT, + WHISPER, + PARTY, + GUILD, + DEBUG, + TRADE, + BATTLE, + LANG, + GM + }; +} // namespace ChatTabType + +#endif // GUI_WIDGETS_TABS_CHATTABTYPE_H diff --git a/src/gui/widgets/tabs/gmtab.h b/src/gui/widgets/tabs/gmtab.h index 0685c3808..ffe738523 100644 --- a/src/gui/widgets/tabs/gmtab.h +++ b/src/gui/widgets/tabs/gmtab.h @@ -22,6 +22,7 @@ #define GUI_WIDGETS_TABS_GMTAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" /** * A tab for whispers from a single player. @@ -36,7 +37,7 @@ class GmTab final : public ChatTab ~GmTab(); int getType() const override final A_WARN_UNUSED - { return ChatTab::TAB_GM; } + { return ChatTabType::GM; } void saveToLogFile(const std::string &msg) const override final; diff --git a/src/gui/widgets/tabs/guildchattab.h b/src/gui/widgets/tabs/guildchattab.h index cfcf901ca..41c06636c 100644 --- a/src/gui/widgets/tabs/guildchattab.h +++ b/src/gui/widgets/tabs/guildchattab.h @@ -24,6 +24,7 @@ #define GUI_WIDGETS_TABS_GUILDCHATTAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" /** * A tab for a guild chat channel. @@ -44,7 +45,7 @@ class GuildChatTab final : public ChatTab, void saveToLogFile(const std::string &msg) const override final; int getType() const override A_WARN_UNUSED - { return ChatTab::TAB_GUILD; } + { return ChatTabType::GUILD; } void playNewMessageSound() const override final; diff --git a/src/gui/widgets/tabs/langtab.h b/src/gui/widgets/tabs/langtab.h index e036e4dd8..49c9c68a0 100644 --- a/src/gui/widgets/tabs/langtab.h +++ b/src/gui/widgets/tabs/langtab.h @@ -22,6 +22,7 @@ #define GUI_WIDGETS_TABS_LANGTAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" class LangTab final : public ChatTab { @@ -34,7 +35,7 @@ class LangTab final : public ChatTab ~LangTab(); int getType() const override final A_WARN_UNUSED - { return ChatTab::TAB_LANG; } + { return ChatTabType::LANG; } void saveToLogFile(const std::string &msg) const override final; }; diff --git a/src/gui/widgets/tabs/tradetab.h b/src/gui/widgets/tabs/tradetab.h index 07d95844e..9bcaa6275 100644 --- a/src/gui/widgets/tabs/tradetab.h +++ b/src/gui/widgets/tabs/tradetab.h @@ -24,6 +24,7 @@ #define GUI_WIDGETS_TABS_TRADETAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" /** * A tab for a party chat channel. @@ -38,7 +39,7 @@ class TradeTab final : public ChatTab ~TradeTab(); int getType() const override final A_WARN_UNUSED - { return ChatTab::TAB_TRADE; } + { return ChatTabType::TRADE; } void saveToLogFile(const std::string &msg) const override final; diff --git a/src/gui/widgets/tabs/whispertab.h b/src/gui/widgets/tabs/whispertab.h index 84b55ae58..8a315a7c3 100644 --- a/src/gui/widgets/tabs/whispertab.h +++ b/src/gui/widgets/tabs/whispertab.h @@ -24,6 +24,7 @@ #define GUI_WIDGETS_TABS_WHISPERTAB_H #include "gui/widgets/tabs/chattab.h" +#include "gui/widgets/tabs/chattabtype.h" /** * A tab for whispers from a single player. @@ -40,7 +41,7 @@ class WhisperTab final : public ChatTab const std::string &restrict args) override final; int getType() const override final A_WARN_UNUSED - { return ChatTab::TAB_WHISPER; } + { return ChatTabType::WHISPER; } void saveToLogFile(const std::string &msg) const override final; |