summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDenis Serdjuk <dserduk@productengine.com>2009-12-18 15:35:51 +0200
committerDenis Serdjuk <dserduk@productengine.com>2009-12-18 15:35:51 +0200
commitbde0540ab5cea7ad4941a847094e0f8f0ff3e723 (patch)
tree9f3bc33b5160409e69790dcc5d2414a01d33e220 /indra/newview
parentd1a857de1f0bb3e7f38ffae6cd4901e188c37ba3 (diff)
implemented major task EXT-3509 User's own name should appear in the Group chat participant list
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llavatarlist.cpp15
-rw-r--r--indra/newview/llavatarlist.h12
-rw-r--r--indra/newview/llparticipantlist.cpp18
-rw-r--r--indra/newview/llparticipantlist.h6
4 files changed, 49 insertions, 2 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 3bd4f898c8..71b23e1383 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llavatarlist.h"
+#include "llagent.h" // for comparator
// newview
#include "llcallingcard.h" // for LLAvatarTracker
@@ -420,3 +421,17 @@ bool LLAvatarItemNameComparator::doCompare(const LLAvatarListItem* avatar_item1,
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);
+}
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 9058fec540..e913be0f62 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -155,4 +155,16 @@ protected:
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
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 93e5b8fa15..1cc08b75da 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -49,11 +49,14 @@
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
#endif
+static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR;
+
LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/):
mSpeakerMgr(data_source),
mAvatarList(avatar_list),
mSortOrder(E_SORT_BY_NAME)
, mParticipantListMenu(NULL)
+, mExcludeAgent(true)
{
mSpeakerAddListener = new SpeakerAddListener(*this);
mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
@@ -97,6 +100,8 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
mModeratorList.insert(speakerp->mID);
}
}
+ // we need to exclude agent id for non group chat
+ mExcludeAgent = !gAgent.isInGroup(mSpeakerMgr->getSessionID());
mAvatarList->setDirty(true);
sort();
}
@@ -307,7 +312,16 @@ void LLParticipantList::sort()
// TODO: Implement more sorting orders after specs updating (EM)
switch ( mSortOrder ) {
case E_SORT_BY_NAME :
- mAvatarList->sortByName();
+ // if mExcludeAgent == true , then no need to keep agent on top of the list
+ if(mExcludeAgent)
+ {
+ mAvatarList->sortByName();
+ }
+ else
+ {
+ mAvatarList->setComparator(&AGENT_ON_TOP_NAME_COMPARATOR);
+ mAvatarList->sort();
+ }
break;
default :
llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl;
@@ -317,7 +331,7 @@ void LLParticipantList::sort()
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);
adjustParticipant(avatar_id);
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index bc6c6c2b50..72c413d188 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -229,6 +229,12 @@ class LLParticipantList
LLParticipantListMenu* mParticipantListMenu;
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::signals2::connection mAvatarListDoubleClickConnection;