From 46948d9fcc9149c3c416167f166aff6ce8fa88d5 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 23 Dec 2009 20:00:48 +0200 Subject: Work on normal task EXT-3636 (Code Improvements: Voice control panels - Make Voice states and fade timeout xml driven) -- made Avatar Item Voice States xml driven. Added fake xml panel file with one textbox per style. Style of the appropriate textbox is applied to avatar item's name -- It was necessary to change visibility of the LLTExtBase::getDefaultStyle() to public. --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 65 +++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 15 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index c8544bc3fb..d70e3c61b9 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -183,28 +183,21 @@ void LLAvatarListItem::setHighlight(const std::string& highlight) setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight); } -void LLAvatarListItem::setStyle(const LLStyle::Params& new_style) +void LLAvatarListItem::setStyle(EItemStyle voice_state) { -// LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle = new_style); + voice_state_map_t mVoiceStateMap = getItemStylesParams(); - // Active group should be bold. - LLFontDescriptor new_desc(mAvatarName->getDefaultFont()->getFontDesc()); - - new_desc.setStyle(new_style.font()->getFontDesc().getStyle()); - // *NOTE dzaporozhan - // On Windows LLFontGL::NORMAL will not remove LLFontGL::BOLD if font - // is predefined as bold (SansSerifSmallBold, for example) -// new_desc.setStyle(active ? LLFontGL::BOLD : LLFontGL::NORMAL); - LLFontGL* new_font = LLFontGL::getFont(new_desc); - -// - mAvatarNameStyle.font = new_font; + mAvatarNameStyle = mVoiceStateMap[voice_state]; // *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. - mAvatarName->setText(mAvatarName->getText(), mAvatarNameStyle/* = new_style*/); + mAvatarName->setText(mAvatarName->getText(), mAvatarNameStyle); + + // *TODO: move icon colors into colors.xml + mAvatarIcon->setColor(voice_state == IS_VOICE_JOINED ? LLColor4::white : LLColor4::smoke); } + void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes) { if (mAvatarId.notNull()) @@ -418,3 +411,45 @@ std::string LLAvatarListItem::formatSeconds(U32 secs) args["[COUNT]"] = llformat("%u", count); return getString(fmt, args); } + +// static +LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams() +{ + static voice_state_map_t item_styles_params_map; + if (!item_styles_params_map.empty()) return item_styles_params_map; + + LLPanel::Params params = LLUICtrlFactory::getDefaultParams(); + LLPanel* params_panel = LLUICtrlFactory::create(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("default_style")->getDefaultStyle())); + + item_styles_params_map.insert( + std::make_pair(IS_VOICE_INVITED, + params_panel->getChild("voice_call_invited_style")->getDefaultStyle())); + + item_styles_params_map.insert( + std::make_pair(IS_VOICE_JOINED, + params_panel->getChild("voice_call_joined_style")->getDefaultStyle())); + + item_styles_params_map.insert( + std::make_pair(IS_VOICE_LEFT, + params_panel->getChild("voice_call_left_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())); + } + if (params_panel) params_panel->die(); + + return item_styles_params_map; +} -- cgit v1.2.3 From 2773a3bb7b864f61064543b4bdbb61dd40bdb298 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 24 Dec 2009 13:13:49 +0200 Subject: Work on normal task EXT-3636 (Code Improvements: Voice control panels - Make Voice states and fade timeout xml driven) -- added possibility to set avatar item online/offline styles via xml. -- commited fake xml panel file with styles missed in previous commit. --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index d70e3c61b9..76e2f2191a 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -166,8 +166,7 @@ void LLAvatarListItem::setOnline(bool online) mOnlineStatus = (EOnlineStatus) online; // Change avatar name font style depending on the new online status. - mAvatarNameStyle.color = online ? LLColor4::white : LLColor4::grey; - setNameInternal(mAvatarName->getText(), mHighlihtSubstring); + setStyle(online ? IS_ONLINE : IS_OFFLINE); // Make the icon fade if the avatar goes offline. mAvatarIcon->setColor(online ? LLColor4::white : LLColor4::smoke); @@ -192,7 +191,7 @@ void LLAvatarListItem::setStyle(EItemStyle voice_state) // *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. - mAvatarName->setText(mAvatarName->getText(), mAvatarNameStyle); + setNameInternal(mAvatarName->getText(), mHighlihtSubstring); // *TODO: move icon colors into colors.xml mAvatarIcon->setColor(voice_state == IS_VOICE_JOINED ? LLColor4::white : LLColor4::smoke); @@ -441,6 +440,14 @@ LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams() item_styles_params_map.insert( std::make_pair(IS_VOICE_LEFT, params_panel->getChild("voice_call_left_style")->getDefaultStyle())); + + item_styles_params_map.insert( + std::make_pair(IS_ONLINE, + params_panel->getChild("online_style")->getDefaultStyle())); + + item_styles_params_map.insert( + std::make_pair(IS_OFFLINE, + params_panel->getChild("offline_style")->getDefaultStyle())); } else { @@ -448,6 +455,8 @@ LLAvatarListItem::voice_state_map_t LLAvatarListItem::getItemStylesParams() 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(); -- cgit v1.2.3 From d75ba371a2fbbd5af981168dffe86079357ef719 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 24 Dec 2009 14:24:09 +0200 Subject: 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 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 76e2f2191a..61361d78e6 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 -- cgit v1.2.3 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 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') 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; -- cgit v1.2.3