summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2009-12-23 20:00:48 +0200
committerMike Antipov <mantipov@productengine.com>2009-12-23 20:00:48 +0200
commit46948d9fcc9149c3c416167f166aff6ce8fa88d5 (patch)
tree2ee2b7d629c2cfd11b83483f193bcdf6c41927d8 /indra/newview
parentb0ed2ab7d92d79f0bb7005a7533c5c0e42f5bce7 (diff)
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
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llavatarlistitem.cpp65
-rw-r--r--indra/newview/llavatarlistitem.h12
-rw-r--r--indra/newview/llcallfloater.cpp19
3 files changed, 64 insertions, 32 deletions
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>();
+ 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()));
+ }
+ 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;
+}
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 0e058f75db..d544ed459e 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -46,6 +46,13 @@ class LLAvatarIconCtrl;
class LLAvatarListItem : public LLPanel, public LLFriendObserver
{
public:
+ typedef enum e_item_style_type {
+ IS_DEFAULT,
+ IS_VOICE_INVITED,
+ IS_VOICE_JOINED,
+ IS_VOICE_LEFT,
+ } EItemStyle;
+
class ContextMenu
{
public:
@@ -73,7 +80,7 @@ public:
void setOnline(bool online);
void setName(const std::string& name);
void setHighlight(const std::string& highlight);
- void setStyle(const LLStyle::Params& new_style);
+ void setStyle(EItemStyle voice_state);
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
@@ -118,6 +125,9 @@ private:
std::string formatSeconds(U32 secs);
+ typedef std::map<EItemStyle, LLStyle::Params> voice_state_map_t;
+ static voice_state_map_t getItemStylesParams();
+
LLAvatarIconCtrl* mAvatarIcon;
LLTextBox* mAvatarName;
LLTextBox* mLastInteractionTime;
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index a02a30a710..1c65eaba9c 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -597,38 +597,25 @@ void LLCallFloater::setState(LLAvatarListItem* item, ESpeakerState state)
setState(item->getAvatarId(), state);
- LLStyle::Params speaker_style;
- LLFontDescriptor new_desc(speaker_style.font()->getFontDesc());
-
switch (state)
{
case STATE_INVITED:
- new_desc.setStyle(LLFontGL::NORMAL);
+ item->setStyle(LLAvatarListItem::IS_VOICE_INVITED);
break;
case STATE_JOINED:
removeVoiceRemoveTimer(item->getAvatarId());
- new_desc.setStyle(LLFontGL::NORMAL);
+ item->setStyle(LLAvatarListItem::IS_VOICE_JOINED);
break;
case STATE_LEFT:
{
setVoiceRemoveTimer(item->getAvatarId());
- new_desc.setStyle(LLFontGL::ITALIC);
+ item->setStyle(LLAvatarListItem::IS_VOICE_LEFT);
}
break;
default:
llwarns << "Unrecognized avatar panel state (" << state << ")" << llendl;
break;
}
-
- LLFontGL* new_font = LLFontGL::getFont(new_desc);
- speaker_style.font = new_font;
- item->setStyle(speaker_style);
-
-// if ()
- {
- // found speaker is in voice, mark him as online
- item->setOnline(STATE_JOINED == state);
- }
}
void LLCallFloater::setVoiceRemoveTimer(const LLUUID& voice_speaker_id)