Fix for friends list not resorting upon avatar online status change. Also did some minor cleanup
This commit is contained in:
@@ -642,6 +642,18 @@ public:
|
|||||||
|
|
||||||
// manually call this whenever editing list items in place to flag need for resorting
|
// manually call this whenever editing list items in place to flag need for resorting
|
||||||
void setNeedsSort(bool val = true) { mSorted = !val; }
|
void setNeedsSort(bool val = true) { mSorted = !val; }
|
||||||
|
void setNeedsSortColumn(S32 col)
|
||||||
|
{
|
||||||
|
if(!isSorted())return;
|
||||||
|
for(std::vector<std::pair<S32, BOOL> >::iterator it=mSortColumns.begin();it!=mSortColumns.end();++it)
|
||||||
|
{
|
||||||
|
if((*it).first == col)
|
||||||
|
{
|
||||||
|
setNeedsSort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void dirtyColumns(); // some operation has potentially affected column layout or ordering
|
void dirtyColumns(); // some operation has potentially affected column layout or ordering
|
||||||
|
|
||||||
boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb )
|
boost::signals2::connection setSortCallback(sort_signal_t::slot_type cb )
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
#include "llfloaterchat.h"
|
#include "llfloaterchat.h"
|
||||||
|
|
||||||
// <dogmode> stuff for Contact groups
|
// <dogmode> stuff for Contact groups
|
||||||
#include "ascentfloatercontactgroups.h"
|
//#include "ascentfloatercontactgroups.h"
|
||||||
|
|
||||||
#define DEFAULT_PERIOD 5.0
|
#define DEFAULT_PERIOD 5.0
|
||||||
#define RIGHTS_CHANGE_TIMEOUT 5.0
|
#define RIGHTS_CHANGE_TIMEOUT 5.0
|
||||||
@@ -87,18 +87,40 @@
|
|||||||
#define ONLINE_SIP_ICON_NAME "slim_icon_16_viewer.tga"
|
#define ONLINE_SIP_ICON_NAME "slim_icon_16_viewer.tga"
|
||||||
|
|
||||||
// simple class to observe the calling cards.
|
// simple class to observe the calling cards.
|
||||||
class LLLocalFriendsObserver : public LLFriendObserver, public LLEventTimer
|
|
||||||
|
|
||||||
|
class LLAvatarListUpdater : public LLEventTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLLocalFriendsObserver(LLPanelFriends* floater) : mFloater(floater), LLEventTimer(OBSERVER_TIMEOUT)
|
LLAvatarListUpdater(F32 period)
|
||||||
|
: LLEventTimer(period)
|
||||||
{
|
{
|
||||||
mEventTimer.stop();
|
mEventTimer.stop();
|
||||||
}
|
}
|
||||||
virtual ~LLLocalFriendsObserver()
|
|
||||||
|
virtual BOOL tick() // from LLEventTimer
|
||||||
{
|
{
|
||||||
mFloater = NULL;
|
return FALSE;
|
||||||
}
|
}
|
||||||
virtual void changed(U32 mask)
|
};
|
||||||
|
|
||||||
|
class LLLocalFriendsObserver : public LLAvatarListUpdater, public LLFriendObserver
|
||||||
|
{
|
||||||
|
LOG_CLASS(LLLocalFriendsObserver);
|
||||||
|
public:
|
||||||
|
LLLocalFriendsObserver(LLPanelFriends* floater)
|
||||||
|
: mFloater(floater), LLAvatarListUpdater(OBSERVER_TIMEOUT)
|
||||||
|
{
|
||||||
|
LLAvatarTracker::instance().addObserver(this);
|
||||||
|
// For notification when SIP online status changes.
|
||||||
|
LLVoiceClient::getInstance()->addObserver(this);
|
||||||
|
}
|
||||||
|
/*virtual*/ ~LLLocalFriendsObserver()
|
||||||
|
{
|
||||||
|
LLVoiceClient::getInstance()->removeObserver(this);
|
||||||
|
LLAvatarTracker::instance().removeObserver(this);
|
||||||
|
}
|
||||||
|
/*virtual*/ void changed(U32 mask)
|
||||||
{
|
{
|
||||||
// events can arrive quickly in bulk - we need not process EVERY one of them -
|
// 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.
|
// so we wait a short while to let others pile-in, and process them in aggregate.
|
||||||
@@ -107,9 +129,9 @@ public:
|
|||||||
// save-up all the mask-bits which have come-in
|
// save-up all the mask-bits which have come-in
|
||||||
mMask |= mask;
|
mMask |= mask;
|
||||||
}
|
}
|
||||||
virtual BOOL tick()
|
/*virtual*/ BOOL tick()
|
||||||
{
|
{
|
||||||
mFloater->populateContactGroupSelect();
|
//mFloater->populateContactGroupSelect();
|
||||||
mFloater->updateFriends(mMask);
|
mFloater->updateFriends(mMask);
|
||||||
|
|
||||||
mEventTimer.stop();
|
mEventTimer.stop();
|
||||||
@@ -134,16 +156,10 @@ LLPanelFriends::LLPanelFriends() :
|
|||||||
{
|
{
|
||||||
mEventTimer.stop();
|
mEventTimer.stop();
|
||||||
mObserver = new LLLocalFriendsObserver(this);
|
mObserver = new LLLocalFriendsObserver(this);
|
||||||
LLAvatarTracker::instance().addObserver(mObserver);
|
|
||||||
// For notification when SIP online status changes.
|
|
||||||
LLVoiceClient::getInstance()->addObserver(mObserver);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLPanelFriends::~LLPanelFriends()
|
LLPanelFriends::~LLPanelFriends()
|
||||||
{
|
{
|
||||||
// For notification when SIP online status changes.
|
|
||||||
LLVoiceClient::getInstance()->removeObserver(mObserver);
|
|
||||||
LLAvatarTracker::instance().removeObserver(mObserver);
|
|
||||||
delete mObserver;
|
delete mObserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +234,7 @@ std::string LLPanelFriends::cleanFileName(std::string filename)
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelFriends::populateContactGroupSelect()
|
/*void LLPanelFriends::populateContactGroupSelect()
|
||||||
{
|
{
|
||||||
LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
|
LLComboBox* combo = getChild<LLComboBox>("buddy_group_combobox");
|
||||||
|
|
||||||
@@ -241,18 +257,18 @@ void LLPanelFriends::populateContactGroupSelect()
|
|||||||
LLChat msg("Null combo");
|
LLChat msg("Null combo");
|
||||||
LLFloaterChat::addChat(msg);
|
LLFloaterChat::addChat(msg);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void LLPanelFriends::setContactGroup(std::string contact_grp)
|
/*void LLPanelFriends::setContactGroup(std::string contact_grp)
|
||||||
{
|
{
|
||||||
LLChat msg("Group set to " + contact_grp);
|
LLChat msg("Group set to " + contact_grp);
|
||||||
LLFloaterChat::addChat(msg);
|
LLFloaterChat::addChat(msg);
|
||||||
refreshNames(LLFriendObserver::ADD);
|
refreshNames(LLFriendObserver::ADD);
|
||||||
refreshUI();
|
refreshUI();
|
||||||
categorizeContacts();
|
categorizeContacts();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void LLPanelFriends::categorizeContacts()
|
/*void LLPanelFriends::categorizeContacts()
|
||||||
{
|
{
|
||||||
LLSD contact_groups = gSavedPerAccountSettings.getLLSD("AscentContactGroups");
|
LLSD contact_groups = gSavedPerAccountSettings.getLLSD("AscentContactGroups");
|
||||||
std::string group_name = "All";
|
std::string group_name = "All";
|
||||||
@@ -306,7 +322,7 @@ void LLPanelFriends::categorizeContacts()
|
|||||||
LLChat msg("Null combo.");
|
LLChat msg("Null combo.");
|
||||||
LLFloaterChat::addChat(msg);
|
LLFloaterChat::addChat(msg);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void LLPanelFriends::filterContacts(const std::string& search_name)
|
void LLPanelFriends::filterContacts(const std::string& search_name)
|
||||||
{
|
{
|
||||||
@@ -350,7 +366,7 @@ void LLPanelFriends::onContactSearchEdit(const std::string& search_string, void*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data)
|
/*void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data)
|
||||||
{
|
{
|
||||||
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||||
|
|
||||||
@@ -359,7 +375,7 @@ void LLPanelFriends::onChangeContactGroup(LLUICtrl* ctrl, void* user_data)
|
|||||||
LLComboBox* combo = panelp->getChild<LLComboBox>("buddy_group_combobox");
|
LLComboBox* combo = panelp->getChild<LLComboBox>("buddy_group_combobox");
|
||||||
panelp->setContactGroup(combo->getValue().asString());
|
panelp->setContactGroup(combo->getValue().asString());
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
// --
|
// --
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
@@ -368,7 +384,7 @@ BOOL LLPanelFriends::postBuild()
|
|||||||
mFriendsList = getChild<LLScrollListCtrl>("friend_list");
|
mFriendsList = getChild<LLScrollListCtrl>("friend_list");
|
||||||
mFriendsList->setCommitOnSelectionChange(TRUE);
|
mFriendsList->setCommitOnSelectionChange(TRUE);
|
||||||
mFriendsList->setCommitCallback(onSelectName, this);
|
mFriendsList->setCommitCallback(onSelectName, this);
|
||||||
childSetCommitCallback("buddy_group_combobox", onChangeContactGroup, this);
|
//childSetCommitCallback("buddy_group_combobox", onChangeContactGroup, this);
|
||||||
mFriendsList->setDoubleClickCallback(onClickIM, this);
|
mFriendsList->setDoubleClickCallback(onClickIM, this);
|
||||||
|
|
||||||
// <dogmode>
|
// <dogmode>
|
||||||
@@ -387,7 +403,7 @@ BOOL LLPanelFriends::postBuild()
|
|||||||
refreshNames(changed_mask);
|
refreshNames(changed_mask);
|
||||||
|
|
||||||
childSetAction("im_btn", onClickIM, this);
|
childSetAction("im_btn", onClickIM, this);
|
||||||
childSetAction("assign_btn", onClickAssign, this);
|
//childSetAction("assign_btn", onClickAssign, this);
|
||||||
childSetAction("expand_collapse_btn", onClickExpand, this);
|
childSetAction("expand_collapse_btn", onClickExpand, this);
|
||||||
childSetAction("profile_btn", onClickProfile, this);
|
childSetAction("profile_btn", onClickProfile, this);
|
||||||
childSetAction("offer_teleport_btn", onClickOfferTeleport, this);
|
childSetAction("offer_teleport_btn", onClickOfferTeleport, this);
|
||||||
@@ -580,6 +596,8 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh
|
|||||||
// enable this item, in case it was disabled after user input
|
// enable this item, in case it was disabled after user input
|
||||||
itemp->setEnabled(TRUE);
|
itemp->setEnabled(TRUE);
|
||||||
|
|
||||||
|
mFriendsList->setNeedsSort();
|
||||||
|
|
||||||
// Do not resort, this function can be called frequently.
|
// Do not resort, this function can be called frequently.
|
||||||
return have_name;
|
return have_name;
|
||||||
}
|
}
|
||||||
@@ -635,7 +653,7 @@ void LLPanelFriends::refreshRightsChangeList()
|
|||||||
if (num_selected == 0) // nothing selected
|
if (num_selected == 0) // nothing selected
|
||||||
{
|
{
|
||||||
childSetEnabled("im_btn", FALSE);
|
childSetEnabled("im_btn", FALSE);
|
||||||
childSetEnabled("assign_btn", FALSE);
|
//childSetEnabled("assign_btn", FALSE);
|
||||||
childSetEnabled("offer_teleport_btn", FALSE);
|
childSetEnabled("offer_teleport_btn", FALSE);
|
||||||
}
|
}
|
||||||
else // we have at least one friend selected...
|
else // we have at least one friend selected...
|
||||||
@@ -644,7 +662,7 @@ void LLPanelFriends::refreshRightsChangeList()
|
|||||||
// to be consistent with context menus in inventory and because otherwise
|
// to be consistent with context menus in inventory and because otherwise
|
||||||
// offline friends would be silently dropped from the session
|
// offline friends would be silently dropped from the session
|
||||||
childSetEnabled("im_btn", selected_friends_online || num_selected == 1);
|
childSetEnabled("im_btn", selected_friends_online || num_selected == 1);
|
||||||
childSetEnabled("assign_btn", num_selected == 1);
|
//childSetEnabled("assign_btn", num_selected == 1);
|
||||||
childSetEnabled("offer_teleport_btn", can_offer_teleport);
|
childSetEnabled("offer_teleport_btn", can_offer_teleport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -776,7 +794,7 @@ void LLPanelFriends::refreshUI()
|
|||||||
//Options that can only be performed with one friend selected
|
//Options that can only be performed with one friend selected
|
||||||
childSetEnabled("profile_btn", single_selected && !multiple_selected);
|
childSetEnabled("profile_btn", single_selected && !multiple_selected);
|
||||||
childSetEnabled("pay_btn", single_selected && !multiple_selected);
|
childSetEnabled("pay_btn", single_selected && !multiple_selected);
|
||||||
childSetEnabled("assign_btn", single_selected && !multiple_selected);
|
//childSetEnabled("assign_btn", single_selected && !multiple_selected);
|
||||||
|
|
||||||
//Options that can be performed with up to MAX_FRIEND_SELECT friends selected
|
//Options that can be performed with up to MAX_FRIEND_SELECT friends selected
|
||||||
//(single_selected will always be true in this situations)
|
//(single_selected will always be true in this situations)
|
||||||
@@ -817,7 +835,7 @@ void LLPanelFriends::onClickProfile(void* user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLPanelFriends::onClickAssign(void* user_data)
|
/*void LLPanelFriends::onClickAssign(void* user_data)
|
||||||
{
|
{
|
||||||
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
LLPanelFriends* panelp = (LLPanelFriends*)user_data;
|
||||||
if (panelp)
|
if (panelp)
|
||||||
@@ -825,7 +843,7 @@ void LLPanelFriends::onClickAssign(void* user_data)
|
|||||||
const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
|
const uuid_vec_t ids = panelp->mFriendsList->getSelectedIDs();
|
||||||
ASFloaterContactGroups::show(ids);
|
ASFloaterContactGroups::show(ids);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLPanelFriends::onClickExpand(void* user_data)
|
void LLPanelFriends::onClickExpand(void* user_data)
|
||||||
@@ -1394,6 +1412,7 @@ void LLPanelFriends::applyRightsToFriends()
|
|||||||
rights &= ~LLRelationship::GRANT_MAP_LOCATION;
|
rights &= ~LLRelationship::GRANT_MAP_LOCATION;
|
||||||
// propagate rights constraint to UI
|
// propagate rights constraint to UI
|
||||||
(*itr)->getColumn(LIST_VISIBLE_MAP)->setValue(FALSE);
|
(*itr)->getColumn(LIST_VISIBLE_MAP)->setValue(FALSE);
|
||||||
|
mFriendsList->setNeedsSortColumn(LIST_VISIBLE_MAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(buddy_relationship->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION) != show_map_location)
|
if(buddy_relationship->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION) != show_map_location)
|
||||||
@@ -1405,6 +1424,7 @@ void LLPanelFriends::applyRightsToFriends()
|
|||||||
rights |= LLRelationship::GRANT_MAP_LOCATION;
|
rights |= LLRelationship::GRANT_MAP_LOCATION;
|
||||||
rights |= LLRelationship::GRANT_ONLINE_STATUS;
|
rights |= LLRelationship::GRANT_ONLINE_STATUS;
|
||||||
(*itr)->getColumn(LIST_VISIBLE_ONLINE)->setValue(TRUE);
|
(*itr)->getColumn(LIST_VISIBLE_ONLINE)->setValue(TRUE);
|
||||||
|
mFriendsList->setNeedsSortColumn(LIST_VISIBLE_ONLINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user