diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llavatarlist.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llavatarlist.h | 3 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 4 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 16 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_avatar_list_item.xml | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_people.xml | 1 |
7 files changed, 85 insertions, 5 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index a7c718de82..52cd86951d 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -53,7 +53,7 @@ static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list"); // Last interaction time update period. -static const F32 LIT_UPDATE_PERIOD = 5; +static const F32 LIT_UPDATE_PERIOD = 1; // Maximum number of avatars that can be added to a list in one pass. // Used to limit time spent for avatar list update per frame. @@ -121,6 +121,7 @@ static const LLFlatListView::ItemReverseComparator REVERSE_NAME_COMPARATOR(NAME_ LLAvatarList::Params::Params() : ignore_online_status("ignore_online_status", false) +, show_avatar_arrival_time("show_avatar_arrival_time", false) , show_avatar_distance("show_avatar_distance", false) , show_last_interaction_time("show_last_interaction_time", false) , show_info_btn("show_info_btn", true) @@ -135,6 +136,7 @@ LLAvatarList::LLAvatarList(const Params& p) , mIgnoreOnlineStatus(p.ignore_online_status) , mShowLastInteractionTime(p.show_last_interaction_time) , mAvatarDistance(p.show_avatar_distance) +, mAvatarArrivalTime(p.show_avatar_arrival_time) , mContextMenu(NULL) , mDirty(true) // to force initial update , mNeedUpdateNames(false) @@ -151,7 +153,7 @@ LLAvatarList::LLAvatarList(const Params& p) // Set default sort order. setComparator(&NAME_COMPARATOR); - if (mShowLastInteractionTime || mAvatarDistance) + if (mShowLastInteractionTime || mAvatarDistance || mAvatarArrivalTime) { mLITUpdateTimer = new LLTimer(); mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update @@ -200,8 +202,12 @@ void LLAvatarList::draw() if (mDirty) refresh(); - if ((mShowLastInteractionTime || mAvatarDistance) && mLITUpdateTimer->hasExpired()) + if ((mShowLastInteractionTime || mAvatarDistance || mAvatarArrivalTime) && mLITUpdateTimer->hasExpired()) { + if (mAvatarArrivalTime) + { + updateAvatarArrivalTime(); + } if (mAvatarDistance) { updateAvatarDistance(); @@ -433,6 +439,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, bool is // This sets the name as a side effect item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus); item->setOnline(mIgnoreOnlineStatus ? true : is_online); + item->showAvatarArrivalTime(mAvatarArrivalTime); item->showAvatarDistance(mAvatarDistance); item->showLastInteractionTime(mShowLastInteractionTime); @@ -540,7 +547,25 @@ void LLAvatarList::computeDifference( LLCommonUtils::computeDifference(vnew_unsorted, vcur, vadded, vremoved); } -void LLAvatarList::updateAvatarDistance() +void LLAvatarList::updateAvatarArrivalTime() +{ + std::vector<LLPanel*> items; + getItems(items); + auto uuids = getIDs(); + std::vector<LLVector3d> positions; + auto me_pos = gAgent.getPositionGlobal(); + LLWorld::getInstance()->getAvatars(&uuids, &positions, me_pos, gSavedSettings.getF32("MPVNearMeRange")); + LLRecentPeople::instance().updateAvatarsArrivalTime(uuids); + for (auto it = items.begin(); it != items.end(); it++) + { + auto item = static_cast<LLAvatarListItem*>(*it); + auto secs_since = LLDate::now().secondsSinceEpoch() - LLRecentPeople::instance().getArrivalTimeByID(item->getAvatarId()); + if (secs_since >= 0) + item->setAvatarArrivalTime(secs_since); + } +} + + void LLAvatarList::updateAvatarDistance() { std::vector<LLPanel*> items; getItems(items); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 81486690c9..37ad578a20 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -50,6 +50,7 @@ public: struct Params : public LLInitParam::Block<Params, LLFlatListViewEx::Params> { Optional<bool> ignore_online_status, // show all items as online + show_avatar_arrival_time, show_avatar_distance, show_last_interaction_time, // show most recent interaction time. *HACK: move this to a derived class show_info_btn, @@ -111,6 +112,7 @@ protected: const uuid_vec_t& vnew, uuid_vec_t& vadded, uuid_vec_t& vremoved); + void updateAvatarArrivalTime(); void updateAvatarDistance(); void updateLastInteractionTimes(); void rebuildNames(); @@ -120,6 +122,7 @@ protected: private: bool mIgnoreOnlineStatus; + bool mAvatarArrivalTime; bool mAvatarDistance; bool mShowLastInteractionTime; bool mDirty; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index dd9365da57..7be4f4eeb8 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), + mAvatarArrivalTime(NULL), mAvatarDistance(NULL), mLastInteractionTime(NULL), mIconPermissionOnline(NULL), @@ -108,6 +109,7 @@ bool LLAvatarListItem::postBuild() { mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon"); mAvatarName = getChild<LLTextBox>("avatar_name"); + mAvatarArrivalTime = getChild<LLTextBox>("avatar_arrival_time"); mAvatarDistance = getChild<LLTextBox>("avatar_distance"); mLastInteractionTime = getChild<LLTextBox>("last_interaction"); @@ -303,6 +305,17 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, b } } +void LLAvatarListItem::showAvatarArrivalTime(bool show) +{ + mAvatarArrivalTime->setVisible(show); + updateChildren(); +} + +void LLAvatarListItem::setAvatarArrivalTime(F32 arrival_time) +{ + mAvatarArrivalTime->setValue(formatSeconds(arrival_time)); +} + void LLAvatarListItem::showAvatarDistance(bool show) { mAvatarDistance->setVisible(show); @@ -552,7 +565,10 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item) 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; + S32 avatar_distance_width = avatar_item->mAvatarDistance->getRect().mLeft - avatar_item->mAvatarArrivalTime->getRect().mLeft; + + // avatar arrival time textbox width + padding + S32 avatar_arrival_time = avatar_item->mAvatarArrivalTime->getRect().mLeft - avatar_item->mAvatarName->getRect().mLeft; // avatar icon width + padding S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft; @@ -562,6 +578,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_arrival_time; sChildrenWidths[--index] = avatar_distance_width; sChildrenWidths[--index] = last_interaction_time_width; sChildrenWidths[--index] = permission_edit_theirs_width; @@ -683,6 +700,9 @@ LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_ case ALIC_NAME: child_view = mAvatarName; break; + case ALIC_ARRIVAL_TIME: + child_view = mAvatarArrivalTime; + break; case ALIC_DISTANCE: child_view = mAvatarDistance; break; diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index d49b131528..630a7ec751 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -98,6 +98,7 @@ public: void setHighlight(const std::string& highlight); void setState(EItemState item_style); void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false, bool is_resident = true); + void setAvatarArrivalTime(F32 arrival_time); void setAvatarDistance(F32 distance); void setLastInteractionTime(U32 secs_since); //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly @@ -105,6 +106,7 @@ public: void setShowInfoBtn(bool show); void showSpeakingIndicator(bool show); void setShowPermissions(bool show) { mShowPermissions = show; }; + void showAvatarArrivalTime(bool show); void showAvatarDistance(bool show); void showLastInteractionTime(bool show); void setAvatarIconVisible(bool visible); @@ -161,6 +163,7 @@ private: ALIC_PERMISSION_EDIT_THEIRS, ALIC_INTERACTION_TIME, ALIC_DISTANCE, + ALIC_ARRIVAL_TIME, ALIC_NAME, ALIC_ICON, ALIC_COUNT, @@ -202,6 +205,7 @@ private: LLView* getItemChildView(EAvatarListItemChildIndex child_index); LLTextBox* mAvatarName; + LLTextBox* mAvatarArrivalTime; LLTextBox* mAvatarDistance; LLTextBox* mLastInteractionTime; LLStyle::Params mAvatarNameStyle; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ae322910ea..64a9af9814 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -70,6 +70,7 @@ #include "llmeshrepository.h" #include "llmutelist.h" #include "llmoveview.h" +#include "llnotificationmanager.h" #include "llnotificationsutil.h" #include "llphysicsshapebuilderutil.h" #include "llquantize.h" @@ -815,6 +816,7 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c //------------------------------------------------------------------------ LLVOAvatar::~LLVOAvatar() { + LLNotificationsUI::LLNotificationManager::instance().onChat(LLChat{llformat("%s left.", getFullname().c_str())}, LLSD{}); if (!mFullyLoaded) { debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud"); @@ -2495,6 +2497,20 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, { mDebugExistenceTimer.reset(); debugAvatarRezTime("AvatarRezArrivedNotification", "avatar arrived"); + uuid_vec_t uuids; + std::vector<LLVector3d> positions; + LLWorld::getInstance()->getAvatars(&uuids, &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("MPVNearMeRange")); + auto pos_it = positions.begin(); + auto id_it = uuids.begin(); + for (;pos_it != positions.end() && id_it != uuids.end(); ++pos_it, ++id_it) + { + if (*id_it == getID() && !isSelf()) + { + LLNotificationsUI::LLNotificationManager::instance() + .onChat(LLChat{llformat("%s arrived (%.1f m).", getFullname().c_str(), dist_vec(*pos_it, gAgent.getPositionGlobal()))}, LLSD{}); + break; + } + } } if (retval & LLViewerObject::INVALID_UPDATE) diff --git a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml index 122b5ae508..cfca246321 100644 --- a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml @@ -71,6 +71,17 @@ height="15" layout="topleft" left_pad="5" + name="avatar_arrival_time" + top="6" + text_color="LtGray_50" + value="0s" + width="35" /> + <text + follows="left|right" + font="SansSerifSmall" + height="15" + layout="topleft" + left_pad="5" name="avatar_distance" top="6" text_color="LtGray_50" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 199609d57d..f1c03fdaa8 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -223,6 +223,7 @@ Learn about [https://community.secondlife.com/knowledgebase/joining-and-particip keep_one_selected="false" multi_select="true" name="avatar_list" + show_avatar_arrival_time="true" show_avatar_distance="true" right="-1" top="2" /> |