summaryrefslogtreecommitdiff
path: root/indra/newview/llparticipantlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llparticipantlist.h')
-rw-r--r--indra/newview/llparticipantlist.h63
1 files changed, 50 insertions, 13 deletions
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index bc6c6c2b50..70badbc40d 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -33,7 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llevent.h"
#include "llpanelpeoplemenus.h"
-#include "llimview.h"
+#include "llavatarlist.h" // for LLAvatarItemRecentSpeakerComparator
class LLSpeakerMgr;
class LLAvatarList;
@@ -43,24 +43,44 @@ class LLParticipantList
{
LOG_CLASS(LLParticipantList);
public:
- LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true);
+
+ typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
+
+ LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true);
~LLParticipantList();
void setSpeakingIndicatorsVisible(BOOL visible);
typedef enum e_participant_sort_oder {
E_SORT_BY_NAME = 0,
+ E_SORT_BY_RECENT_SPEAKERS = 1,
} EParticipantSortOrder;
/**
+ * Adds specified avatar ID to the existing list if it is not Agent's ID
+ *
+ * @param[in] avatar_id - Avatar UUID to be added into the list
+ */
+ void addAvatarIDExceptAgent(const LLUUID& avatar_id);
+
+ /**
* Set and sort Avatarlist by given order
*/
void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME);
+ EParticipantSortOrder getSortOrder();
/**
- * Refreshes participants to display ones not in voice as disabled.
- * TODO: mantipov: probably should be moved into derived class for LLFloaterCall
+ * Refreshes the participant list if it's in sort by recent speaker order.
*/
- void refreshVoiceState();
+ void updateRecentSpeakersOrder();
+
+ /**
+ * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
+ *
+ * If the callback is unset all speakers are considered as valid.
+ *
+ * @see onAddItemEvent()
+ */
+ void setValidateSpeakerCallback(validate_speaker_callback_t cb);
protected:
/**
@@ -139,6 +159,7 @@ class LLParticipantList
bool enableContextMenuItem(const LLSD& userdata);
bool checkContextMenuItem(const LLSD& userdata);
+ void sortParticipantList(const LLSD& userdata);
void toggleAllowTextChat(const LLSD& userdata);
void toggleMute(const LLSD& userdata, U32 flags);
void toggleMuteText(const LLSD& userdata);
@@ -195,19 +216,26 @@ class LLParticipantList
void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute);
};
+ /**
+ * Comparator for comparing avatar items by last spoken time
+ */
+ class LLAvatarItemRecentSpeakerComparator : public LLAvatarItemNameComparator, public LLRefCount
+ {
+ LOG_CLASS(LLAvatarItemRecentSpeakerComparator);
+ public:
+ LLAvatarItemRecentSpeakerComparator(LLParticipantList& parent):mParent(parent){};
+ virtual ~LLAvatarItemRecentSpeakerComparator() {};
+ protected:
+ virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
+ private:
+ LLParticipantList& mParent;
+ };
+
private:
void onAvatarListDoubleClicked(LLAvatarList* list);
void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param);
/**
- * Adds specified avatar ID to the existing list if it is not Agent's ID
- *
- * @param[in, out] existing_list - vector with avatars' UUIDs already in the list
- * @param[in] avatar_id - Avatar UUID to be added into the list
- */
- void addAvatarIDExceptAgent(std::vector<LLUUID>& existing_list, const LLUUID& avatar_id);
-
- /**
* Adjusts passed participant to work properly.
*
* Adds SpeakerMuteListener to process moderation actions.
@@ -229,9 +257,18 @@ 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;
boost::signals2::connection mAvatarListRefreshConnection;
boost::signals2::connection mAvatarListReturnConnection;
+
+ LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers;
+ validate_speaker_callback_t mValidateSpeakerCallback;
};