From 49ab517a6c51a14ab7ae72143f4364b1e1416a2f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Apr 2012 03:50:43 +0300 Subject: Cache some settings om chat window. --- src/gui/chatwindow.cpp | 12 +++++++++--- src/gui/chatwindow.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index a91a8fc82..191348897 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -163,7 +163,8 @@ ChatWindow::ChatWindow(): mChatHistoryIndex(0), mGMLoaded(false), mHaveMouse(false), - mAutoHide(false) + mAutoHide(false), + mShowBattleEvents(false) { listen(CHANNEL_NOTICES); listen(CHANNEL_ATTRIBUTES); @@ -230,12 +231,15 @@ ChatWindow::ChatWindow(): parseHighlights(); config.addListener("autohideChat", this); + config.addListener("showBattleEvents", this); + mAutoHide = config.getBoolValue("autohideChat"); + mShowBattleEvents = config.getBoolValue("showBattleEvents"); } ChatWindow::~ChatWindow() { - config.removeListener("autohideChat", this); + config.removeListeners(this); saveState(); config.setValue("ReturnToggles", mReturnToggles); removeAllWhispers(); @@ -917,7 +921,7 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event) } else if (channel == CHANNEL_ATTRIBUTES) { - if (!config.getBoolValue("showBattleEvents")) + if (!mShowBattleEvents) return; if (event.getName() == EVENT_UPDATEATTRIBUTE) @@ -1651,6 +1655,8 @@ void ChatWindow::optionChanged(const std::string &name) { if (name == "autohideChat") mAutoHide = config.getBoolValue("autohideChat"); + else if (name == "showBattleEvents") + mShowBattleEvents = config.getBoolValue("showBattleEvents"); } void ChatWindow::mouseMoved(gcn::MouseEvent &event) diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 05882aa69..336f0cb72 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -352,6 +352,7 @@ class ChatWindow : public Window, bool mGMLoaded; bool mHaveMouse; bool mAutoHide; + bool mShowBattleEvents; }; extern ChatWindow *chatWindow; -- cgit v1.2.3-60-g2f50