diff options
| author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-16 19:34:40 -0700 | 
|---|---|---|
| committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-16 19:34:40 -0700 | 
| commit | 7f0798fd6dad069aca44b954aa0fb7e49d42198c (patch) | |
| tree | bfa3d0a23d18550b7e4038b9895eaa7b280d61dd | |
| parent | 0c93e1746c91d06be61b16663482a5641be931e6 (diff) | |
adding a new tab in people panel that has a folder view
| -rw-r--r-- | indra/newview/llconversationmodel.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llpanelpeople.cpp | 142 | ||||
| -rw-r--r-- | indra/newview/llpanelpeople.h | 18 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_people.xml | 13 | 
4 files changed, 173 insertions, 1 deletions
| diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index c74ce24872..ed434d82d5 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -95,6 +95,7 @@ void LLConversationItem::postEvent(const std::string& event_type, LLConversation  	LLUUID participant_id = (participant ? participant->getUUID() : LLUUID());  	LLSD event(LLSDMap("type", event_type)("session_uuid", session_id)("participant_uuid", participant_id));  	LLEventPumps::instance().obtain("ConversationsEvents").post(event); +	LLEventPumps::instance().obtain("ConversationsEventsTwo").post(event);  }  // Virtual action callbacks diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 519868612a..6864381404 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -28,6 +28,8 @@  // libs  #include "llavatarname.h" +#include "llconversationview.h" +#include "llfloaterimcontainer.h"  #include "llfloaterreg.h"  #include "llfloatersidepanelcontainer.h"  #include "llmenubutton.h" @@ -48,7 +50,9 @@  #include "llavataractions.h"  #include "llavatarlist.h"  #include "llavatarlistitem.h" +#include "llavatarnamecache.h"  #include "llcallingcard.h"			// for LLAvatarTracker +#include "llcallbacklist.h"  #include "llerror.h"  #include "llfloateravatarpicker.h"  //#include "llfloaterminiinspector.h" @@ -58,6 +62,7 @@  #include "llinventoryobserver.h"  #include "llnetmap.h"  #include "llpanelpeoplemenus.h" +#include "llparticipantlist.h"  #include "llsidetraypanelcontainer.h"  #include "llrecentpeople.h"  #include "llviewercontrol.h"		// for gSavedSettings @@ -78,6 +83,7 @@ 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 FBCTEST_TAB_NAME	= "fbctest_panel"; +static const std::string FBCTESTTWO_TAB_NAME	= "fbctesttwo_panel";  static const std::string COLLAPSED_BY_USER  = "collapsed_by_user";  static const std::string FBC_SERVICES_URL = "https://pdp15.lindenlab.com/fbc"; @@ -540,6 +546,8 @@ private:  LLPanelPeople::LLPanelPeople()  	:	LLPanel(),  		mConnectedToFbc(false), +		mConversationsRoot(NULL), +		mConversationsEventStream("ConversationsEventsTwo"),  		mTryToConnectToFbc(true),  		mTabContainer(NULL),  		mOnlineFriendList(NULL), @@ -595,6 +603,8 @@ LLPanelPeople::~LLPanelPeople()  	}  	if (mFbcTestBrowserHandle.get()) mFbcTestBrowserHandle.get()->die(); + +	mConversationsEventStream.stopListening("ConversationsRefresh");  }  void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list) @@ -678,6 +688,61 @@ BOOL LLPanelPeople::postBuild()  	mFacebookFriends = social_tab->getChild<LLSocialList>("facebook_friends");  	social_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFbcTestListUpdater, _2)); +	//===Test START======================================================================== + +	LLPanel * socialtwo_tab = getChild<LLPanel>(FBCTESTTWO_TAB_NAME); + +	//Create folder view +	LLConversationItem* base_item = new LLConversationItem(mConversationViewModel); + +	LLFolderView::Params folder_view_params(LLUICtrlFactory::getDefaultParams<LLFolderView>()); +	folder_view_params.rect.left(0).right(0).top(0).bottom(0); +	folder_view_params.parent_panel = friends_tab; +	folder_view_params.listener = base_item; +	folder_view_params.view_model = &mConversationViewModel; +	folder_view_params.root = NULL; +	folder_view_params.use_ellipses = false; +	folder_view_params.options_menu = "menu_conversation.xml"; +	folder_view_params.name = "fbcfolderview"; +	mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(folder_view_params); +	mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLPanelPeople::onConversationModelEvent, this, _1)); + +	//Create scroller +	LLRect scroller_view_rect = socialtwo_tab->getRect(); +	//scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); +	LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams<LLFolderViewScrollContainer>()); +	scroller_params.rect(scroller_view_rect); + +	LLScrollContainer* scroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params); +	socialtwo_tab->addChildInBack(scroller); +	scroller->addChild(mConversationsRoot); +	scroller->setFollowsAll(); +	mConversationsRoot->setScrollContainer(scroller); +	mConversationsRoot->setFollowsAll(); + +	//Create a session +	//LLSpeakerMgr* speaker_manager = (LLSpeakerMgr*)LLLocalSpeakerMgr::getInstance(); +	LLConversationItemSession* item = new LLConversationItemSession(LLUUID(NULL), mConversationViewModel); +	item->renameItem("Facebook Friends"); +	LLConversationViewSession::Params params; + +	params.name = item->getDisplayName(); +	params.root = mConversationsRoot; +	params.listener = item; +	params.tool_tip = params.name; +	params.container = LLFloaterIMContainer::getInstance(); +	LLConversationViewSession * widget = LLUICtrlFactory::create<LLConversationViewSession>(params); +	widget->addToFolder(mConversationsRoot); + +	mConversationsItems[LLUUID(NULL)] = item; +	mConversationsWidgits[LLUUID(NULL)] = widget; + +	gIdleCallbacks.addFunction(idle, this); + +	//===Test END======================================================================== + + +  	setSortOrder(mRecentList,		(ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"),	false);  	setSortOrder(mAllFriendList,	(ESortOrder)gSavedSettings.getU32("FriendsSortOrder"),		false);  	setSortOrder(mNearbyList,		(ESortOrder)gSavedSettings.getU32("NearbyPeopleSortOrder"),	false); @@ -757,6 +822,12 @@ void LLPanelPeople::onChange(EStatusType status, const std::string &channelURI,  	updateButtons();  } +void LLPanelPeople::idle(void * user_data) +{ +	LLPanelPeople * self = static_cast<LLPanelPeople *>(user_data); +	self->mConversationsRoot->update(); +} +  void LLPanelPeople::updateFriendListHelpText()  {  	// show special help text for just created account to help finding friends. EXT-4836 @@ -999,6 +1070,10 @@ LLUUID LLPanelPeople::getCurrentItemID() const  	if (cur_tab == FBCTEST_TAB_NAME)  		return LLUUID::null; +	if (cur_tab == FBCTESTTWO_TAB_NAME) +		return LLUUID::null; + +  	llassert(0 && "unknown tab selected");  	return LLUUID::null;  } @@ -1023,6 +1098,8 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const  		selected_uuids.clear(); // FIXME?  	else if (cur_tab == FBCTEST_TAB_NAME)  		return; +	else if (cur_tab == FBCTESTTWO_TAB_NAME) +		return;  	else  		llassert(0 && "unknown tab selected"); @@ -1576,6 +1653,49 @@ bool LLPanelPeople::isAccordionCollapsedByUser(const std::string& name)  	return isAccordionCollapsedByUser(getChild<LLUICtrl>(name));  } +bool LLPanelPeople::onConversationModelEvent(const LLSD& event) +{ +	std::string type = event.get("type").asString(); +	LLUUID session_id = event.get("session_uuid").asUUID(); +	LLUUID participant_id = event.get("participant_uuid").asUUID(); + +	if(type == "add_participant") +	{ +		LLConversationItemSession * session_model = dynamic_cast<LLConversationItemSession *>(mConversationsItems[session_id]); +		LLConversationViewSession * session_view = dynamic_cast<LLConversationViewSession *>(mConversationsWidgits[session_id]); +		LLConversationItemParticipant * participant_model = session_model->findParticipant(participant_id); + +		if(participant_model) +		{ +			LLConversationViewParticipant * participant_view = createConversationViewParticipant(participant_model); +			participant_view->addToFolder(session_view); +		} +		 + +		llinfos << "adding!!!!!!" << llendl; +	} + +	return false; +} + +LLConversationViewParticipant * LLPanelPeople::createConversationViewParticipant(LLConversationItem * item) +{ +	LLConversationViewParticipant::Params params; +	LLRect panel_rect = getChild<LLPanel>(FBCTESTTWO_TAB_NAME)->getRect(); + +	params.name = item->getDisplayName(); +	params.root = mConversationsRoot; +	params.listener = item; + +	//24 is the the current hight of an item (itemHeight) loaded from conversation_view_participant.xml. +	params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); +	params.tool_tip = params.name; +	params.participant_id = item->getUUID(); +	params.folder_indentation = 2; + +	return LLUICtrlFactory::create<LLConversationViewParticipant>(params); +} +  void LLPanelPeople::openFacebookWeb(LLFloaterWebContent::Params& p)  {  	LLFloater* browser = LLFloaterReg::showInstance("web_content", p); @@ -1601,6 +1721,28 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends)  	}  } +void LLPanelPeople::addTestParticipant() +{ +	for(int i = 0; i < 300; ++i) +	{ +		LLConversationItemSession * session_model = dynamic_cast<LLConversationItemSession *>(mConversationsItems[LLUUID(NULL)]); +		addParticipantToModel(session_model, LLUUID().generateNewID(), "Test"); +	} +	} + +void LLPanelPeople::addParticipantToModel(LLConversationItemSession * session_model, const LLUUID& agent_id, const std::string& name) +{ +	LLConversationItemParticipant* participant = NULL; + +	// Create a participant model +	LLAvatarName avatar_name; +	bool has_name = LLAvatarNameCache::get(agent_id, &avatar_name); +	std::string avatar_name_string = has_name ? name + " (" + avatar_name.getDisplayName() + ")" : name; + +	participant = new LLConversationItemParticipant(avatar_name_string , agent_id, mConversationViewModel); +	session_model->addParticipant(participant); +} +  void LLPanelPeople::hideFacebookFriends()  {  	mFacebookFriends->clear(); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index e9581bb5f3..b4582d9a3e 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -22,7 +22,7 @@   *    * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$ - */ + */   #ifndef LL_LLPANELPEOPLE_H  #define LL_LLPANELPEOPLE_H @@ -30,6 +30,8 @@  #include <llpanel.h>  #include "llcallingcard.h" // for avatar tracker +#include "llconversationmodel.h" +#include "llevents.h"  #include "llfloaterwebcontent.h"  #include "llvoiceclient.h" @@ -41,6 +43,7 @@ class LLGroupList;  class LLSocialList;  class LLMenuButton;  class LLTabContainer; +class LLFolderView;  class LLPanelPeople   	: public LLPanel @@ -58,8 +61,12 @@ public:  	// when voice is available  	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); +	static void idle(void * user_data); +  	void openFacebookWeb(LLFloaterWebContent::Params& p);  	void showFacebookFriends(const LLSD& friends); +	void addTestParticipant(); +	void addParticipantToModel(LLConversationItemSession * session_model, const LLUUID& agent_id, const std::string& name);  	void hideFacebookFriends();  	void loadFacebookFriends();  	void tryToReconnectToFacebook(); @@ -149,6 +156,9 @@ private:  	bool					isAccordionCollapsedByUser(LLUICtrl* acc_tab);  	bool					isAccordionCollapsedByUser(const std::string& name); +	bool					onConversationModelEvent(const LLSD& event); +	LLConversationViewParticipant * createConversationViewParticipant(LLConversationItem * item); +  	LLTabContainer*			mTabContainer;  	LLAvatarList*			mOnlineFriendList;  	LLAvatarList*			mAllFriendList; @@ -170,6 +180,12 @@ private:  	Updater*				mButtonsUpdater;  	LLMenuButton*			mFBCGearButton;      LLHandle< LLFloater >	mPicker; + +	conversations_items_map mConversationsItems; +	conversations_widgets_map mConversationsWidgits; +	LLConversationViewModel mConversationViewModel; +	LLFolderView* mConversationsRoot; +	LLEventStream mConversationsEventStream;  };  #endif //LL_LLPANELPEOPLE_H diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 08c8aef1e9..c4db547a8e 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -725,5 +725,18 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M               />            </panel>          </panel> +        <panel +           background_opaque="true" +           background_visible="true" +           bg_alpha_color="DkGray" +           bg_opaque_color="DkGray" +           follows="all" +           height="383" +           label="FBC TEST TWO" +           layout="topleft" +           left="0" +           help_topic="people_fbctest_tab" +           name="fbctesttwo_panel" +           top="0"/>            </tab_container>  </panel> | 
