From 5dc8738076d158aa74a93f7f3630a17d9102fdc4 Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Mon, 10 Sep 2012 07:40:13 -0700
Subject: [PATCH] CHUI-283: Basic Implementation, just have hard coded avatar
 icon appearing and profile/info buttons visible. profile/info buttons do not
 have proper positioning or mouseclick events.

---
 indra/llcommon/llfoldertype.h          |   4 +-
 indra/llui/llfolderviewitem.cpp        |   8 +-
 indra/llui/llfolderviewitem.h          |   2 +-
 indra/newview/llconversationmodel.h    |   4 +-
 indra/newview/llconversationview.cpp   | 110 ++++++++++++++++++++++++-
 indra/newview/llconversationview.h     |  42 +++++++++-
 indra/newview/llimfloatercontainer.cpp |   2 +-
 indra/newview/llviewerfoldertype.cpp   |   2 +
 8 files changed, 163 insertions(+), 11 deletions(-)
 mode change 100644 => 100755 indra/llcommon/llfoldertype.h
 mode change 100644 => 100755 indra/llui/llfolderviewitem.cpp
 mode change 100644 => 100755 indra/llui/llfolderviewitem.h
 mode change 100644 => 100755 indra/newview/llconversationmodel.h
 mode change 100644 => 100755 indra/newview/llconversationview.cpp
 mode change 100644 => 100755 indra/newview/llconversationview.h
 mode change 100644 => 100755 indra/newview/llimfloatercontainer.cpp
 mode change 100644 => 100755 indra/newview/llviewerfoldertype.cpp

diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h
old mode 100644
new mode 100755
index a0c847914f0..6b5ae572a93
--- a/indra/llcommon/llfoldertype.h
+++ b/indra/llcommon/llfoldertype.h
@@ -89,7 +89,9 @@ class LL_COMMON_API LLFolderType
 
 		FT_COUNT,
 
-		FT_NONE = -1
+		FT_NONE = -1,
+
+        FT_PROFILE = 58
 	};
 
 	static EType 				lookup(const std::string& type_name);
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
old mode 100644
new mode 100755
index 52923389cd6..c46af27a04b
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -609,13 +609,14 @@ void LLFolderViewItem::draw()
 	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
 	static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
 
+
+    getViewModelItem()->update();
+
 	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
 	const S32 TOP_PAD = default_params.item_top_pad;
 	const S32 FOCUS_LEFT = 1;
 	const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
 
-	getViewModelItem()->update();
-
 	//--------------------------------------------------------------------------------//
 	// Draw open folder arrow
 	//
@@ -793,6 +794,9 @@ void LLFolderViewItem::draw()
 							  sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
 							  filter_string_length, S32_MAX, &right_x, FALSE );
 		}
+
+        
+        LLView::draw(); 
 	}
 
 const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
old mode 100644
new mode 100755
index 6eacbe8bd08..766d9b3fe30
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -231,7 +231,7 @@ class LLFolderViewItem : public LLView
 
 	virtual void onMouseLeave(S32 x, S32 y, MASK mask);
 
-	virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; }
+	//virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return LLView::findChildView(name, recurse); }
 
 	//	virtual void handleDropped();
 	virtual void draw();
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
old mode 100644
new mode 100755
index 1a2e09dfab0..7baabf7f76d
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -29,6 +29,7 @@
 
 #include "llfolderviewitem.h"
 #include "llfolderviewmodel.h"
+#include "llviewerfoldertype.h"
 
 // Implementation of conversations list
 
@@ -55,7 +56,7 @@ class LLConversationItem : public LLFolderViewModelItemCommon
 	virtual const std::string& getSearchableName() const { return mName; }
 	virtual const LLUUID& getUUID() const { return mUUID; }
 	virtual time_t getCreationDate() const { return 0; }
-	virtual LLPointer<LLUIImage> getIcon() const { return NULL; }
+	virtual LLPointer<LLUIImage> getIcon() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(LLFolderType::FT_PROFILE, FALSE)); }
 	virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
 	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
 	virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
@@ -115,6 +116,7 @@ class LLConversationItemSession : public LLConversationItem
 	LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
 	virtual ~LLConversationItemSession() {}
 	
+    LLPointer<LLUIImage> getIcon() const { return NULL; }
 	void setSessionID(const LLUUID& session_id) { mUUID = session_id; }
 	void addParticipant(LLConversationItemParticipant* participant);
 	void removeParticipant(LLConversationItemParticipant* participant);
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
old mode 100644
new mode 100755
index fefb7e9cac4..d1a84786978
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -32,9 +32,15 @@
 #include "llimconversation.h"
 #include "llimfloatercontainer.h"
 
+
+#include "lluictrlfactory.h"
+#include "llavatariconctrl.h"
+
 //
 // Implementation of conversations list session widgets
 //
+ 
+
 
 LLConversationViewSession::Params::Params() :	
 	container()
@@ -83,9 +89,111 @@ void LLConversationViewSession::setVisibleIfDetached(BOOL visible)
 // Implementation of conversations list participant (avatar) widgets
 //
 
-LLConversationViewParticipant::LLConversationViewParticipant( const LLFolderViewItem::Params& p ):
+static LLDefaultChildRegistry::Register<LLConversationViewParticipant> r("conversation_view_participant");
+
+LLConversationViewParticipant::Params::Params() :	
+container(),
+view_profile_button("view_profile_button"),
+info_button("info_button")
+{}
+
+LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ):
 	LLFolderViewItem(p)
+{	
+
+}
+
+void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params)
+{
+	LLButton::Params view_profile_button_params(params.view_profile_button());
+	LLButton * button = LLUICtrlFactory::create<LLButton>(view_profile_button_params);
+	addChild(button);
+	
+	LLButton::Params info_button_params(params.info_button());
+	button = LLUICtrlFactory::create<LLButton>(info_button_params);
+	addChild(button);	
+}
+
+BOOL LLConversationViewParticipant::postBuild()
+{
+	mInfoBtn = getChild<LLButton>("info_btn");
+	mProfileBtn = getChild<LLButton>("profile_btn");
+	
+	mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this));
+	mProfileBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onProfileBtnClick, this));
+	
+	
+	LLFolderViewItem::postBuild();
+	return TRUE;
+}
+
+void LLConversationViewParticipant::onInfoBtnClick()
+{
+	
+	
+}
+
+void LLConversationViewParticipant::onProfileBtnClick()
+{
+	
+}
+
+LLButton* LLConversationViewParticipant::createProfileButton()
+{
+	
+	LLButton::Params params;
+	
+	
+	//<button
+	params.follows.flags(FOLLOWS_RIGHT);
+	//params.height="20";
+	LLUIImage * someImage = LLUI::getUIImage("Web_Profile_Off");
+	params.image_overlay = someImage;
+	params.layout="topleft";
+	params.left_pad=5;
+	//params.right="-28";
+	params.name="profile_btn";
+	params.tab_stop="false";
+	params.tool_tip="View profile";
+	params.top_delta=-2;
+	//params.width="20";
+	///>	
+	
+	
+	/*
+	LLConversationViewParticipant::Params params;
+	
+	params.name = item->getDisplayName();
+	//params.icon = bridge->getIcon();
+	//params.icon_open = bridge->getOpenIcon();
+	//params.creation_date = bridge->getCreationDate();
+	params.root = mConversationsRoot;
+	params.listener = item;
+	params.rect = LLRect (0, 0, 0, 0);
+	params.tool_tip = params.name;
+	params.container = this;
+	*/
+	
+	LLButton * button = LLUICtrlFactory::create<LLButton>(params);
+	LLRect someRect;
+	someRect.setOriginAndSize(30, 0, 20, 20);
+	button->setShape(someRect);
+	
+	//button->follows= "right";
+	//button->height = 20;
+	//button->image_overlay="Web_Profile_Off";
+	//button->right = -28;
+	//button->width = 20;
+
+	
+	
+	return button;
+}
+
+
+void LLConversationViewParticipant::draw()
 {
+    LLFolderViewItem::draw();
 }
 
 // EOF
diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h
old mode 100644
new mode 100755
index 5695925f43d..a7f468cb273
--- a/indra/newview/llconversationview.h
+++ b/indra/newview/llconversationview.h
@@ -29,6 +29,14 @@
 
 #include "llfolderviewitem.h"
 
+
+
+
+#include "llstyle.h"
+#include "llcallbackmap.h"
+#include "lltextbox.h"
+#include "llbutton.h";
+
 class LLIMFloaterContainer;
 
 // Implementation of conversations list session widgets
@@ -57,14 +65,40 @@ class LLConversationViewSession : public LLFolderViewFolder
 
 // Implementation of conversations list participant (avatar) widgets
 
+class LLAvatarIconCtrl;
+
 class LLConversationViewParticipant : public LLFolderViewItem
 {
+
+public:
+
+    struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
+    {
+        Optional<LLIMFloaterContainer*>			container;
+		Optional<LLButton::Params>				view_profile_button,
+												info_button;
+
+        Params();
+    };
+
+    virtual ~LLConversationViewParticipant( void ) { }
+    virtual void draw();
+    
 protected:
-	friend class LLUICtrlFactory;
-	LLConversationViewParticipant( const LLFolderViewItem::Params& p );
+    friend class LLUICtrlFactory;
+    LLConversationViewParticipant( const Params& p );
+	void initFromParams(const Params& params);
+	BOOL postBuild();
+
+	void onInfoBtnClick();
+	void onProfileBtnClick();	
 	
-public:
-	virtual ~LLConversationViewParticipant( void ) { }
+private:
+	LLButton* createProfileButton();
+	LLButton * mInfoBtn;
+	LLButton * mProfileBtn;
+	
+
 };
 
 #endif // LL_LLCONVERSATIONVIEW_H
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
old mode 100644
new mode 100755
index 5261d30cd95..9758f5a93e0
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -634,7 +634,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL
 
 LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item)
 {
-	LLConversationViewSession::Params params;
+	LLConversationViewParticipant::Params params;
 	
 	params.name = item->getDisplayName();
 	//params.icon = bridge->getIcon();
diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp
old mode 100644
new mode 100755
index a179b61cffc..d470abb8c5b
--- a/indra/newview/llviewerfoldertype.cpp
+++ b/indra/newview/llviewerfoldertype.cpp
@@ -147,6 +147,8 @@ LLViewerFolderDictionary::LLViewerFolderDictionary()
 		addEntry((LLFolderType::EType)type, 		new ViewerFolderEntry("New Folder",				"Inv_FolderOpen",		"Inv_FolderClosed",		FALSE,     false));
 	}	
 #endif
+
+    addEntry(LLFolderType::FT_PROFILE, 				new ViewerFolderEntry("Profile",				"Generic_Person",		"Generic_Person",		FALSE,     false, "default"));
 }
 
 bool LLViewerFolderDictionary::initEnsemblesFromFile()
-- 
GitLab