diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-12 16:21:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-12 16:21:11 +0300 |
commit | 2e8e53fb5e3f2ba7d0d4f55b0c6705d12ec8efa9 (patch) | |
tree | 95eabbcc64c3420f3b40110ee84e21bebf9bd557 /src/gui | |
parent | 1d689e6492993a66935c7b36ff9827f6c170e166 (diff) | |
download | mv-2e8e53fb5e3f2ba7d0d4f55b0c6705d12ec8efa9.tar.gz mv-2e8e53fb5e3f2ba7d0d4f55b0c6705d12ec8efa9.tar.bz2 mv-2e8e53fb5e3f2ba7d0d4f55b0c6705d12ec8efa9.tar.xz mv-2e8e53fb5e3f2ba7d0d4f55b0c6705d12ec8efa9.zip |
Add log file name into chattab.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/tabs/chat/battletab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/battletab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/emulateguildtab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/emulateguildtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/gmtab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/gmtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/guildtab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/guildtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/langtab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/langtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/partytab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/partytab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/tradetab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/tradetab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/whispertab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/whispertab.h | 2 |
18 files changed, 21 insertions, 77 deletions
diff --git a/src/gui/widgets/tabs/chat/battletab.cpp b/src/gui/widgets/tabs/chat/battletab.cpp index 21bbf6430..c9672965f 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"), "", ChatTabType::BATTLE) + ChatTab(widget, _("Battle"), "", "#Battle", ChatTabType::BATTLE) { if (config.getBoolValue("showChatHistory")) loadFromLogFile("#Battle"); @@ -42,9 +42,3 @@ BattleTab::BattleTab(const Widget2 *const widget) : BattleTab::~BattleTab() { } - -void BattleTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log(std::string("#Battle"), std::string(msg)); -} diff --git a/src/gui/widgets/tabs/chat/battletab.h b/src/gui/widgets/tabs/chat/battletab.h index c948a2684..ffac0dfd9 100644 --- a/src/gui/widgets/tabs/chat/battletab.h +++ b/src/gui/widgets/tabs/chat/battletab.h @@ -37,8 +37,6 @@ class BattleTab final : public ChatTab A_DELETE_COPY(BattleTab) ~BattleTab(); - - void saveToLogFile(const std::string &msg) const override final; }; extern BattleTab *battleChatTab; diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index 783df0416..5dc18b329 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -62,12 +62,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 &logName, const ChatTabType::Type &type) : Tab(widget), mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mTextOutput, false)), mChannelName(channel), + mLogName(logName), mType(type), mAllowHightlight(true), mRemoveNames(false), @@ -461,7 +463,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args) return handleCommand(type, args); } -void ChatTab::saveToLogFile(const std::string &msg) const +void ChatTab::saveToLogFile(std::string msg) const { if (chatLogger) { @@ -469,10 +471,14 @@ void ChatTab::saveToLogFile(const std::string &msg) const { chatLogger->log(msg); } - else if (getType() == ChatTabType::DEBUG - && config.getBoolValue("enableDebugLog")) + else if (getType() == ChatTabType::DEBUG) { - chatLogger->log("#Debug", msg); + if (config.getBoolValue("enableDebugLog")) + chatLogger->log("#Debug", msg); + } + else if (!mLogName.empty()) + { + chatLogger->log(mLogName, msg); } } } diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index aa4162ce3..41a02030e 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -59,6 +59,7 @@ class ChatTab notfinal : public Tab ChatTab(const Widget2 *const widget, const std::string &name, const std::string &channel, + const std::string &logName, const ChatTabType::Type &type); A_DELETE_COPY(ChatTab) @@ -136,7 +137,7 @@ class ChatTab notfinal : public Tab int getType() const A_WARN_UNUSED { return mType; } - virtual void saveToLogFile(const std::string &msg) const; + void saveToLogFile(std::string msg) const; const std::list<std::string> &getRows() const A_WARN_UNUSED { return mTextOutput->getRows(); } @@ -198,6 +199,7 @@ class ChatTab notfinal : public Tab BrowserBox *mTextOutput; ScrollArea *mScrollArea; std::string mChannelName; + std::string mLogName; ChatTabType::Type mType; bool mAllowHightlight; bool mRemoveNames; diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp index 2d24fee64..1606fbcd3 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"), "", ChatTabType::GUILD) + ChatTab(widget, _("Guild"), "", "#Guild", ChatTabType::GUILD) { setTabColors(Theme::GUILD_CHAT_TAB); mShowOnline = config.getBoolValue("showGuildOnline"); @@ -90,12 +90,6 @@ void EmulateGuildTab::getAutoCompleteCommands(StringVect &names) const names.push_back("/notice "); } -void EmulateGuildTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log("#Guild", msg); -} - void EmulateGuildTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.h b/src/gui/widgets/tabs/chat/emulateguildtab.h index 8a7b8c749..86279d249 100644 --- a/src/gui/widgets/tabs/chat/emulateguildtab.h +++ b/src/gui/widgets/tabs/chat/emulateguildtab.h @@ -42,8 +42,6 @@ class EmulateGuildTab final : public ChatTab, bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; - void saveToLogFile(const std::string &msg) const override final; - 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 567aeeb4a..db1e6a98d 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"), "", ChatTabType::GM) + ChatTab(widget, _("GM"), "", "#GM", ChatTabType::GM) { setTabColors(Theme::GM_CHAT_TAB); } @@ -48,12 +48,6 @@ void GmTab::handleCommand(const std::string &msg A_UNUSED) { } -void GmTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log("#GM", msg); -} - void GmTab::getAutoCompleteList(StringVect &names A_UNUSED) const { } diff --git a/src/gui/widgets/tabs/chat/gmtab.h b/src/gui/widgets/tabs/chat/gmtab.h index 6fdd88c68..008b7ec12 100644 --- a/src/gui/widgets/tabs/chat/gmtab.h +++ b/src/gui/widgets/tabs/chat/gmtab.h @@ -36,8 +36,6 @@ class GmTab final : public ChatTab ~GmTab(); - void saveToLogFile(const std::string &msg) const override final; - protected: void getAutoCompleteList(StringVect &names) const override final; diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp index 8074bd304..97f0f348d 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"), "", ChatTabType::GUILD) + ChatTab(widget, _("Guild"), "", "#Guild", ChatTabType::GUILD) { setTabColors(Theme::GUILD_CHAT_TAB); mShowOnline = config.getBoolValue("showGuildOnline"); @@ -120,12 +120,6 @@ void GuildTab::getAutoCompleteCommands(StringVect &names) const names.push_back("/leave"); } -void GuildTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log("#Guild", msg); -} - void GuildTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); diff --git a/src/gui/widgets/tabs/chat/guildtab.h b/src/gui/widgets/tabs/chat/guildtab.h index 5c32f5c0a..c0d5b7ce7 100644 --- a/src/gui/widgets/tabs/chat/guildtab.h +++ b/src/gui/widgets/tabs/chat/guildtab.h @@ -42,8 +42,6 @@ class GuildTab notfinal : public ChatTab, bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; - void saveToLogFile(const std::string &msg) const override final; - 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 57eb68670..554af2782 100644 --- a/src/gui/widgets/tabs/chat/langtab.cpp +++ b/src/gui/widgets/tabs/chat/langtab.cpp @@ -31,16 +31,10 @@ LangTab *langChatTab = nullptr; LangTab::LangTab(const Widget2 *const widget, const std::string &lang) : // TRANSLATORS: lang chat tab name - ChatTab(widget, _("Lang"), lang + " ", ChatTabType::LANG) + ChatTab(widget, _("Lang"), lang + " ", "#Lang", ChatTabType::LANG) { } LangTab::~LangTab() { } - -void LangTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log(std::string("#Lang"), std::string(msg)); -} diff --git a/src/gui/widgets/tabs/chat/langtab.h b/src/gui/widgets/tabs/chat/langtab.h index d2444f73b..65a26b562 100644 --- a/src/gui/widgets/tabs/chat/langtab.h +++ b/src/gui/widgets/tabs/chat/langtab.h @@ -33,8 +33,6 @@ class LangTab final : public ChatTab A_DELETE_COPY(LangTab) ~LangTab(); - - void saveToLogFile(const std::string &msg) const override final; }; extern LangTab *langChatTab; diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp index 7d928be17..e34d49014 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"), "", ChatTabType::PARTY) + ChatTab(widget, _("Party"), "", "#Party", ChatTabType::PARTY) { setTabColors(Theme::PARTY_CHAT_TAB); mShowOnline = config.getBoolValue("showPartyOnline"); @@ -224,12 +224,6 @@ void PartyTab::getAutoCompleteCommands(StringVect &names) const names.push_back("/setleader "); } -void PartyTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log("#Party", msg); -} - void PartyTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); diff --git a/src/gui/widgets/tabs/chat/partytab.h b/src/gui/widgets/tabs/chat/partytab.h index 12af1c8a9..dc0799ecc 100644 --- a/src/gui/widgets/tabs/chat/partytab.h +++ b/src/gui/widgets/tabs/chat/partytab.h @@ -42,8 +42,6 @@ class PartyTab notfinal : public ChatTab, bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; - void saveToLogFile(const std::string &msg) const override final; - void playNewMessageSound() const override final; void optionChanged(const std::string &value); diff --git a/src/gui/widgets/tabs/chat/tradetab.cpp b/src/gui/widgets/tabs/chat/tradetab.cpp index 7812a86b8..a4906a815 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, ChatTabType::TRADE) + ChatTab(widget, _("Trade"), TRADE_CHANNEL, "#Trade", ChatTabType::TRADE) { } @@ -47,9 +47,3 @@ void TradeTab::handleInput(const std::string &msg) std::string str("\302\202" + msg); ChatTab::handleInput(str); } - -void TradeTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log(std::string("#Trade"), std::string(msg)); -} diff --git a/src/gui/widgets/tabs/chat/tradetab.h b/src/gui/widgets/tabs/chat/tradetab.h index 9a4dace18..935f2ce4f 100644 --- a/src/gui/widgets/tabs/chat/tradetab.h +++ b/src/gui/widgets/tabs/chat/tradetab.h @@ -38,8 +38,6 @@ class TradeTab final : public ChatTab ~TradeTab(); - void saveToLogFile(const std::string &msg) const override final; - protected: void handleInput(const std::string &msg) override final; }; diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp index 16b62a66c..fc68cb222 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, "", ChatTabType::WHISPER), + ChatTab(widget, nick, "", nick, ChatTabType::WHISPER), mNick(nick) { setWhisperTabColors(); @@ -110,12 +110,6 @@ bool WhisperTab::handleCommand(const std::string &restrict type, return true; } -void WhisperTab::saveToLogFile(const std::string &msg) const -{ - if (chatLogger) - chatLogger->log(getNick(), msg); -} - void WhisperTab::getAutoCompleteList(StringVect &names) const { names.push_back(mNick); diff --git a/src/gui/widgets/tabs/chat/whispertab.h b/src/gui/widgets/tabs/chat/whispertab.h index 4fa85c0be..4e9f091df 100644 --- a/src/gui/widgets/tabs/chat/whispertab.h +++ b/src/gui/widgets/tabs/chat/whispertab.h @@ -40,8 +40,6 @@ class WhisperTab final : public ChatTab bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; - void saveToLogFile(const std::string &msg) const override final; - void setWhisperTabColors(); void setWhisperTabOfflineColors(); |