diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-07-23 21:41:27 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-07-25 08:45:52 -0400 |
commit | 29c8fb0a76b4271471c5cbdf356d5256cb37e3ea (patch) | |
tree | ead6b6a93b4a8db8fc59e4d4edbbc96b1c6ed983 /indra | |
parent | 316d815e7b97091a6ae34d48fc7672c59d613713 (diff) |
Fix excessive getChild calls during teleport from LLPanelGroup
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelgroup.cpp | 127 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.h | 14 |
2 files changed, 68 insertions, 73 deletions
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 519f157973..598df0135e 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -113,7 +113,7 @@ void LLPanelGroup::onOpen(const LLSD& key) if(!key.has("action")) { setGroupID(group_id); - getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab(); + mGroupsAccordion->expandDefaultTab(); return; } @@ -148,24 +148,26 @@ void LLPanelGroup::onOpen(const LLSD& key) bool LLPanelGroup::postBuild() { + mGroupsAccordion = getChild<LLAccordionCtrl>("groups_accordion"); + mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); - LLButton* button; + mButtonApply = getChild<LLButton>("btn_apply"); + mButtonApply->setClickedCallback(onBtnApply, this); + mButtonApply->setVisible(true); + mButtonApply->setEnabled(false); - button = getChild<LLButton>("btn_apply"); - button->setClickedCallback(onBtnApply, this); - button->setVisible(true); - button->setEnabled(false); + mButtonCall = getChild<LLButton>("btn_call"); + mButtonCall->setClickedCallback(onBtnGroupCallClicked, this); - button = getChild<LLButton>("btn_call"); - button->setClickedCallback(onBtnGroupCallClicked, this); + mButtonChat = getChild<LLButton>("btn_chat"); + mButtonChat->setClickedCallback(onBtnGroupChatClicked, this); - button = getChild<LLButton>("btn_chat"); - button->setClickedCallback(onBtnGroupChatClicked, this); + mButtonRefresh = getChild<LLButton>("btn_refresh"); + mButtonRefresh->setClickedCallback(onBtnRefresh, this); - button = getChild<LLButton>("btn_refresh"); - button->setClickedCallback(onBtnRefresh, this); + mButtonCancel = getChild<LLButton>("btn_cancel"); childSetCommitCallback("back",boost::bind(&LLPanelGroup::onBackBtnClick,this),NULL); @@ -184,7 +186,7 @@ bool LLPanelGroup::postBuild() if(panel_general) { panel_general->setupCtrls(this); - button = panel_general->getChild<LLButton>("btn_join"); + LLButton* button = panel_general->getChild<LLButton>("btn_join"); button->setVisible(false); button->setEnabled(true); @@ -199,9 +201,8 @@ bool LLPanelGroup::postBuild() return true; } -void LLPanelGroup::reposButton(const std::string& name) +void LLPanelGroup::reposButton(LLButton* button) { - LLButton* button = findChild<LLButton>(name); if(!button) return; LLRect btn_rect = button->getRect(); @@ -211,23 +212,20 @@ void LLPanelGroup::reposButton(const std::string& name) void LLPanelGroup::reposButtons() { - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - - if(button_refresh && button_cancel && button_refresh->getVisible() && button_cancel->getVisible()) + if(mButtonRefresh && mButtonCancel && mButtonRefresh->getVisible() && mButtonCancel->getVisible()) { - LLRect btn_refresh_rect = button_refresh->getRect(); - LLRect btn_cancel_rect = button_cancel->getRect(); + LLRect btn_refresh_rect = mButtonRefresh->getRect(); + LLRect btn_cancel_rect = mButtonCancel->getRect(); btn_refresh_rect.setLeftTopAndSize( btn_cancel_rect.mLeft + btn_cancel_rect.getWidth() + 2, btn_refresh_rect.getHeight() + 2, btn_refresh_rect.getWidth(), btn_refresh_rect.getHeight()); - button_refresh->setRect(btn_refresh_rect); + mButtonRefresh->setRect(btn_refresh_rect); } - reposButton("btn_apply"); - reposButton("btn_refresh"); - reposButton("btn_cancel"); - reposButton("btn_chat"); - reposButton("btn_call"); + reposButton(mButtonApply); + reposButton(mButtonRefresh); + reposButton(mButtonCancel); + reposButton(mButtonChat); + reposButton(mButtonCall); } void LLPanelGroup::reshape(S32 width, S32 height, bool called_from_parent ) @@ -279,9 +277,9 @@ void LLPanelGroup::onBtnJoin() } else { - LL_DEBUGS() << "joining group: " << mID << LL_ENDL; - LLGroupActions::join(mID); -} + LL_DEBUGS() << "joining group: " << mID << LL_ENDL; + LLGroupActions::join(mID); + } } void LLPanelGroup::changed(LLGroupChange gc) @@ -299,7 +297,7 @@ void LLPanelGroup::onChange(EStatusType status, const LLSD& channelInfo, bool pr return; } - childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); + mButtonCall->setEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); } void LLPanelGroup::notifyObservers() @@ -372,32 +370,23 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) group_name_ctrl->setToolTip(group_name); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - LLButton* button_refresh = findChild<LLButton>("btn_refresh"); - - LLButton* button_cancel = findChild<LLButton>("btn_cancel"); - LLButton* button_call = findChild<LLButton>("btn_call"); - LLButton* button_chat = findChild<LLButton>("btn_chat"); - - bool is_null_group_id = group_id == LLUUID::null; - if(button_apply) - button_apply->setVisible(!is_null_group_id); - if(button_refresh) - button_refresh->setVisible(!is_null_group_id); + if(mButtonApply) + mButtonApply->setVisible(!is_null_group_id); + if(mButtonRefresh) + mButtonRefresh->setVisible(!is_null_group_id); - if(button_cancel) - button_cancel->setVisible(!is_null_group_id); + if(mButtonCancel) + mButtonCancel->setVisible(!is_null_group_id); - if(button_call) - button_call->setVisible(!is_null_group_id); - if(button_chat) - button_chat->setVisible(!is_null_group_id); + if(mButtonCall) + mButtonCall->setVisible(!is_null_group_id); + if(mButtonChat) + mButtonChat->setVisible(!is_null_group_id); getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id); - LLAccordionCtrl* tab_ctrl = getChild<LLAccordionCtrl>("groups_accordion"); - tab_ctrl->reset(); + mGroupsAccordion->reset(); LLAccordionCtrlTab* tab_general = getChild<LLAccordionCtrlTab>("group_general_tab"); LLAccordionCtrlTab* tab_roles = getChild<LLAccordionCtrlTab>("group_roles_tab"); @@ -431,10 +420,10 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) getChild<LLUICtrl>("group_name")->setVisible(false); getChild<LLUICtrl>("group_name_editor")->setVisible(true); - if(button_call) - button_call->setVisible(false); - if(button_chat) - button_chat->setVisible(false); + if(mButtonCall) + mButtonCall->setVisible(false); + if(mButtonChat) + mButtonChat->setVisible(false); } else { @@ -463,15 +452,15 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) getChild<LLUICtrl>("group_name")->setVisible(true); getChild<LLUICtrl>("group_name_editor")->setVisible(false); - if(button_apply) - button_apply->setVisible(is_member); - if(button_call) - button_call->setVisible(is_member); - if(button_chat) - button_chat->setVisible(is_member); + if(mButtonApply) + mButtonApply->setVisible(is_member); + if(mButtonCall) + mButtonCall->setVisible(is_member); + if(mButtonChat) + mButtonChat->setVisible(is_member); } - tab_ctrl->arrange(); + mGroupsAccordion->arrange(); reposButtons(); update(GC_ALL);//show/hide "join" button if data is already ready @@ -539,20 +528,18 @@ void LLPanelGroup::draw() if (mRefreshTimer.hasExpired()) { mRefreshTimer.stop(); - childEnable("btn_refresh"); - childEnable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(true); + mGroupsAccordion->setEnabled(true); } - LLButton* button_apply = findChild<LLButton>("btn_apply"); - - if(button_apply && button_apply->getVisible()) + if(mButtonApply && mButtonApply->getVisible()) { bool enable = false; std::string mesg; for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) enable = enable || (*it)->needsApply(mesg); - childSetEnabled("btn_apply", enable); + mButtonApply->setEnabled(enable); } } @@ -568,8 +555,8 @@ void LLPanelGroup::refreshData() setGroupID(getID()); // 5 second timeout - childDisable("btn_refresh"); - childDisable("groups_accordion"); + if(mButtonRefresh) mButtonRefresh->setEnabled(false); + mGroupsAccordion->setEnabled(false); mRefreshTimer.start(); mRefreshTimer.setTimerExpirySec(5); diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index ede8118720..1dbc8c32ff 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -33,11 +33,12 @@ class LLOfferInfo; -const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005; // 5ms +const F32 UPDATE_MEMBERS_SECONDS_PER_FRAME = 0.005f; // 5ms // Forward declares class LLPanelGroupTab; class LLTabContainer; +class LLAccordionCtrl; class LLAgent; @@ -98,7 +99,7 @@ protected: static void onBtnGroupCallClicked(void*); static void onBtnGroupChatClicked(void*); - void reposButton(const std::string& name); + void reposButton(LLButton* button); void reposButtons(); @@ -114,7 +115,14 @@ protected: std::vector<LLPanelGroupTab* > mTabs; - LLButton* mButtonJoin; + LLAccordionCtrl* mGroupsAccordion = nullptr; + + LLButton* mButtonJoin = nullptr; + LLButton* mButtonApply = nullptr; + LLButton* mButtonCall = nullptr; + LLButton* mButtonChat = nullptr; + LLButton* mButtonRefresh = nullptr; + LLButton* mButtonCancel = nullptr; LLUICtrl* mJoinText; }; |