diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-31 00:55:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-31 00:55:36 +0300 |
commit | ecd8811f15034a6c895a81c0153a4b154dbc1061 (patch) | |
tree | c451e027766b6e455033eca468e383de95a81fb0 | |
parent | d4f7f4f688c3660440e0ac0d752ec9db036cdf59 (diff) | |
download | plus-ecd8811f15034a6c895a81c0153a4b154dbc1061.tar.gz plus-ecd8811f15034a6c895a81c0153a4b154dbc1061.tar.bz2 plus-ecd8811f15034a6c895a81c0153a4b154dbc1061.tar.xz plus-ecd8811f15034a6c895a81c0153a4b154dbc1061.zip |
Improve chattab class.
-rw-r--r-- | src/gui/widgets/battletab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/battletab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 13 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/gmtab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/gmtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/guildchattab.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/langtab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/langtab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tradetab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tradetab.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 2 | ||||
-rw-r--r-- | src/net/ea/gui/guildtab.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/gui/guildtab.h | 4 | ||||
-rw-r--r-- | src/net/ea/gui/partytab.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/gui/partytab.h | 4 |
18 files changed, 32 insertions, 31 deletions
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp index 005cea05a..5cc770478 100644 --- a/src/gui/widgets/battletab.cpp +++ b/src/gui/widgets/battletab.cpp @@ -49,7 +49,7 @@ BattleTab::~BattleTab() { } -void BattleTab::saveToLogFile(std::string &msg) +void BattleTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log(std::string("#Battle"), std::string(msg)); diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h index 55b922f70..2377cb591 100644 --- a/src/gui/widgets/battletab.h +++ b/src/gui/widgets/battletab.h @@ -40,7 +40,7 @@ class BattleTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_BATTLE; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; }; extern BattleTab *battleChatTab; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 339d124f7..df84368f9 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -281,10 +281,11 @@ void ChatTab::chatLog(std::string line, Own own, return; } - if (!getTabbedArea()) + TabbedArea *const tabArea = getTabbedArea(); + if (!tabArea) return; - if (this != getTabbedArea()->getSelectedTab()) + if (this != tabArea->getSelectedTab()) { if (getFlash() == 0) { @@ -306,7 +307,7 @@ void ChatTab::chatLog(std::string line, Own own, } if ((getAllowHighlight() || own == BY_GM) - && (this != getTabbedArea()->getSelectedTab() + && (this != tabArea->getSelectedTab() || (Client::getIsMinimized() || (!Client::getMouseFocused() && !Client::getInputFocused())))) { @@ -443,7 +444,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args) return handleCommand(type, args); } -void ChatTab::saveToLogFile(std::string &msg) +void ChatTab::saveToLogFile(const std::string &msg) { if (getType() == TAB_INPUT && chatLogger) chatLogger->log(msg); @@ -480,7 +481,7 @@ void ChatTab::addRow(std::string &line) mTextOutput->addRow(line); } -void ChatTab::loadFromLogFile(std::string name) +void ChatTab::loadFromLogFile(const std::string &name) { if (chatLogger) { @@ -512,7 +513,7 @@ void ChatTab::addNewRow(std::string &line) mScrollArea->logic(); } -void ChatTab::playNewMessageSound() +void ChatTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_WHISPER); } diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 7cec0c18d..f45f78668 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -141,7 +141,7 @@ class ChatTab : public Tab */ virtual int getType() const A_WARN_UNUSED; - virtual void saveToLogFile(std::string &msg); + virtual void saveToLogFile(const std::string &msg); std::list<std::string> &getRows() const A_WARN_UNUSED { return mTextOutput->getRows(); } @@ -149,7 +149,7 @@ class ChatTab : public Tab bool hasRows() const A_WARN_UNUSED { return mTextOutput->hasRows(); } - void loadFromLogFile(std::string name); + void loadFromLogFile(const std::string &name); bool getAllowHighlight() const A_WARN_UNUSED { return mAllowHightlight; } @@ -174,7 +174,7 @@ class ChatTab : public Tab void showOnline(const std::string &nick, const bool isOnline); - virtual void playNewMessageSound(); + virtual void playNewMessageSound() const; const std::string &getChannelName() const { return mChannelName; } diff --git a/src/gui/widgets/gmtab.cpp b/src/gui/widgets/gmtab.cpp index 7c356ec43..854a67692 100644 --- a/src/gui/widgets/gmtab.cpp +++ b/src/gui/widgets/gmtab.cpp @@ -56,7 +56,7 @@ void GmTab::handleCommand(const std::string &msg A_UNUSED) { } -void GmTab::saveToLogFile(std::string &msg) +void GmTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log("#GM", msg); diff --git a/src/gui/widgets/gmtab.h b/src/gui/widgets/gmtab.h index c0a2ffdd8..64a53b1fc 100644 --- a/src/gui/widgets/gmtab.h +++ b/src/gui/widgets/gmtab.h @@ -38,7 +38,7 @@ class GmTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_GM; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; protected: void getAutoCompleteList(StringVect &names) const override; diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index 0ce3cda1c..dd55b3a39 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -138,13 +138,13 @@ void GuildChatTab::getAutoCompleteList(StringVect &names) const names.push_back("/notice "); } -void GuildChatTab::saveToLogFile(std::string &msg) +void GuildChatTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log("#Guild", msg); } -void GuildChatTab::playNewMessageSound() +void GuildChatTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); } diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index 1303d6f39..03170626b 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -42,12 +42,12 @@ class GuildChatTab final : public ChatTab, public ConfigListener void showHelp() override; - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; int getType() const override A_WARN_UNUSED { return ChatTab::TAB_GUILD; } - void playNewMessageSound() override; + void playNewMessageSound() const override; void optionChanged(const std::string &value) override; diff --git a/src/gui/widgets/langtab.cpp b/src/gui/widgets/langtab.cpp index f61c7e348..ddad893b9 100644 --- a/src/gui/widgets/langtab.cpp +++ b/src/gui/widgets/langtab.cpp @@ -36,7 +36,7 @@ LangTab::~LangTab() { } -void LangTab::saveToLogFile(std::string &msg) +void LangTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log(std::string("#Lang"), std::string(msg)); diff --git a/src/gui/widgets/langtab.h b/src/gui/widgets/langtab.h index c594981ad..e4359a9e5 100644 --- a/src/gui/widgets/langtab.h +++ b/src/gui/widgets/langtab.h @@ -35,7 +35,7 @@ class LangTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_LANG; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; }; extern LangTab *langChatTab; diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp index b3fc2dcbe..e2ef34536 100644 --- a/src/gui/widgets/tradetab.cpp +++ b/src/gui/widgets/tradetab.cpp @@ -51,7 +51,7 @@ void TradeTab::handleInput(const std::string &msg) ChatTab::handleInput(str); } -void TradeTab::saveToLogFile(std::string &msg) +void TradeTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log(std::string("#Trade"), std::string(msg)); diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h index e7fe67bf3..01b6b0946 100644 --- a/src/gui/widgets/tradetab.h +++ b/src/gui/widgets/tradetab.h @@ -40,7 +40,7 @@ class TradeTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_TRADE; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; protected: void handleInput(const std::string &msg) override; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 6f3ddbcdb..45e1b12c4 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -157,7 +157,7 @@ bool WhisperTab::handleCommand(const std::string &type, return true; } -void WhisperTab::saveToLogFile(std::string &msg) +void WhisperTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log(getNick(), msg); diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 9bfc1ce20..89f961b00 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -46,7 +46,7 @@ class WhisperTab final : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_WHISPER; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; void setWhisperTabColors(); diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index aa89309b1..38a384629 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -158,13 +158,13 @@ void GuildTab::getAutoCompleteList(StringVect &names) const names.push_back("/notice "); } -void GuildTab::saveToLogFile(std::string &msg) +void GuildTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log("#Guild", msg); } -void GuildTab::playNewMessageSound() +void GuildTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); } diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h index 28b689f79..1fe57437d 100644 --- a/src/net/ea/gui/guildtab.h +++ b/src/net/ea/gui/guildtab.h @@ -45,12 +45,12 @@ class GuildTab : public ChatTab, public ConfigListener void showHelp() override; - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; int getType() const override A_WARN_UNUSED { return ChatTab::TAB_GUILD; } - void playNewMessageSound() override; + void playNewMessageSound() const override; void optionChanged(const std::string &value) override; diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 5b3184038..78105d3ad 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -274,13 +274,13 @@ void PartyTab::getAutoCompleteList(StringVect &names) const p->getNames(names); } -void PartyTab::saveToLogFile(std::string &msg) +void PartyTab::saveToLogFile(const std::string &msg) { if (chatLogger) chatLogger->log("#Party", msg); } -void PartyTab::playNewMessageSound() +void PartyTab::playNewMessageSound() const { soundManager.playGuiSound(SOUND_GUILD); } diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h index 983e6efb2..16c9e8a3f 100644 --- a/src/net/ea/gui/partytab.h +++ b/src/net/ea/gui/partytab.h @@ -48,9 +48,9 @@ class PartyTab : public ChatTab int getType() const override A_WARN_UNUSED { return ChatTab::TAB_PARTY; } - void saveToLogFile(std::string &msg) override; + void saveToLogFile(const std::string &msg) override; - void playNewMessageSound() override; + void playNewMessageSound() const override; protected: void handleInput(const std::string &msg) override; |