From 8d2ddff47e973c1692b42081e74dba3ad7745fdd Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 17 Jun 2010 17:42:09 +0300
Subject: [PATCH] EXT-7609 FIXED Added worn items indication with bold text.
 Fixed updating worn items indication.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/551/.

--HG--
branch : product-engine
---
 indra/newview/llinventoryitemslist.cpp | 11 +++++++----
 indra/newview/llinventoryitemslist.h   |  7 +++++--
 indra/newview/lloutfitslist.cpp        |  7 ++++---
 indra/newview/llwearableitemslist.cpp  | 13 +++++++++----
 indra/newview/llwearableitemslist.h    |  8 +++++---
 5 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index 384b24210cf..f7a07b260b2 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -80,10 +80,11 @@ void LLPanelInventoryListItemBase::draw()
 }
 
 // virtual
-void LLPanelInventoryListItemBase::updateItem(const std::string& name)
+void LLPanelInventoryListItemBase::updateItem(const std::string& name,
+											  const LLStyle::Params& input_params)
 {
 	setIconImage(mIconImage);
-	setTitle(name, mHighlightedText);
+	setTitle(name, mHighlightedText, input_params);
 }
 
 void LLPanelInventoryListItemBase::addWidgetToLeftSide(const std::string& name, bool show_widget/* = true*/)
@@ -286,13 +287,15 @@ void LLPanelInventoryListItemBase::setIconImage(const LLUIImagePtr& image)
 	}
 }
 
-void LLPanelInventoryListItemBase::setTitle(const std::string& title, const std::string& highlit_text)
+void LLPanelInventoryListItemBase::setTitle(const std::string& title,
+											const std::string& highlit_text,
+											const LLStyle::Params& input_params)
 {
 	setToolTip(title);
 
 	LLTextUtil::textboxSetHighlightedVal(
 		mTitleCtrl,
-		LLStyle::Params(),
+		input_params,
 		title,
 		highlit_text);
 }
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h
index 489a82829c8..5dc0bfe3de6 100644
--- a/indra/newview/llinventoryitemslist.h
+++ b/indra/newview/llinventoryitemslist.h
@@ -152,7 +152,8 @@ class LLPanelInventoryListItemBase : public LLPanel
 	/**
 	 * Called after inventory item was updated, update panel widgets to reflect inventory changes.
 	 */
-	virtual void updateItem(const std::string& name);
+	virtual void updateItem(const std::string& name,
+							const LLStyle::Params& input_params = LLStyle::Params());
 
 	/** setter for mIconCtrl */
 	void setIconCtrl(LLIconCtrl* icon) { mIconCtrl = icon; }
@@ -177,7 +178,9 @@ class LLPanelInventoryListItemBase : public LLPanel
 	void setIconImage(const LLUIImagePtr& image);
 
 	/** Set item title - inventory item name usually */
-	virtual void setTitle(const std::string& title, const std::string& highlit_text);
+	virtual void setTitle(const std::string& title,
+						  const std::string& highlit_text,
+						  const LLStyle::Params& input_params = LLStyle::Params());
 
 	/**
 	 * Show tool tip if item name text size > panel size
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index de074d6aaf4..8c6189353e1 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -44,7 +44,6 @@
 #include "llinventorymodel.h"
 #include "lllistcontextmenu.h"
 #include "llnotificationsutil.h"
-#include "lloutfitobserver.h"
 #include "llsidetray.h"
 #include "lltransutil.h"
 #include "llviewermenu.h"
@@ -208,8 +207,10 @@ void LLOutfitsList::onOpen(const LLSD& /*info*/)
 		mCategoriesObserver->addCategory(outfits,
 			boost::bind(&LLOutfitsList::refreshList, this, outfits));
 
-		// Start observing changes in Current Outfit to update items worn state.
-		LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLOutfitsList::onCOFChanged, this));
+		const LLUUID cof = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+
+		// Start observing changes in Current Outfit category.
+		mCategoriesObserver->addCategory(cof, boost::bind(&LLOutfitsList::onCOFChanged, this));
 
 		// Fetch "My Outfits" contents and refresh the list to display
 		// initially fetched items. If not all items are fetched now
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index ea0c5f1d0f4..9c308359fa9 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -112,16 +112,19 @@ LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item
 }
 
 // virtual
-void LLPanelWearableOutfitItem::updateItem(const std::string& name)
+void LLPanelWearableOutfitItem::updateItem(const std::string& name,
+										   const LLStyle::Params& input_params)
 {
 	std::string search_label = name;
+	LLStyle::Params style_params = input_params;
 
 	if (mItem && get_is_item_worn(mItem->getUUID()))
 	{
 		search_label += LLTrans::getString("worn");
+		style_params.font.style("BOLD");
 	}
 
-	LLPanelInventoryListItemBase::updateItem(search_label);
+	LLPanelInventoryListItemBase::updateItem(search_label, style_params);
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -261,7 +264,9 @@ LLPanelAttachmentListItem* LLPanelAttachmentListItem::create(LLViewerInventoryIt
 	return list_item;
 }
 
-void LLPanelAttachmentListItem::setTitle(const std::string& title, const std::string& highlit_text)
+void LLPanelAttachmentListItem::setTitle(const std::string& title,
+										 const std::string& highlit_text,
+										 const LLStyle::Params& input_params)
 {
 	std::string title_joint = title;
 
@@ -271,7 +276,7 @@ void LLPanelAttachmentListItem::setTitle(const std::string& title, const std::st
 		title_joint = title + " (" + joint + ")";
 	}
 
-	LLPanelDeletableWearableListItem::setTitle(title_joint, highlit_text);
+	LLPanelDeletableWearableListItem::setTitle(title_joint, highlit_text, input_params);
 }
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 69134dd6462..5dc06284c38 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -86,8 +86,8 @@ class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase
 	/**
 	 * Updates item name and (worn) suffix.
 	 */
-	/*virtual*/ void updateItem(const std::string& name);
-
+	/*virtual*/ void updateItem(const std::string& name,
+								const LLStyle::Params& input_params = LLStyle::Params());
 
 protected:
 	LLPanelWearableOutfitItem(LLViewerInventoryItem* item);
@@ -124,7 +124,9 @@ class LLPanelAttachmentListItem : public LLPanelDeletableWearableListItem
 	virtual ~LLPanelAttachmentListItem() {};
 
 	/** Set item title. Joint name is added to the title in parenthesis */
-	/*virtual*/ void setTitle(const std::string& title, const std::string& highlit_text);
+	/*virtual*/ void setTitle(const std::string& title,
+							  const std::string& highlit_text,
+							  const LLStyle::Params& input_params = LLStyle::Params());
 
 protected:
 	LLPanelAttachmentListItem(LLViewerInventoryItem* item) : LLPanelDeletableWearableListItem(item) {};
-- 
GitLab