summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDenis Serdjuk <dserduk@productengine.com>2009-10-29 21:02:47 +0200
committerDenis Serdjuk <dserduk@productengine.com>2009-10-29 21:02:47 +0200
commit682aba9b3be58689c894062317358205b70b4241 (patch)
tree9cd98486147d05ba0c53710bab2dbe4f1ede5fb7 /indra/newview
parent15687e2acd07ed3c0a56a61af982595b99dc064f (diff)
implemented task EXT-1334 Add \"Friends\" tab in Resident Chooser containing a full list of users contacts
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloateravatarpicker.cpp63
-rw-r--r--indra/newview/llfloateravatarpicker.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_avatar_picker.xml46
3 files changed, 101 insertions, 9 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index ccfe7d4b64..8ac7f3fd7e 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -35,6 +35,7 @@
// Viewer includes
#include "llagent.h"
+#include "llcallingcard.h"
#include "llfocusmgr.h"
#include "llfloaterreg.h"
#include "llviewercontrol.h"
@@ -76,6 +77,7 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
mCloseOnSelect(FALSE)
{
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml");
+ mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this));
}
BOOL LLFloaterAvatarPicker::postBuild()
@@ -95,7 +97,11 @@ BOOL LLFloaterAvatarPicker::postBuild()
LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe");
nearme->setDoubleClickCallback(onBtnSelect, this);
childSetCommitCallback("NearMe", onList, this);
-
+
+ LLScrollListCtrl* friends = getChild<LLScrollListCtrl>("Friends");
+ friends->setDoubleClickCallback(onBtnSelect, this);
+ childSetCommitCallback("Friends", onList, this);
+
childSetAction("Select", onBtnSelect, this);
childDisable("Select");
@@ -119,6 +125,8 @@ BOOL LLFloaterAvatarPicker::postBuild()
center();
+ populateFriend();
+
return TRUE;
}
@@ -159,25 +167,37 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata)
if(self->mCallback)
{
+ std::string acvtive_panel_name;
+ LLScrollListCtrl* list = NULL;
LLPanel* active_panel = self->childGetVisibleTab("ResidentChooserTabs");
-
- if(active_panel == self->getChild<LLPanel>("SearchPanel"))
+ if(active_panel)
{
- std::vector<std::string> avatar_names;
- std::vector<LLUUID> avatar_ids;
- getSelectedAvatarData(self->getChild<LLScrollListCtrl>("SearchResults"), avatar_names, avatar_ids);
- self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata);
+ acvtive_panel_name = active_panel->getName();
+ }
+ if(acvtive_panel_name == "SearchPanel")
+ {
+ list = self->getChild<LLScrollListCtrl>("SearchResults");
+ }
+ else if(acvtive_panel_name == "NearMePanel")
+ {
+ list =self->getChild<LLScrollListCtrl>("NearMe");
+ }
+ else if (acvtive_panel_name == "FriendsPanel")
+ {
+ list =self->getChild<LLScrollListCtrl>("Friends");
}
- else if(active_panel == self->getChild<LLPanel>("NearMePanel"))
+
+ if(list)
{
std::vector<std::string> avatar_names;
std::vector<LLUUID> avatar_ids;
- getSelectedAvatarData(self->getChild<LLScrollListCtrl>("NearMe"), avatar_names, avatar_ids);
+ getSelectedAvatarData(list, avatar_names, avatar_ids);
self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata);
}
}
self->getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
self->getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
+ self->getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
if(self->mCloseOnSelect)
{
self->mCloseOnSelect = FALSE;
@@ -268,6 +288,26 @@ void LLFloaterAvatarPicker::populateNearMe()
}
}
+void LLFloaterAvatarPicker::populateFriend()
+{
+ LLScrollListCtrl* friends_scroller = getChild<LLScrollListCtrl>("Friends");
+ friends_scroller->deleteAllItems();
+ LLCollectAllBuddies collector;
+ LLAvatarTracker::instance().applyFunctor(collector);
+ LLCollectAllBuddies::buddy_map_t::iterator it;
+
+
+ for(it = collector.mOnline.begin(); it!=collector.mOnline.end(); it++)
+ {
+ friends_scroller->addStringUUIDItem(it->first, it->second);
+ }
+ for(it = collector.mOffline.begin(); it!=collector.mOffline.end(); it++)
+ {
+ friends_scroller->addStringUUIDItem(it->first, it->second);
+ }
+ friends_scroller->sortByColumnIndex(0, TRUE);
+}
+
void LLFloaterAvatarPicker::draw()
{
LLFloater::draw();
@@ -289,6 +329,10 @@ BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
{
return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
}
+ else if(active_panel == getChild<LLPanel>("FriendsPanel"))
+ {
+ return getChild<LLScrollListCtrl>("Friends")->getFirstSelectedIndex() >= 0;
+ }
return FALSE;
}
@@ -321,6 +365,7 @@ void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple)
{
getChild<LLScrollListCtrl>("SearchResults")->setAllowMultipleSelection(allow_multiple);
getChild<LLScrollListCtrl>("NearMe")->setAllowMultipleSelection(allow_multiple);
+ getChild<LLScrollListCtrl>("Friends")->setAllowMultipleSelection(allow_multiple);
}
// static
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index 85aacb68a5..b8ace985d9 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -67,6 +67,7 @@ private:
void onTabChanged();
void populateNearMe();
+ void populateFriend();
BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected.
void find();
diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
index 0542d4509e..f609ba9557 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
@@ -85,6 +85,52 @@
top="52"
width="132" />
</panel>
+ <panel
+ border="none"
+ height="150"
+ label="Friends"
+ layout="topleft"
+ left="6"
+ help_topic="avatarpicker_friends_tab"
+ name="FriendsPanel"
+ top="150"
+ width="132">
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left="10"
+ name="InstructSelectFriend"
+ top="15"
+ width="200">
+ Select a friend(s):
+ </text>
+ <button
+ follows="top|right"
+ layout="topleft"
+ right="-5"
+ top ="5"
+ height="20"
+ width="20"
+ name="RefreshFriends"
+ picture_style="true"
+ image_overlay="Refresh_Off">
+ <button.commit_callback
+ function="Refresh.FriendList"/>
+ </button>
+ <scroll_list
+ follows="all"
+ height="100"
+ border="false"
+ layout="topleft"
+ left="0"
+ name="Friends"
+ sort_column="0"
+ top_pad="5"
+ width="132" />
+ </panel>
<panel
border="none"