From 5ea6474aebb7f81ce797de1449863bac1543fb03 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Tue, 3 Nov 2009 17:47:20 +0200 Subject: Implemented low task EXT-1787 (Implement sorting of participant list) --HG-- branch : product-engine --- indra/newview/llparticipantlist.h | 56 ++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'indra/newview/llparticipantlist.h') diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index a3a55303c0..04d9e29256 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -38,48 +38,74 @@ class LLAvatarList; class LLParticipantList { + LOG_CLASS(LLParticipantList); public: LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list); ~LLParticipantList(); + typedef enum e_participant_sort_oder { + E_SORT_BY_NAME = 0, + } EParticipantSortOrder; + + /** + * Set and sort Avatarlist by given order + */ + void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME); + protected: + /** + * LLSpeakerMgr event handlers + */ + bool onAddItemEvent(LLPointer event, const LLSD& userdata); + bool onRemoveItemEvent(LLPointer event, const LLSD& userdata); + bool onClearListEvent(LLPointer event, const LLSD& userdata); + + /** + * Sorts the Avatarlist by stored order + */ + void sort(); //List of listeners implementing LLOldEvents::LLSimpleListener. //There is no way to handle all the events in one listener as LLSpeakerMgr registers listeners in such a way //that one listener can handle only one type of event - class SpeakerAddListener : public LLOldEvents::LLSimpleListener + class BaseSpeakerListner : public LLOldEvents::LLSimpleListener { public: - SpeakerAddListener(LLAvatarList* avatar_list) : mAvatarList(avatar_list) {} + BaseSpeakerListner(LLParticipantList& parent) : mParent(parent) {} + protected: + LLParticipantList& mParent; + }; + class SpeakerAddListener : public BaseSpeakerListner + { + public: + SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - LLAvatarList* mAvatarList; }; - class SpeakerRemoveListener : public LLOldEvents::LLSimpleListener + class SpeakerRemoveListener : public BaseSpeakerListner { public: - SpeakerRemoveListener(LLAvatarList* avatar_list) : mAvatarList(avatar_list) {} - + SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - LLAvatarList* mAvatarList; }; - class SpeakerClearListener : public LLOldEvents::LLSimpleListener + class SpeakerClearListener : public BaseSpeakerListner { public: - SpeakerClearListener(LLAvatarList* avatar_list) : mAvatarList(avatar_list) {} - + SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); - LLAvatarList* mAvatarList; }; + private: void onAvatarListDoubleClicked(LLAvatarList* list); LLSpeakerMgr* mSpeakerMgr; - LLAvatarList* mAvatarList; + LLAvatarList* mAvatarList; + + SpeakerAddListener mSpeakerAddListener; + SpeakerRemoveListener mSpeakerRemoveListener; + SpeakerClearListener mSpeakerClearListener; - SpeakerAddListener* mSpeakerAddListener; - SpeakerRemoveListener* mSpeakerRemoveListener; - SpeakerClearListener* mSpeakerClearListener; + EParticipantSortOrder mSortOrder; }; -- cgit v1.2.3