From ba539933c7a6ceb78140c8ed422d1c185e9e096e Mon Sep 17 00:00:00 2001
From: Eugene Kondrashev <ekondrashev@productengine.com>
Date: Mon, 2 Nov 2009 14:58:41 +0200
Subject: [PATCH] Fixed Normal bug EXT-1975-Remove 'i' and show profile buttons
 from participant list items(See Communication UI spec)

--HG--
branch : product-engine
---
 indra/newview/llavatarlist.cpp                |  7 +++
 indra/newview/llavatarlist.h                  |  4 ++
 indra/newview/llavatarlistitem.cpp            | 48 +++++++++++++++----
 indra/newview/llavatarlistitem.h              | 11 ++++-
 .../xui/en/panel_adhoc_control_panel.xml      |  2 +
 .../xui/en/panel_group_control_panel.xml      |  2 +
 6 files changed, 63 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 65a2b8b5e69..7b2dc02864f 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -79,6 +79,8 @@ static const LLFlatListView::ItemReverseComparator REVERSE_NAME_COMPARATOR(NAME_
 LLAvatarList::Params::Params()
 : ignore_online_status("ignore_online_status", false)
 , show_last_interaction_time("show_last_interaction_time", false)
+, show_info_btn("show_info_btn", true)
+, show_profile_btn("show_profile_btn", true)
 {
 }
 
@@ -89,6 +91,9 @@ LLAvatarList::LLAvatarList(const Params& p)
 , mContextMenu(NULL)
 , mDirty(true) // to force initial update
 , mLITUpdateTimer(NULL)
+, mShowIcons(true)
+, mShowInfoBtn(p.show_info_btn)
+, mShowProfileBtn(p.show_profile_btn)
 {
 	setCommitOnSelectionChange(true);
 
@@ -253,6 +258,8 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is
 
 	item->childSetVisible("info_btn", false);
 	item->setAvatarIconVisible(mShowIcons);
+	item->setShowInfoBtn(mShowInfoBtn);
+	item->setShowProfileBtn(mShowProfileBtn);
 
 	addItem(item, id, pos);
 }
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 8f2f0249a61..51d3760d393 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -59,6 +59,8 @@ class LLAvatarList : public LLFlatListView
 	{
 		Optional<bool> ignore_online_status; // show all items as online
 		Optional<bool> show_last_interaction_time; // show most recent interaction time. *HACK: move this to a derived class
+		Optional<bool> show_info_btn;
+		Optional<bool> show_profile_btn;
 		Params();
 	};
 
@@ -96,6 +98,8 @@ class LLAvatarList : public LLFlatListView
 	bool mShowLastInteractionTime;
 	bool mDirty;
 	bool mShowIcons;
+	bool mShowInfoBtn;
+	bool mShowProfileBtn;
 
 	LLTimer*				mLITUpdateTimer; // last interaction time update timer
 	std::string				mIconParamName;
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 84644305017..a7ac14c9486 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -42,8 +42,6 @@
 #include "llavatariconctrl.h"
 #include "llbutton.h"
 
-S32 LLAvatarListItem::sIconWidth = 0;
-
 LLAvatarListItem::LLAvatarListItem()
 :	LLPanel(),
 	mAvatarIcon(NULL),
@@ -53,15 +51,17 @@ LLAvatarListItem::LLAvatarListItem()
 	mInfoBtn(NULL),
 	mProfileBtn(NULL),
 	mContextMenu(NULL),
-	mOnlineStatus(E_UNKNOWN)
+	mOnlineStatus(E_UNKNOWN),
+	mShowInfoBtn(true),
+	mShowProfileBtn(true)
 {
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml");
 	// Remember avatar icon width including its padding from the name text box,
 	// so that we can hide and show the icon again later.
-	if (!sIconWidth)
-	{
-		sIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
-	}
+
+	mIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
+	mInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight;
+	mProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight;
 }
 
 LLAvatarListItem::~LLAvatarListItem()
@@ -116,8 +116,8 @@ BOOL  LLAvatarListItem::postBuild()
 void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
 {
 	childSetVisible("hovered_icon", true);
-	mInfoBtn->setVisible(true);
-	mProfileBtn->setVisible(true);
+	mInfoBtn->setVisible(mShowInfoBtn);
+	mProfileBtn->setVisible(mShowProfileBtn);
 
 	LLPanel::onMouseEnter(x, y, mask);
 }
@@ -202,6 +202,34 @@ void LLAvatarListItem::setLastInteractionTime(const std::string& val)
 	mLastInteractionTime->setValue(val);
 }
 
+void LLAvatarListItem::setShowInfoBtn(bool show)
+{
+	// Already done? Then do nothing.
+	if(mShowInfoBtn == show)
+		return;
+	mShowInfoBtn = show;
+	S32 width_delta = show ? - mInfoBtnWidth : mInfoBtnWidth;
+
+	//Translating speaking indicator
+	mSpeakingIndicator->translate(width_delta, 0);
+	//Reshaping avatar name
+	mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
+}
+
+void LLAvatarListItem::setShowProfileBtn(bool show)
+{
+	// Already done? Then do nothing.
+	if(mShowProfileBtn == show)
+			return;
+	mShowProfileBtn = show;
+	S32 width_delta = show ? - mProfileBtnWidth : mProfileBtnWidth;
+
+	//Translating speaking indicator
+	mSpeakingIndicator->translate(width_delta, 0);
+	//Reshaping avatar name
+	mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
+}
+
 void LLAvatarListItem::setAvatarIconVisible(bool visible)
 {
 	// Already done? Then do nothing.
@@ -213,7 +241,7 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible)
 
 	// Move the avatar name horizontally by icon size + its distance from the avatar name.
 	LLRect name_rect = mAvatarName->getRect();
-	name_rect.mLeft += visible ? sIconWidth : -sIconWidth;
+	name_rect.mLeft += visible ? mIconWidth : -mIconWidth;
 	mAvatarName->setRect(name_rect);
 }
 
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 10c0b17005f..cd7a85c3dc5 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -64,6 +64,9 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	void setName(const std::string& name);
 	void setAvatarId(const LLUUID& id, bool ignore_status_changes = false);
 	void setLastInteractionTime(const std::string& val);
+	//Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
+	void setShowProfileBtn(bool hide);
+	void setShowInfoBtn(bool hide);
 	void setAvatarIconVisible(bool visible);
 	
 	const LLUUID& getAvatarId() const;
@@ -99,7 +102,13 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 
 	LLUUID mAvatarId;
 	EOnlineStatus mOnlineStatus;
-	static S32	sIconWidth; // icon width + padding
+	//Flag indicating that info/profile button shouldn't be shown at all.
+	//Speaker indicator and avatar name coords are translated accordingly
+	bool mShowInfoBtn;
+	bool mShowProfileBtn;
+	S32	 mIconWidth; // icon width + padding
+	S32  mInfoBtnWidth; //info btn width + padding
+	S32  mProfileBtnWidth; //profile btn width + padding
 };
 
 #endif //LL_LLAVATARLISTITEM_H
diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
index 8db745fab71..1003b4a3a8b 100644
--- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml
@@ -13,6 +13,8 @@
      left="3"
      name="speakers_list"
      opaque="false"
+     show_info_btn="false"
+     show_profile_btn="false"
      top="10"
      width="140" />
     <button
diff --git a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
index 15b6b2a00db..ce952628c64 100644
--- a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml
@@ -13,6 +13,8 @@
      left="3"
      name="speakers_list"
      opaque="false"
+     show_info_btn="false"
+     show_profile_btn="false"
      top="10"
      width="140" />
     <button
-- 
GitLab