CHUI-340 : WIP : Implement time update and comparison for sessions and participants
parent
bb8820c70b
commit
1107803a5c
|
|
@ -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<LLConversationItemParticipant*>(*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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ public:
|
|||
virtual void selectItem(void) { }
|
||||
virtual void showProperties(void);
|
||||
|
||||
// Methods used in sorting (see LLConversationSort::operator()
|
||||
// Methods used in sorting (see LLConversationSort::operator())
|
||||
EConversationType const getType() const { return mConvType; }
|
||||
virtual const bool getTime(F32& time) const { return false; }
|
||||
virtual const bool getTime(F64& time) const { return false; }
|
||||
virtual const bool getDistanceToAgent(F32& distance) const { return false; }
|
||||
|
||||
// This method will be called to determine if a drop can be
|
||||
|
|
@ -152,6 +152,8 @@ public:
|
|||
|
||||
bool isLoaded() { return mIsLoaded; }
|
||||
|
||||
virtual const bool getTime(F64& time) const;
|
||||
|
||||
void dumpDebugData();
|
||||
|
||||
private:
|
||||
|
|
@ -169,14 +171,18 @@ public:
|
|||
bool isModerator() {return mIsModerator; }
|
||||
void setIsMuted(bool is_muted) { mIsMuted = is_muted; mNeedsRefresh = true; }
|
||||
void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; }
|
||||
void setTimeNow() { mLastActiveTime = LLFrameTimer::getElapsedSeconds(); }
|
||||
|
||||
void onAvatarNameCache(const LLAvatarName& av_name);
|
||||
|
||||
virtual const bool getTime(F64& time) const { time = mLastActiveTime; return (time > 0.1 ? true : false); }
|
||||
|
||||
void dumpDebugData();
|
||||
|
||||
private:
|
||||
bool mIsMuted; // default is false
|
||||
bool mIsModerator; // default is false
|
||||
F64 mLastActiveTime;
|
||||
};
|
||||
|
||||
// We don't want to ever filter conversations but we need to declare that class to create a conversation view model.
|
||||
|
|
|
|||
|
|
@ -591,8 +591,13 @@ bool LLParticipantList::onSpeakerUpdateEvent(LLPointer<LLOldEvents::LLEvent> eve
|
|||
const LLSD& evt_data = event->getValue();
|
||||
if ( evt_data.has("id") )
|
||||
{
|
||||
LLUUID id = evt_data["id"];
|
||||
llinfos << "Merov debug : onSpeakerUpdateEvent, session = " << mUUID << ", uuid = " << id << ", date = " << LLFrameTimer::getElapsedSeconds() << llendl;
|
||||
LLUUID participant_id = evt_data["id"];
|
||||
LLConversationItemParticipant* participant = findParticipant(participant_id);
|
||||
if (participant)
|
||||
{
|
||||
participant->setTimeNow();
|
||||
}
|
||||
llinfos << "Merov debug : onSpeakerUpdateEvent, session = " << mUUID << ", uuid = " << participant_id << ", date = " << LLFrameTimer::getElapsedSeconds() << llendl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue