From 1107803a5c6da07cd5171f06afc0490f3eca7bf7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Sep 2012 17:50:58 -0700 Subject: CHUI-340 : WIP : Implement time update and comparison for sessions and participants --- indra/newview/llconversationmodel.cpp | 44 +++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 612744c3e9..b39b997a55 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -167,6 +167,31 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +// The time of activity of a session is the time of the most recent participation +const bool LLConversationItemSession::getTime(F64& time) const +{ + bool has_time = false; + F64 most_recent_time = 0.0; + LLConversationItemParticipant* participant = NULL; + child_list_t::const_iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + F64 participant_time; + if (participant->getTime(participant_time)) + { + has_time = true; + most_recent_time = llmax(most_recent_time,participant_time); + } + } + if (has_time) + { + time = most_recent_time; + } + llinfos << "Merov debug : get time session, uuid = " << mUUID << ", has_time = " << has_time << ", time = " << time << llendl; + return has_time; +} + void LLConversationItemSession::dumpDebugData() { llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; @@ -186,7 +211,8 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false) + mIsModerator(false), + mLastActiveTime(0.0) { mConvType = CONV_PARTICIPANT; } @@ -228,8 +254,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderParticipants(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -251,8 +277,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL U32 sort_order = getSortOrderSessions(); if (sort_order == LLConversationFilter::SO_DATE) { - F32 time_a = 0.0; - F32 time_b = 0.0; + F64 time_a = 0.0; + F64 time_b = 0.0; if (a->getTime(time_a) && b->getTime(time_b)) { return (time_a > time_b); @@ -260,7 +286,10 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { - return (type_a < type_b); + if (type_a != type_b) + { + return (type_a < type_b); + } } } else @@ -270,7 +299,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first return (type_a < type_b); } - // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), sort by name + // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), + // we sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); return (compare < 0); } -- cgit v1.2.3 From fc6bbee3f4ba1abba2956ee92f7ac7ba01d0f59b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 20 Sep 2012 20:48:20 -0700 Subject: CHUI-340 : WIP : Implement time update on all IM typing cases --- indra/newview/llconversationmodel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b39b997a55..31f9ca6a32 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -167,6 +167,15 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_id) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setTimeNow(); + } +} + // The time of activity of a session is the time of the most recent participation const bool LLConversationItemSession::getTime(F64& time) const { -- cgit v1.2.3 From b5583906d0cce652f456851732db5b1c19659662 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 18:12:06 -0700 Subject: CHUI-340 : WIP : Fix sorting bugs on time for sessions, simplified the update time mechanism and clean up --- indra/newview/llconversationmodel.cpp | 53 ++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 31f9ca6a32..e090d1647f 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -38,7 +38,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mName(display_name), mUUID(uuid), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -47,7 +48,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mName(""), mUUID(uuid), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -56,7 +58,8 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mName(""), mUUID(), mNeedsRefresh(true), - mConvType(CONV_UNKNOWN) + mConvType(CONV_UNKNOWN), + mLastActiveTime(0.0) { } @@ -167,8 +170,10 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } -void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_id) +void LLConversationItemSession::setTimeNow(const LLUUID& participant_id) { + mLastActiveTime = LLFrameTimer::getElapsedSeconds(); + mNeedsRefresh = true; LLConversationItemParticipant* participant = findParticipant(participant_id); if (participant) { @@ -176,11 +181,11 @@ void LLConversationItemSession::setParticipantTimeNow(const LLUUID& participant_ } } -// The time of activity of a session is the time of the most recent participation +// The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { - bool has_time = false; - F64 most_recent_time = 0.0; + F64 most_recent_time = mLastActiveTime; + bool has_time = (most_recent_time > 0.1); LLConversationItemParticipant* participant = NULL; child_list_t::const_iterator iter; for (iter = mChildren.begin(); iter != mChildren.end(); iter++) @@ -197,7 +202,6 @@ const bool LLConversationItemSession::getTime(F64& time) const { time = most_recent_time; } - llinfos << "Merov debug : get time session, uuid = " << mUUID << ", has_time = " << has_time << ", time = " << time << llendl; return has_time; } @@ -220,8 +224,7 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false), - mLastActiveTime(0.0) + mIsModerator(false) { mConvType = CONV_PARTICIPANT; } @@ -265,19 +268,34 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { F64 time_a = 0.0; F64 time_b = 0.0; - if (a->getTime(time_a) && b->getTime(time_b)) + bool has_time_a = a->getTime(time_a); + bool has_time_b = b->getTime(time_b); + if (has_time_a && has_time_b) { return (time_a > time_b); } + else if (has_time_a || has_time_b) + { + // If we have only one time updated, we consider the element with time as the "highest". + // That boils down to "has_time_a" if you think about it. + return has_time_a; + } + // If not time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_DISTANCE) { F32 dist_a = 0.0; F32 dist_b = 0.0; - if (a->getDistanceToAgent(dist_a) && b->getDistanceToAgent(dist_b)) + bool has_dist_a = a->getDistanceToAgent(dist_a); + bool has_dist_b = b->getDistanceToAgent(dist_b); + if (has_dist_a && has_dist_b) { return (dist_a > dist_b); } + else if (has_dist_a || has_dist_b) + { + return has_dist_a; + } } } else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT)) @@ -288,10 +306,19 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { F64 time_a = 0.0; F64 time_b = 0.0; - if (a->getTime(time_a) && b->getTime(time_b)) + bool has_time_a = a->getTime(time_a); + bool has_time_b = b->getTime(time_b); + if (has_time_a && has_time_b) { return (time_a > time_b); } + else if (has_time_a || has_time_b) + { + // If we have only one time updated, we consider the element with time as the "highest". + // That boils down to "has_time_a" if you think about it. + return has_time_a; + } + // If not time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { -- cgit v1.2.3 From 552f288a0caea45e30a231478a19f4243d69689c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 21 Sep 2012 20:13:50 -0700 Subject: CHUI-340 : Implement distance computation and update --- indra/newview/llconversationmodel.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index e090d1647f..b0d691fa13 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -181,6 +181,16 @@ void LLConversationItemSession::setTimeNow(const LLUUID& participant_id) } } +void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 dist) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setDistance(dist); + mNeedsRefresh = true; + } +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { @@ -224,13 +234,17 @@ void LLConversationItemSession::dumpDebugData() LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), - mIsModerator(false) + mIsModerator(false), + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(uuid,root_view_model) + LLConversationItem(uuid,root_view_model), + mIsMuted(false), + mIsModerator(false), + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } @@ -284,13 +298,13 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } else if (sort_order == LLConversationFilter::SO_DISTANCE) { - F32 dist_a = 0.0; - F32 dist_b = 0.0; + F64 dist_a = 0.0; + F64 dist_b = 0.0; bool has_dist_a = a->getDistanceToAgent(dist_a); bool has_dist_b = b->getDistanceToAgent(dist_b); if (has_dist_a && has_dist_b) { - return (dist_a > dist_b); + return (dist_a < dist_b); } else if (has_dist_a || has_dist_b) { -- cgit v1.2.3 From 5b0e06108b3c4373c55103dedab3306f06d392c9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Sep 2012 19:55:31 -0700 Subject: CHUI-340 : Fix dupe items in the conversation model list. Refresh when resorting. --- indra/newview/llconversationmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b0d691fa13..a94d82bf7c 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -217,7 +217,7 @@ const bool LLConversationItemSession::getTime(F64& time) const void LLConversationItemSession::dumpDebugData() { - llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + llinfos << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; LLConversationItemParticipant* participant = NULL; child_list_t::iterator iter; for (iter = mChildren.begin(); iter != mChildren.end(); iter++) @@ -262,7 +262,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; + llinfos << "Merov debug : participant " << this << ", uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } // -- cgit v1.2.3 From 7ac4d71c43ec746f7bb30e5cedcfdd2c4c7940f7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Sep 2012 16:39:11 -0700 Subject: CHUI-329 : WIP : Always sort Nearby Chat to be on top of the list --- indra/newview/llconversationmodel.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a94d82bf7c..00cd8ba8f8 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -269,6 +269,7 @@ void LLConversationItemParticipant::dumpDebugData() // LLConversationSort // +// Comparison operator: returns "true" is a comes before b, "false" otherwise bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const { LLConversationItem::EConversationType type_a = a->getType(); @@ -276,7 +277,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL if ((type_a == LLConversationItem::CONV_PARTICIPANT) && (type_b == LLConversationItem::CONV_PARTICIPANT)) { - // If both are participants + // If both items are participants U32 sort_order = getSortOrderParticipants(); if (sort_order == LLConversationFilter::SO_DATE) { @@ -286,15 +287,15 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL bool has_time_b = b->getTime(time_b); if (has_time_a && has_time_b) { + // Most recent comes first return (time_a > time_b); } else if (has_time_a || has_time_b) { - // If we have only one time updated, we consider the element with time as the "highest". - // That boils down to "has_time_a" if you think about it. + // If we have only one time available, the element with time must come first return has_time_a; } - // If not time available, we'll default to sort by name at the end of this method + // If no time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_DISTANCE) { @@ -304,52 +305,63 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL bool has_dist_b = b->getDistanceToAgent(dist_b); if (has_dist_a && has_dist_b) { + // Closest comes first return (dist_a < dist_b); } else if (has_dist_a || has_dist_b) { + // If we have only one distance available, the element with it must come first return has_dist_a; } + // If no distance available, we'll default to sort by name at the end of this method } } else if ((type_a > LLConversationItem::CONV_PARTICIPANT) && (type_b > LLConversationItem::CONV_PARTICIPANT)) { // If both are sessions U32 sort_order = getSortOrderSessions(); - if (sort_order == LLConversationFilter::SO_DATE) + if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) + { + // If one is the nearby session, put nearby session *always* first + return (type_a == LLConversationItem::CONV_SESSION_NEARBY); + } + else if (sort_order == LLConversationFilter::SO_DATE) { + // Sort by time F64 time_a = 0.0; F64 time_b = 0.0; bool has_time_a = a->getTime(time_a); bool has_time_b = b->getTime(time_b); if (has_time_a && has_time_b) { + // Most recent comes first return (time_a > time_b); } else if (has_time_a || has_time_b) { - // If we have only one time updated, we consider the element with time as the "highest". - // That boils down to "has_time_a" if you think about it. + // If we have only one time available, the element with time must come first return has_time_a; } - // If not time available, we'll default to sort by name at the end of this method + // If no time available, we'll default to sort by name at the end of this method } else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) { if (type_a != type_b) { + // Lowest types come first. See LLConversationItem definition of types return (type_a < type_b); } + // If types are identical, we'll default to sort by name at the end of this method } } else { - // If one is a participant and the other a session, the session is always "less" than the participant + // If one item is a participant and the other a session, the session comes before the participant // so we simply compare the type // Notes: as a consequence, CONV_UNKNOWN (which should never get created...) always come first - return (type_a < type_b); + return (type_a > type_b); } - // By default, in all other possible cases (including sort order of type LLConversationFilter::SO_NAME of course), + // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); return (compare < 0); -- cgit v1.2.3 From 3502e783b7425ba30d92f66697bafa89ae891e60 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Sep 2012 22:02:44 -0700 Subject: CHUI-342 : Fixed : Use user name and display name correctly. Sort according to user names. --- indra/newview/llconversationmodel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 00cd8ba8f8..7d0ffa0788 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -251,8 +251,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = av_name.mDisplayName; - // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername + mName = av_name.mUsername; + mDisplayName = av_name.mDisplayName; mNeedsRefresh = true; if (mParent) { @@ -262,7 +262,7 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant " << this << ", uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; } // @@ -363,7 +363,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); return (compare < 0); } -- cgit v1.2.3 From 0651e10afff81a6e32828c122753d87b8503a79b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 11:15:45 -0700 Subject: CHUI-342, CHUI-366 and CHUI-367 : WIP : Allow a NO_TOOLTIP value for tooltips, update display/user names and sort on display/user names --- indra/newview/llconversationmodel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7d0ffa0788..176c05248d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,6 +36,7 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), + mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -46,6 +47,7 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), + mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -56,6 +58,7 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), + mUseNameForSort(true), mUUID(), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -251,8 +254,9 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = av_name.mUsername; - mDisplayName = av_name.mDisplayName; + mUseNameForSort = !av_name.mUsername.empty(); + mName = (mUseNameForSort ? av_name.mUsername : NO_TOOLTIP_STRING); + mDisplayName = (av_name.mDisplayName.empty() ? mName : av_name.mDisplayName); mNeedsRefresh = true; if (mParent) { @@ -363,7 +367,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); + S32 compare = LLStringUtil::compareDict((a->useNameForSort() ? a->getName() : a->getDisplayName()), (b->useNameForSort() ? b->getName() : b->getDisplayName())); return (compare < 0); } -- cgit v1.2.3 From 7fc33cc47fdc080bbc7674cf118011b689ba1485 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 28 Sep 2012 17:30:18 -0700 Subject: CHUI-367 : Completed : Show user name tooltip in all situations so to avoid the conversation name showing up --- indra/newview/llconversationmodel.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 176c05248d..9fa8758d11 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,7 +36,6 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -47,7 +46,6 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUseNameForSort(true), mUUID(uuid), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -58,7 +56,6 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUseNameForSort(true), mUUID(), mNeedsRefresh(true), mConvType(CONV_UNKNOWN), @@ -254,9 +251,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mUseNameForSort = !av_name.mUsername.empty(); - mName = (mUseNameForSort ? av_name.mUsername : NO_TOOLTIP_STRING); - mDisplayName = (av_name.mDisplayName.empty() ? mName : av_name.mDisplayName); + mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); + mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); mNeedsRefresh = true; if (mParent) { @@ -367,7 +363,7 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // By default, in all other possible cases (including sort order type LLConversationFilter::SO_NAME of course), // we sort by name - S32 compare = LLStringUtil::compareDict((a->useNameForSort() ? a->getName() : a->getDisplayName()), (b->useNameForSort() ? b->getName() : b->getDisplayName())); + S32 compare = LLStringUtil::compareDict(a->getName(), b->getName()); return (compare < 0); } -- cgit v1.2.3 From 11a148415e810706f2a1835b6b717a0a062d458f Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 28 Sep 2012 18:22:05 -0700 Subject: CHUI-102: Now the participants and one-on-one conversations have right-click-menus. These menus are functional as well, but 'chat history' does not yet work. --- indra/newview/llconversationmodel.cpp | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 7d0ffa0788..1c4c7aefae 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llmenugl.h" // // Conversation items : common behaviors @@ -84,6 +85,24 @@ void LLConversationItem::showProperties(void) { } +void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) +{ + items.push_back(std::string("view_profile")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); + items.push_back(std::string("add_friend")); + items.push_back(std::string("remove_friend")); + items.push_back(std::string("invite_to_group")); + items.push_back(std::string("separator_invite_to_group")); + items.push_back(std::string("map")); + items.push_back(std::string("share")); + items.push_back(std::string("pay")); + items.push_back(std::string("block_unblock")); +} + // // LLConversationItemSession // @@ -191,6 +210,22 @@ void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 di } } +void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + lldebugs << "LLConversationItemParticipant::buildContextMenu()" << llendl; + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + if(this->getType() == CONV_SESSION_1_ON_1) + { + items.push_back(std::string("close_conversation")); + items.push_back(std::string("separator_disconnect_from_voice")); + buildParticipantMenuOptions(items); + } + + hide_context_entries(menu, items, disabled_items); +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { @@ -249,6 +284,15 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, mConvType = CONV_PARTICIPANT; } +void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + buildParticipantMenuOptions(items); + hide_context_entries(menu, items, disabled_items); +} + void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { mName = av_name.mUsername; -- cgit v1.2.3 From 8e1a9e2813da6b9d5c17795b375098fb6a386ee1 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 13:54:53 -0700 Subject: CHUI-102: Cleaned up code after code review. --- indra/newview/llconversationmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 1c4c7aefae..f587ef8428 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,7 +28,6 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" -#include "llmenugl.h" // // Conversation items : common behaviors -- cgit v1.2.3 From 598f5345866c58abdd971935d80f9b53756042c9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 1 Oct 2012 17:04:13 -0700 Subject: CHUI-102: Right clicking on a group conversation brings up the correct menu. The user can now view the group profile, activate the group and leave the group. --- indra/newview/llconversationmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 265f77365f..3d1523c874 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -221,6 +221,14 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("separator_disconnect_from_voice")); buildParticipantMenuOptions(items); } + else if(this->getType() == CONV_SESSION_GROUP) + { + items.push_back(std::string("close_conversation")); + items.push_back(std::string("separator_disconnect_from_voice")); + items.push_back(std::string("group_profile")); + items.push_back(std::string("activate_group")); + items.push_back(std::string("leave_group")); + } hide_context_entries(menu, items, disabled_items); } -- cgit v1.2.3 From 9d989feede2dbef934cdc459b4758c024df862d6 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 15:10:12 -0700 Subject: CHUI-102: Now the user can select a conversation and use the right-click-menu to enable/disable voice. --- indra/newview/llconversationmodel.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 3d1523c874..a3ec154ac6 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,6 +28,7 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llimview.h" //For LLIMModel // // Conversation items : common behaviors @@ -224,15 +225,35 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) else if(this->getType() == CONV_SESSION_GROUP) { items.push_back(std::string("close_conversation")); + addVoiceOptions(items); items.push_back(std::string("separator_disconnect_from_voice")); items.push_back(std::string("group_profile")); items.push_back(std::string("activate_group")); items.push_back(std::string("leave_group")); } + else if(this->getType() == CONV_SESSION_AD_HOC) + { + items.push_back(std::string("close_conversation")); + addVoiceOptions(items); + } hide_context_entries(menu, items, disabled_items); } +void LLConversationItemSession::addVoiceOptions(menuentry_vec_t& items) +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance() ? LLIMModel::getInstance()->getVoiceChannel(this->getUUID()) : NULL; + + if(voice_channel != LLVoiceChannel::getCurrentVoiceChannel()) + { + items.push_back(std::string("open_voice_conversation")); + } + else + { + items.push_back(std::string("disconnect_from_voice")); + } +} + // The time of activity of a session is the time of the most recent activity, session and participants included const bool LLConversationItemSession::getTime(F64& time) const { -- cgit v1.2.3 From ed9ade7d50b699ac60eb69a979ea32a60eefa630 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 2 Oct 2012 17:03:46 -0700 Subject: CHUI-102: Now the options menu (right-click menu) for a participant/conversation will open the 'Chat history' dialog when selected. --- indra/newview/llconversationmodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationmodel.cpp') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a3ec154ac6..5fc305da81 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -226,7 +226,8 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); addVoiceOptions(items); - items.push_back(std::string("separator_disconnect_from_voice")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); items.push_back(std::string("group_profile")); items.push_back(std::string("activate_group")); items.push_back(std::string("leave_group")); @@ -235,6 +236,7 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); addVoiceOptions(items); + items.push_back(std::string("chat_history")); } hide_context_entries(menu, items, disabled_items); -- cgit v1.2.3