summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelpeople.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-10-17 16:56:21 +0300
committerGitHub <noreply@github.com>2024-10-17 16:56:21 +0300
commit0ef7a9b39cf72da1211039ab22bdf8f9f6a2c984 (patch)
tree6f51ef179497265b5bff2a355471ae5dc9643ad2 /indra/newview/llpanelpeople.cpp
parent9e24b300d02e5627ea0d304d412cb683ec2de3a4 (diff)
parentd3d349ae0f17a72481f30b9354b9367b1cd3b639 (diff)
Merge pull request #2856 from secondlife/marchcat/c-develop
Develop → Maint C sync
Diffstat (limited to 'indra/newview/llpanelpeople.cpp')
-rw-r--r--indra/newview/llpanelpeople.cpp231
1 files changed, 108 insertions, 123 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 44e860837e..ca1a4e258d 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 )
@@ -310,12 +308,12 @@ public:
: LLEventTimer(period),
LLPanelPeople::Updater(cb)
{
- mEventTimer.stop();
+ stop();
}
- virtual BOOL tick() // from LLEventTimer
+ bool tick() override // from LLEventTimer
{
- return FALSE;
+ return false;
}
};
@@ -338,7 +336,7 @@ public:
LLAvatarTracker::instance().addObserver(this);
// For notification when SIP online status changes.
- LLVoiceClient::getInstance()->addObserver(this);
+ LLVoiceClient::addObserver(this);
mInvObserver = new LLInventoryFriendCardObserver(this);
}
@@ -346,20 +344,17 @@ public:
{
// will be deleted by ~LLInventoryModel
//delete mInvObserver;
- if (LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+ LLVoiceClient::removeObserver(this);
LLAvatarTracker::instance().removeObserver(this);
}
- /*virtual*/ void changed(U32 mask)
+ void changed(U32 mask) override
{
if (mIsActive)
{
// events can arrive quickly in bulk - we need not process EVERY one of them -
// so we wait a short while to let others pile-in, and process them in aggregate.
- mEventTimer.start();
+ start();
}
// save-up all the mask-bits which have come-in
@@ -367,9 +362,9 @@ public:
}
- /*virtual*/ BOOL tick()
+ bool tick() override
{
- if (!mIsActive) return FALSE;
+ if (!mIsActive) return false;
if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
{
@@ -377,14 +372,13 @@ public:
}
// Stop updates.
- mEventTimer.stop();
+ stop();
mMask = 0;
- return FALSE;
+ return false;
}
- // virtual
- void setActive(bool active)
+ void setActive(bool active) override
{
mIsActive = active;
if (active)
@@ -493,25 +487,25 @@ public:
setActive(false);
}
- /*virtual*/ void setActive(bool val)
+ void setActive(bool val) override
{
if (val)
{
// update immediately and start regular updates
update();
- mEventTimer.start();
+ start();
}
else
{
// stop regular updates
- mEventTimer.stop();
+ stop();
}
}
- /*virtual*/ BOOL tick()
+ bool tick() override
{
update();
- return FALSE;
+ return false;
}
private:
};
@@ -548,18 +542,18 @@ LLPanelPeople::LLPanelPeople()
mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this));
mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this));
- mCommitCallbackRegistrar.add("People.AddFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this));
- mCommitCallbackRegistrar.add("People.AddFriendWizard", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this));
- mCommitCallbackRegistrar.add("People.DelFriend", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Group.Minus", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Chat", boost::bind(&LLPanelPeople::onChatButtonClicked, this));
- mCommitCallbackRegistrar.add("People.Gear", boost::bind(&LLPanelPeople::onGearButtonClicked, this, _1));
+ mCommitCallbackRegistrar.add("People.AddFriend", { boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this) });
+ mCommitCallbackRegistrar.add("People.AddFriendWizard", { boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this) });
+ mCommitCallbackRegistrar.add("People.DelFriend", { boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this), cb_info::UNTRUSTED_BLOCK });
+ mCommitCallbackRegistrar.add("People.Group.Minus", { boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this), cb_info::UNTRUSTED_BLOCK });
+ mCommitCallbackRegistrar.add("People.Chat", { boost::bind(&LLPanelPeople::onChatButtonClicked, this) });
+ mCommitCallbackRegistrar.add("People.Gear", { boost::bind(&LLPanelPeople::onGearButtonClicked, this, _1) });
- mCommitCallbackRegistrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Friends.ViewSort.Action", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Nearby.ViewSort.Action", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Groups.ViewSort.Action", boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2));
- mCommitCallbackRegistrar.add("People.Recent.ViewSort.Action", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2));
+ mCommitCallbackRegistrar.add("People.Group.Plus.Action", { boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2), cb_info::UNTRUSTED_BLOCK });
+ mCommitCallbackRegistrar.add("People.Friends.ViewSort.Action", { boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2) });
+ mCommitCallbackRegistrar.add("People.Nearby.ViewSort.Action", { boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2) });
+ mCommitCallbackRegistrar.add("People.Groups.ViewSort.Action", { boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2) });
+ mCommitCallbackRegistrar.add("People.Recent.ViewSort.Action", { boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2) });
mEnableCallbackRegistrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2));
mEnableCallbackRegistrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2));
@@ -577,10 +571,13 @@ LLPanelPeople::~LLPanelPeople()
delete mFriendListUpdater;
delete mRecentListUpdater;
- if(LLVoiceClient::instanceExists())
- {
- LLVoiceClient::getInstance()->removeObserver(this);
- }
+ LLVoiceClient::removeObserver(this);
+
+ mNearbyFilterCommitConnection.disconnect();
+ mFriedsFilterCommitConnection.disconnect();
+ mGroupsFilterCommitConnection.disconnect();
+ mRecentFilterCommitConnection.disconnect();
+
}
void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list)
@@ -609,19 +606,17 @@ void LLPanelPeople::removePicker()
}
}
-BOOL LLPanelPeople::postBuild()
+bool LLPanelPeople::postBuild()
{
S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
- getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- getChild<LLFilterEditor>("friends_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));
-
+ 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)
{
- getChild<LLTextBox>("groupcount")->setText(getString("GroupCountWithInfo"));
- getChild<LLTextBox>("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
+ mGroupCountText->setText(getString("GroupCountWithInfo"));
+ mGroupCountText->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this));
}
mTabContainer = getChild<LLTabContainer>("tabs");
@@ -634,40 +629,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<LLButton>("gear_btn");
+ mFriendsDelFriendBtn = friends_tab->getChild<LLUICtrl>("friends_del_btn");
+
mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online");
mAllFriendList = friends_tab->getChild<LLAvatarList>("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<LLPanel>(NEARBY_TAB_NAME);
nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
+
mNearbyList = nearby_tab->getChild<LLAvatarList>("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<LLNetMap>("Net Map", true);
mMiniMap->setToolTipMsg(gSavedSettings.getBOOL("DoubleClickTeleport") ?
getString("AltMiniMapToolTipMsg") : getString("MiniMapToolTipMsg"));
- mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
+ mNearbyGearBtn = nearby_tab->getChild<LLButton>("gear_btn");
+ mNearbyAddFriendBtn = nearby_tab->getChild<LLButton>("add_friend_btn");
+
+ LLPanel* recent_tab = getChild<LLPanel>(RECENT_TAB_NAME);
+ mRecentList = recent_tab->getChild<LLAvatarList>("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<LLGroupList>("group_list");
+ mRecentGearBtn = recent_tab->getChild<LLButton>("gear_btn");
+ mRecentAddFriendBtn = recent_tab->getChild<LLButton>("add_friend_btn");
+
+ mGroupList = group_tab->getChild<LLGroupList>("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<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ mFriedsFilterCommitConnection = friends_tab->getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ mRecentFilterCommitConnection = recent_tab->getChild<LLFilterEditor>("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+ mGroupsFilterCommitConnection = group_tab->getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
+
mNearbyList->setContextMenu(&LLPanelPeopleMenus::gNearbyPeopleContextMenu);
mRecentList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
@@ -710,18 +721,20 @@ 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.
mTabContainer->selectTabByName(NEARBY_TAB_NAME);
- LLVoiceClient::getInstance()->addObserver(this);
+ LLVoiceClient::addObserver(this);
// call this method in case some list is empty and buttons can be in inconsistent state
updateButtons();
@@ -729,11 +742,11 @@ BOOL LLPanelPeople::postBuild()
mOnlineFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
mAllFriendList->setRefreshCompleteCallback(boost::bind(&LLPanelPeople::onFriendListRefreshComplete, this, _1, _2));
- return TRUE;
+ return true;
}
// virtual
-void LLPanelPeople::onChange(EStatusType status, const std::string &channelURI, bool proximal)
+void LLPanelPeople::onChange(EStatusType status, const LLSD& channelInfo, bool proximal)
{
if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL)
{
@@ -831,7 +844,7 @@ void LLPanelPeople::updateNearbyList()
mNearbyList->setDirty();
DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
- LLActiveSpeakerMgr::instance().update(TRUE);
+ LLActiveSpeakerMgr::instance().update(true);
}
void LLPanelPeople::updateRecentList()
@@ -845,10 +858,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;
@@ -863,14 +877,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 = gAgent.mGroups.size();
- S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
+ U32 groups_count = static_cast<U32>(gAgent.mGroups.size());
+ U32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit();
U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0;
- groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count));
- groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
+ mGroupCountText->setTextArg("[COUNT]", llformat("%d", groups_count));
+ mGroupCountText->setTextArg("[REMAINING]", llformat("%d", groups_remaining));
}
else
{
@@ -884,33 +897,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
{
@@ -940,7 +956,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)
{
@@ -961,25 +977,6 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
}
-void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
-{
- // Shows the menu at the top of the button bar.
-
- // Calculate its coordinates.
- // (assumes that groups panel is the current tab)
- LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
- LLPanel* parent_panel = mTabContainer->getCurrentPanel();
- menu->arrangeAndClear();
- S32 menu_height = menu->getRect().getHeight();
- S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
- S32 menu_y = bottom_panel->getRect().mTop + menu_height;
-
- // Actually show the menu.
- menu->buildDrawLabels();
- menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
-}
-
void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save)
{
switch (order)
@@ -1047,7 +1044,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);
@@ -1063,8 +1060,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
@@ -1107,7 +1104,6 @@ void LLPanelPeople::onGroupLimitInfo()
void LLPanelPeople::onTabSelected(const LLSD& param)
{
- std::string tab_name = getChild<LLPanel>(param.asString())->getName();
updateButtons();
showFriendsAccordionsIfNeeded();
@@ -1141,9 +1137,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);
@@ -1168,12 +1164,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;
}
@@ -1184,11 +1177,11 @@ bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids)
void LLPanelPeople::onAddFriendWizButtonClicked()
{
LLPanel* cur_panel = mTabContainer->getCurrentPanel();
- LLView * button = cur_panel->findChild<LLButton>("friends_add_btn", TRUE);
+ LLView * button = cur_panel->findChild<LLButton>("friends_add_btn", true);
// Show add friend wizard.
LLFloater* root_floater = gFloaterView->getParentFloater(this);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button);
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), false, true, false, root_floater->getName(), button);
if (!picker)
{
return;
@@ -1478,15 +1471,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)
{
@@ -1504,12 +1490,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
@@ -1522,11 +1507,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());
}
}