diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-22 13:43:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-22 13:45:50 +0300 |
commit | 0384e13f0faf26e4b2716c3a16d2518bb23fba42 (patch) | |
tree | 96cf8a9b745995fa39580b7cbc93012013dd4085 /src/gui | |
parent | 392b20563409d8f56fb9940c622a195f0ee0f7c7 (diff) | |
download | manaplus-0384e13f0faf26e4b2716c3a16d2518bb23fba42.tar.gz manaplus-0384e13f0faf26e4b2716c3a16d2518bb23fba42.tar.bz2 manaplus-0384e13f0faf26e4b2716c3a16d2518bb23fba42.tar.xz manaplus-0384e13f0faf26e4b2716c3a16d2518bb23fba42.zip |
Show channel messages in language tab.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chatwindow.cpp | 25 | ||||
-rw-r--r-- | src/gui/chatwindow.h | 7 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/langtab.cpp | 2 |
4 files changed, 25 insertions, 11 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 9d8739ddb..074ce2b81 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -45,6 +45,7 @@ #include "gui/widgets/battletab.h" #include "gui/widgets/dropdown.h" #include "gui/widgets/itemlinkhandler.h" +#include "gui/widgets/langtab.h" #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/textfield.h" @@ -1422,18 +1423,23 @@ std::string ChatWindow::autoCompleteHistory(std::string partName) } void ChatWindow::resortChatLog(std::string line, Own own, + const std::string &channel, const bool ignoreRecord, const bool tryRemoveColors) { if (own == -1) own = BY_SERVER; + std::string prefix; + if (!channel.empty()) + prefix = std::string("##3").append(channel).append("##0"); + if (tradeChatTab) { if (findI(line, mTradeFilter) != std::string::npos) { -// logger->log("trade: " + line); - tradeChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); + tradeChatTab->chatLog(prefix + line, own, + ignoreRecord, tryRemoveColors); return; } @@ -1447,7 +1453,7 @@ void ChatWindow::resortChatLog(std::string line, Own own, if (line.find(": \302\202\302") != std::string::npos) return; line = line.erase(idx + 2, 2); - tradeChatTab->chatLog(line, own, ignoreRecord, + tradeChatTab->chatLog(prefix + line, own, ignoreRecord, tryRemoveColors); return; } @@ -1464,8 +1470,8 @@ void ChatWindow::resortChatLog(std::string line, Own own, { if (line.find("http", idx1) != idx1 + 2) { - tradeChatTab->chatLog(line, own, ignoreRecord, - tryRemoveColors); + tradeChatTab->chatLog(prefix + line, own, + ignoreRecord, tryRemoveColors); return; } } @@ -1473,8 +1479,15 @@ void ChatWindow::resortChatLog(std::string line, Own own, } } - if (localChatTab) + if (langChatTab && !channel.empty() + && langChatTab->getChannelName() == channel) + { + langChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); + } + else if (localChatTab && channel.empty()) + { localChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); + } } void ChatWindow::battleChatLog(std::string line, Own own, diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 1e9274466..7e2426467 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -235,9 +235,10 @@ class ChatWindow final : public Window, void ignoreAllWhispers(); - void resortChatLog(std::string line, Own own = BY_UNKNOWN, - const bool ignoreRecord = false, - const bool tryRemoveColors = true); + void resortChatLog(std::string line, Own own, + const std::string &channel, + const bool ignoreRecord, + const bool tryRemoveColors); void battleChatLog(std::string line, Own own = BY_UNKNOWN, const bool ignoreRecord = false, diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index e85dac74a..7105f3fc4 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -176,7 +176,7 @@ class ChatTab : public Tab virtual void playNewMessageSound(); - std::string getChannelName() + const std::string &getChannelName() const { return mChannelName; } protected: diff --git a/src/gui/widgets/langtab.cpp b/src/gui/widgets/langtab.cpp index edef9e178..f9ae12ebd 100644 --- a/src/gui/widgets/langtab.cpp +++ b/src/gui/widgets/langtab.cpp @@ -27,7 +27,7 @@ #include "debug.h" LangTab::LangTab(const Widget2 *const widget, const std::string &lang) : - ChatTab(widget, _("Lang"), " " + lang) + ChatTab(widget, _("Lang"), lang + " ") { } |