Clean up FSFloaterContacts
parent
dbf4e1e61f
commit
66ac54aea9
|
|
@ -25,34 +25,29 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "fsfloatercontacts.h"
|
||||
|
||||
// libs
|
||||
#include "fscommon.h"
|
||||
#include "fscontactsfriendsctrl.h"
|
||||
#include "fscontactsfriendsmenu.h"
|
||||
#include "fsfloaterimcontainer.h"
|
||||
#include "llagent.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "lltabcontainer.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llavatarlistitem.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llcallingcard.h" // for LLAvatarTracker
|
||||
#include "llfloateravatarpicker.h"
|
||||
#include "llfloatergroupinvite.h"
|
||||
#include "llfriendcard.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llgroupactions.h"
|
||||
#include "llgrouplist.h"
|
||||
#include "fsfloaterimcontainer.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llstartup.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llvoiceclient.h"
|
||||
#include "fscommon.h"
|
||||
#include "lltabcontainer.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "fscontactsfriendsctrl.h"
|
||||
#include "fscontactsfriendsmenu.h"
|
||||
#include "llvoiceclient.h"
|
||||
|
||||
//Maximum number of people you can select to do an operation on at once.
|
||||
const U32 MAX_FRIEND_SELECT = 20;
|
||||
|
|
@ -123,11 +118,9 @@ BOOL FSFloaterContacts::postBuild()
|
|||
|
||||
mFriendsList = mFriendsTab->getChild<FSContactsFriendsCtrl>("friend_list");
|
||||
mFriendsList->setMaxSelectable(MAX_FRIEND_SELECT);
|
||||
//mFriendsList->setMaximumSelectCallback(boost::bind(&FSFloaterContacts::onMaximumSelect, this)); //TODO
|
||||
mFriendsList->setCommitOnSelectionChange(TRUE);
|
||||
mFriendsList->setCommitCallback(boost::bind(&FSFloaterContacts::onSelectName, this));
|
||||
mFriendsList->setDoubleClickCallback(boost::bind(&FSFloaterContacts::onImButtonClicked, this));
|
||||
//mFriendsList->setReturnCallback(boost::bind(&FSFloaterContacts::onImButtonClicked, this));
|
||||
mFriendsList->setContextMenu(&gFSContactsFriendsMenu);
|
||||
|
||||
mFriendsTab->childSetAction("im_btn", boost::bind(&FSFloaterContacts::onImButtonClicked, this));
|
||||
|
|
@ -252,7 +245,6 @@ void FSFloaterContacts::openTab(const std::string& name)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//static
|
||||
FSFloaterContacts* FSFloaterContacts::findInstance()
|
||||
{
|
||||
|
|
@ -270,33 +262,16 @@ FSFloaterContacts* FSFloaterContacts::getInstance()
|
|||
// Friend actions
|
||||
//
|
||||
|
||||
void FSFloaterContacts::onAvatarListDoubleClicked(LLUICtrl* ctrl)
|
||||
{
|
||||
LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
|
||||
if (!item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLUUID clicked_id = item->getAvatarId();
|
||||
|
||||
#if 0 // SJB: Useful for testing, but not currently functional or to spec
|
||||
LLAvatarActions::showProfile(clicked_id);
|
||||
#else // spec says open IM window
|
||||
LLAvatarActions::startIM(clicked_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
void FSFloaterContacts::onImButtonClicked()
|
||||
{
|
||||
uuid_vec_t selected_uuids;
|
||||
getCurrentItemIDs(selected_uuids);
|
||||
if ( selected_uuids.size() == 1 )
|
||||
if (selected_uuids.size() == 1)
|
||||
{
|
||||
// if selected only one person then start up IM
|
||||
LLAvatarActions::startIM(selected_uuids.at(0));
|
||||
LLAvatarActions::startIM(selected_uuids.front());
|
||||
}
|
||||
else if ( selected_uuids.size() > 1 )
|
||||
else if (selected_uuids.size() > 1)
|
||||
{
|
||||
// for multiple selection start up friends conference
|
||||
LLAvatarActions::startConference(selected_uuids);
|
||||
|
|
@ -320,7 +295,9 @@ void FSFloaterContacts::onPayButtonClicked()
|
|||
{
|
||||
LLUUID id = getCurrentItemID();
|
||||
if (id.notNull())
|
||||
{
|
||||
LLAvatarActions::pay(id);
|
||||
}
|
||||
}
|
||||
|
||||
void FSFloaterContacts::onDeleteFriendButtonClicked()
|
||||
|
|
@ -330,11 +307,11 @@ void FSFloaterContacts::onDeleteFriendButtonClicked()
|
|||
|
||||
if (selected_uuids.size() == 1)
|
||||
{
|
||||
LLAvatarActions::removeFriendDialog( selected_uuids.front() );
|
||||
LLAvatarActions::removeFriendDialog(selected_uuids.front());
|
||||
}
|
||||
else if (selected_uuids.size() > 1)
|
||||
{
|
||||
LLAvatarActions::removeFriendsDialog( selected_uuids );
|
||||
LLAvatarActions::removeFriendsDialog(selected_uuids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -458,9 +435,13 @@ LLUUID FSFloaterContacts::getCurrentItemID() const
|
|||
{
|
||||
LLScrollListItem* selected = mFriendsList->getFirstSelected();
|
||||
if (selected)
|
||||
{
|
||||
return selected->getUUID();
|
||||
}
|
||||
else
|
||||
{
|
||||
return LLUUID::null;
|
||||
}
|
||||
}
|
||||
else if (cur_tab == GROUP_TAB_NAME)
|
||||
{
|
||||
|
|
@ -517,8 +498,6 @@ void FSFloaterContacts::sortFriendList()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Friends list
|
||||
//
|
||||
|
|
@ -527,59 +506,64 @@ void FSFloaterContacts::onFriendListUpdate(U32 changed_mask)
|
|||
{
|
||||
LLAvatarTracker& at = LLAvatarTracker::instance();
|
||||
|
||||
switch(changed_mask) {
|
||||
case LLFriendObserver::ADD:
|
||||
{
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
switch (changed_mask)
|
||||
{
|
||||
case LLFriendObserver::ADD:
|
||||
{
|
||||
addFriend(*id_it);
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
{
|
||||
addFriend(*id_it);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LLFriendObserver::REMOVE:
|
||||
{
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
break;
|
||||
case LLFriendObserver::REMOVE:
|
||||
{
|
||||
mFriendsList->deleteSingleItem(mFriendsList->getItemIndex(*id_it));
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
{
|
||||
mFriendsList->deleteSingleItem(mFriendsList->getItemIndex(*id_it));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LLFriendObserver::POWERS:
|
||||
{
|
||||
--mNumRightsChanged;
|
||||
if(mNumRightsChanged > 0)
|
||||
mAllowRightsChange = FALSE;
|
||||
else
|
||||
mAllowRightsChange = TRUE;
|
||||
break;
|
||||
case LLFriendObserver::POWERS:
|
||||
{
|
||||
--mNumRightsChanged;
|
||||
if (mNumRightsChanged > 0)
|
||||
{
|
||||
mAllowRightsChange = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mAllowRightsChange = TRUE;
|
||||
}
|
||||
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
{
|
||||
const LLRelationship* info = at.getBuddyInfo(*id_it);
|
||||
updateFriendItem(*id_it, info);
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
{
|
||||
const LLRelationship* info = at.getBuddyInfo(*id_it);
|
||||
updateFriendItem(*id_it, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LLFriendObserver::ONLINE:
|
||||
{
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
break;
|
||||
case LLFriendObserver::ONLINE:
|
||||
{
|
||||
const LLRelationship* info = at.getBuddyInfo(*id_it);
|
||||
updateFriendItem(*id_it, info);
|
||||
const std::set<LLUUID>& changed_items = at.getChangedIDs();
|
||||
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
|
||||
std::set<LLUUID>::const_iterator id_end = changed_items.end();
|
||||
for (;id_it != id_end; ++id_it)
|
||||
{
|
||||
const LLRelationship* info = at.getBuddyInfo(*id_it);
|
||||
updateFriendItem(*id_it, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
default:;
|
||||
default:;
|
||||
}
|
||||
|
||||
refreshUI();
|
||||
|
|
@ -589,7 +573,11 @@ void FSFloaterContacts::addFriend(const LLUUID& agent_id)
|
|||
{
|
||||
LLAvatarTracker& at = LLAvatarTracker::instance();
|
||||
const LLRelationship* relationInfo = at.getBuddyInfo(agent_id);
|
||||
if(!relationInfo) return;
|
||||
|
||||
if (!relationInfo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(agent_id);
|
||||
bool isOnline = relationInfo->isOnline();
|
||||
|
|
@ -688,9 +676,16 @@ void FSFloaterContacts::onMapButtonClicked()
|
|||
// Does not resort the UI list because it can be called frequently. JC
|
||||
void FSFloaterContacts::updateFriendItem(const LLUUID& agent_id, const LLRelationship* info)
|
||||
{
|
||||
if (!info) return;
|
||||
if (!info)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLScrollListItem* itemp = mFriendsList->getItem(agent_id);
|
||||
if (!itemp) return;
|
||||
if (!itemp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isOnlineSIP = LLVoiceClient::getInstance()->isOnlineSIP(itemp->getUUID());
|
||||
bool isOnline = info->isOnline();
|
||||
|
|
@ -703,7 +698,7 @@ void FSFloaterContacts::updateFriendItem(const LLUUID& agent_id, const LLRelatio
|
|||
|
||||
// Name of the status icon to use
|
||||
std::string statusIcon;
|
||||
if(isOnline)
|
||||
if (isOnline)
|
||||
{
|
||||
statusIcon = "icon_avatar_online";
|
||||
}
|
||||
|
|
@ -714,9 +709,9 @@ void FSFloaterContacts::updateFriendItem(const LLUUID& agent_id, const LLRelatio
|
|||
|
||||
itemp->getColumn(LIST_ONLINE_STATUS)->setValue(statusIcon);
|
||||
|
||||
itemp->getColumn(LIST_FRIEND_USER_NAME)->setValue( av_name.getUserNameForDisplay() );
|
||||
itemp->getColumn(LIST_FRIEND_DISPLAY_NAME)->setValue( av_name.getDisplayName() );
|
||||
itemp->getColumn(LIST_FRIEND_NAME)->setValue( getFullName(av_name) );
|
||||
itemp->getColumn(LIST_FRIEND_USER_NAME)->setValue(av_name.getUserNameForDisplay());
|
||||
itemp->getColumn(LIST_FRIEND_DISPLAY_NAME)->setValue(av_name.getDisplayName());
|
||||
itemp->getColumn(LIST_FRIEND_NAME)->setValue(getFullName(av_name));
|
||||
|
||||
// render name of online friends in bold text
|
||||
LLFontGL::StyleFlags font_style = ((isOnline || isOnlineSIP) ? LLFontGL::BOLD : LLFontGL::NORMAL);
|
||||
|
|
@ -773,7 +768,7 @@ void FSFloaterContacts::refreshRightsChangeList()
|
|||
}
|
||||
}
|
||||
|
||||
if (num_selected == 0) // nothing selected
|
||||
if (num_selected == 0) // nothing selected
|
||||
{
|
||||
childSetEnabled("im_btn", false);
|
||||
childSetEnabled("offer_teleport_btn", false);
|
||||
|
|
@ -836,21 +831,24 @@ void FSFloaterContacts::onSelectName()
|
|||
|
||||
void FSFloaterContacts::confirmModifyRights(rights_map_t& ids, EGrantRevoke command)
|
||||
{
|
||||
if (ids.empty()) return;
|
||||
if (ids.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLSD args;
|
||||
if(ids.size() > 0)
|
||||
if (ids.size() > 0)
|
||||
{
|
||||
rights_map_t* rights = new rights_map_t(ids);
|
||||
|
||||
// for single friend, show their name
|
||||
if(ids.size() == 1)
|
||||
if (ids.size() == 1)
|
||||
{
|
||||
LLUUID agent_id = ids.begin()->first;
|
||||
std::string name;
|
||||
if(gCacheName->getFullName(agent_id, name))
|
||||
if (gCacheName->getFullName(agent_id, name))
|
||||
{
|
||||
args["NAME"] = name;
|
||||
args["NAME"] = name;
|
||||
}
|
||||
if (command == GRANT)
|
||||
{
|
||||
|
|
@ -1034,11 +1032,13 @@ void FSFloaterContacts::sendRightsGrant(rights_map_t& ids)
|
|||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
void FSFloaterContacts::childShowTab(const std::string& id, const std::string& tabname )
|
||||
void FSFloaterContacts::childShowTab(const std::string& id, const std::string& tabname)
|
||||
{
|
||||
LLTabContainer* child = findChild<LLTabContainer>(id);
|
||||
if (child)
|
||||
{
|
||||
child->selectTabByName(tabname);
|
||||
}
|
||||
}
|
||||
|
||||
void FSFloaterContacts::updateRlvRestrictions(ERlvBehaviour behavior)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ private:
|
|||
LLUUID getCurrentItemID() const;
|
||||
void getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
|
||||
void getCurrentFriendItemIDs(uuid_vec_t& selected_uuids) const;
|
||||
void onAvatarListDoubleClicked(LLUICtrl* ctrl);
|
||||
|
||||
enum FRIENDS_COLUMN_ORDER
|
||||
{
|
||||
|
|
@ -102,7 +101,7 @@ private:
|
|||
void refreshUI();
|
||||
void onSelectName();
|
||||
void applyRightsToFriends();
|
||||
void addFriend(const LLUUID& agent_id);
|
||||
void addFriend(const LLUUID& agent_id);
|
||||
void updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship);
|
||||
|
||||
typedef enum
|
||||
|
|
|
|||
Loading…
Reference in New Issue