From 005f3bd62a73040fe9a9c447f697e70a3d918bd4 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Thu, 25 Jul 2024 09:50:07 -0400 Subject: Fix findChild stall during teleport in people panel --- indra/newview/llpanelpeople.cpp | 77 ++++++++++++++++++++++++----------------- indra/newview/llpanelpeople.h | 13 ++++++- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 7f64cfca08..2f0a8f7656 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -153,8 +153,6 @@ public: id_it = uuids.begin(), id_end = uuids.end(); - LLAvatarItemDistanceComparator::id_to_pos_map_t pos_map; - mAvatarsPositions.clear(); for (;pos_it != pos_end && id_it != id_end; ++pos_it, ++id_it ) @@ -618,15 +616,13 @@ bool LLPanelPeople::postBuild() { S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); - mNearbyFilterCommitConnection = getChild("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mFriedsFilterCommitConnection = getChild("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mGroupsFilterCommitConnection = getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - mRecentFilterCommitConnection = getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - + LLPanel* group_tab = getChild(GROUP_TAB_NAME); + mGroupDelBtn = group_tab->getChild("minus_btn"); + mGroupCountText = group_tab->getChild("groupcount"); if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) { - getChild("groupcount")->setText(getString("GroupCountWithInfo")); - getChild("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); + mGroupCountText->setText(getString("GroupCountWithInfo")); + mGroupCountText->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); } mTabContainer = getChild("tabs"); @@ -639,40 +635,56 @@ bool LLPanelPeople::postBuild() friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2)); friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this)); + mFriendsGearBtn = friends_tab->getChild("gear_btn"); + mFriendsDelFriendBtn = friends_tab->getChild("friends_del_btn"); + mOnlineFriendList = friends_tab->getChild("avatars_online"); mAllFriendList = friends_tab->getChild("avatars_all"); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); mOnlineFriendList->setShowIcons("FriendsListShowIcons"); - mOnlineFriendList->showPermissions("FriendsListShowPermissions"); + mOnlineFriendList->showPermissions(gSavedSettings.getBOOL("FriendsListShowPermissions")); mOnlineFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); mAllFriendList->setNoItemsCommentText(getString("no_friends")); mAllFriendList->setShowIcons("FriendsListShowIcons"); - mAllFriendList->showPermissions("FriendsListShowPermissions"); + mAllFriendList->showPermissions(gSavedSettings.getBOOL("FriendsListShowPermissions")); mAllFriendList->setShowCompleteName(!gSavedSettings.getBOOL("FriendsListHideUsernames")); LLPanel* nearby_tab = getChild(NEARBY_TAB_NAME); nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2)); + mNearbyList = nearby_tab->getChild("avatar_list"); mNearbyList->setNoItemsCommentText(getString("no_one_near")); mNearbyList->setNoItemsMsg(getString("no_one_near")); mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near")); mNearbyList->setShowIcons("NearbyListShowIcons"); mNearbyList->setShowCompleteName(!gSavedSettings.getBOOL("NearbyListHideUsernames")); - mMiniMap = (LLNetMap*)getChildView("Net Map",true); + mMiniMap = nearby_tab->getChild("Net Map", true); mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ? getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg")); - mRecentList = getChild(RECENT_TAB_NAME)->getChild("avatar_list"); + mNearbyGearBtn = nearby_tab->getChild("gear_btn"); + mNearbyAddFriendBtn = nearby_tab->getChild("add_friend_btn"); + + LLPanel* recent_tab = getChild(RECENT_TAB_NAME); + mRecentList = recent_tab->getChild("avatar_list"); mRecentList->setNoItemsCommentText(getString("no_recent_people")); mRecentList->setNoItemsMsg(getString("no_recent_people")); mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people")); mRecentList->setShowIcons("RecentListShowIcons"); - mGroupList = getChild("group_list"); + mRecentGearBtn = recent_tab->getChild("gear_btn"); + mRecentAddFriendBtn = recent_tab->getChild("add_friend_btn"); + + mGroupList = group_tab->getChild("group_list"); mGroupList->setNoItemsCommentText(getString("no_groups_msg")); mGroupList->setNoItemsMsg(getString("no_groups_msg")); mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg")); + mNearbyFilterCommitConnection = nearby_tab->getChild("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mFriedsFilterCommitConnection = friends_tab->getChild("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mRecentFilterCommitConnection = recent_tab->getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mGroupsFilterCommitConnection = group_tab->getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); + mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyPeopleContextMenu); mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu); @@ -850,10 +862,11 @@ void LLPanelPeople::updateRecentList() void LLPanelPeople::updateButtons() { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); + bool nearby_tab_active = (cur_tab == NEARBY_TAB_NAME); bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME); bool group_tab_active = (cur_tab == GROUP_TAB_NAME); - //bool recent_tab_active = (cur_tab == RECENT_TAB_NAME); + bool recent_tab_active = (cur_tab == RECENT_TAB_NAME); LLUUID selected_id; uuid_vec_t selected_uuids; @@ -868,14 +881,13 @@ void LLPanelPeople::updateButtons() selected_id = mGroupList->getSelectedUUID(); } - LLPanel* groups_panel = mTabContainer->getCurrentPanel(); - groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected + mGroupDelBtn->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = static_cast(gAgent.mGroups.size()); U32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; - groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); - groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); + mGroupCountText->setTextArg("[COUNT]", llformat("%d", groups_count)); + mGroupCountText->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); } else { @@ -889,33 +901,36 @@ void LLPanelPeople::updateButtons() is_self = gAgent.getID() == selected_id; } - LLPanel* cur_panel = mTabContainer->getCurrentPanel(); - if (cur_panel) { - if (cur_panel->hasChild("add_friend_btn", true)) - cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self); + if(nearby_tab_active) + { + mNearbyAddFriendBtn->setEnabled(item_selected && !is_friend && !is_self); + mNearbyGearBtn->setEnabled(multiple_selected); + } if (friends_tab_active) { - cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected); + mFriendsDelFriendBtn->setEnabled(multiple_selected); + mFriendsGearBtn->setEnabled(multiple_selected); } - if (!group_tab_active) + if (recent_tab_active) { - cur_panel->getChildView("gear_btn")->setEnabled(multiple_selected); + mRecentAddFriendBtn->setEnabled(item_selected && !is_friend && !is_self); + mRecentGearBtn->setEnabled(multiple_selected); } } } } -std::string LLPanelPeople::getActiveTabName() const +const std::string& LLPanelPeople::getActiveTabName() const { return mTabContainer->getCurrentPanel()->getName(); } LLUUID LLPanelPeople::getCurrentItemID() const { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == FRIENDS_TAB_NAME) // this tab has two lists { @@ -945,7 +960,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const { - std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == FRIENDS_TAB_NAME) { @@ -1033,7 +1048,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) saved_filter = search_upper; // Apply new filter to the current tab. - const std::string cur_tab = getActiveTabName(); + const std::string& cur_tab = getActiveTabName(); if (cur_tab == NEARBY_TAB_NAME) { mNearbyList->setNameFilter(filter); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 768ba1ef49..445bc4c081 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -84,7 +84,7 @@ private: bool isItemsFreeOfFriends(const uuid_vec_t& uuids); void updateButtons(); - std::string getActiveTabName() const; + const std::string& getActiveTabName() const; LLUUID getCurrentItemID() const; void getCurrentItemIDs(uuid_vec_t& selected_uuids) const; void setSortOrder(LLAvatarList* list, ESortOrder order, bool save = true); @@ -139,6 +139,17 @@ private: LLGroupList* mGroupList; LLNetMap* mMiniMap; + LLButton* mNearbyGearBtn = nullptr; + LLButton* mFriendsGearBtn = nullptr; + LLButton* mRecentGearBtn = nullptr; + LLButton* mGroupDelBtn = nullptr; + + LLButton* mNearbyAddFriendBtn = nullptr; + LLButton* mRecentAddFriendBtn = nullptr; + LLUICtrl* mFriendsDelFriendBtn = nullptr; + + LLTextBox* mGroupCountText = nullptr; + std::vector mSavedOriginalFilters; std::vector mSavedFilters; -- cgit v1.2.3