Skip to content

Commit 6d47963

Browse files
committed
Clean up contacts floater
1 parent 02a5b8f commit 6d47963

2 files changed

Lines changed: 49 additions & 58 deletions

File tree

indra/newview/fsfloatercontacts.cpp

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void FSFloaterContacts::onOpen(const LLSD& key)
274274
// first set the tear-off host to the conversations container
275275
setHost(floater_container);
276276
// clear the tear-off host right after, the "last host used" will still stick
277-
setHost(NULL);
277+
setHost(nullptr);
278278
// reparent to floater view
279279
gFloaterView->addChild(this);
280280
}
@@ -389,7 +389,7 @@ void FSFloaterContacts::onDeleteFriendButtonClicked()
389389
}
390390
}
391391

392-
bool FSFloaterContacts::isItemsFreeOfFriends(const uuid_vec_t& uuids)
392+
bool FSFloaterContacts::isItemsFreeOfFriends(const uuid_vec_t& uuids) const
393393
{
394394
const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
395395
for (const auto& id : uuids)
@@ -723,11 +723,7 @@ void FSFloaterContacts::addFriend(const LLUUID& agent_id)
723723
update_gen_column["column"] = "friend_last_update_generation";
724724
update_gen_column["value"] = relationInfo->getChangeSerialNum();
725725

726-
mFriendsList->addElement(element, ADD_BOTTOM);
727-
if (LLScrollListItem* added_item = mFriendsList->getItem(agent_id); added_item)
728-
{
729-
updateFriendItemColor(added_item, agent_id);
730-
}
726+
updateFriendItemColor(mFriendsList->addElement(element, ADD_BOTTOM), agent_id);
731727
}
732728

733729
void FSFloaterContacts::onMapButtonClicked()
@@ -936,56 +932,52 @@ void FSFloaterContacts::onSelectName()
936932
applyRightsToFriends();
937933
}
938934

939-
void FSFloaterContacts::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
935+
void FSFloaterContacts::confirmModifyRights(const rights_map_t& ids, EGrantRevoke command)
940936
{
941937
if (ids.empty())
942938
{
943939
return;
944940
}
945941

946942
LLSD args;
947-
if (ids.size() > 0)
948-
{
949-
rights_map_t* rights = new rights_map_t(ids);
943+
rights_map_t* rights = new rights_map_t(ids);
950944

951-
// for single friend, show their name
952-
if (ids.size() == 1)
945+
// for single friend, show their name
946+
if (ids.size() == 1)
947+
{
948+
args["NAME"] = LLSLURL("agent", ids.begin()->first, "completename").getSLURLString();
949+
if (command == GRANT)
953950
{
954-
args["NAME"] = LLSLURL("agent", ids.begin()->first, "completename").getSLURLString();
955-
if (command == GRANT)
956-
{
957-
LLNotificationsUtil::add("GrantModifyRights",
958-
args,
959-
LLSD(),
960-
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
961-
}
962-
else
963-
{
964-
LLNotificationsUtil::add("RevokeModifyRights",
965-
args,
966-
LLSD(),
967-
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
968-
}
951+
LLNotificationsUtil::add("GrantModifyRights",
952+
args,
953+
LLSD(),
954+
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
969955
}
970956
else
971957
{
972-
if (command == GRANT)
973-
{
974-
LLNotificationsUtil::add("GrantModifyRightsMultiple",
975-
args,
976-
LLSD(),
977-
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
978-
}
979-
else
980-
{
981-
LLNotificationsUtil::add("RevokeModifyRightsMultiple",
982-
args,
983-
LLSD(),
984-
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
985-
}
958+
LLNotificationsUtil::add("RevokeModifyRights",
959+
args,
960+
LLSD(),
961+
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
962+
}
963+
}
964+
else
965+
{
966+
if (command == GRANT)
967+
{
968+
LLNotificationsUtil::add("GrantModifyRightsMultiple",
969+
args,
970+
LLSD(),
971+
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
972+
}
973+
else
974+
{
975+
LLNotificationsUtil::add("RevokeModifyRightsMultiple",
976+
args,
977+
LLSD(),
978+
boost::bind(&FSFloaterContacts::modifyRightsConfirmation, this, _1, _2, rights));
986979
}
987980
}
988-
989981
}
990982

991983
bool FSFloaterContacts::modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights)
@@ -1113,7 +1105,7 @@ void FSFloaterContacts::applyRightsToFriends()
11131105
}
11141106
}
11151107

1116-
void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
1108+
void FSFloaterContacts::sendRightsGrant(const rights_map_t& ids)
11171109
{
11181110
if (ids.empty())
11191111
{
@@ -1312,7 +1304,7 @@ void FSFloaterContacts::onDisplayNameChanged()
13121304
mFriendsList->setNeedsSort();
13131305
}
13141306

1315-
std::string FSFloaterContacts::getFullName(const LLAvatarName& av_name)
1307+
std::string FSFloaterContacts::getFullName(const LLAvatarName& av_name) const
13161308
{
13171309
if (av_name.isDisplayNameDefault() || !gSavedSettings.getBOOL("UseDisplayNames"))
13181310
{

indra/newview/fsfloatercontacts.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "llcallingcard.h"
3434
#include "llfloater.h"
3535
#include "lggcontactsets.h"
36-
#include "llscrolllistcolumn.h"
3736
#include "rlvhandler.h"
3837

3938
class FSScrollListCtrl;
@@ -67,16 +66,16 @@ class FSFloaterContacts : public LLFloater, LLFriendObserver, LLEventTimer
6766
void openTab(std::string_view name);
6867
LLPanel* getPanelByName(std::string_view panel_name);
6968

70-
void sortFriendList();
71-
void onDisplayNameChanged();
72-
void resetFriendFilter();
69+
void sortFriendList();
70+
void onDisplayNameChanged();
71+
void resetFriendFilter();
7372

7473
// <FS:TJ> [FIRE-35804] Allow the IM floater to have separate transparency
7574
F32 onGetFilterOpacityCallback(ETypeTransparency type, F32 alpha);
7675
// </FS:TJ>
7776

7877
private:
79-
typedef std::vector<LLScrollListItem*> listitem_vec_t;
78+
using listitem_vec_t = std::vector<LLScrollListItem*>;
8079

8180
std::string getActiveTabName() const;
8281
LLUUID getCurrentItemID() const;
@@ -97,7 +96,7 @@ class FSFloaterContacts : public LLFloater, LLFriendObserver, LLEventTimer
9796
LIST_FRIEND_UPDATE_GEN
9897
};
9998

100-
typedef std::map<LLUUID, S32> rights_map_t;
99+
using rights_map_t = std::map<LLUUID, S32>;
101100
void refreshRightsChangeList();
102101
void refreshUI();
103102
void updateFriendCount();
@@ -108,17 +107,17 @@ class FSFloaterContacts : public LLFloater, LLFriendObserver, LLEventTimer
108107
void updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship, const LLUUID& request_id);
109108
void updateFriendItemColor(LLScrollListItem* item, const LLUUID& agent_id) const;
110109

111-
typedef enum
110+
enum EGrantRevoke
112111
{
113112
GRANT,
114113
REVOKE
115-
} EGrantRevoke;
116-
void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
117-
void sendRightsGrant(rights_map_t& ids);
114+
};
115+
void confirmModifyRights(const rights_map_t& ids, EGrantRevoke command);
116+
void sendRightsGrant(const rights_map_t& ids);
118117
bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights);
119118

120119

121-
bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
120+
bool isItemsFreeOfFriends(const uuid_vec_t& uuids) const;
122121

123122
// misc callbacks
124123
static void onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName>& names);
@@ -201,11 +200,11 @@ class FSFloaterContacts : public LLFloater, LLFriendObserver, LLEventTimer
201200
boost::signals2::connection mRlvBehaviorCallbackConnection{};
202201
boost::signals2::connection mContactSetChangedConnection{};
203202

204-
std::string getFullName(const LLAvatarName& av_name);
203+
std::string getFullName(const LLAvatarName& av_name) const;
205204

206205
void setDirtyNames(const LLUUID& request_id);
207206

208-
typedef std::map<LLUUID, LLAvatarNameCache::callback_connection_t> avatar_name_cb_t;
207+
using avatar_name_cb_t = std::map<LLUUID, LLAvatarNameCache::callback_connection_t>;
209208
avatar_name_cb_t mAvatarNameCacheConnections;
210209
void disconnectAvatarNameCacheConnection(const LLUUID& request_id);
211210
};

0 commit comments

Comments
 (0)