From 8f81b5dbe4ff0a0d6486e5325250650986f6a81e Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 24 Dec 2009 14:31:48 +0200 Subject: Work on normal task EXT-3636 (Code Improvements: Voice control panels - Make Voice states and fade timeout xml driven) -- Code cleaned up: renamed variables related to item styles, -- changed signature of LLAvatarListItem::getItemStylesParams & LLAvatarListItem::getItemIconColorMap to return a reference to avoid calling of plural copy constructors. --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 16 ++++++++-------- indra/newview/llavatarlistitem.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 61361d78e6..8bc11b0c1c 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -178,19 +178,19 @@ void LLAvatarListItem::setHighlight(const std::string& highlight) setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight); } -void LLAvatarListItem::setStyle(EItemStyle voice_state) +void LLAvatarListItem::setStyle(EItemStyle item_style) { - voice_state_map_t mVoiceStateMap = getItemStylesParams(); + item_style_map_t& item_styles_params_map = getItemStylesParams(); - mAvatarNameStyle = mVoiceStateMap[voice_state]; + mAvatarNameStyle = item_styles_params_map[item_style]; // *NOTE: You cannot set the style on a text box anymore, you must // rebuild the text. This will cause problems if the text contains // hyperlinks, as their styles will be wrong. setNameInternal(mAvatarName->getText(), mHighlihtSubstring); - icon_color_map_t item_icon_color_map = getItemIconColorMap(); - mAvatarIcon->setColor(item_icon_color_map[voice_state]); + icon_color_map_t& item_icon_color_map = getItemIconColorMap(); + mAvatarIcon->setColor(item_icon_color_map[item_style]); } void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes) @@ -408,9 +408,9 @@ std::string LLAvatarListItem::formatSeconds(U32 secs) } // static -LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams() +LLAvatarListItem::item_style_map_t& LLAvatarListItem::getItemStylesParams() { - static voice_state_map_t item_styles_params_map; + static item_style_map_t item_styles_params_map; if (!item_styles_params_map.empty()) return item_styles_params_map; LLPanel::Params params = LLUICtrlFactory::getDefaultParams(); @@ -460,7 +460,7 @@ LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams() } // static -LLAvatarListItem::icon_color_map_t LLAvatarListItem::getItemIconColorMap() +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; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index ed556fbcb4..8e359f16b3 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -82,7 +82,7 @@ public: void setOnline(bool online); void setName(const std::string& name); void setHighlight(const std::string& highlight); - void setStyle(EItemStyle voice_state); + void setStyle(EItemStyle item_style); void setAvatarId(const LLUUID& id, bool ignore_status_changes = false); void setLastInteractionTime(U32 secs_since); //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly @@ -127,11 +127,11 @@ private: std::string formatSeconds(U32 secs); - typedef std::map voice_state_map_t; - static voice_state_map_t getItemStylesParams(); + typedef std::map item_style_map_t; + static item_style_map_t& getItemStylesParams(); typedef std::map icon_color_map_t; - static icon_color_map_t getItemIconColorMap(); + static icon_color_map_t& getItemIconColorMap(); LLAvatarIconCtrl* mAvatarIcon; LLTextBox* mAvatarName; -- cgit v1.2.3