diff options
author | richard <none@none> | 2010-01-22 16:51:13 -0800 |
---|---|---|
committer | richard <none@none> | 2010-01-22 16:51:13 -0800 |
commit | 337716d946cf4ece8ba59cce82bd51b3c2148f75 (patch) | |
tree | 3dee9d70847c017e00e0090692606058565bfdd3 /indra/newview | |
parent | 41f2b8e6017c4846430f501dc3d4877b505b9fbd (diff) |
LLPointer cleanup and fix for EXT-4413
reviewed by Rick
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llavatarlist.h | 10 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 15 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml | 44 |
6 files changed, 98 insertions, 67 deletions
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index a58a562378..aeed4fee08 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -57,11 +57,11 @@ public: struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> { - 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; - Optional<bool> show_speaking_indicator; + Optional<bool> ignore_online_status, // show all items as online + show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class + show_info_btn, + show_profile_btn, + show_speaking_indicator; Params(); }; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 66ab32f3e8..26a39532dd 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -48,6 +48,17 @@ S32 LLAvatarListItem::sLeftPadding = 0; S32 LLAvatarListItem::sRightNamePadding = 0; S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT]; +static LLWidgetNameRegistry::StaticRegistrar sRegisterAvatarListItemParams(&typeid(LLAvatarListItem::Params), "avatar_list_item"); + +LLAvatarListItem::Params::Params() +: default_style("default_style"), + voice_call_invited_style("voice_call_invited_style"), + voice_call_joined_style("voice_call_joined_style"), + voice_call_left_style("voice_call_left_style"), + online_style("online_style"), + offline_style("offline_style") +{}; + LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) : LLPanel(), @@ -166,9 +177,30 @@ void LLAvatarListItem::setHighlight(const std::string& highlight) void LLAvatarListItem::setState(EItemState item_style) { - item_style_map_t& item_styles_params_map = getItemStylesParams(); + const LLAvatarListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>(); - mAvatarNameStyle = item_styles_params_map[item_style]; + switch(item_style) + { + default: + case IS_DEFAULT: + mAvatarNameStyle = params.default_style(); + break; + case IS_VOICE_INVITED: + mAvatarNameStyle = params.voice_call_invited_style(); + break; + case IS_VOICE_JOINED: + mAvatarNameStyle = params.voice_call_joined_style(); + break; + case IS_VOICE_LEFT: + mAvatarNameStyle = params.voice_call_left_style(); + break; + case IS_ONLINE: + mAvatarNameStyle = params.online_style(); + break; + case IS_OFFLINE: + mAvatarNameStyle = params.offline_style(); + break; + } // *NOTE: You cannot set the style on a text box anymore, you must // rebuild the text. This will cause problems if the text contains @@ -353,58 +385,6 @@ std::string LLAvatarListItem::formatSeconds(U32 secs) } // static -LLAvatarListItem::item_style_map_t& LLAvatarListItem::getItemStylesParams() -{ - 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<LLPanel>(); - LLPanel* params_panel = LLUICtrlFactory::create<LLPanel>(params); - - BOOL sucsess = LLUICtrlFactory::instance().buildPanel(params_panel, "panel_avatar_list_item_params.xml"); - - if (sucsess) - { - - item_styles_params_map.insert( - std::make_pair(IS_DEFAULT, - params_panel->getChild<LLTextBox>("default_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_INVITED, - params_panel->getChild<LLTextBox>("voice_call_invited_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_JOINED, - params_panel->getChild<LLTextBox>("voice_call_joined_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_VOICE_LEFT, - params_panel->getChild<LLTextBox>("voice_call_left_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_ONLINE, - params_panel->getChild<LLTextBox>("online_style")->getDefaultStyle())); - - item_styles_params_map.insert( - std::make_pair(IS_OFFLINE, - params_panel->getChild<LLTextBox>("offline_style")->getDefaultStyle())); - } - else - { - item_styles_params_map.insert(std::make_pair(IS_DEFAULT, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_INVITED, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_JOINED, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_VOICE_LEFT, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_ONLINE, LLStyle::Params())); - item_styles_params_map.insert(std::make_pair(IS_OFFLINE, LLStyle::Params())); - } - if (params_panel) params_panel->die(); - - return item_styles_params_map; -} - -// static LLAvatarListItem::icon_color_map_t& LLAvatarListItem::getItemIconColorMap() { static icon_color_map_t item_icon_color_map; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 479a4833cb..9f81aa0804 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -46,6 +46,18 @@ class LLAvatarIconCtrl; class LLAvatarListItem : public LLPanel, public LLFriendObserver { public: + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + { + Optional<LLStyle::Params> default_style, + voice_call_invited_style, + voice_call_joined_style, + voice_call_left_style, + online_style, + offline_style; + + Params(); + }; + typedef enum e_item_state_type { IS_DEFAULT, IS_VOICE_INVITED, @@ -143,9 +155,6 @@ private: std::string formatSeconds(U32 secs); - typedef std::map<EItemState, LLStyle::Params> item_style_map_t; - static item_style_map_t& getItemStylesParams(); - typedef std::map<EItemState, LLColor4> icon_color_map_t; static icon_color_map_t& getItemIconColorMap(); diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 9f6412c0ab..77b3a48cef 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -169,8 +169,7 @@ void LLExpandableTextBox::LLTextBoxEx::showExpandText() std::pair<S32, S32> visible_lines = getVisibleLines(true); S32 last_line = visible_lines.second - 1; - LLStyle::Params expander_style = getDefaultStyle(); - expander_style.font.name(LLFontGL::nameFromFont(expander_style.font)); + LLStyle::Params expander_style(getDefaultStyleParams()); expander_style.font.style = "UNDERLINE"; expander_style.color = LLUIColorTable::instance().getColor("HTMLLinkColor"); LLExpanderSegment* expanderp = new LLExpanderSegment(new LLStyle(expander_style), getLineStart(last_line), getLength() + 1, mExpanderLabel, *this); @@ -186,8 +185,7 @@ void LLExpandableTextBox::LLTextBoxEx::hideExpandText() if (mExpanderVisible) { // this will overwrite the expander segment and all text styling with a single style - LLNormalTextSegment* segmentp = new LLNormalTextSegment( - new LLStyle(getDefaultStyle()), 0, getLength() + 1, *this); + LLNormalTextSegment* segmentp = new LLNormalTextSegment(LLStyleConstSP(new LLStyle(getDefaultStyleParams())), 0, getLength() + 1, *this); insertSegment(segmentp); mExpanderVisible = false; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 300aea1620..94c257fe8c 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -247,7 +247,7 @@ public: return FALSE; } - /*virtual*/ const LLStyleSP getStyle() const { return mStyle; } + /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } private: LLUIImagePtr mImage; diff --git a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml new file mode 100644 index 0000000000..1a9a882c7b --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<avatar_list_item + height="0" + layout="topleft" + left="0" + name="avatar_list_item" + top="0" + width="0"> + <!-- DEFAULT styles for avatar item --> + <default_style + font="SansSerifSmall" + font.style="NORMAL" + text_color="DkGray"/> + + <!-- styles for avatar item INVITED to voice call --> + <voice_call_invited_style + font="SansSerifSmall" + font.style="NORMAL" + text_color="0.5 0.5 0.5 0.5"/> + + <!-- styles for avatar item JOINED to voice call --> + <voice_call_joined_style + font="SansSerifSmall" + font.style="NORMAL" + text_color="white"/> + + <!-- styles for avatar item which HAS LEFT voice call --> + <voice_call_left_style + font="SansSerifSmall" + font.style="ITALIC" + text_color="LtGray_50"/> + + <!-- styles for ONLINE avatar item --> + <online_style + font="SansSerifSmall" + font.style="NORMAL" + text_color="white"/> + + <!-- styles for OFFLINE avatar item --> + <offline_style + font="SansSerifSmall" + font.style="NORMAL" + text_color="0.5 0.5 0.5 1.0"/> +</avatar_list_item> |