diff options
| author | Merov Linden <merov@lindenlab.com> | 2013-04-30 17:20:49 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2013-04-30 17:20:49 -0700 | 
| commit | 8764e84041c48d0facd3a2860d90f78c88714f7c (patch) | |
| tree | 775bc74790ca0b65028608372a3557ced83b7a3c /indra | |
| parent | 336efe17d8f24a8445e93645f2cf18b68e18de2e (diff) | |
| parent | 9fdfc8dd5c52e515990f3ef4e552b9084fa66373 (diff) | |
Pull from viewer-fbc
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llpanelpeople.cpp | 7 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 13 | ||||
| -rw-r--r-- | indra/newview/llpersonmodelcommon.h | 6 | ||||
| -rw-r--r-- | indra/newview/llpersontabview.cpp | 112 | ||||
| -rw-r--r-- | indra/newview/llpersontabview.h | 26 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/person_view.xml | 12 | 
6 files changed, 159 insertions, 17 deletions
| diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 609284cdd5..a9a024c9ed 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1698,7 +1698,12 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model  {  	LLPersonModel* person_model = NULL; -	person_model = new LLPersonModel(name, mPersonFolderViewModel); +	LLAvatarName avatar_name; +	bool avatar_name_exists = LLAvatarNameCache::get(agent_id, &avatar_name); + +	std::string aggregated_name = avatar_name_exists ? name + " (" + avatar_name.getDisplayName() + ") " : name; + +	person_model = new LLPersonModel(agent_id, aggregated_name, mPersonFolderViewModel);  	person_folder_model->addParticipant(person_model);  } diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 32ceef096d..3e9ca9c3b9 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -148,14 +148,21 @@ LLPersonModel* LLPersonTabModel::findParticipant(const LLUUID& person_id)  // LLPersonModel  //  -LLPersonModel::LLPersonModel(std::string display_name, LLFolderViewModelInterface& root_view_model) : -LLPersonModelCommon(display_name,root_view_model) +LLPersonModel::LLPersonModel(const LLUUID& agent_id, const std::string display_name, LLFolderViewModelInterface& root_view_model) : +LLPersonModelCommon(display_name,root_view_model), +mAgentID(agent_id)  {  }  LLPersonModel::LLPersonModel(LLFolderViewModelInterface& root_view_model) : -LLPersonModelCommon(root_view_model) +LLPersonModelCommon(root_view_model), +mAgentID(LLUUID(NULL)) +{ +} + +LLUUID LLPersonModel::getAgentID()  { +	return mAgentID;  }  // diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index 2ddec3d05e..9e13a7d7d9 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -120,11 +120,13 @@ private:  class LLPersonModel : public LLPersonModelCommon  {  public: -	LLPersonModel(std::string display_name, LLFolderViewModelInterface& root_view_model); +	LLPersonModel(const LLUUID& agent_id, const std::string display_name, LLFolderViewModelInterface& root_view_model);  	LLPersonModel(LLFolderViewModelInterface& root_view_model); -private: +	LLUUID getAgentID(); +private: +	LLUUID mAgentID;  };  // Filtering functional object diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp index eaa112e051..76f3151777 100644 --- a/indra/newview/llpersontabview.cpp +++ b/indra/newview/llpersontabview.cpp @@ -29,6 +29,10 @@  #include "llpersontabview.h" +#include "llavataractions.h" +#include "llfloaterreg.h" +#include "llpersonmodelcommon.h" +  static LLDefaultChildRegistry::Register<LLPersonTabView> r_person_tab_view("person_tab_view");  const LLColor4U DEFAULT_WHITE(255, 255, 255); @@ -116,6 +120,9 @@ void LLPersonTabView::drawHighlight()  static LLDefaultChildRegistry::Register<LLPersonView> r_person_view("person_view"); +bool LLPersonView::sChildrenWidthsInitialized = false; +ChildWidthVec LLPersonView::mChildWidthVec; +  LLPersonView::Params::Params() :  avatar_icon("avatar_icon"),  last_interaction_time_textbox("last_interaction_time_textbox"), @@ -142,7 +149,6 @@ mInfoBtn(NULL),  mProfileBtn(NULL),  mOutputMonitorCtrl(NULL)  { -	initChildrenWidths(this);  }  S32 LLPersonView::getLabelXPos() @@ -162,6 +168,42 @@ LLPersonView::~LLPersonView()  } +BOOL LLPersonView::postBuild() +{ +	if(!sChildrenWidthsInitialized) +	{ +		initChildrenWidthVec(this); +		sChildrenWidthsInitialized = true; +	} +	 +	initChildVec(); +	updateChildren(); + +	LLPersonModel * person_model = static_cast<LLPersonModel *>(getViewModelItem()); + +	mAvatarIcon->setValue(person_model->getAgentID()); +	mInfoBtn->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "inspect_avatar", LLSD().with("avatar_id", person_model->getAgentID()), FALSE)); +	mProfileBtn->setClickedCallback(boost::bind(&LLAvatarActions::showProfile, person_model->getAgentID())); + +	return LLFolderViewItem::postBuild(); +} + +void LLPersonView::onMouseEnter(S32 x, S32 y, MASK mask) +{ +	mInfoBtn->setVisible(TRUE); +	mProfileBtn->setVisible(TRUE); +	updateChildren(); +	LLFolderViewItem::onMouseEnter(x, y, mask); +} + +void LLPersonView::onMouseLeave(S32 x, S32 y, MASK mask) +{ +	mInfoBtn->setVisible(FALSE); +	mProfileBtn->setVisible(FALSE); +	updateChildren(); +	LLFolderViewItem::onMouseLeave(x, y, mask); +} +  void LLPersonView::draw()  {  	static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); @@ -222,6 +264,11 @@ void LLPersonView::initFromParams(const LLPersonView::Params & params)  	mPermissionEditTheirsIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_edit_theirs_icon);  	addChild(mPermissionEditTheirsIcon); +	LLIconCtrl::Params permission_edit_mine_icon(params.permission_edit_mine_icon()); +	applyXUILayout(permission_edit_mine_icon, this); +	mPermissionEditMineIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_edit_mine_icon); +	addChild(mPermissionEditMineIcon); +  	LLIconCtrl::Params permission_map_icon(params.permission_map_icon());  	applyXUILayout(permission_map_icon, this);  	mPermissionMapIcon = LLUICtrlFactory::create<LLIconCtrl>(permission_map_icon); @@ -248,7 +295,68 @@ void LLPersonView::initFromParams(const LLPersonView::Params & params)  	addChild(mOutputMonitorCtrl);  } -void LLPersonView::initChildrenWidths(LLPersonView* self) +void LLPersonView::initChildrenWidthVec(LLPersonView* self) +{ +	S32 output_monitor_width = self->getRect().getWidth() - self->mOutputMonitorCtrl->getRect().mLeft; +	S32 profile_btn_width = self->mOutputMonitorCtrl->getRect().mLeft - self->mProfileBtn->getRect().mLeft; +	S32 info_btn_width = self->mProfileBtn->getRect().mLeft - self->mInfoBtn->getRect().mLeft; +	S32 permission_online_icon_width = self->mInfoBtn->getRect().mLeft - self->mPermissionOnlineIcon->getRect().mLeft; +	S32 permissions_map_icon_width = self->mPermissionOnlineIcon->getRect().mLeft - self->mPermissionMapIcon->getRect().mLeft; +	S32 permission_edit_mine_icon_width = self->mPermissionMapIcon->getRect().mLeft - self->mPermissionEditMineIcon->getRect().mLeft; +	S32 permission_edit_theirs_icon_width = self->mPermissionEditMineIcon->getRect().mLeft - self->mPermissionEditTheirsIcon->getRect().mLeft; +	S32 last_interaction_time_textbox_width = self->mPermissionEditTheirsIcon->getRect().mLeft - self->mLastInteractionTimeTextbox->getRect().mLeft; + +	self->mChildWidthVec.push_back(output_monitor_width); +	self->mChildWidthVec.push_back(profile_btn_width); +	self->mChildWidthVec.push_back(info_btn_width); +	self->mChildWidthVec.push_back(permission_online_icon_width); +	self->mChildWidthVec.push_back(permissions_map_icon_width); +	self->mChildWidthVec.push_back(permission_edit_mine_icon_width); +	self->mChildWidthVec.push_back(permission_edit_theirs_icon_width); +	self->mChildWidthVec.push_back(last_interaction_time_textbox_width); +} + +void LLPersonView::initChildVec() +{ +	mChildVec.push_back(mOutputMonitorCtrl); +	mChildVec.push_back(mProfileBtn); +	mChildVec.push_back(mInfoBtn); +	mChildVec.push_back(mPermissionOnlineIcon); +	mChildVec.push_back(mPermissionMapIcon); +	mChildVec.push_back(mPermissionEditMineIcon); +	mChildVec.push_back(mPermissionEditTheirsIcon); +	mChildVec.push_back(mLastInteractionTimeTextbox); +} + +void LLPersonView::updateChildren()  { +	mLabelPaddingRight = 0; +	LLView * control; +	S32 control_width; +	LLRect control_rect; +	llassert(mChildWidthVec.size() == mChildVec.size()); + +	for(S32 i = 0; i < mChildWidthVec.size(); ++i) +	{ +		control = mChildVec[i]; + +		if(!control->getVisible()) +		{ +			continue; +		} + +		control_width = mChildWidthVec[i]; +		mLabelPaddingRight += control_width; + +		control_rect = control->getRect(); +		control_rect.setLeftTopAndSize( +			getLocalRect().getWidth() - mLabelPaddingRight, +			control_rect.mTop, +			control_rect.getWidth(), +			control_rect.getHeight()); + +		control->setShape(control_rect); + +	}  } diff --git a/indra/newview/llpersontabview.h b/indra/newview/llpersontabview.h index d8d1a65df6..80020073d7 100644 --- a/indra/newview/llpersontabview.h +++ b/indra/newview/llpersontabview.h @@ -64,6 +64,9 @@ private:  }; +typedef std::vector<S32> ChildWidthVec; +typedef std::vector<LLView *> ChildVec; +  class LLPersonView : public LLFolderViewItem  { @@ -86,11 +89,15 @@ public:  	LLPersonView(const LLPersonView::Params& p);  	virtual ~LLPersonView(); -	 S32 getLabelXPos(); -	 void addToFolder(LLFolderViewFolder * person_folder_view); -	 void initFromParams(const LLPersonView::Params & params); +	S32 getLabelXPos(); +	void addToFolder(LLFolderViewFolder * person_folder_view); +	void initFromParams(const LLPersonView::Params & params); +	BOOL postBuild(); +	void onMouseEnter(S32 x, S32 y, MASK mask); +	void onMouseLeave(S32 x, S32 y, MASK mask);  protected:	 +	  	void draw();  	void drawHighlight(); @@ -123,12 +130,15 @@ private:  		ALIC_COUNT,  	} EAvatarListItemChildIndex; -	static bool	sStaticInitialized; -	static S32 sMouseOverChildrenWidths[ALIC_COUNT]; -	static S32 sMouseOverChildren[ALIC_COUNT]; -	static void initChildrenWidths(LLPersonView* self); +	//Widths of controls are same for every instance so can be static +	static ChildWidthVec mChildWidthVec; +	//Control pointers are different for each instance so non-static +	ChildVec mChildVec; + +	static bool	sChildrenWidthsInitialized; +	static void initChildrenWidthVec(LLPersonView* self); +	void initChildVec();  	void updateChildren(); -	//LLView* getItemChildView(EAvatarListItemChildIndex child_view_index);  };  #endif // LL_LLPERSONTABVIEW_H diff --git a/indra/newview/skins/default/xui/en/widgets/person_view.xml b/indra/newview/skins/default/xui/en/widgets/person_view.xml index d257a5114f..4a39109f36 100644 --- a/indra/newview/skins/default/xui/en/widgets/person_view.xml +++ b/indra/newview/skins/default/xui/en/widgets/person_view.xml @@ -31,6 +31,7 @@        name="last_interaction_time_textbox"        text_color="LtGray_50"        value="0s" +      visible="false"         width="35" />      <permission_edit_theirs_icon        layout="topleft" @@ -42,6 +43,7 @@        name="permission_edit_theirs_icon"        tool_tip="You can edit this friend's objects"        top="4" +      visible="false"         width="16" />      <permission_edit_mine_icon        layout="topleft" @@ -52,6 +54,8 @@        right="-110"        name="permission_edit_mine_icon"        tool_tip="This friend can edit, delete or take your objects" +      top="4" +      visible="false"         width="16" />      <permission_map_icon        height="16" @@ -61,6 +65,7 @@        tool_tip="This friend can locate you on the map"        right="-91"        name="permission_map_icon" +      visible="false"         width="16" />      <permission_online_icon        height="16" @@ -70,6 +75,7 @@        right="-72"        name="permission_online_icon"        tool_tip="This friend can see when you're online" +      visible="false"         width="16" />      <info_btn        follows="right" @@ -81,8 +87,10 @@        name="info_btn"        tool_tip="More info"        tab_stop="false" +      visible="false"              width="16" />      <profile_btn +      layout="topleft"        follows="right"        height="20"        image_overlay="Web_Profile_Off" @@ -91,7 +99,8 @@        name="profile_btn"        tab_stop="false"        tool_tip="View profile" -      top_delta="-2" +      top="2" +      visible="false"        width="20" />      <output_monitor        auto_update="true" @@ -101,6 +110,7 @@        right="-3"        mouse_opaque="true"        name="speaking_indicator" +      visible="false"        width="20" />   </person_view> | 
