diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 47 | ||||
-rw-r--r-- | src/gui/chat.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 11 |
4 files changed, 32 insertions, 33 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 8baf702e..7861bdb6 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -19,24 +19,25 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <guichan/focushandler.hpp> - #include "chat.h" -#include "chatinput.h" -#include "itemlinkhandler.h" -#include "recorder.h" -#include "scrollarea.h" -#include "sdlinput.h" -#include "widgets/tabbedarea.h" -#include "widgets/whispertab.h" +#include "gui/chatinput.h" +#include "gui/itemlinkhandler.h" +#include "gui/recorder.h" +#include "gui/scrollarea.h" +#include "gui/sdlinput.h" -#include "../beingmanager.h" -#include "../configuration.h" -#include "../localplayer.h" +#include "gui/widgets/tabbedarea.h" +#include "gui/widgets/whispertab.h" -#include "../utils/dtor.h" -#include "../utils/stringutils.h" +#include "beingmanager.h" +#include "configuration.h" +#include "localplayer.h" + +#include "utils/dtor.h" +#include "utils/stringutils.h" + +#include <guichan/focushandler.hpp> #ifdef TMWSERV_SUPPORT ChatWindow::ChatWindow(): @@ -140,20 +141,21 @@ void ChatWindow::logic() Window::logic(); Tab *tab = getFocused(); - if (tab != currentTab) { - currentTab == tab; + if (tab != mCurrentTab) { + mCurrentTab = tab; adjustTabSize(); } } -ChatTab* ChatWindow::getFocused() const +ChatTab *ChatWindow::getFocused() const { return dynamic_cast<ChatTab*>(mChatTabs->getSelectedTab()); } -void ChatWindow::clearTab(ChatTab* tab) +void ChatWindow::clearTab(ChatTab *tab) { - if (tab) tab->clearText(); + if (tab) + tab->clearText(); } void ChatWindow::clearTab() @@ -373,11 +375,8 @@ void ChatWindow::whisper(std::string nick, std::string mes, bool own) toLower(playerName); toLower(tempNick); - if (tempNick.compare(playerName) == 0) - if (own) - ; - else - return; + if (!own && tempNick.compare(playerName) == 0) + return; ChatTab *tab = mWhispers[tempNick]; diff --git a/src/gui/chat.h b/src/gui/chat.h index 736f9284..7c080960 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -213,7 +213,7 @@ class ChatWindow : public Window, /** Tabbed area for holding each channel. */ TabbedArea *mChatTabs; - Tab *currentTab; + Tab *mCurrentTab; typedef std::map<const std::string, ChatTab*> TabMap; /** Manage whisper tabs */ diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index b67b74f8..ba469c00 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -47,8 +47,9 @@ #include "../../utils/strprintf.h" #include "../../utils/stringutils.h" -WhisperTab::WhisperTab(std::string nick) : ChatTab(nick), - mNick(nick) +WhisperTab::WhisperTab(const std::string &nick) : + ChatTab(nick), + mNick(nick) { } diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 059346fa..e3ebf0f3 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -27,24 +27,23 @@ class Channel; /** - * A tab for whispers from a single nick. + * A tab for whispers from a single player. */ class WhisperTab : public ChatTab { public: - std::string getNick() { return mNick; } + const std::string &getNick() const { return mNick; } protected: friend class ChatWindow; /** * Constructor. + * + * @param nick the name of the player this tab is whispering to */ - WhisperTab(std::string nick); + WhisperTab(const std::string &nick); - /** - * Destructor. - */ ~WhisperTab(); void sendChat(std::string &msg); |