From 27145699bf7a5a3340be3f9ba37af9d6711cebf4 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 2 Jul 2013 19:05:53 -0400 Subject: [PATCH] Update/cleanup llpanelpermissions --- indra/newview/llpanelpermissions.cpp | 72 +++++++++++++--------------- indra/newview/llpanelpermissions.h | 34 ++++--------- 2 files changed, 42 insertions(+), 64 deletions(-) diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 326fb952d..9d1df930c 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -5,10 +5,9 @@ * viewing/editing object names, owners, permissions, etc. * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -36,6 +35,7 @@ #include "llpanelpermissions.h" +// library includes #include "llpermissions.h" #include "llclickaction.h" #include "llfocusmgr.h" @@ -43,6 +43,7 @@ #include "lltrans.h" #include "llwindow.h" +// project includes #include "llviewerwindow.h" #include "llresmgr.h" #include "lltextbox.h" @@ -117,32 +118,30 @@ BOOL LLPanelPermissions::postBuild() getChild("Object Description")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); - childSetAction("button owner profile",LLPanelPermissions::onClickOwner,this); - childSetAction("button last owner profile",LLPanelPermissions::onClickLastOwner,this); - childSetAction("button creator profile",LLPanelPermissions::onClickCreator,this); + getChild("button owner profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickOwner,this)); + getChild("button last owner profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickLastOwner,this)); + getChild("button creator profile")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickCreator,this)); - childSetAction("button set group",LLPanelPermissions::onClickGroup,this); - childSetAction("button open group",LLPanelPermissions::onClickOpenGroup,this); + getChild("button set group")->setCommitCallback(boost::bind(&LLPanelPermissions::onClickGroup,this)); + getChild("button open group")->setCommitCallback(boost::bind(LLPanelPermissions::onClickOpenGroup)); childSetCommitCallback("checkbox share with group",LLPanelPermissions::onCommitGroupShare,this); childSetAction("button deed",LLPanelPermissions::onClickDeedToGroup,this); - childSetAction("button cpy_key",LLPanelPermissions::onClickCopyObjKey,this); + getChild("button cpy_key")->setCommitCallback(boost::bind(LLPanelPermissions::onClickCopyObjKey)); childSetCommitCallback("checkbox allow everyone move",LLPanelPermissions::onCommitEveryoneMove,this); childSetCommitCallback("checkbox allow everyone copy",LLPanelPermissions::onCommitEveryoneCopy,this); - getChild("checkbox allow export")->setCommitCallback(boost::bind(&LLPanelPermissions::onCommitExport, this, _2)); - childSetCommitCallback("checkbox for sale",LLPanelPermissions::onCommitSaleInfo,this); + childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); + childSetCommitCallback("Edit Cost",LLPanelPermissions::onCommitSaleInfo,this); getChild("Edit Cost")->setPrevalidate(&LLLineEditor::prevalidateNonNegativeS32); - childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); - childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this); childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); childSetCommitCallback("checkbox next owner can transfer",LLPanelPermissions::onCommitNextOwnerTransfer,this); @@ -152,7 +151,10 @@ BOOL LLPanelPermissions::postBuild() mLabelGroupName = getChild("Group Name Proxy"); if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) + { + getChild("checkbox allow export")->setCommitCallback(boost::bind(&LLPanelPermissions::onCommitExport, this, _2)); LFSimFeatureHandler::instance().setSupportsExportCallback(boost::bind(&LLPanelPermissions::refresh, this)); + } return TRUE; } @@ -195,16 +197,16 @@ void LLPanelPermissions::disableAll() getChildView("button last owner profile")->setEnabled(FALSE); getChildView("Group:")->setEnabled(FALSE); - getChild("Group Name")->setValue(LLStringUtil::null); - getChildView("Group Name")->setEnabled(FALSE); + getChild("Group Name Proxy")->setValue(LLStringUtil::null); + getChildView("Group Name Proxy")->setEnabled(FALSE); getChildView("button set group")->setEnabled(FALSE); getChildView("button open group")->setEnabled(FALSE); getChild("Object Name")->setValue(LLStringUtil::null); getChildView("Object Name")->setEnabled(FALSE); getChildView("Name:")->setEnabled(FALSE); - getChild("Group Name")->setValue(LLStringUtil::null); - getChildView("Group Name")->setEnabled(FALSE); + //getChild("Group Name")->setValue(LLStringUtil::null); + //getChildView("Group Name")->setEnabled(FALSE); getChildView("Description:")->setEnabled(FALSE); getChild("Object Description")->setValue(LLStringUtil::null); getChildView("Object Description")->setEnabled(FALSE); @@ -310,9 +312,8 @@ void LLPanelPermissions::refresh() return; } - // figure out a few variables - BOOL is_one_object = (object_count == 1); + const BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() @@ -446,7 +447,7 @@ void LLPanelPermissions::refresh() // update group text field getChildView("Group:")->setEnabled(TRUE); - getChild("Group Name")->setValue(LLStringUtil::null); + //getChild("Group Name")->setValue(LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) @@ -996,19 +997,13 @@ void LLPanelPermissions::onClickRelease(void*) LLSelectMgr::getInstance()->sendOwner(LLUUID::null, LLUUID::null); } -// static -void LLPanelPermissions::onClickCreator(void *data) +void LLPanelPermissions::onClickCreator() { - LLPanelPermissions *self = (LLPanelPermissions *)data; - - LLAvatarActions::showProfile(self->mCreatorID); + LLAvatarActions::showProfile(mCreatorID); } -// static -void LLPanelPermissions::onClickOwner(void *data) +void LLPanelPermissions::onClickOwner() { - LLPanelPermissions *self = (LLPanelPermissions *)data; - if (LLSelectMgr::getInstance()->selectIsGroupOwned()) { LLUUID group_id; @@ -1020,26 +1015,24 @@ void LLPanelPermissions::onClickOwner(void *data) // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { - LLAvatarActions::showProfile(self->mOwnerID); + LLAvatarActions::showProfile(mOwnerID); } // [/RLVa:KB] -// LLAvatarActions::showProfile(self->mOwnerID); +// LLAvatarActions::showProfile(mOwnerID); } } -void LLPanelPermissions::onClickLastOwner(void *data) +void LLPanelPermissions::onClickLastOwner() { - LLPanelPermissions *self = (LLPanelPermissions *)data; - LLAvatarActions::showProfile(self->mLastOwnerID); + LLAvatarActions::showProfile(mLastOwnerID); } -void LLPanelPermissions::onClickGroup(void* data) +void LLPanelPermissions::onClickGroup() { - LLPanelPermissions* panelp = (LLPanelPermissions*)data; LLUUID owner_id; std::string name; BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, name); - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); if(owners_identical && (owner_id == gAgent.getID())) { @@ -1047,7 +1040,7 @@ void LLPanelPermissions::onClickGroup(void* data) if (fg) { - fg->setSelectCallback( cbGroupID, data ); + fg->setSelectCallback( cbGroupID, this ); if (parent_floater) { @@ -1059,11 +1052,10 @@ void LLPanelPermissions::onClickGroup(void* data) } } -void LLPanelPermissions::onClickOpenGroup(void* data) +void LLPanelPermissions::onClickOpenGroup() { LLUUID group_id; LLSelectMgr::getInstance()->selectGetGroup(group_id); - LLGroupActions::show(group_id); } @@ -1099,7 +1091,7 @@ void LLPanelPermissions::onClickDeedToGroup(void* data) LLNotificationsUtil::add( "DeedObjectToGroup", LLSD(), LLSD(), callback_deed_to_group); } -void LLPanelPermissions::onClickCopyObjKey(void* data) +void LLPanelPermissions::onClickCopyObjKey() { //NAMESHORT - Was requested on the forums, was going to integrate a textbox with the ID, but due to lack of room on the floater, //We now have a copy button :> diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 8ac27d9be..da87e1196 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -3,10 +3,9 @@ * @brief LLPanelPermissions class header file * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -42,12 +41,6 @@ // Panel for permissions of an object. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLCheckBoxCtrl; -class LLTextBox; -class LLButton; -class LLLineEditor; -class LLRadioGroup; -class LLComboBox; class LLNameBox; class LLPanelPermissions : public LLPanel @@ -56,26 +49,23 @@ public: LLPanelPermissions(const std::string& title); virtual ~LLPanelPermissions(); - virtual BOOL postBuild(); - virtual void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void handleVisibilityChange(BOOL new_visibility); - // MANIPULATORS void refresh(); // refresh all labels as needed -// void setPermCheckboxes(U32 mask_on, U32 mask_off, -// LLCheckBoxCtrl* move, LLCheckboxCtrl* edit, -// LLCheckBoxCtrl* copy); + protected: // statics static void onClickClaim(void*); static void onClickRelease(void*); - static void onClickCreator(void*); - static void onClickOwner(void*); - static void onClickLastOwner(void*); - static void onClickGroup(void*); - static void onClickOpenGroup(void*); + void onClickCreator(); + void onClickOwner(); + void onClickLastOwner(); + void onClickGroup(); + static void onClickOpenGroup(); static void cbGroupID(LLUUID group_id, void* userdata); static void onClickDeedToGroup(void*); - static void onClickCopyObjKey(void*); + static void onClickCopyObjKey(); static void onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm); @@ -109,10 +99,6 @@ protected: private: LLNameBox* mLabelGroupName; // group name - //LLTextBox* mBuyerLabel; - //LLCheckBoxCtrl* mCheckBuyerModify; - //LLCheckBoxCtrl* mCheckBuyerCopy; - LLUUID mCreatorID; LLUUID mOwnerID; LLUUID mLastOwnerID;