diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-08-17 13:23:01 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-08-17 13:23:01 +0800 |
commit | d15ebf5623fe15677a59a66029e9cfd00edc2942 (patch) | |
tree | 5dc79911481636a95546c2c10382cc609ba92edc /indra/newview/llavatarlistitem.cpp | |
parent | 90127cf36c5ca6e7c6273261830e65da2d7e9c73 (diff) |
Distance in nearby tab (draft)
https://megapahit.com/show_bug.cgi?id=49
Still needs to be tidied up. For now it's aligned to the left.
If you want to align it to the right, apart from modifying
avatar_distance in panel_avatar_list_item.xml to look more like
last_interaction, modify newview/llavatarlistitem.cpp line 555
to be something like:
`S32 avatar_distance_width = avatar_item->mLastInteractionTime->getRect().mLeft - avatar_item->mAvatarDistance->getRect().mLeft;`
I had tried this at first, but I couldn't make it look good and
that's why I aligned it to the left.
Also, these distances need to not be shown on Friends list.
I'm doing that next.
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 5f243d18c0..dd0e2d83d3 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -65,6 +65,7 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) LLFriendObserver(), mAvatarIcon(NULL), mAvatarName(NULL), + mAvatarDistance(NULL), mLastInteractionTime(NULL), mIconPermissionOnline(NULL), mIconPermissionMap(NULL), @@ -107,6 +108,7 @@ BOOL LLAvatarListItem::postBuild() { mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarName = getChild<LLTextBox>("avatar_name"); + mAvatarDistance = getChild<LLTextBox>("avatar_distance"); mLastInteractionTime = getChild<LLTextBox>("last_interaction"); mIconPermissionOnline = getChild<LLIconCtrl>("permission_online_icon"); @@ -301,6 +303,17 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b } } +void LLAvatarListItem::showAvatarDistance(bool show) +{ + mAvatarDistance->setVisible(show); + updateChildren(); +} + +void LLAvatarListItem::setAvatarDistance(F32 distance) +{ + mAvatarDistance->setValue(llformat("%.1f m", distance)); +} + void LLAvatarListItem::showLastInteractionTime(bool show) { mLastInteractionTime->setVisible(show); @@ -538,6 +551,9 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item) // last interaction time textbox width + padding S32 last_interaction_time_width = avatar_item->mIconPermissionEditTheirs->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft; + // avatar distance textbox width + padding + S32 avatar_distance_width = avatar_item->mAvatarDistance->getRect().mLeft - avatar_item->mAvatarName->getRect().mLeft; + // avatar icon width + padding S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft; @@ -546,6 +562,7 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item) S32 index = ALIC_COUNT; sChildrenWidths[--index] = icon_width; sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space" + sChildrenWidths[--index] = avatar_distance_width; sChildrenWidths[--index] = last_interaction_time_width; sChildrenWidths[--index] = permission_edit_theirs_width; sChildrenWidths[--index] = permission_edit_mine_width; @@ -666,6 +683,9 @@ LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_ case ALIC_NAME: child_view = mAvatarName; break; + case ALIC_DISTANCE: + child_view = mAvatarDistance; + break; case ALIC_INTERACTION_TIME: child_view = mLastInteractionTime; break; |