Skip to content
Snippets Groups Projects
Commit 7c8c6158 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Optimize people panel tab switching to not cause minor stall

parent 99110329
No related branches found
No related tags found
No related merge requests found
...@@ -619,10 +619,13 @@ BOOL LLPanelPeople::postBuild() ...@@ -619,10 +619,13 @@ BOOL LLPanelPeople::postBuild()
getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
LLPanel* group_tab = getChild<LLPanel>(GROUP_TAB_NAME);
mGroupDelBtn = group_tab->getChild<LLButton>("minus_btn");
mGroupCountText = group_tab->getChild<LLTextBox>("groupcount");
if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium)
{ {
getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo")); mGroupCountText->setText(getString("GroupCountWithInfo"));
getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); mGroupCountText->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
} }
mTabContainer = getChild<LLTabContainer>("tabs"); mTabContainer = getChild<LLTabContainer>("tabs");
...@@ -635,6 +638,9 @@ BOOL LLPanelPeople::postBuild() ...@@ -635,6 +638,9 @@ BOOL LLPanelPeople::postBuild()
friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2)); friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2));
friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this)); friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this));
mFriendsGearBtn = friends_tab->getChild<LLButton>("gear_btn");
mFriendsDelFriendBtn = friends_tab->getChild<LLUICtrl>("friends_del_btn");
EShowPermissionType spType = (EShowPermissionType)gSavedSettings.getU32("FriendsListShowPermissions"); EShowPermissionType spType = (EShowPermissionType)gSavedSettings.getU32("FriendsListShowPermissions");
if (spType >= SP_COUNT) if (spType >= SP_COUNT)
spType = SP_NEVER; spType = SP_NEVER;
...@@ -661,17 +667,22 @@ BOOL LLPanelPeople::postBuild() ...@@ -661,17 +667,22 @@ BOOL LLPanelPeople::postBuild()
// [RLVa:KB] - Checked: RLVa-1.2.0 // [RLVa:KB] - Checked: RLVa-1.2.0
mNearbyList->setRlvCheckShowNames(true); mNearbyList->setRlvCheckShowNames(true);
// [/RLVa:KB] // [/RLVa:KB]
mMiniMap = getChild<LLNetMap>("Net Map", true); mMiniMap = nearby_tab->getChild<LLNetMap>("Net Map", true);
mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ? mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ?
getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg")); getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg"));
mNearbyGearBtn = nearby_tab->getChild<LLButton>("gear_btn");
mNearbyAddFriendBtn = nearby_tab->getChild<LLButton>("add_friend_btn");
mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list"); LLPanel* recent_tab = getChild<LLPanel>(RECENT_TAB_NAME);
mRecentList = recent_tab->getChild<LLAvatarList>("avatar_list");
mRecentList->setNoItemsCommentText(getString("no_recent_people")); mRecentList->setNoItemsCommentText(getString("no_recent_people"));
mRecentList->setNoItemsMsg(getString("no_recent_people")); mRecentList->setNoItemsMsg(getString("no_recent_people"));
mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people")); mRecentList->setNoFilteredItemsMsg(getString("no_filtered_recent_people"));
mRecentList->setShowIcons("RecentListShowIcons"); mRecentList->setShowIcons("RecentListShowIcons");
mRecentGearBtn = recent_tab->getChild<LLButton>("gear_btn");
mRecentAddFriendBtn = recent_tab->getChild<LLButton>("add_friend_btn");
mGroupList = getChild<LLGroupList>("group_list"); mGroupList = group_tab->getChild<LLGroupList>("group_list");
mGroupList->setNoItemsCommentText(getString("no_groups_msg")); mGroupList->setNoItemsCommentText(getString("no_groups_msg"));
mGroupList->setNoItemsMsg(getString("no_groups_msg")); mGroupList->setNoItemsMsg(getString("no_groups_msg"));
mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg")); mGroupList->setNoFilteredItemsMsg(getString("no_filtered_groups_msg"));
...@@ -718,12 +729,13 @@ BOOL LLPanelPeople::postBuild() ...@@ -718,12 +729,13 @@ BOOL LLPanelPeople::postBuild()
LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; LL_WARNS() << "People->Groups list menu not found" << LL_ENDL;
} }
LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); mFriendsAccordion = friends_tab->getChild<LLAccordionCtrl>("friends_accordion");
accordion_tab->setDropDownStateChangedCallback( mAccordionAllTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_all");
mAccordionAllTab->setDropDownStateChangedCallback(
boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList)); boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mAllFriendList));
accordion_tab = getChild<LLAccordionCtrlTab>("tab_online"); mAccordionOnlineTab = mFriendsAccordion->getChild<LLAccordionCtrlTab>("tab_online");
accordion_tab->setDropDownStateChangedCallback( mAccordionOnlineTab->setDropDownStateChangedCallback(
boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList));
// Must go after setting commit callback and initializing all pointers to children. // Must go after setting commit callback and initializing all pointers to children.
...@@ -858,13 +870,13 @@ void LLPanelPeople::updateRecentList() ...@@ -858,13 +870,13 @@ void LLPanelPeople::updateRecentList()
void LLPanelPeople::updateButtons() void LLPanelPeople::updateButtons()
{ {
std::string cur_tab = getActiveTabName(); const std::string& cur_tab = getActiveTabName();
// [RLVa:KB] - Checked: RLVa-1.4.9 // [RLVa:KB] - Checked: RLVa-1.4.9
bool nearby_tab_active = (cur_tab == NEARBY_TAB_NAME); bool nearby_tab_active = (cur_tab == NEARBY_TAB_NAME);
// [/RLVa:KB] // [/RLVa:KB]
bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME); bool friends_tab_active = (cur_tab == FRIENDS_TAB_NAME);
bool group_tab_active = (cur_tab == GROUP_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; LLUUID selected_id;
uuid_vec_t selected_uuids; uuid_vec_t selected_uuids;
...@@ -879,14 +891,13 @@ void LLPanelPeople::updateButtons() ...@@ -879,14 +891,13 @@ void LLPanelPeople::updateButtons()
selected_id = mGroupList->getSelectedUUID(); selected_id = mGroupList->getSelectedUUID();
} }
LLPanel* groups_panel = mTabContainer->getCurrentPanel(); mGroupDelBtn->setEnabled(item_selected && selected_id.notNull()); // a real group selected
groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected
U32 groups_count = gAgent.mGroups.size(); U32 groups_count = gAgent.mGroups.size();
S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0;
groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); mGroupCountText->setTextArg("[COUNT]", llformat("%d", groups_count));
groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); mGroupCountText->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
} }
else else
{ {
...@@ -900,25 +911,31 @@ void LLPanelPeople::updateButtons() ...@@ -900,25 +911,31 @@ void LLPanelPeople::updateButtons()
is_self = gAgent.getID() == selected_id; is_self = gAgent.getID() == selected_id;
} }
LLPanel* cur_panel = mTabContainer->getCurrentPanel();
if (cur_panel)
{ {
// [RLVa:KB] - Checked: RLVa-1.2.0 // [RLVa:KB] - Checked: RLVa-1.2.0
auto add_friend_btn = cur_panel->findChildView("add_friend_btn", TRUE); // auto add_friend_btn = cur_panel->findChildView("add_friend_btn", TRUE);
if (add_friend_btn) // if (add_friend_btn)
add_friend_btn->setEnabled(item_selected && !is_friend && !is_self && ((!nearby_tab_active) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, selected_id)))); // add_friend_btn->setEnabled(item_selected && !is_friend && !is_self && ((!nearby_tab_active) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, selected_id))));
// [/RLBa:KB] // [/RLBa:KB]
// if (cur_panel->hasChild("add_friend_btn", TRUE)) // if (cur_panel->hasChild("add_friend_btn", TRUE))
// cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend && !is_self); // 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 && ((!nearby_tab_active) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, selected_id))));
mNearbyGearBtn->setEnabled(multiple_selected);
}
if (friends_tab_active) if (friends_tab_active)
{ {
cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected); mFriendsGearBtn->setEnabled(multiple_selected);
mFriendsDelFriendBtn->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 && ((!nearby_tab_active) || (RlvActions::canShowName(RlvActions::SNC_DEFAULT, selected_id))));
mRecentGearBtn->setEnabled(multiple_selected);
} }
} }
} }
...@@ -934,14 +951,14 @@ void LLPanelPeople::updateButtons() ...@@ -934,14 +951,14 @@ void LLPanelPeople::updateButtons()
// [/RLBa:KB] // [/RLBa:KB]
} }
std::string LLPanelPeople::getActiveTabName() const const std::string& LLPanelPeople::getActiveTabName() const
{ {
return mTabContainer->getCurrentPanel()->getName(); return mTabContainer->getCurrentPanel()->getName();
} }
LLUUID LLPanelPeople::getCurrentItemID() const 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 if (cur_tab == FRIENDS_TAB_NAME) // this tab has two lists
{ {
...@@ -971,7 +988,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const ...@@ -971,7 +988,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const
void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) 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) if (cur_tab == FRIENDS_TAB_NAME)
{ {
...@@ -1078,7 +1095,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) ...@@ -1078,7 +1095,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string)
saved_filter = search_upper; saved_filter = search_upper;
// Apply new filter to the current tab. // 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) if (cur_tab == NEARBY_TAB_NAME)
{ {
mNearbyList->setNameFilter(filter); mNearbyList->setNameFilter(filter);
...@@ -1094,8 +1111,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) ...@@ -1094,8 +1111,8 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string)
mOnlineFriendList->setNameFilter(filter); mOnlineFriendList->setNameFilter(filter);
mAllFriendList->setNameFilter(filter); mAllFriendList->setNameFilter(filter);
setAccordionCollapsedByUser("tab_online", false); setAccordionCollapsedByUser(mAccordionOnlineTab, false);
setAccordionCollapsedByUser("tab_all", false); setAccordionCollapsedByUser(mAccordionAllTab, false);
showFriendsAccordionsIfNeeded(); showFriendsAccordionsIfNeeded();
// restore accordion tabs state _after_ all manipulations // restore accordion tabs state _after_ all manipulations
...@@ -1598,15 +1615,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) ...@@ -1598,15 +1615,8 @@ bool LLPanelPeople::notifyChildren(const LLSD& info)
return LLPanel::notifyChildren(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); tab->setVisible(show);
if(show) if(show)
{ {
...@@ -1624,12 +1634,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded() ...@@ -1624,12 +1634,11 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded()
if(FRIENDS_TAB_NAME == getActiveTabName()) if(FRIENDS_TAB_NAME == getActiveTabName())
{ {
// Expand and show accordions if needed, else - hide them // Expand and show accordions if needed, else - hide them
showAccordion("tab_online", mOnlineFriendList->filterHasMatches()); showAccordion(mAccordionOnlineTab, mOnlineFriendList->filterHasMatches());
showAccordion("tab_all", mAllFriendList->filterHasMatches()); showAccordion(mAccordionAllTab, mAllFriendList->filterHasMatches());
// Rearrange accordions // Rearrange accordions
LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion"); mFriendsAccordion->arrange();
accordion->arrange();
// *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368). // *TODO: new no_matched_tabs_text attribute was implemented in accordion (EXT-7368).
// this code should be refactored to use it // this code should be refactored to use it
...@@ -1642,11 +1651,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param ...@@ -1642,11 +1651,11 @@ void LLPanelPeople::onFriendListRefreshComplete(LLUICtrl*ctrl, const LLSD& param
{ {
if(ctrl == mOnlineFriendList) if(ctrl == mOnlineFriendList)
{ {
showAccordion("tab_online", param.asInteger()); showAccordion(mAccordionOnlineTab, param.asInteger());
} }
else if(ctrl == mAllFriendList) else if(ctrl == mAllFriendList)
{ {
showAccordion("tab_all", param.asInteger()); showAccordion(mAccordionAllTab, param.asInteger());
} }
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "llfloaterwebcontent.h" #include "llfloaterwebcontent.h"
#include "llvoiceclient.h" #include "llvoiceclient.h"
class LLAccordionCtrl;
class LLAccordionCtrlTab;
class LLAvatarList; class LLAvatarList;
class LLAvatarName; class LLAvatarName;
class LLFilterEditor; class LLFilterEditor;
...@@ -96,7 +98,7 @@ class LLPanelPeople ...@@ -96,7 +98,7 @@ class LLPanelPeople
bool isItemsFreeOfFriends(const uuid_vec_t& uuids); bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
void updateButtons(); void updateButtons();
std::string getActiveTabName() const; const std::string& getActiveTabName() const;
LLUUID getCurrentItemID() const; LLUUID getCurrentItemID() const;
void getCurrentItemIDs(uuid_vec_t& selected_uuids) const; void getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
void showGroupMenu(LLMenuGL* menu); void showGroupMenu(LLMenuGL* menu);
...@@ -135,7 +137,7 @@ class LLPanelPeople ...@@ -135,7 +137,7 @@ class LLPanelPeople
void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); 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(); void showFriendsAccordionsIfNeeded();
...@@ -147,6 +149,9 @@ class LLPanelPeople ...@@ -147,6 +149,9 @@ class LLPanelPeople
bool isAccordionCollapsedByUser(const std::string& name); bool isAccordionCollapsedByUser(const std::string& name);
LLTabContainer* mTabContainer; LLTabContainer* mTabContainer;
LLAccordionCtrl* mFriendsAccordion = nullptr;
LLAccordionCtrlTab* mAccordionAllTab = nullptr;
LLAccordionCtrlTab* mAccordionOnlineTab = nullptr;
LLAvatarList* mOnlineFriendList; LLAvatarList* mOnlineFriendList;
LLAvatarList* mAllFriendList; LLAvatarList* mAllFriendList;
LLAvatarList* mNearbyList; LLAvatarList* mNearbyList;
...@@ -154,6 +159,17 @@ class LLPanelPeople ...@@ -154,6 +159,17 @@ class LLPanelPeople
LLGroupList* mGroupList; LLGroupList* mGroupList;
LLNetMap* mMiniMap; 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<std::string> mSavedOriginalFilters; std::vector<std::string> mSavedOriginalFilters;
std::vector<std::string> mSavedFilters; std::vector<std::string> mSavedFilters;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment