From d75ba371a2fbbd5af981168dffe86079357ef719 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Thu, 24 Dec 2009 14:24:09 +0200
Subject: [PATCH] Work on normal task EXT-3636 (Code Improvements: Voice
 control panels - Make Voice states and fade timeout xml driven) -- made
 Avatar List Item icon color xml-driven.

--HG--
branch : product-engine
---
 indra/newview/llavatarlistitem.cpp     | 43 ++++++++++++++++++++++----
 indra/newview/llavatarlistitem.h       |  3 ++
 indra/newview/skins/default/colors.xml | 18 +++++++++++
 3 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 76e2f2191a7..61361d78e6d 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -158,7 +158,6 @@ void LLAvatarListItem::changed(U32 mask)
 void LLAvatarListItem::setOnline(bool online)
 {
 	// *FIX: setName() overrides font style set by setOnline(). Not an issue ATM.
-	// *TODO: Make the colors configurable via XUI.
 
 	if (mOnlineStatus != E_UNKNOWN && (bool) mOnlineStatus == online)
 		return;
@@ -167,9 +166,6 @@ void LLAvatarListItem::setOnline(bool online)
 
 	// Change avatar name font style depending on the new online status.
 	setStyle(online ? IS_ONLINE : IS_OFFLINE);
-
-	// Make the icon fade if the avatar goes offline.
-	mAvatarIcon->setColor(online ? LLColor4::white : LLColor4::smoke);
 }
 
 void LLAvatarListItem::setName(const std::string& name)
@@ -193,8 +189,8 @@ void LLAvatarListItem::setStyle(EItemStyle voice_state)
 	// hyperlinks, as their styles will be wrong.
 	setNameInternal(mAvatarName->getText(), mHighlihtSubstring);
 
-	// *TODO: move icon colors into colors.xml
-	mAvatarIcon->setColor(voice_state == IS_VOICE_JOINED ? LLColor4::white : LLColor4::smoke);
+	icon_color_map_t item_icon_color_map = getItemIconColorMap();
+	mAvatarIcon->setColor(item_icon_color_map[voice_state]);
 }
 
 void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes)
@@ -462,3 +458,38 @@ LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams()
 
 	return item_styles_params_map;
 }
+
+// static
+LLAvatarListItem::icon_color_map_t LLAvatarListItem::getItemIconColorMap()
+{
+	static icon_color_map_t item_icon_color_map;
+	if (!item_icon_color_map.empty()) return item_icon_color_map;
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_DEFAULT,
+		LLUIColorTable::instance().getColor("AvatarListItemIconDefaultColor", LLColor4::white)));
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_VOICE_INVITED,
+		LLUIColorTable::instance().getColor("AvatarListItemIconVoiceInvitedColor", LLColor4::white)));
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_VOICE_JOINED,
+		LLUIColorTable::instance().getColor("AvatarListItemIconVoiceJoinedColor", LLColor4::white)));
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_VOICE_LEFT,
+		LLUIColorTable::instance().getColor("AvatarListItemIconVoiceLeftColor", LLColor4::white)));
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_ONLINE,
+		LLUIColorTable::instance().getColor("AvatarListItemIconOnlineColor", LLColor4::white)));
+
+	item_icon_color_map.insert(
+		std::make_pair(IS_OFFLINE,
+		LLUIColorTable::instance().getColor("AvatarListItemIconOfflineColor", LLColor4::white)));
+
+	return item_icon_color_map;
+}
+
+// EOF
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 628061b0331..ed556fbcb47 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -130,6 +130,9 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	typedef std::map<EItemStyle, LLStyle::Params> voice_state_map_t;
 	static voice_state_map_t getItemStylesParams();
 
+	typedef std::map<EItemStyle, LLColor4> icon_color_map_t;
+	static icon_color_map_t getItemIconColorMap();
+
 	LLAvatarIconCtrl* mAvatarIcon;
 	LLTextBox* mAvatarName;
 	LLTextBox* mLastInteractionTime;
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 706245a4793..cb511c2f0bf 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -101,6 +101,24 @@
     <color
      name="AvatarNameColor"
      reference="White" />
+    <color
+     name="AvatarListItemIconDefaultColor"
+     reference="White" />
+    <color
+     name="AvatarListItemIconOnlineColor"
+     reference="White" />
+    <color
+     name="AvatarListItemIconOfflineColor"
+     value="0.5 0.5 0.5 0.5" />
+    <color
+     name="AvatarListItemIconVoiceInvitedColor"
+     reference="AvatarListItemIconOfflineColor" />
+    <color
+     name="AvatarListItemIconVoiceJoinedColor"
+     reference="AvatarListItemIconOnlineColor" />
+    <color
+     name="AvatarListItemIconVoiceLeftColor"
+     reference="AvatarListItemIconOfflineColor" />
     <color
      name="BackgroundChatColor"
      reference="DkGray_66" />
-- 
GitLab