summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelpeople.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelpeople.cpp')
-rw-r--r--indra/newview/llpanelpeople.cpp123
1 files changed, 64 insertions, 59 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index fb96718d1c..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 )
@@ -612,15 +610,13 @@ bool LLPanelPeople::postBuild()
{
S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit();
- mNearbyFilterCommitConnection = getChild<LLFilterEditor>("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- mFriedsFilterCommitConnection = getChild<LLFilterEditor>("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- mGroupsFilterCommitConnection = getChild<LLFilterEditor>("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
- mRecentFilterCommitConnection = 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");
@@ -633,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);
@@ -709,12 +721,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.
@@ -844,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;
@@ -862,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 = 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
{
@@ -883,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
{
@@ -939,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)
{
@@ -1027,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);
@@ -1043,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
@@ -1087,7 +1104,6 @@ void LLPanelPeople::onGroupLimitInfo()
void LLPanelPeople::onTabSelected(const LLSD& param)
{
- std::string tab_name = getChild<LLPanel>(param.asString())->getName();
updateButtons();
showFriendsAccordionsIfNeeded();
@@ -1121,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);
@@ -1148,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;
}
@@ -1458,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)
{
@@ -1484,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
@@ -1502,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());
}
}