summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-08 12:36:22 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-08 12:36:22 +0300
commitd0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57 (patch)
treec1fc8dd2d9ddbc04f8893139276b8a35346ae2d1 /src/gui
parente2dfb4d9242f74e566416be7f3ad6ac529fac520 (diff)
downloadmanaplus-d0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57.tar.gz
manaplus-d0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57.tar.bz2
manaplus-d0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57.tar.xz
manaplus-d0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57.zip
add autocomplete support for online list.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chatwindow.cpp6
-rw-r--r--src/gui/whoisonline.cpp7
-rw-r--r--src/gui/whoisonline.h2
3 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index b33a14a0e..04c2a2d9a 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -43,6 +43,7 @@
#include "gui/sdlfont.h"
#include "gui/sdlinput.h"
#include "gui/viewport.h"
+#include "gui/whoisonline.h"
#include "gui/widgets/battletab.h"
#include "gui/widgets/dropdown.h"
@@ -1262,6 +1263,11 @@ void ChatWindow::autoComplete()
}
if (newName.empty())
newName = autoComplete(name, &mCustomWords);
+ if (newName.empty())
+ {
+ whoIsOnline->getPlayerNames(nameList);
+ newName = autoComplete(nameList, name);
+ }
if (!newName.empty())
{
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index e5eb90cd1..741e1e771 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -797,6 +797,13 @@ void WhoIsOnline::setNeutralColor(OnlinePlayer *const player)
player->setText("0");
}
+void WhoIsOnline::getPlayerNames(StringVect &names)
+{
+ names.clear();
+ FOR_EACH (std::set<std::string>::const_iterator, it, mOnlineNicks)
+ names.push_back(*it);
+}
+
void OnlinePlayer::setText(std::string color)
{
mText.clear();
diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h
index 8301897cb..f3d299f41 100644
--- a/src/gui/whoisonline.h
+++ b/src/gui/whoisonline.h
@@ -154,6 +154,8 @@ public:
void setNeutralColor(OnlinePlayer *const player);
+ void getPlayerNames(StringVect &names);
+
private:
void download();