diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-18 22:05:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-18 22:05:19 +0300 |
commit | 9f2993aaa89a4a837455e78a4e00826a779b036c (patch) | |
tree | c36c593f320c9590a04b0791d1239ae4ebb94f57 /src/gui/windows | |
parent | 215ce3e68738159ec98056874a4ad86e451418d0 (diff) | |
download | mv-9f2993aaa89a4a837455e78a4e00826a779b036c.tar.gz mv-9f2993aaa89a4a837455e78a4e00826a779b036c.tar.bz2 mv-9f2993aaa89a4a837455e78a4e00826a779b036c.tar.xz mv-9f2993aaa89a4a837455e78a4e00826a779b036c.zip |
Add baic menu into social window menu button.
Allow create/leave party or guild.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/socialwindow.cpp | 47 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.h | 8 |
2 files changed, 48 insertions, 7 deletions
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 2d53536bd..52507a422 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -21,6 +21,8 @@ #include "gui/windows/socialwindow.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/okdialog.h" #include "gui/windows/setupwindow.h" @@ -70,7 +72,7 @@ SocialWindow::SocialWindow() : mFriends(new SocialFriendsTab(this, _("F"), getOptionBool("showtabbackground"))), // TRANSLATORS: social window button - mCreateButton(new Button(this, _("Create"), "create", this)), + mMenuButton(new Button(this, _("Menu"), "menu", this)), mCountLabel(new Label(this, "1000 / 1000")), mTabs(CREATEWIDGETR(TabbedArea, this)), mMap(nullptr), @@ -98,7 +100,7 @@ void SocialWindow::postInit() if (setupWindow) setupWindow->registerWindowForReset(this); - place(0, 0, mCreateButton); + place(0, 0, mMenuButton); place(0, 1, mCountLabel); place(0, 2, mTabs, 2, 4); @@ -322,6 +324,34 @@ void SocialWindow::action(const ActionEvent &event) mGuildInvited = 0; mGuildAcceptDialog = nullptr; } + else if (eventId == "party") + { + popupMenu->showPartyPopup(); + } + else if (eventId == "guild") + { + popupMenu->showGuildPopup(); + } + else if (eventId == "attack") + { + popupMenu->showAttackPopup(); + } + else if (eventId == "friends") + { + popupMenu->showFriendsPopup(); + } + else if (eventId == "navigation") + { + popupMenu->showNavigationPopup(); + } + else if (eventId == "pickup") + { + popupMenu->showPickupPopup(); + } + else if (eventId == "players") + { + popupMenu->showPlayersPopup(); + } } void SocialWindow::showGuildInvite(const std::string &restrict guildName, @@ -560,16 +590,23 @@ void SocialWindow::widgetResized(const Event &event) mTabs->adjustSize(); } -void SocialWindow::setCounter(const SocialTab *const tab, - const std::string &str) +void SocialWindow::updateCounter(const SocialTab *const tab, + const std::string &counter) { if (mTabs->getSelectedTab() == tab) { - mCountLabel->setCaption(str); + mCountLabel->setCaption(counter); mCountLabel->adjustSize(); } } +void SocialWindow::updateMenu(const SocialTab *const tab, + const std::string &menu) +{ + if (mTabs->getSelectedTab() == tab) + mMenuButton->setActionEventId(menu); +} + void SocialWindow::updateGuildCounter(const int online, const int total) { if (!localPlayer) diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h index b2bd1409f..4c2f82068 100644 --- a/src/gui/windows/socialwindow.h +++ b/src/gui/windows/socialwindow.h @@ -117,7 +117,11 @@ class SocialWindow final : public Window, void widgetResized(const Event &event) override final; - void setCounter(const SocialTab *const tab, const std::string &str); + void updateCounter(const SocialTab *const tab, + const std::string &count); + + void updateMenu(const SocialTab *const tab, + const std::string &menu); void updateGuildCounter(const int online = 0, const int total = 0); @@ -151,7 +155,7 @@ class SocialWindow final : public Window, SocialTab *mNavigation A_NONNULLPOINTER; SocialTab *mFriends A_NONNULLPOINTER; - Button *mCreateButton A_NONNULLPOINTER; + Button *mMenuButton A_NONNULLPOINTER; Label *mCountLabel A_NONNULLPOINTER; TabbedArea *mTabs A_NONNULLPOINTER; Map *mMap; |