diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-26 16:57:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-27 05:37:27 +0300 |
commit | 12bf548533867a2eb3a1c354b778ef7f9157322a (patch) | |
tree | 3cb6f61396f00a5d3fa280ecd9d99f309f06f4ca /src/gui/socialwindow.cpp | |
parent | 2e7bfc350d38e16b3d340f8e4ea69e6ff6748f5c (diff) | |
download | plus-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.gz plus-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.bz2 plus-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.xz plus-12bf548533867a2eb3a1c354b778ef7f9157322a.zip |
Basic support for guild bot integration.
Not working context menu actions, chat commands, auto complete.
Diffstat (limited to 'src/gui/socialwindow.cpp')
-rw-r--r-- | src/gui/socialwindow.cpp | 111 |
1 files changed, 109 insertions, 2 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index e3aa69b30..aa26fa051 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -206,6 +206,109 @@ private: Guild *mGuild; }; +class GuildTab2 : public SocialTab, public gcn::ActionListener +{ +public: + GuildTab2(Guild *guild): + mGuild(guild) + { + setCaption(_("Guild")); + + setTabColor(&Theme::getThemeColor(Theme::GUILD_SOCIAL_TAB)); + + mList = new AvatarListBox(guild); + mScroll = new ScrollArea(mList); + + mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO); + mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); + } + + ~GuildTab2() + { + delete mList; + mList = 0; + delete mScroll; + mScroll = 0; + } + + void action(const gcn::ActionEvent &event) + { +/* + if (event.getId() == "do invite") + { + std::string name = mInviteDialog->getText(); + Net::getGuildHandler()->invite(mGuild->getId(), name); + + if (localChatTab) + { + localChatTab->chatLog(strprintf( + _("Invited user %s to guild %s."), + name.c_str(), mGuild->getName().c_str()), BY_SERVER); + } + mInviteDialog = 0; + } + else if (event.getId() == "~do invite") + { + mInviteDialog = 0; + } + else if (event.getId() == "yes") + { + Net::getGuildHandler()->leave(mGuild->getId()); + if (localChatTab) + { + localChatTab->chatLog(strprintf(_("Guild %s quit requested."), + mGuild->getName().c_str()), BY_SERVER); + } + mConfirmDialog = 0; + } + else if (event.getId() == "~yes") + { + mConfirmDialog = 0; + } +*/ + } + + void updateList() + { + } + + void updateAvatar(std::string name A_UNUSED) + { + } + + void resetDamage(std::string name A_UNUSED) + { + } + +protected: + void invite() + { +/* + mInviteDialog = new TextDialog(_("Member Invite to Guild"), + strprintf(_("Who would you like to invite to guild %s?"), + mGuild->getName().c_str()), + socialWindow); + mInviteDialog->setActionEventId("do invite"); + mInviteDialog->addActionListener(this); +*/ + } + + void leave() + { +/* + mConfirmDialog = new ConfirmDialog(_("Leave Guild?"), + strprintf(_("Are you sure you want to leave guild %s?"), + mGuild->getName().c_str()), + socialWindow); + + mConfirmDialog->addActionListener(this); +*/ + } + +private: + Guild *mGuild; +}; + class PartyTab : public SocialTab, public gcn::ActionListener { public: @@ -1106,9 +1209,13 @@ bool SocialWindow::addTab(Guild *guild) if (mGuilds.find(guild) != mGuilds.end()) return false; - GuildTab *tab = new GuildTab(guild); - mGuilds[guild] = tab; + SocialTab *tab = 0; + if (guild->getServerGuild()) + tab = new GuildTab(guild); + else + tab = new GuildTab2(guild); + mGuilds[guild] = tab; mTabs->addTab(tab, tab->mScroll); updateButtons(); |