From 860d3e8e1bbe99b77763d533aebba9fde01e74c6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 24 May 2015 21:49:22 +0300 Subject: Add strong typed bool type IgnoreRecord. --- src/gui/widgets/tabs/chat/chattab.cpp | 11 ++++++++--- src/gui/widgets/tabs/chat/chattab.h | 3 ++- src/gui/windows/chatwindow.cpp | 10 ++++++---- src/gui/windows/chatwindow.h | 9 ++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index bd3759c65..072ab677e 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -106,8 +106,10 @@ ChatTab::~ChatTab() delete2(mScrollArea); } -void ChatTab::chatLog(std::string line, ChatMsgType::Type own, - const bool ignoreRecord, const bool tryRemoveColors) +void ChatTab::chatLog(std::string line, + ChatMsgType::Type own, + const IgnoreRecord ignoreRecord, + const bool tryRemoveColors) { // Trim whitespace trim(line); @@ -359,7 +361,10 @@ void ChatTab::chatLog(const std::string &nick, std::string msg) ? ChatMsgType::BY_PLAYER : ChatMsgType::BY_OTHER); if (byWho == ChatMsgType::BY_OTHER && config.getBoolValue("removeColors")) msg = removeColors(msg); - chatLog(std::string(nick).append(" : ").append(msg), byWho, false, false); + chatLog(std::string(nick).append(" : ").append(msg), + byWho, + IgnoreRecord_false, + 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 cc694a874..7af3920ef 100644 --- a/src/gui/widgets/tabs/chat/chattab.h +++ b/src/gui/widgets/tabs/chat/chattab.h @@ -25,6 +25,7 @@ #include "enums/gui/chatmsgtype.h" +#include "enums/simpletypes/ignorerecord.h" #include "enums/simpletypes/online.h" #include "gui/widgets/browserbox.h" @@ -79,7 +80,7 @@ class ChatTab notfinal : public Tab */ void chatLog(std::string line, ChatMsgType::Type own = ChatMsgType::BY_SERVER, - const bool ignoreRecord = false, + const IgnoreRecord ignoreRecord = IgnoreRecord_false, const bool tryRemoveColors = true); /** diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index ba882b985..44053c50c 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1114,7 +1114,9 @@ void ChatWindow::addWhisper(const std::string &restrict nick, else { localChatTab->chatLog(std::string(nick).append( - " : ").append(mes), ChatMsgType::ACT_WHISPER, false); + " : ").append(mes), + ChatMsgType::ACT_WHISPER, + IgnoreRecord_false); if (localPlayer) localPlayer->afkRespond(nullptr, nick); } @@ -1506,7 +1508,7 @@ std::string ChatWindow::autoCompleteHistory(const std::string &partName) const bool ChatWindow::resortChatLog(std::string line, ChatMsgType::Type own, const std::string &channel, - const bool ignoreRecord, + const IgnoreRecord ignoreRecord, const bool tryRemoveColors) { if (own == ChatMsgType::BY_UNKNOWN) @@ -1660,7 +1662,7 @@ bool ChatWindow::resortChatLog(std::string line, } void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own, - const bool ignoreRecord, + const IgnoreRecord ignoreRecord, const bool tryRemoveColors) { if (own == ChatMsgType::BY_UNKNOWN) @@ -1674,7 +1676,7 @@ void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own, void ChatWindow::channelChatLog(const std::string &channel, const std::string &line, ChatMsgType::Type own, - const bool ignoreRecord, + const IgnoreRecord ignoreRecord, const bool tryRemoveColors) { std::string tempChannel = channel; diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 90c743284..766e5161e 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -25,6 +25,8 @@ #include "enums/gui/chatmsgtype.h" +#include "enums/simpletypes/ignorerecord.h" + #include "gui/widgets/window.h" #include "gui/widgets/tabs/chat/chattabtype.h" @@ -221,19 +223,20 @@ class ChatWindow final : public Window, bool resortChatLog(std::string line, ChatMsgType::Type own, const std::string &channel, - const bool ignoreRecord, + const IgnoreRecord ignoreRecord, const bool tryRemoveColors); static void battleChatLog(const std::string &line, ChatMsgType::Type own = ChatMsgType::BY_UNKNOWN, - const bool ignoreRecord = false, + const IgnoreRecord ignoreRecord + = IgnoreRecord_false, const bool tryRemoveColors = true); void channelChatLog(const std::string &channel, const std::string &line, ChatMsgType::Type own, - const bool ignoreRecord, + const IgnoreRecord ignoreRecord, const bool tryRemoveColors); void updateOnline(const std::set &onlinePlayers) const; -- cgit v1.2.3-70-g09d2