diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-07-24 19:30:29 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-07-25 08:45:53 -0400 |
commit | e3deb8340a5f2e5b1c997e66042f3515f33f5cea (patch) | |
tree | b18de8c488089c72d2987fc6e6245390b31d5dca /indra/newview | |
parent | 70f332d02e687c2c3d4806ccda0e1dcd8bde1232 (diff) |
Fix excessive findChild calls during about land floater draw
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 258 | ||||
-rw-r--r-- | indra/newview/llfloaterland.h | 18 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llpanelland.cpp | 78 | ||||
-rw-r--r-- | indra/newview/llpanelland.h | 21 |
5 files changed, 199 insertions, 177 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index aebadb36ae..bec76fe5e4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2443,19 +2443,34 @@ LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel) bool LLPanelLandAccess::postBuild() { - childSetCommitCallback("public_access", onCommitPublicAccess, this); - childSetCommitCallback("limit_payment", onCommitAny, this); - childSetCommitCallback("limit_age_verified", onCommitAny, this); - childSetCommitCallback("GroupCheck", onCommitGroupCheck, this); - childSetCommitCallback("PassCheck", onCommitAny, this); - childSetCommitCallback("pass_combo", onCommitAny, this); - childSetCommitCallback("PriceSpin", onCommitAny, this); - childSetCommitCallback("HoursSpin", onCommitAny, this); - - childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); - childSetAction("remove_allowed", onClickRemoveAccess, this); - childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); - childSetAction("remove_banned", onClickRemoveBanned, this); + mPaymentInfoCheck = getChild<LLUICtrl>("limit_payment"); + mPaymentInfoCheck->setCommitCallback(onCommitAny, this); + mAgeVerifiedCheck = getChild<LLUICtrl>("limit_age_verified"); + mAgeVerifiedCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassCheck = getChild<LLUICtrl>("PassCheck"); + mTemporaryPassCheck->setCommitCallback(onCommitAny, this); + mPublicAccessCheck = getChild<LLUICtrl>("public_access"); + mPublicAccessCheck->setCommitCallback(onCommitPublicAccess, this); + mGroupAccessCheck = getChild<LLUICtrl>("GroupCheck"); + mGroupAccessCheck->setCommitCallback(onCommitGroupCheck, this); + mTemporaryPassCombo = getChild<LLComboBox>("pass_combo"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassPriceSpin = getChild<LLUICtrl>("PriceSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + mTemporaryPassHourSpin = getChild<LLUICtrl>("HoursSpin"); + mGroupAccessCheck->setCommitCallback(onCommitAny, this); + + mAllowText = getChild<LLUICtrl>("AllowedText"); + mBanText = getChild<LLUICtrl>("BanCheck"); + + mBtnAddAllowed = getChild<LLButton>("add_allowed"); + mBtnAddAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); + mBtnRemoveAllowed = getChild<LLButton>("remove_allowed"); + mBtnRemoveAllowed->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveAccess, this)); + mBtnAddBanned = getChild<LLButton>("add_banned"); + mBtnAddBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); + mBtnRemoveBanned = getChild<LLButton>("remove_banned"); + mBtnRemoveBanned->setCommitCallback(boost::bind(&LLPanelLandAccess::onClickRemoveBanned, this)); mListAccess = getChild<LLNameListCtrl>("AccessList"); if (mListAccess) @@ -2494,17 +2509,17 @@ void LLPanelLandAccess::refresh() if (parcel->getRegionAllowAccessOverride()) { - getChild<LLUICtrl>("public_access")->setValue(public_access); - getChild<LLUICtrl>("GroupCheck")->setValue(use_group); + mPublicAccessCheck->setValue(public_access); + mGroupAccessCheck->setValue(use_group); } else { - getChild<LLUICtrl>("public_access")->setValue(true); - getChild<LLUICtrl>("GroupCheck")->setValue(false); + mPublicAccessCheck->setValue(true); + mGroupAccessCheck->setValue(false); } std::string group_name; gCacheName->getGroupName(parcel->getGroupID(), group_name); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name ); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name ); // Allow list if (mListAccess) @@ -2513,11 +2528,11 @@ void LLPanelLandAccess::refresh() mListAccess->clearSortOrder(); mListAccess->deleteAllItems(); auto count = parcel->mAccessList.size(); - getChild<LLUICtrl>("AllowedText")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("AllowedText")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mAllowText->setTextArg("[COUNT]", llformat("%d", count)); + mAllowText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mAccessList.begin(); cit != parcel->mAccessList.end(); ++cit) @@ -2561,11 +2576,11 @@ void LLPanelLandAccess::refresh() mListBanned->clearSortOrder(); mListBanned->deleteAllItems(); auto count = parcel->mBanList.size(); - getChild<LLUICtrl>("BanCheck")->setTextArg("[COUNT]", llformat("%d",count)); - getChild<LLUICtrl>("BanCheck")->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mBanText->setTextArg("[COUNT]", llformat("%d",count)); + mBanText->setTextArg("[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",count)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",PARCEL_MAX_ACCESS_LIST)); for (LLAccessEntry::map::const_iterator cit = parcel->mBanList.begin(); cit != parcel->mBanList.end(); ++cit) @@ -2622,75 +2637,74 @@ void LLPanelLandAccess::refresh() if(parcel->getRegionDenyAnonymousOverride()) { - getChild<LLUICtrl>("limit_payment")->setValue(true); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); + mPaymentInfoCheck->setValue(true); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_payment")->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); - getChild<LLUICtrl>("limit_payment")->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); + mPaymentInfoCheck->setValue((parcel->getParcelFlag(PF_DENY_ANONYMOUS))); + mPaymentInfoCheck->setLabelArg("[ESTATE_PAYMENT_LIMIT]", std::string() ); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { - getChild<LLUICtrl>("limit_age_verified")->setValue(true); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); + mAgeVerifiedCheck->setValue(true); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", getString("access_estate_defined") ); } else { - getChild<LLUICtrl>("limit_age_verified")->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); - getChild<LLUICtrl>("limit_age_verified")->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); + mAgeVerifiedCheck->setValue((parcel->getParcelFlag(PF_DENY_AGEUNVERIFIED))); + mAgeVerifiedCheck->setLabelArg("[ESTATE_AGE_LIMIT]", std::string() ); } bool use_pass = parcel->getParcelFlag(PF_USE_PASS_LIST); - getChild<LLUICtrl>("PassCheck")->setValue(use_pass); - LLCtrlSelectionInterface* passcombo = childGetSelectionInterface("pass_combo"); - if (passcombo) + mTemporaryPassCheck->setValue(use_pass); + if (mTemporaryPassCombo) { if (public_access || !use_pass) { - passcombo->selectByValue("anyone"); + mTemporaryPassCombo->selectByValue("anyone"); } } S32 pass_price = parcel->getPassPrice(); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)pass_price ); + mTemporaryPassPriceSpin->setValue((F32)pass_price); F32 pass_hours = parcel->getPassHours(); - getChild<LLUICtrl>("HoursSpin")->setValue(pass_hours ); + mTemporaryPassHourSpin->setValue(pass_hours); } else { - getChild<LLUICtrl>("public_access")->setValue(false); - getChild<LLUICtrl>("limit_payment")->setValue(false); - getChild<LLUICtrl>("limit_age_verified")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setValue(false); - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", LLStringUtil::null ); - getChild<LLUICtrl>("PassCheck")->setValue(false); - getChild<LLUICtrl>("PriceSpin")->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); - getChild<LLUICtrl>("HoursSpin")->setValue(PARCEL_PASS_HOURS_DEFAULT ); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("AccessList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); - getChild<LLUICtrl>("BannedList")->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mPublicAccessCheck->setValue(false); + mPaymentInfoCheck->setValue(false); + mAgeVerifiedCheck->setValue(false); + mGroupAccessCheck->setValue(false); + mGroupAccessCheck->setLabelArg("[GROUP]", LLStringUtil::null ); + mTemporaryPassCheck->setValue(false); + mTemporaryPassPriceSpin->setValue((F32)PARCEL_PASS_PRICE_DEFAULT); + mTemporaryPassHourSpin->setValue(PARCEL_PASS_HOURS_DEFAULT ); + mListAccess->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListAccess->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[LISTED]"), llformat("%d",0)); + mListBanned->setToolTipArg(LLStringExplicit("[MAX]"), llformat("%d",0)); } } void LLPanelLandAccess::refresh_ui() { - getChildView("public_access")->setEnabled(false); - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); - getChildView("GroupCheck")->setEnabled(false); - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("PriceSpin")->setEnabled(false); - getChildView("HoursSpin")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); - getChildView("BannedList")->setEnabled(false); - getChildView("add_allowed")->setEnabled(false); - getChildView("remove_allowed")->setEnabled(false); - getChildView("add_banned")->setEnabled(false); - getChildView("remove_banned")->setEnabled(false); + mPublicAccessCheck->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); + mGroupAccessCheck->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mTemporaryPassPriceSpin->setEnabled(false); + mTemporaryPassHourSpin->setEnabled(false); + mListAccess->setEnabled(false); + mListBanned->setEnabled(false); + mBtnAddAllowed->setEnabled(false); + mBtnRemoveAllowed->setEnabled(false); + mBtnAddBanned->setEnabled(false); + mBtnRemoveBanned->setEnabled(false); LLParcel *parcel = mParcel->getParcel(); if (parcel && !gDisconnected) @@ -2703,73 +2717,64 @@ void LLPanelLandAccess::refresh_ui() can_manage_allowed = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_MANAGE_ALLOWED); } - getChildView("public_access")->setEnabled(can_manage_allowed); - bool public_access = getChild<LLUICtrl>("public_access")->getValue().asBoolean(); + mPublicAccessCheck->setEnabled(can_manage_allowed); + bool public_access = mPublicAccessCheck->getValue().asBoolean(); if (public_access) { bool override = false; if(parcel->getRegionDenyAnonymousOverride()) { override = true; - getChildView("limit_payment")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(can_manage_allowed); + mPaymentInfoCheck->setEnabled(can_manage_allowed); } if(parcel->getRegionDenyAgeUnverifiedOverride()) { override = true; - getChildView("limit_age_verified")->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); } else { - getChildView("limit_age_verified")->setEnabled(can_manage_allowed); + mAgeVerifiedCheck->setEnabled(can_manage_allowed); } - if (override) - { - getChildView("Only Allow")->setToolTip(getString("estate_override")); - } - else - { - getChildView("Only Allow")->setToolTip(std::string()); - } - getChildView("PassCheck")->setEnabled(false); - getChildView("pass_combo")->setEnabled(false); - getChildView("AccessList")->setEnabled(false); + mTemporaryPassCheck->setEnabled(false); + mTemporaryPassCombo->setEnabled(false); + mListAccess->setEnabled(false); } else { - getChildView("limit_payment")->setEnabled(false); - getChildView("limit_age_verified")->setEnabled(false); + mPaymentInfoCheck->setEnabled(false); + mAgeVerifiedCheck->setEnabled(false); - - bool sell_passes = getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - getChildView("PassCheck")->setEnabled(can_manage_allowed); + bool sell_passes = mTemporaryPassCheck->getValue().asBoolean(); + mTemporaryPassCheck->setEnabled(can_manage_allowed); if (sell_passes) { - getChildView("pass_combo")->setEnabled(can_manage_allowed); - getChildView("PriceSpin")->setEnabled(can_manage_allowed); - getChildView("HoursSpin")->setEnabled(can_manage_allowed); + mTemporaryPassCombo->setEnabled(can_manage_allowed); + mTemporaryPassPriceSpin->setEnabled(can_manage_allowed); + mTemporaryPassHourSpin->setEnabled(can_manage_allowed); } } std::string group_name; if (gCacheName->getGroupName(parcel->getGroupID(), group_name)) { - bool can_allow_groups = !public_access || (public_access && (getChild<LLUICtrl>("limit_payment")->getValue().asBoolean() ^ getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean())); - getChildView("GroupCheck")->setEnabled(can_manage_allowed && can_allow_groups); + bool can_allow_groups = !public_access || (public_access && (mPaymentInfoCheck->getValue().asBoolean() ^ mAgeVerifiedCheck->getValue().asBoolean())); + mGroupAccessCheck->setEnabled(can_manage_allowed && can_allow_groups); } - getChildView("AccessList")->setEnabled(can_manage_allowed); + mListAccess->setEnabled(can_manage_allowed); auto allowed_list_count = parcel->mAccessList.size(); - getChildView("add_allowed")->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddAllowed->setEnabled(can_manage_allowed && allowed_list_count < PARCEL_MAX_ACCESS_LIST); bool has_selected = (mListAccess && mListAccess->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_allowed")->setEnabled(can_manage_allowed && has_selected); + mBtnRemoveAllowed->setEnabled(can_manage_allowed && has_selected); - getChildView("BannedList")->setEnabled(can_manage_banned); + mListBanned->setEnabled(can_manage_banned); auto banned_list_count = parcel->mBanList.size(); - getChildView("add_banned")->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); + mBtnAddBanned->setEnabled(can_manage_banned && banned_list_count < PARCEL_MAX_ACCESS_LIST); has_selected = (mListBanned && mListBanned->getSelectionInterface()->getFirstSelectedIndex() >= 0); - getChildView("remove_banned")->setEnabled(can_manage_banned && has_selected); + mBtnRemoveBanned->setEnabled(can_manage_banned && has_selected); } } @@ -2783,7 +2788,7 @@ void LLPanelLandAccess::refreshNames() { gCacheName->getGroupName(parcel->getGroupID(), group_name); } - getChild<LLUICtrl>("GroupCheck")->setLabelArg("[GROUP]", group_name); + mGroupAccessCheck->setLabelArg("[GROUP]", group_name); } @@ -2817,9 +2822,9 @@ void LLPanelLandAccess::onCommitGroupCheck(LLUICtrl *ctrl, void *userdata) return; } - bool use_pass_list = !self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + bool use_pass_list = !self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2846,8 +2851,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } // Extract data from UI - bool public_access = self->getChild<LLUICtrl>("public_access")->getValue().asBoolean(); - bool use_access_group = self->getChild<LLUICtrl>("GroupCheck")->getValue().asBoolean(); + bool public_access = self->mPublicAccessCheck->getValue().asBoolean(); + bool use_access_group = self->mGroupAccessCheck->getValue().asBoolean(); if (use_access_group) { std::string group_name; @@ -2864,14 +2869,14 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) if (public_access) { use_access_list = false; - limit_payment = self->getChild<LLUICtrl>("limit_payment")->getValue().asBoolean(); - limit_age_verified = self->getChild<LLUICtrl>("limit_age_verified")->getValue().asBoolean(); + limit_payment = self->mPaymentInfoCheck->getValue().asBoolean(); + limit_age_verified = self->mAgeVerifiedCheck->getValue().asBoolean(); } else { use_access_list = true; - use_pass_list = self->getChild<LLUICtrl>("PassCheck")->getValue().asBoolean(); - LLCtrlSelectionInterface* passcombo = self->childGetSelectionInterface("pass_combo"); + use_pass_list = self->mTemporaryPassCheck->getValue().asBoolean(); + LLCtrlSelectionInterface* passcombo = self->mTemporaryPassCombo; if (passcombo) { if (use_access_group && use_pass_list) @@ -2884,8 +2889,8 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) } } - S32 pass_price = llfloor((F32)self->getChild<LLUICtrl>("PriceSpin")->getValue().asReal()); - F32 pass_hours = (F32)self->getChild<LLUICtrl>("HoursSpin")->getValue().asReal(); + S32 pass_price = llfloor((F32)self->mTemporaryPassPriceSpin->getValue().asReal()); + F32 pass_hours = (F32)self->mTemporaryPassHourSpin->getValue().asReal(); // Push data into current parcel parcel->setParcelFlag(PF_USE_ACCESS_GROUP, use_access_group); @@ -2907,10 +2912,9 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) void LLPanelLandAccess::onClickAddAccess() { - LLView * button = findChild<LLButton>("add_allowed"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), false, false, false, root_floater->getName(), mBtnAddAllowed); if (picker) { root_floater->addDependentFloater(picker); @@ -2938,16 +2942,14 @@ void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids) } } -// static -void LLPanelLandAccess::onClickRemoveAccess(void* data) +void LLPanelLandAccess::onClickRemoveAccess() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListAccess) + if (mListAccess) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListAccess->getAllSelected(); + std::vector<LLScrollListItem*> names = mListAccess->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -2956,18 +2958,16 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) parcel->removeFromAccessList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); - panelp->refresh(); + refresh(); } } } -// static void LLPanelLandAccess::onClickAddBanned() { - LLView * button = findChild<LLButton>("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), true, false, false, root_floater->getName(), mBtnAddBanned); if (picker) { root_floater->addDependentFloater(picker); @@ -3014,16 +3014,14 @@ void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 durat } } -// static -void LLPanelLandAccess::onClickRemoveBanned(void* data) +void LLPanelLandAccess::onClickRemoveBanned() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp && panelp->mListBanned) + if (mListBanned) { - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { - std::vector<LLScrollListItem*> names = panelp->mListBanned->getAllSelected(); + std::vector<LLScrollListItem*> names = mListBanned->getAllSelected(); for (std::vector<LLScrollListItem*>::iterator iter = names.begin(); iter != names.end(); ) { @@ -3032,7 +3030,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data) parcel->removeFromBanList(agent_id); } LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); - panelp->refresh(); + refresh(); } } } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 3560304566..95f6a44a94 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -375,13 +375,13 @@ public: static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata); static void onCommitAny(LLUICtrl* ctrl, void *userdata); static void onCommitGroupCheck(LLUICtrl* ctrl, void *userdata); - static void onClickRemoveAccess(void*); - static void onClickRemoveBanned(void*); virtual bool postBuild(); void onClickAddAccess(); void onClickAddBanned(); + void onClickRemoveAccess(); + void onClickRemoveBanned(); void callbackAvatarCBBanned(const uuid_vec_t& ids); void callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration); void callbackAvatarCBAccess(const uuid_vec_t& ids); @@ -389,6 +389,20 @@ public: protected: LLNameListCtrl* mListAccess; LLNameListCtrl* mListBanned; + LLUICtrl* mAllowText = nullptr; + LLUICtrl* mBanText = nullptr; + LLUICtrl* mPublicAccessCheck = nullptr; + LLUICtrl* mGroupAccessCheck = nullptr; + LLUICtrl* mPaymentInfoCheck = nullptr; + LLUICtrl* mAgeVerifiedCheck = nullptr; + LLUICtrl* mTemporaryPassCheck = nullptr; + LLComboBox* mTemporaryPassCombo = nullptr; + LLUICtrl* mTemporaryPassPriceSpin = nullptr; + LLUICtrl* mTemporaryPassHourSpin = nullptr; + LLButton* mBtnAddAllowed = nullptr; + LLButton* mBtnRemoveAllowed = nullptr; + LLButton* mBtnAddBanned = nullptr; + LLButton* mBtnRemoveBanned = nullptr; LLSafeHandle<LLParcelSelection>& mParcel; }; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fc6abf4bfe..cc9aca1338 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2331,7 +2331,6 @@ void LLPanelEstateInfo::refresh() // Disable access restriction controls if they make no sense. bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString()); - getChildView("Only Allow")->setEnabled(public_access); getChildView("limit_payment")->setEnabled(public_access); getChildView("limit_age_verified")->setEnabled(public_access); getChildView("limit_bots")->setEnabled(public_access); diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 3e22374294..07f4a710db 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -58,14 +58,26 @@ public: bool LLPanelLandInfo::postBuild() { - childSetAction("button buy land",boost::bind(onClickClaim)); - childSetAction("button abandon land", boost::bind(onClickRelease)); - childSetAction("button subdivide land", boost::bind(onClickDivide)); - childSetAction("button join land", boost::bind(onClickJoin)); - childSetAction("button about land", boost::bind(onClickAbout)); + mButtonBuyLand = getChild<LLButton>("button buy land"); + mButtonBuyLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickClaim, this)); + + mButtonAbandonLand = getChild<LLButton>("button abandon land"); + mButtonAbandonLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickRelease, this)); + + mButtonSubdivLand = getChild<LLButton>("button subdivide land"); + mButtonSubdivLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickDivide, this)); + + mButtonJoinLand = getChild<LLButton>("button join land"); + mButtonJoinLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickJoin, this)); + + mButtonAboutLand = getChild<LLButton>("button about land"); + mButtonAboutLand->setCommitCallback(boost::bind(&LLPanelLandInfo::onClickAbout, this)); mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); - getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + mCheckShowOwners->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); + + mTextArea = getChild<LLTextBox>("label_area"); + mTextAreaPrice = getChild<LLTextBox>("label_area_price"); return true; } @@ -119,17 +131,14 @@ void LLPanelLandInfo::refresh() if (!parcel || !regionp) { // nothing selected, disable panel - getChildView("label_area_price")->setVisible(false); - getChildView("label_area")->setVisible(false); - - //mTextPrice->setText(LLStringUtil::null); - getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null); - - getChildView("button buy land")->setEnabled(false); - getChildView("button abandon land")->setEnabled(false); - getChildView("button subdivide land")->setEnabled(false); - getChildView("button join land")->setEnabled(false); - getChildView("button about land")->setEnabled(false); + mTextAreaPrice->setVisible(false); + mTextArea->setVisible(false); + + mButtonBuyLand->setEnabled(false); + mButtonAbandonLand->setEnabled(false); + mButtonSubdivLand->setEnabled(false); + mButtonJoinLand->setEnabled(false); + mButtonAboutLand->setEnabled(false); } else { @@ -147,11 +156,11 @@ void LLPanelLandInfo::refresh() if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners()) { - getChildView("button buy land")->setEnabled(true); + mButtonBuyLand->setEnabled(true); } else { - getChildView("button buy land")->setEnabled(can_buy); + mButtonBuyLand->setEnabled(can_buy); } bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); @@ -163,16 +172,16 @@ void LLPanelLandInfo::refresh() bool manager_divideable = ( gAgent.canManageEstate() && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) ); - getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); + mButtonAbandonLand->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); // only mainland sims are subdividable by owner if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) { - getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); } else { - getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike()); + mButtonSubdivLand->setEnabled(manager_divideable || gAgent.isGodlike()); } // To join land, must have something selected, @@ -183,15 +192,15 @@ void LLPanelLandInfo::refresh() //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) { - getChildView("button join land")->setEnabled(true); + mButtonJoinLand->setEnabled(true); } else { LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; - getChildView("button join land")->setEnabled(false); + mButtonJoinLand->setEnabled(false); } - getChildView("button about land")->setEnabled(true); + mButtonAboutLand->setEnabled(true); // show pricing information S32 area; @@ -206,47 +215,42 @@ void LLPanelLandInfo::refresh() &dwell); if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())) { - getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price)); - getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area_price")->setVisible(true); - getChildView("label_area")->setVisible(false); + mTextAreaPrice->setTextArg("[PRICE]", llformat("%d",claim_price)); + mTextAreaPrice->setTextArg("[AREA]", llformat("%d",area)); + mTextAreaPrice->setVisible(true); + mTextArea->setVisible(false); } else { - getChildView("label_area_price")->setVisible(false); - getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area")->setVisible(true); + mTextAreaPrice->setVisible(false); + mTextArea->setTextArg("[AREA]", llformat("%d",area)); + mTextArea->setVisible(true); } } } -//static void LLPanelLandInfo::onClickClaim() { LLViewerParcelMgr::getInstance()->startBuyLand(); } -//static void LLPanelLandInfo::onClickRelease() { LLViewerParcelMgr::getInstance()->startReleaseLand(); } -// static void LLPanelLandInfo::onClickDivide() { LLViewerParcelMgr::getInstance()->startDivideLand(); } -// static void LLPanelLandInfo::onClickJoin() { LLViewerParcelMgr::getInstance()->startJoinLand(); } -//static void LLPanelLandInfo::onClickAbout() { // Promote the rectangle selection to a parcel selection diff --git a/indra/newview/llpanelland.h b/indra/newview/llpanelland.h index 7d0c6936bd..aeadee4085 100644 --- a/indra/newview/llpanelland.h +++ b/indra/newview/llpanelland.h @@ -46,20 +46,27 @@ public: void refresh() override; static void refreshAll(); - LLCheckBoxCtrl *mCheckShowOwners; - protected: - static void onClickClaim(); - static void onClickRelease(); - static void onClickDivide(); - static void onClickJoin(); - static void onClickAbout(); + void onClickClaim(); + void onClickRelease(); + void onClickDivide(); + void onClickJoin(); + void onClickAbout(); protected: bool postBuild() override; static LLPanelLandSelectObserver* sObserver; static LLPanelLandInfo* sInstance; +private: + LLCheckBoxCtrl *mCheckShowOwners = nullptr; + LLButton* mButtonBuyLand = nullptr; + LLButton* mButtonAbandonLand = nullptr; + LLButton* mButtonSubdivLand = nullptr; + LLButton* mButtonJoinLand = nullptr; + LLButton* mButtonAboutLand = nullptr; + LLTextBox* mTextArea = nullptr; + LLTextBox* mTextAreaPrice = nullptr; }; #endif |