Add contact sets to the people panel for those who like that type of thing

Cinders 2013-11-21 00:23:52 -07:00
parent bb8c85d8b7
commit 12b8969abc
8 changed files with 471 additions and 11 deletions

View File

@ -38,6 +38,7 @@
#include "llcallingcard.h"
#include "llfloateravatarpicker.h"
#include "llfloaterreg.h"
#include "llpanelpeoplemenus.h"
#include "llslurl.h"
#include "lltrans.h"
@ -81,6 +82,7 @@ BOOL FSPanelContactSets::postBuild()
{
mAvatarList->setCommitCallback(boost::bind(&FSPanelContactSets::onSelectAvatar, this));
mAvatarList->setNoItemsCommentText(getString("empty_list"));
mAvatarList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
generateAvatarList(mContactSetCombo->getSimple());
}

View File

@ -78,17 +78,22 @@
// Firestorm includes
#include "fspanelradar.h"
#include "lggcontactsets.h"
#include "llcombobox.h"
#include "lllayoutstack.h"
#include "rlvhandler.h"
#define FRIEND_LIST_UPDATE_TIMEOUT 0.5
#define NEARBY_LIST_UPDATE_INTERVAL 1
#include <boost/foreach.hpp>
const F32 FRIEND_LIST_UPDATE_TIMEOUT = 0.5f;
const F32 NEARBY_LIST_UPDATE_INTERVAL = 1.f;
static const std::string NEARBY_TAB_NAME = "nearby_panel";
static const std::string FRIENDS_TAB_NAME = "friends_panel";
static const std::string GROUP_TAB_NAME = "groups_panel";
static const std::string RECENT_TAB_NAME = "recent_panel";
static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars
static const std::string CONTACT_SETS_TAB_NAME = "contact_sets_panel"; // [FS:CR] Contact sets
static const std::string COLLAPSED_BY_USER = "collapsed_by_user";
@ -521,6 +526,9 @@ LLPanelPeople::LLPanelPeople()
mNearbyList(NULL),
mRecentList(NULL),
mGroupList(NULL),
// [FS:CR] Contact sets
mContactSetList(NULL),
mContactSetCombo(NULL),
// <FS:Ansariel> Firestorm radar
//mMiniMap(NULL)
mMiniMap(NULL),
@ -553,6 +561,12 @@ LLPanelPeople::LLPanelPeople()
//mEnableCallbackRegistrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2));
mEnableCallbackRegistrar.add("People.Group.Plus.Validate", boost::bind(&LLPanelPeople::onGroupPlusButtonValidate, this));
// [FS:CR] Contact sets
mCommitCallbackRegistrar.add("ContactSet.Action", boost::bind(&LLPanelPeople::onContactSetsMenuItemClicked, this, _2));
mEnableCallbackRegistrar.add("ContactSet.Enable", boost::bind(&LLPanelPeople::onContactSetsEnable, this, _2));
mContactSetChangedConnection = LGGContactSets::getInstance()->setContactSetChangeCallback(boost::bind(&LLPanelPeople::updateContactSets, this, _1));
// [/FS:CR]
}
LLPanelPeople::~LLPanelPeople()
@ -567,6 +581,11 @@ LLPanelPeople::~LLPanelPeople()
{
LLVoiceClient::getInstance()->removeObserver(this);
}
// [FS:CR] Contact sets
if (mContactSetChangedConnection.connected())
mContactSetChangedConnection.disconnect();
// [/FS:CR]
}
void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list)
@ -718,6 +737,25 @@ BOOL LLPanelPeople::postBuild()
{
llwarns << "People->Groups list menu not found" << llendl;
}
// [FS:CR] Contact sets
mContactSetCombo = getChild<LLComboBox>("combo_sets");
if (mContactSetCombo)
{
mContactSetCombo->setCommitCallback(boost::bind(&LLPanelPeople::generateCurrentContactList, this));
refreshContactSets();
}
mContactSetList = getChild<LLAvatarList>("contact_list");
if (mContactSetList)
{
mContactSetList->setCommitCallback(boost::bind(&LLPanelPeople::updateButtons, this));
mContactSetList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
mContactSetList->setNoItemsCommentText(getString("empty_list"));
mContactSetList->setContextMenu(&LLPanelPeopleMenus::gPeopleContextMenu);
generateCurrentContactList();
}
// [/FS:CR]
// <FS:Ansariel> Friend list accordion replacement
//LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all");
@ -1020,15 +1058,19 @@ LLUUID LLPanelPeople::getCurrentItemID() const
return mRadarPanel->getCurrentItemID();
// </FS:AO>
if (cur_tab == RECENT_TAB_NAME)
else if (cur_tab == RECENT_TAB_NAME)
return mRecentList->getSelectedUUID();
if (cur_tab == GROUP_TAB_NAME)
else if (cur_tab == GROUP_TAB_NAME)
return mGroupList->getSelectedUUID();
if (cur_tab == BLOCKED_TAB_NAME)
else if (cur_tab == BLOCKED_TAB_NAME)
return LLUUID::null; // FIXME?
// [FS:CR] Contact sets
else if (cur_tab == CONTACT_SETS_TAB_NAME)
return mContactSetList->getSelectedUUID();
// [/FS:CR] Contact sets
llassert(0 && "unknown tab selected");
return LLUUID::null;
}
@ -1054,6 +1096,10 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
mGroupList->getSelectedUUIDs(selected_uuids);
else if (cur_tab == BLOCKED_TAB_NAME)
selected_uuids.clear(); // FIXME?
// [FS:CR] Contact sets
else if (cur_tab == CONTACT_SETS_TAB_NAME)
mContactSetList->getSelectedUUIDs(selected_uuids);
// [/FS:CR] Contact sets
else
llassert(0 && "unknown tab selected");
@ -1241,9 +1287,8 @@ void LLPanelPeople::onAvatarListCommitted(LLAvatarList* list)
mAllFriendList->resetSelection(true);
else if (list == mAllFriendList)
mOnlineFriendList->resetSelection(true);
// possible side effect of sidebar work; should be no harm in ignoring this -KC
// else
// llassert(0 && "commit on unknown friends list");
else
llassert(0 && "commit on unknown friends list");
}
updateButtons();
@ -1375,7 +1420,6 @@ void LLPanelPeople::onGroupMinusButtonClicked()
void LLPanelPeople::onGroupPlusMenuItemClicked(const LLSD& userdata)
{
std::string chosen_item = userdata.asString();
if (chosen_item == "join_group")
LLGroupActions::search();
else if (chosen_item == "new_group")
@ -1505,7 +1549,7 @@ void LLPanelPeople::onMoreButtonClicked()
// *TODO: not implemented yet
}
void LLPanelPeople::onOpen(const LLSD& key)
void LLPanelPeople::onOpen(const LLSD& key)
{
std::string tab_name = key["people_panel_tab_name"];
if (!tab_name.empty())
@ -1674,4 +1718,175 @@ void LLPanelPeople::onGlobalVisToggleButtonClicked()
}
// </FS:Ansariel> Firestorm radar
// [FS:CR] Contact sets
void LLPanelPeople::updateContactSets(LGGContactSets::EContactSetUpdate type)
{
switch (type)
{
case LGGContactSets::UPDATED_LISTS:
refreshContactSets();
case LGGContactSets::UPDATED_MEMBERS:
generateCurrentContactList();
break;
}
}
void LLPanelPeople::refreshContactSets()
{
if (!mContactSetCombo) return;
mContactSetCombo->clearRows();
std::vector<std::string> contact_sets = LGGContactSets::getInstance()->getAllGroups();
if (!contact_sets.empty())
{
BOOST_FOREACH(const std::string& set_name, contact_sets)
{
mContactSetCombo->add(set_name);
}
}
else
{
mContactSetCombo->add(getString("no_sets"), LLSD("No Set"));
}
}
void LLPanelPeople::generateContactList(const std::string& contact_set)
{
if (!mContactSetList) return;
uuid_vec_t& avatars = mContactSetList->getIDs();
avatars.clear();
if (contact_set == getString("no_sets"))
{
}
else
{
LGGContactSets::ContactSetGroup* group = LGGContactSets::getInstance()->getGroup(contact_set);
BOOST_FOREACH(const LLUUID id, group->mFriends)
{
avatars.push_back(id);
}
}
mContactSetList->setDirty();
}
void LLPanelPeople::generateCurrentContactList()
{
generateContactList(mContactSetCombo->getSimple());
}
bool LLPanelPeople::onContactSetsEnable(const LLSD& userdata)
{
std::string item = userdata.asString();
if (item == "has_set")
return (!LGGContactSets::getInstance()->getAllGroups().empty());
else if (item == "has_selection")
{
uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
return (!selected_uuids.empty());
}
return false;
}
void LLPanelPeople::onContactSetsMenuItemClicked(const LLSD& userdata)
{
std::string chosen_item = userdata.asString();
if (chosen_item == "add_set")
{
LLNotificationsUtil::add("AddNewContactSet", LLSD(), LLSD(), &LGGContactSets::handleAddContactSetCallback);
}
else if (chosen_item == "remove_set")
{
LLSD payload, args;
std::string set = mContactSetCombo->getSimple();
args["SET_NAME"] = set;
payload["contact_set"] = set;
LLNotificationsUtil::add("RemoveContactSet", args, payload, &LGGContactSets::handleRemoveContactSetCallback);
}
else if (chosen_item == "add_contact")
{
LLFloater* root_floater = gFloaterView->getParentFloater(this);
LLFloater* avatar_picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::handlePickerCallback, this, _1, mContactSetCombo->getSimple()),
TRUE, TRUE, TRUE, root_floater->getName());
if (root_floater && avatar_picker)
root_floater->addDependentFloater(avatar_picker);
}
else if (chosen_item == "remove_contact")
{
if (!mContactSetCombo) return;
uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
if (selected_uuids.empty()) return;
LLSD payload, args;
std::string set = mContactSetCombo->getSimple();
S32 selected_size = selected_uuids.size();
args["SET_NAME"] = set;
args["TARGET"] = (selected_size > 1 ? llformat("%d", selected_size) : LLSLURL("agent", selected_uuids.front(), "about").getSLURLString());
payload["contact_set"] = set;
BOOST_FOREACH(const LLUUID& id, selected_uuids)
{
payload["ids"].append(id);
}
LLNotificationsUtil::add((selected_size > 1 ? "RemoveContactsFromSet" : "RemoveContactFromSet"), args, payload, &LGGContactSets::handleRemoveAvatarFromSetCallback);
}
else if (chosen_item == "set_config")
{
LLFloater* root_floater = gFloaterView->getParentFloater(this);
LLFloater* config_floater = LLFloaterReg::showInstance("fs_contact_set_config", LLSD(mContactSetCombo->getSimple()));
if (root_floater && config_floater)
root_floater->addDependentFloater(config_floater);
}
else if (chosen_item == "profile")
{
uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
if (selected_uuids.empty()) return;
BOOST_FOREACH(const LLUUID& id, selected_uuids)
{
LLAvatarActions::showProfile(id);
}
}
else if (chosen_item == "im")
{
uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
if (selected_uuids.empty()) return;
if (selected_uuids.size() == 1)
{
LLAvatarActions::startIM(selected_uuids[0]);
}
else if (selected_uuids.size() > 1)
{
LLAvatarActions::startConference(selected_uuids);
}
}
else if (chosen_item == "teleport")
{
uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
if (selected_uuids.empty()) return;
LLAvatarActions::offerTeleport(selected_uuids);
}
}
void LLPanelPeople::handlePickerCallback(const uuid_vec_t& ids, const std::string& set)
{
if (ids.empty() || !mContactSetCombo) return;
BOOST_FOREACH(const LLUUID& id, ids)
{
if (!LLAvatarTracker::instance().isBuddy(id))
LGGContactSets::getInstance()->addNonFriendToList(id);
LGGContactSets::getInstance()->addFriendToGroup(id, set);
}
}
// [/FS:CR]
// EOF

View File

@ -35,6 +35,10 @@
#include "llfloater.h"
// [FS:CR] Contact sets
#include "lggcontactsets.h"
#include <boost/signals2.hpp>
class LLAvatarList;
class LLAvatarName;
class LLFilterEditor;
@ -148,6 +152,7 @@ private:
LLAvatarList* mAllFriendList;
LLAvatarList* mSuggestedFriends;
LLAvatarList* mNearbyList;
LLAvatarList* mContactSetList; // [FS:CR] Contact sets
// <FS:Ansariel> Firestorm radar
FSPanelRadar* mRadarPanel;
// </FS:Ansariel> Firestorm radar
@ -166,6 +171,19 @@ private:
Updater* mFacebookListUpdater;
Updater* mButtonsUpdater;
LLHandle< LLFloater > mPicker;
// [FS:CR] Contact sets
bool onContactSetsEnable(const LLSD& userdata);
void onContactSetsMenuItemClicked(const LLSD& userdata);
void handlePickerCallback(const uuid_vec_t& ids, const std::string& set);
void refreshContactSets();
void generateContactList(const std::string& contact_set);
void generateCurrentContactList();
void updateContactSets(LGGContactSets::EContactSetUpdate type);
boost::signals2::connection mContactSetChangedConnection;
LLComboBox* mContactSetCombo;
// [/FS:CR]
};
#endif //LL_LLPANELPEOPLE_H

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<toggleable_menu
name="menu_people_contact_sets_add"
left="0" bottom="0" visible="false"
mouse_opaque="false">
<menu_item_call
label="Add Set..."
name="add_set">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="add_set"/>
</menu_item_call>
<menu_item_call
label="Add Contact..."
name="add_contact">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="add_contact"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_set" />
</menu_item_call>
</toggleable_menu>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<toggleable_menu
name="menu_people_contact_sets_gear"
left="0" bottom="0" visible="false"
mouse_opaque="false">
<menu_item_call
label="View Profile"
name="profile">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="profile"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_selection" />
</menu_item_call>
<menu_item_call
label="IM..."
name="im">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="im"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_selection" />
</menu_item_call>
<menu_item_call
label="Teleport..."
name="teleport">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="teleport"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_selection" />
</menu_item_call>
<menu_item_separator/>
<menu_item_call
label="Configure Contact Set..."
name="set_config">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="set_config"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_set" />
</menu_item_call>
</toggleable_menu>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<toggleable_menu
name="menu_people_contact_sets_remove"
left="0" bottom="0" visible="false"
mouse_opaque="false">
<menu_item_call
label="Remove Set..."
name="remove_set">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="remove_set" />
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_set" />
</menu_item_call>
<menu_item_call
label="Remove Contact..."
name="remove_contact">
<menu_item_call.on_click
function="ContactSet.Action"
parameter="remove_contact"/>
<menu_item_call.on_enable
function="ContactSet.Enable"
parameter="has_selection" />
</menu_item_call>
</toggleable_menu>

View File

@ -57,6 +57,14 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
<string
name="AltMiniMapToolTipMsg"
value="[REGION] (Double-click to teleport, shift-drag to pan)"/>
<panel.string
name="empty_list">
This contact set is empty.
</panel.string>
<panel.string
name="no_sets">
No contact sets available.
</panel.string>
<tab_container
bottom="-10"
follows="all"
@ -678,5 +686,34 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
top="0"
right="-1" />
</panel>
<!-- ============================== CONTACT SETS tab ======================= -->
<panel
background_opaque="false"
background_visible="false"
follows="all"
height="383"
label="Contact Sets"
layout="topleft"
left="0"
help_topic="people_contact_sets_tab"
name="contact_sets_panel"
right="-1"
top="0">
<panel
class="panel_people_contacts_sidetray"
height="383"
name="panel_people_contacts_sidetray"
filename="panel_people_contact_sets.xml"
follows="all"
label="Contact Sets"
layout="topleft"
left="0"
font="SansSerifBold"
top="0"
right="-1" />
</panel>
</tab_container>
</panel>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
background_visible="true"
follows="left|top|right|bottom"
height="305"
layout="topleft"
left="0"
name="contact_sets_panel"
min_height="350"
min_width="240"
width="323">
<panel
follows="left|top|right"
height="27"
label="bottom_panel"
layout="topleft"
left="0"
name="contact_sets_buttons_panel"
right="-1"
top="0">
<combo_box
follows="left|top|right"
layout="topleft"
height="25"
left="2"
top="2"
name="combo_sets"
width="216" />
<menu_button
follows="right"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="OptionsMenu_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
left_pad="4"
menu_filename="menu_people_contact_sets_gear.xml"
menu_position="bottomleft"
name="contact_sets_gear_btn"
tool_tip="Actions on selected person or group"
top="3"
width="31" />
<menu_button
follows="right"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="AddItem_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
left_pad="2"
menu_filename="menu_people_contact_sets_add.xml"
menu_position="bottomleft"
name="contact_sets_plus_btn"
tool_tip="Add a group or resident"
top_delta="0"
width="31"/>
<menu_button
follows="right"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="MinusItem_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
left_pad="2"
menu_filename="menu_people_contact_sets_remove.xml"
menu_position="bottomleft"
name="contact_sets_remove_btn"
tool_tip="Remove a group or resident"
top_delta="0"
width="31"/>
</panel>
<avatar_list
left="3"
right="-1"
top="31"
bottom="-3"
follows="all"
layout="topleft"
ignore_online_status="true"
show_profile_button="true"
show_speaking_indicator="false"
show_voice_volume="false"
show_permissions_granted="true"
show_icons="true"
allow_select="true"
multi_select="true"
keep_one_selected="false"
name="contact_list" />
</panel>