diff options
author | Denis Serdjuk <dserduk@productengine.com> | 2009-10-29 21:02:47 +0200 |
---|---|---|
committer | Denis Serdjuk <dserduk@productengine.com> | 2009-10-29 21:02:47 +0200 |
commit | 682aba9b3be58689c894062317358205b70b4241 (patch) | |
tree | 9cd98486147d05ba0c53710bab2dbe4f1ede5fb7 /indra/newview/llfloateravatarpicker.cpp | |
parent | 15687e2acd07ed3c0a56a61af982595b99dc064f (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/llfloateravatarpicker.cpp')
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 63 |
1 files changed, 54 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 |