summaryrefslogtreecommitdiff
path: root/indra/newview/llavatarlistitem.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-10-19 01:45:44 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-10-19 01:45:44 +0000
commit8103710c054ec6ea4a46f9732e569e543691184b (patch)
treeac03dd6d385e3345c57eff0e1064a011597fe5d6 /indra/newview/llavatarlistitem.cpp
parent4ee757b45d527699b094bf9422244171fdd7d693 (diff)
Merging revisions 2046-2068 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0, respecting ancestry
* Bugs: EXT-1414 EXT-1213 EXT-1539 EXT-1253 EXT-1446 EXT-1438 EXT-1233 EXT-1466 EXT-1446 EXT-1512 EXT-1231 * Dev: EXT-719 (landmarks) EXT-747 EXT-1446 EXT-1378 EXT-397 EXT-1476 * IM changes
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r--indra/newview/llavatarlistitem.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 4179d7a58d..90408beca0 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -52,11 +52,17 @@ LLAvatarListItem::LLAvatarListItem()
mInfoBtn(NULL),
mProfileBtn(NULL),
mContextMenu(NULL),
- mAvatarId(LLUUID::null)
+ mOnlineStatus(E_UNKNOWN)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml");
}
+LLAvatarListItem::~LLAvatarListItem()
+{
+ if (mAvatarId.notNull())
+ LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
+}
+
BOOL LLAvatarListItem::postBuild()
{
mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
@@ -138,6 +144,36 @@ void LLAvatarListItem::setStatus(const std::string& status)
mStatus->setValue(status);
}
+// virtual, called by LLAvatarTracker
+void LLAvatarListItem::changed(U32 mask)
+{
+ // no need to check mAvatarId for null in this case
+ setOnline(LLAvatarTracker::instance().isBuddyOnline(mAvatarId));
+}
+
+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;
+
+ mOnlineStatus = (EOnlineStatus) online;
+
+ // Change avatar name font style depending on the new online status.
+ LLStyle::Params style_params;
+ style_params.color = online ? LLColor4::white : LLColor4::grey;
+
+ // Rebuild the text to change its style.
+ std::string text = mAvatarName->getText();
+ mAvatarName->setText(LLStringUtil::null);
+ mAvatarName->appendText(text, false, style_params);
+
+ // Make the icon fade if the avatar goes offline.
+ mAvatarIcon->setColor(online ? LLColor4::white : LLColor4::smoke);
+}
+
void LLAvatarListItem::setName(const std::string& name)
{
mAvatarName->setValue(name);
@@ -146,10 +182,17 @@ void LLAvatarListItem::setName(const std::string& name)
void LLAvatarListItem::setAvatarId(const LLUUID& id)
{
+ if (mAvatarId.notNull())
+ LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
+
mAvatarId = id;
mAvatarIcon->setValue(id);
mSpeakingIndicator->setSpeakerId(id);
+ // We'll be notified on avatar online status changes
+ if (mAvatarId.notNull())
+ LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this);
+
// Set avatar name.
gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3));
}