diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-28 00:31:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-28 03:08:31 +0300 |
commit | 40f34b7ba7317f5f5c3dfbed0b291be9555d3137 (patch) | |
tree | 512bd693c37b8ad710a0f752abe3ac04e3c8ea77 /src/gui/whoisonline.h | |
parent | 8333597dfaecfca2cac6b98390a8fb7131cb2a09 (diff) | |
download | mv-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.gz mv-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.bz2 mv-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.tar.xz mv-40f34b7ba7317f5f5c3dfbed0b291be9555d3137.zip |
Add basic support for extended online list on evol server.
Diffstat (limited to 'src/gui/whoisonline.h')
-rw-r--r-- | src/gui/whoisonline.h | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index ade391d5a..ef25257da 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -42,6 +42,62 @@ class ScrollArea; struct SDL_Thread; +class OnlinePlayer +{ + public: + OnlinePlayer(std::string nick, int status, int level, int version) : + mNick(nick), + mText(""), + mStatus(status), + mLevel(level), + mVersion(version) + { + } + + const std::string getNick() const + { + return mNick; + } + + int getStaus() const + { + return mStatus; + } + + int getVersion() const + { + return mVersion; + } + + int getLevel() const + { + return mLevel; + } + + const std::string getText() + { + return mText; + } + + void setText(std::string str); + + void setLevel(int level) + { + mLevel = level; + } + + private: + std::string mNick; + + std::string mText; + + int mStatus; + + int mLevel; + + int mVersion; +}; + /** * Update progress window GUI * @@ -52,7 +108,7 @@ class WhoIsOnline : public Window, public gcn::ActionListener, public ConfigListener { - public: +public: /** * Constructor. */ @@ -68,7 +124,7 @@ class WhoIsOnline : public Window, */ void loadWebList(); - void loadList(std::vector<std::string> &list); + void loadList(std::vector<OnlinePlayer*> &list); void handleLink(const std::string& link, gcn::MouseEvent *event); @@ -78,9 +134,12 @@ class WhoIsOnline : public Window, void widgetResized(const gcn::Event &event); - std::set<std::string> &getOnlinePlayers() + const std::set<OnlinePlayer*> &getOnlinePlayers() { return mOnlinePlayers; } + const std::set<std::string> &getOnlineNicks() + { return mOnlineNicks; } + void setAllowUpdate(bool n) { mAllowUpdate = n; } @@ -109,10 +168,10 @@ private: const std::string prepareNick(std::string nick, int level, std::string color) const; - void updateWindow(std::vector<std::string> &friends, - std::vector<std::string> &neutral, - std::vector<std::string> &disregard, - std::vector<std::string> enemy, + void updateWindow(std::vector<OnlinePlayer*> &friends, + std::vector<OnlinePlayer*> &neutral, + std::vector<OnlinePlayer*> &disregard, + std::vector<OnlinePlayer*> enemy, int numOnline); enum DownloadStatus @@ -143,7 +202,8 @@ private: BrowserBox *mBrowserBox; ScrollArea *mScrollArea; time_t mUpdateTimer; - std::set<std::string> mOnlinePlayers; + std::set<OnlinePlayer*> mOnlinePlayers; + std::set<std::string> mOnlineNicks; gcn::Button *mUpdateButton; bool mAllowUpdate; |