From 9f2993aaa89a4a837455e78a4e00826a779b036c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 18 Aug 2016 22:05:19 +0300 Subject: Add baic menu into social window menu button. Allow create/leave party or guild. --- src/gui/windows/socialwindow.cpp | 47 +++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'src/gui/windows/socialwindow.cpp') 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) -- cgit v1.2.3-60-g2f50