diff options
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; |