diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-24 22:04:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-24 22:04:29 +0300 |
commit | 7ae8a11e0e99ab28730a8ca98388a6ec0ea1923e (patch) | |
tree | 6b440c246a9ed2c3d915c98f6b090a45673a2fb7 /src/gui | |
parent | 860d3e8e1bbe99b77763d533aebba9fde01e74c6 (diff) | |
download | manaplus-7ae8a11e0e99ab28730a8ca98388a6ec0ea1923e.tar.gz manaplus-7ae8a11e0e99ab28730a8ca98388a6ec0ea1923e.tar.bz2 manaplus-7ae8a11e0e99ab28730a8ca98388a6ec0ea1923e.tar.xz manaplus-7ae8a11e0e99ab28730a8ca98388a6ec0ea1923e.zip |
Add strong typed bool type TryRemoveColors.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.h | 4 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 34 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 8 |
4 files changed, 34 insertions, 19 deletions
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index 072ab677e..dd2ff9a54 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -109,7 +109,7 @@ ChatTab::~ChatTab() void ChatTab::chatLog(std::string line, ChatMsgType::Type own, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors) + const TryRemoveColors tryRemoveColors) { // Trim whitespace trim(line); @@ -117,7 +117,8 @@ void ChatTab::chatLog(std::string line, if (line.empty()) return; - if (tryRemoveColors && own == ChatMsgType::BY_OTHER && + if (tryRemoveColors == TryRemoveColors_true && + own == ChatMsgType::BY_OTHER && config.getBoolValue("removeColors")) { line = removeColors(line); @@ -364,7 +365,7 @@ void ChatTab::chatLog(const std::string &nick, std::string msg) chatLog(std::string(nick).append(" : ").append(msg), byWho, IgnoreRecord_false, - false); + TryRemoveColors_false); } void ChatTab::chatInput(const std::string &message) diff --git a/src/gui/widgets/tabs/chat/chattab.h b/src/gui/widgets/tabs/chat/chattab.h index 7af3920ef..6eee19b9d 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -27,6 +27,7 @@ #include "enums/simpletypes/ignorerecord.h" #include "enums/simpletypes/online.h" +#include "enums/simpletypes/tryremovecolors.h" #include "gui/widgets/browserbox.h" @@ -81,7 +82,8 @@ class ChatTab notfinal : public Tab void chatLog(std::string line, ChatMsgType::Type own = ChatMsgType::BY_SERVER, const IgnoreRecord ignoreRecord = IgnoreRecord_false, - const bool tryRemoveColors = true); + const TryRemoveColors tryRemoveColors + = TryRemoveColors_true); /** * Adds the text to the message list diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 44053c50c..178f41c7e 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1509,7 +1509,7 @@ bool ChatWindow::resortChatLog(std::string line, ChatMsgType::Type own, const std::string &channel, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors) + const TryRemoveColors tryRemoveColors) { if (own == ChatMsgType::BY_UNKNOWN) { @@ -1537,8 +1537,10 @@ bool ChatWindow::resortChatLog(std::string line, { if (tradeChatTab) { - tradeChatTab->chatLog(prefix + line, own, - ignoreRecord, tryRemoveColors); + tradeChatTab->chatLog(prefix + line, + own, + ignoreRecord, + tryRemoveColors); } return false; } @@ -1600,7 +1602,9 @@ bool ChatWindow::resortChatLog(std::string line, if (tradeChatTab) { line = line.erase(idx + 2, 2); - tradeChatTab->chatLog(prefix + line, own, ignoreRecord, + tradeChatTab->chatLog(prefix + line, + own, + ignoreRecord, tryRemoveColors); } return false; @@ -1620,8 +1624,10 @@ bool ChatWindow::resortChatLog(std::string line, { if (line.find("http", idx1) != idx1 + 2) { - tradeChatTab->chatLog(prefix + line, own, - ignoreRecord, tryRemoveColors); + tradeChatTab->chatLog(prefix + line, + own, + ignoreRecord, + tryRemoveColors); return false; } } @@ -1639,8 +1645,10 @@ bool ChatWindow::resortChatLog(std::string line, } else if (mShowAllLang) { - langChatTab->chatLog(prefix + line, own, - ignoreRecord, tryRemoveColors); + langChatTab->chatLog(prefix + line, + own, + ignoreRecord, + tryRemoveColors); } } else if (serverFeatures->haveChatChannels()) @@ -1650,8 +1658,10 @@ bool ChatWindow::resortChatLog(std::string line, } else if (mShowAllLang) { - localChatTab->chatLog(prefix + line, own, - ignoreRecord, tryRemoveColors); + localChatTab->chatLog(prefix + line, + own, + ignoreRecord, + tryRemoveColors); } } else if (localChatTab && channel.empty()) @@ -1663,7 +1673,7 @@ bool ChatWindow::resortChatLog(std::string line, void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors) + const TryRemoveColors tryRemoveColors) { if (own == ChatMsgType::BY_UNKNOWN) own = ChatMsgType::BY_SERVER; @@ -1677,7 +1687,7 @@ void ChatWindow::channelChatLog(const std::string &channel, const std::string &line, ChatMsgType::Type own, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors) + const TryRemoveColors tryRemoveColors) { std::string tempChannel = channel; toLower(tempChannel); diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 766e5161e..3077b9e8b 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -26,6 +26,7 @@ #include "enums/gui/chatmsgtype.h" #include "enums/simpletypes/ignorerecord.h" +#include "enums/simpletypes/tryremovecolors.h" #include "gui/widgets/window.h" @@ -224,20 +225,21 @@ class ChatWindow final : public Window, bool resortChatLog(std::string line, ChatMsgType::Type own, const std::string &channel, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors); + const TryRemoveColors tryRemoveColors); static void battleChatLog(const std::string &line, ChatMsgType::Type own = ChatMsgType::BY_UNKNOWN, const IgnoreRecord ignoreRecord = IgnoreRecord_false, - const bool tryRemoveColors = true); + const TryRemoveColors tryRemoveColors + = TryRemoveColors_true); void channelChatLog(const std::string &channel, const std::string &line, ChatMsgType::Type own, const IgnoreRecord ignoreRecord, - const bool tryRemoveColors); + const TryRemoveColors tryRemoveColors); void updateOnline(const std::set<std::string> &onlinePlayers) const; |