diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 17:33:59 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 18:36:33 -0400 |
commit | ab4abd4387cb834e0c350bfe78e929e8530f4f80 (patch) | |
tree | 727d3be87a3daa2c1b6f2fa2c369bb734520ef7c /indra | |
parent | 39d65cc1c44496889e4d41956e6576012aba6624 (diff) |
Fix findChild stutter when changing people panel tabs
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 46 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 8 |
2 files changed, 25 insertions, 29 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 2f0a8f7656..107b1cf6cd 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -727,12 +727,14 @@ bool LLPanelPeople::postBuild() LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; } - LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsAccordion = friends_tab->getChild<LLAccordionCtrl>("friends_accordion"); + + mFriendsAllTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_all"); + mFriendsAllTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList)); - accordion_tab = getChild<LLAccordionCtrlTab>("tab_online"); - accordion_tab->setDropDownStateChangedCallback( + mFriendsOnlineTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_online"); + mFriendsOnlineTab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); // Must go after setting commit callback and initializing all pointers to children. @@ -1064,8 +1066,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mOnlineFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter); - setAccordionCollapsedByUser("tab_online", false); - setAccordionCollapsedByUser("tab_all", false); + setAccordionCollapsedByUser(mFriendsOnlineTab, false); + setAccordionCollapsedByUser(mFriendsAllTab, false); showFriendsAccordionsIfNeeded(); // restore accordion tabs state _after_ all manipulations @@ -1108,7 +1110,6 @@ void LLPanelPeople::onGroupLimitInfo() void LLPanelPeople::onTabSelected(const LLSD& param) { - std::string tab_name = getChild<LLPanel>(param.asString())->getName(); updateButtons(); showFriendsAccordionsIfNeeded(); @@ -1142,9 +1143,9 @@ void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list) uuid_vec_t selected_uuids; getCurrentItemIDs(selected_uuids); mMiniMap->setSelected(selected_uuids); - } else + } // Make sure only one of the friends lists (online/all) has selection. - if (getActiveTabName() == FRIENDS_TAB_NAME) + else if (getActiveTabName() == FRIENDS_TAB_NAME) { if (list == mOnlineFriendList) mAllFriendList->resetSelection(true); @@ -1169,12 +1170,9 @@ void LLPanelPeople::onAddFriendButtonClicked() bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) { const LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); - for ( uuid_vec_t::const_iterator - id = uuids.begin(), - id_end = uuids.end(); - id != id_end; ++id ) + for (const LLUUID& uuid : uuids) { - if (av_tracker.isBuddy (*id)) + if (av_tracker.isBuddy(uuid)) { return false; } @@ -1479,15 +1477,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) return LLPanel::notifyChildren(info); } -void LLPanelPeople::showAccordion(const std::string name, bool show) +void LLPanelPeople::showAccordion(LLAccordionCtrlTab* tab, bool show) { - if(name.empty()) - { - LL_WARNS() << "No name provided" << LL_ENDL; - return; - } - - LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name); tab->setVisible(show); if(show) { @@ -1505,12 +1496,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() if(FRIENDS_TAB_NAME == getActiveTabName()) { // Expand and show accordions if needed, else - hide them - showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); - showAccordion("tab_all", mAllFriendList->filterHasMatches()); + showAccordion(mFriendsOnlineTab, mOnlineFriendList->filterHasMatches()); + showAccordion(mFriendsAllTab, mAllFriendList->filterHasMatches()); // Rearrange accordions - LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion"); - accordion->arrange(); + mFriendsAccordion->arrange(); // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368). // this code should be refactored to use it @@ -1523,11 +1513,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param { if(ctrl == mOnlineFriendList) { - showAccordion("tab_online", param.asInteger()); + showAccordion(mFriendsOnlineTab, param.asInteger()); } else if(ctrl == mAllFriendList) { - showAccordion("tab_all", param.asInteger()); + showAccordion(mFriendsAllTab, param.asInteger()); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 445bc4c081..aef66db980 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -40,6 +40,8 @@ class LLGroupList; class LLMenuButton; class LLTabContainer; class LLNetMap; +class LLAccordionCtrl; +class LLAccordionCtrlTab; class LLPanelPeople : public LLPanel @@ -120,7 +122,7 @@ private: void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); - void showAccordion(const std::string name, bool show); + void showAccordion(LLAccordionCtrlTab* tab, bool show); void showFriendsAccordionsIfNeeded(); @@ -139,6 +141,10 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLAccordionCtrl* mFriendsAccordion = nullptr; + LLAccordionCtrlTab* mFriendsAllTab = nullptr; + LLAccordionCtrlTab* mFriendsOnlineTab = nullptr; + LLButton* mNearbyGearBtn = nullptr; LLButton* mFriendsGearBtn = nullptr; LLButton* mRecentGearBtn = nullptr; |