Fix findChild stutter when changing people panel tabs

master
Rye Mutt 2024-08-18 17:33:59 -04:00
parent 39d65cc1c4
commit ab4abd4387
2 changed files with 25 additions and 29 deletions

View File

@ -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());
}
}

View File

@ -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;