diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-02-22 16:49:38 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-02-22 16:53:32 -0700 |
commit | 00cbc7490641a697dbedb85b3b2ff3f75893b7ff (patch) | |
tree | a8ac366342a9138063eefca13ea2440042b32b84 /src/gui | |
parent | dc3b7dc6001c64bd9473518299c74f292b521516 (diff) | |
download | mana-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.gz mana-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.bz2 mana-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.xz mana-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.zip |
Change chat autocompletion to be more flexible
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 15 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 2 |
5 files changed, 4 insertions, 33 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 3a47cd16..954ee3f0 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -521,15 +521,9 @@ void ChatWindow::autoComplete() ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab()); std::vector<std::string> nameList; - if (cTab && cTab->getType() == ChatTab::PARTY) - { - Party *p = player_node->getParty(); - - if (p) // Shouldn't be needed, but lets be safe - p->getNames(nameList); + cTab->getAutoCompleteList(nameList); + newName = autoComplete(nameList, name); - newName = autoComplete(nameList, name); - } if (newName == "") { beingManager->getPlayerNames(nameList, true); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d2221255..ee4197eb 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -275,11 +275,6 @@ void ChatTab::handleCommand(const std::string &msg) commandHandler->handleCommand(msg, this); } -int ChatTab::getType() const -{ - return INPUT; -} - void ChatTab::addRow(std::string &line) { std::string::size_type idx = 0; diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 8fa0ab71..3a4133bb 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -48,14 +48,6 @@ enum class ChatTab : public Tab { public: - enum Type - { - UNKNOWN, - INPUT, - WHISPER, - PARTY - }; - /** * Constructor. */ @@ -119,11 +111,6 @@ class ChatTab : public Tab const std::string &args) { return false; } - /** - * Returns type of the being. - */ - virtual int getType() const; - protected: friend class ChatWindow; friend class WhisperWindow; @@ -134,6 +121,8 @@ class ChatTab : public Tab virtual void handleCommand(const std::string &msg); + virtual void getAutoCompleteList(std::vector<std::string>&) const {} + void addRow(std::string &line); ScrollArea *mScrollArea; diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index 9707953e..124b3165 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -114,8 +114,3 @@ bool WhisperTab::handleCommand(const std::string &type, return true; } - -int WhisperTab::getType() const -{ - return ChatTab::WHISPER; -} diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 146ea5c5..447a8fe0 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -39,8 +39,6 @@ class WhisperTab : public ChatTab bool handleCommand(const std::string &type, const std::string &args); - int getType() const; - protected: friend class ChatWindow; |