Skip to content
Snippets Groups Projects
Commit bde0540a authored by Denis Serdjuk's avatar Denis Serdjuk
Browse files

implemented major task EXT-3509 User's own name should appear in the Group...

implemented major task EXT-3509   	 User's own name should appear in the Group chat participant list

--HG--
branch : product-engine
parent d1a857de
Branches
Tags
No related merge requests found
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llavatarlist.h" #include "llavatarlist.h"
#include "llagent.h" // for comparator
// newview // newview
#include "llcallingcard.h" // for LLAvatarTracker #include "llcallingcard.h" // for LLAvatarTracker
...@@ -420,3 +421,17 @@ bool LLAvatarItemNameComparator::doCompare(const LLAvatarListItem* avatar_item1, ...@@ -420,3 +421,17 @@ bool LLAvatarItemNameComparator::doCompare(const LLAvatarListItem* avatar_item1,
return name1 < name2; return name1 < name2;
} }
bool LLAvatarItemAgentOnTopComparator::doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
{
//keep agent on top, if first is agent,
//then we need to return true to elevate this id, otherwise false.
if(avatar_item1->getAvatarId() == gAgent.getID())
{
return true;
}
else if (avatar_item2->getAvatarId() == gAgent.getID())
{
return false;
}
return LLAvatarItemNameComparator::doCompare(avatar_item1,avatar_item2);
}
...@@ -155,4 +155,16 @@ protected: ...@@ -155,4 +155,16 @@ protected:
virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const; virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
}; };
class LLAvatarItemAgentOnTopComparator : public LLAvatarItemNameComparator
{
LOG_CLASS(LLAvatarItemAgentOnTopComparator);
public:
LLAvatarItemAgentOnTopComparator() {};
virtual ~LLAvatarItemAgentOnTopComparator() {};
protected:
virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
};
#endif // LL_LLAVATARLIST_H #endif // LL_LLAVATARLIST_H
...@@ -49,11 +49,14 @@ ...@@ -49,11 +49,14 @@
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
#endif #endif
static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR;
LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/): LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/):
mSpeakerMgr(data_source), mSpeakerMgr(data_source),
mAvatarList(avatar_list), mAvatarList(avatar_list),
mSortOrder(E_SORT_BY_NAME) mSortOrder(E_SORT_BY_NAME)
, mParticipantListMenu(NULL) , mParticipantListMenu(NULL)
, mExcludeAgent(true)
{ {
mSpeakerAddListener = new SpeakerAddListener(*this); mSpeakerAddListener = new SpeakerAddListener(*this);
mSpeakerRemoveListener = new SpeakerRemoveListener(*this); mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
...@@ -97,6 +100,8 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av ...@@ -97,6 +100,8 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
mModeratorList.insert(speakerp->mID); mModeratorList.insert(speakerp->mID);
} }
} }
// we need to exclude agent id for non group chat
mExcludeAgent = !gAgent.isInGroup(mSpeakerMgr->getSessionID());
mAvatarList->setDirty(true); mAvatarList->setDirty(true);
sort(); sort();
} }
...@@ -307,7 +312,16 @@ void LLParticipantList::sort() ...@@ -307,7 +312,16 @@ void LLParticipantList::sort()
// TODO: Implement more sorting orders after specs updating (EM) // TODO: Implement more sorting orders after specs updating (EM)
switch ( mSortOrder ) { switch ( mSortOrder ) {
case E_SORT_BY_NAME : case E_SORT_BY_NAME :
// if mExcludeAgent == true , then no need to keep agent on top of the list
if(mExcludeAgent)
{
mAvatarList->sortByName(); mAvatarList->sortByName();
}
else
{
mAvatarList->setComparator(&AGENT_ON_TOP_NAME_COMPARATOR);
mAvatarList->sort();
}
break; break;
default : default :
llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl; llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl;
...@@ -317,7 +331,7 @@ void LLParticipantList::sort() ...@@ -317,7 +331,7 @@ void LLParticipantList::sort()
void LLParticipantList::addAvatarIDExceptAgent(std::vector<LLUUID>& existing_list, const LLUUID& avatar_id) void LLParticipantList::addAvatarIDExceptAgent(std::vector<LLUUID>& existing_list, const LLUUID& avatar_id)
{ {
if (gAgent.getID() == avatar_id) return; if (mExcludeAgent && gAgent.getID() == avatar_id) return;
existing_list.push_back(avatar_id); existing_list.push_back(avatar_id);
adjustParticipant(avatar_id); adjustParticipant(avatar_id);
......
...@@ -229,6 +229,12 @@ class LLParticipantList ...@@ -229,6 +229,12 @@ class LLParticipantList
LLParticipantListMenu* mParticipantListMenu; LLParticipantListMenu* mParticipantListMenu;
EParticipantSortOrder mSortOrder; EParticipantSortOrder mSortOrder;
/*
* This field manages an adding a new avatar_id in the mAvatarList
* If true, then agent_id wont be added into mAvatarList
* Also by default this field is controlling a sort procedure, @c sort()
*/
bool mExcludeAgent;
// boost::connections // boost::connections
boost::signals2::connection mAvatarListDoubleClickConnection; boost::signals2::connection mAvatarListDoubleClickConnection;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment