summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgroup.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-09-29 19:37:05 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-09-29 19:37:05 +0000
commit606b381c9fbc43c214afd26fb2e2598eec656b66 (patch)
tree422a6d5d94d50bd97ac5bcbdb52f0f6de083c6e7 /indra/newview/llpanelgroup.cpp
parent751cc7cf68bb4d766e8ecaaf76af054dcfbbe9dc (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1830 https://svn.aws.productengine.com/secondlife/pe/stable-2@1839 -> viewer-2.0.0-3
JIRAS: EXT-96 EXT-204 EXT-312 EXT-334 EXT-479 EXT-498 EXT-514 EXT-637 EXT-647 EXT-746 EXT-748 EXT-749 EXT-757 EXT-789 EXT-794 EXT-808 EXT-817 EXT-823 EXT-831 EXT-834 EXT-837 EXT-844 EXT-848 EXT-862 EXT-876 EXT-896 EXT-897 EXT-898 EXT-899 EXT-910 EXT-912 EXT-918 EXT-921 EXT-925 EXT-926 EXT-928 EXT-930 EXT-931 EXT-935 EXT-938 EXT-939 EXT-952 EXT-985 EXT-986 EXT-992 EXT-994 EXT-995 EXT-996 EXT-997 EXT-998 EXT-1001 EXT-1004 EXT-1010 EXT-1012 EXT-1016 EXT-1018 EXT-1020 EXT-1028 EXT-1041 EXT-1044 EXT-1051 EXT-1052 EXT-1061 EXT-1069 EXT-1071 EXT-1074 EXT-1075 EXT-1076 EXT-1078 EXT-1080 EXT-1081 EXT-1082 EXT-1083 EXT-1085 EXT-1092 EXT-1093 EXT-1099 EXT-1100 EXT-1101 EXT-1104 EXT-1106 EXT-1111 EXT-1113 EXT-1114 EXT-1115 EXT-1116 EXT-1118 EXT-1119 EXT-1129 EXT-1132 EXT-1135 EXT-1138 EXT-1142 EXT-1161 EXT-1162 EXT-1178 EXT-1180 * NEW DEVELOPMENT: * EXT-898 - Add dock/undock support for camera and movement controls * Avatar list changes * Bottom bar changes: menu, docking, visibility * Camera changes * Camera & Movement Floaters * Dockable Floaters (LLDockableFloater) * Removed LLListCtrl * Toast / Notification changes: signal / destruction changes, ordering * Nearby chat input should display active voice indicator QA NOTES: * Message Well Window is ready to be tested for regression & matching the spec. * Verify Group List Item L&F * Verify All tabs in People Panel * Verify that Picks behavior is not changed
Diffstat (limited to 'indra/newview/llpanelgroup.cpp')
-rw-r--r--indra/newview/llpanelgroup.cpp154
1 files changed, 115 insertions, 39 deletions
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index d1ce6b14ed..490c845c94 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -44,6 +44,9 @@
#include "llfloaterreg.h"
#include "llfloater.h"
+#include "llagent.h"
+#include "llstatusbar.h" // can_afford_transaction()
+
#include "llsidetraypanelcontainer.h"
#include "llpanelgroupnotices.h"
@@ -162,15 +165,25 @@ BOOL LLPanelGroup::postBuild()
button->setEnabled(false);
+ button = getChild<LLButton>("btn_join");
+ button->setVisible(false);
+ button->setEnabled(true);
+
+ button = getChild<LLButton>("btn_cancel");
+ button->setVisible(false); button->setEnabled(true);
+
button = getChild<LLButton>("btn_refresh");
button->setClickedCallback(onBtnRefresh, this);
button->setVisible(mAllowEdit);
getChild<LLButton>("btn_create")->setVisible(false);
- childSetCommitCallback("btn_create",boost::bind(&LLPanelGroup::onBtnCreate,this),NULL);
childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL);
+ childSetCommitCallback("btn_create",boost::bind(&LLPanelGroup::onBtnCreate,this),NULL);
+ childSetCommitCallback("btn_join",boost::bind(&LLPanelGroup::onBtnJoin,this),NULL);
+ childSetCommitCallback("btn_cancel",boost::bind(&LLPanelGroup::onBtnCancel,this),NULL);
+
LLPanelGroupTab* panel_general = findChild<LLPanelGroupTab>("group_general_tab_panel");
LLPanelGroupTab* panel_roles = findChild<LLPanelGroupTab>("group_roles_tab_panel");
LLPanelGroupTab* panel_notices = findChild<LLPanelGroupTab>("group_notices_tab_panel");
@@ -181,41 +194,30 @@ BOOL LLPanelGroup::postBuild()
if(panel_notices) mTabs.push_back(panel_notices);
if(panel_land) mTabs.push_back(panel_land);
+ if(panel_general)
panel_general->setupCtrls(this);
return TRUE;
}
-void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent )
+void LLPanelGroup::reposButton(const std::string& name)
{
- LLPanel::reshape(width, height, called_from_parent );
-
- LLRect btn_rect;
-
- LLButton* button = findChild<LLButton>("btn_apply");
- if(button)
- {
- btn_rect = button->getRect();
- btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
- button->setRect(btn_rect);
- }
-
- button = findChild<LLButton>("btn_create");
- if(button)
- {
- btn_rect = button->getRect();
+ LLButton* button = findChild<LLButton>(name);
+ if(!button)
+ return;
+ LLRect btn_rect = button->getRect();
btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
button->setRect(btn_rect);
- }
+}
+void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent )
+{
+ LLPanel::reshape(width, height, called_from_parent );
- button = findChild<LLButton>("btn_refresh");
- if(button)
- {
- btn_rect = button->getRect();
- btn_rect.setLeftTopAndSize( btn_rect.mLeft, btn_rect.getHeight() + 2, btn_rect.getWidth(), btn_rect.getHeight());
- button->setRect(btn_rect);
- }
+ reposButton("btn_apply");
+ reposButton("btn_create");
+ reposButton("btn_refresh");
+ reposButton("btn_cancel");
}
void LLPanelGroup::onBackBtnClick()
@@ -247,33 +249,94 @@ void LLPanelGroup::onBtnApply(void* user_data)
LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
self->apply();
}
+void LLPanelGroup::onBtnJoin()
+{
+ lldebugs << "joining group: " << mID << llendl;
+
+ LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
+
+ if (gdatap)
+ {
+ S32 cost = gdatap->mMembershipFee;
+ LLSD args;
+ args["COST"] = llformat("%d", cost);
+ LLSD payload;
+ payload["group_id"] = mID;
+
+ if (can_afford_transaction(cost))
+ {
+ LLNotifications::instance().add("JoinGroupCanAfford", args, payload, LLPanelGroup::joinDlgCB);
+ }
+ else
+ {
+ LLNotifications::instance().add("JoinGroupCannotAfford", args, payload);
+ }
+ }
+ else
+ {
+ llwarns << "LLGroupMgr::getInstance()->getGroupData(" << mID << ") was NULL" << llendl;
+ }
+}
+bool LLPanelGroup::joinDlgCB(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ if (option == 1)
+ {
+ // user clicked cancel
+ return false;
+ }
+
+ LLGroupMgr::getInstance()->sendGroupMemberJoin(notification["payload"]["group_id"].asUUID());
+ return false;
+}
+
+void LLPanelGroup::onBtnCancel()
+{
+ onBackBtnClick();
+}
void LLPanelGroup::changed(LLGroupChange gc)
{
for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
(*it)->update(gc);
-
- LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
- if(gdatap)
- childSetValue("group_name", gdatap->mName);
+ update(gc);
}
void LLPanelGroup::notifyObservers()
{
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- (*it)->update(GC_ALL);
+ changed(GC_ALL);
+}
+void LLPanelGroup::update(LLGroupChange gc)
+{
LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
if(gdatap)
+ {
childSetValue("group_name", gdatap->mName);
-
-}
-
+ LLGroupData agent_gdatap;
+ bool is_member = gAgent.getGroupData(mID,agent_gdatap);
+ LLButton* btn_join = getChild<LLButton>("btn_join");
+ bool join_btn_visible = !is_member && gdatap->mOpenEnrollment;
+ btn_join->setVisible(join_btn_visible);
+ if(join_btn_visible)
+ {
+ LLStringUtil::format_map_t string_args;
+ string_args["[AMOUNT]"] = llformat("%d", gdatap->mMembershipFee);
+ std::string fee_buff = getString("group_join_btn", string_args);
+ btn_join->setLabelSelected(fee_buff);
+ btn_join->setLabelUnselected(fee_buff);
+ }
+ }
+}
void LLPanelGroup::setGroupID(const LLUUID& group_id)
{
+ std::string str_group_id;
+ group_id.toString(str_group_id);
+
LLGroupMgr::getInstance()->removeObserver(this);
mID = group_id;
LLGroupMgr::getInstance()->addObserver(this);
@@ -288,6 +351,8 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
LLButton* button_apply = findChild<LLButton>("btn_apply");
LLButton* button_refresh = findChild<LLButton>("btn_refresh");
LLButton* button_create = findChild<LLButton>("btn_create");
+ LLButton* button_join = findChild<LLButton>("btn_join");
+ LLButton* button_cancel = findChild<LLButton>("btn_cancel");
bool is_null_group_id = group_id == LLUUID::null;
@@ -295,8 +360,11 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
button_apply->setVisible(!is_null_group_id);
if(button_refresh)
button_refresh->setVisible(!is_null_group_id);
+
if(button_create)
button_create->setVisible(is_null_group_id);
+ if(button_cancel)
+ button_cancel->setVisible(!is_null_group_id);
getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);
@@ -307,6 +375,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
if(!tab_general || !tab_roles || !tab_notices || !tab_land)
return;
+
+ if(button_join)
+ button_join->setVisible(false);
if(is_null_group_id)//creating new group
{
@@ -323,6 +394,10 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
tab_roles->canOpenClose(false);
tab_notices->canOpenClose(false);
tab_land->canOpenClose(false);
+
+ getChild<LLUICtrl>("group_name")->setVisible(false);
+ getChild<LLUICtrl>("group_name_editor")->setVisible(true);
+
}
else
{
@@ -338,6 +413,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
tab_roles->canOpenClose(true);
tab_notices->canOpenClose(true);
tab_land->canOpenClose(true);
+
+ getChild<LLUICtrl>("group_name")->setVisible(true);
+ getChild<LLUICtrl>("group_name_editor")->setVisible(false);
}
}
@@ -395,11 +473,9 @@ void LLPanelGroup::draw()
void LLPanelGroup::refreshData()
{
LLGroupMgr::getInstance()->clearGroupData(getID());
-
- for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
- (*it)->activate();
-
+ setGroupID(getID());
+
// 5 second timeout
childDisable("btn_refresh");
mRefreshTimer.start();