diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-10-04 11:19:26 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-10-04 11:19:26 -0400 |
commit | 83bd99df5dfbe1fec188d20922cf3b367b79c827 (patch) | |
tree | ed6a3fe90f058d1a3c57e425fcf2ead95490b8fd /indra | |
parent | 3a1f0ef173e5853f20aed93c741a9f74637d7d36 (diff) |
SH-270 FIXED As a SL user, I want my speaker order settings to persist between sessions
SH-271 FIXED Add #ifdefs to llparticipantlist.h
Changed speaker order to store its speaker ordering using settings.xml.
Did some superficial code cleanup.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llcallfloater.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 99 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.h | 431 |
3 files changed, 278 insertions, 258 deletions
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index c78f73c3b8..2dfc30675e 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -44,6 +44,7 @@ #include "llspeakers.h" #include "lltextutil.h" #include "lltransientfloatermgr.h" +#include "llviewercontrol.h" #include "llviewerwindow.h" #include "llvoicechannel.h" #include "llviewerparcelmgr.h" @@ -327,8 +328,9 @@ void LLCallFloater::refreshParticipantList() { mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false); mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1)); - mParticipants->setSortOrder(LLParticipantList::E_SORT_BY_RECENT_SPEAKERS); - + const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder"); + mParticipants->setSortOrder(LLParticipantList::EParticipantSortOrder(speaker_sort_order)); + if (LLLocalSpeakerMgr::getInstance() == mSpeakerManager) { mAvatarList->setNoItemsCommentText(getString("no_one_near")); diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index c8aa9ac91e..1c68f8a43c 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -197,17 +197,20 @@ private: uuid_set_t mAvalineCallers; }; -LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/, - bool exclude_agent /*= true*/, bool can_toggle_icons /*= true*/): +LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, + LLAvatarList* avatar_list, + bool use_context_menu/* = true*/, + bool exclude_agent /*= true*/, + bool can_toggle_icons /*= true*/) : mSpeakerMgr(data_source), mAvatarList(avatar_list), - mSortOrder(E_SORT_BY_NAME) -, mParticipantListMenu(NULL) -, mExcludeAgent(exclude_agent) -, mValidateSpeakerCallback(NULL) + mParticipantListMenu(NULL), + mExcludeAgent(exclude_agent), + mValidateSpeakerCallback(NULL) { + mAvalineUpdater = new LLAvalineUpdater(boost::bind(&LLParticipantList::onAvalineCallerFound, this, _1), - boost::bind(&LLParticipantList::onAvalineCallerRemoved, this, _1)); + boost::bind(&LLParticipantList::onAvalineCallerRemoved, this, _1)); mSpeakerAddListener = new SpeakerAddListener(*this); mSpeakerRemoveListener = new SpeakerRemoveListener(*this); @@ -378,15 +381,15 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) } /* -Seems this method is not necessary after onAvalineCallerRemoved was implemented; + Seems this method is not necessary after onAvalineCallerRemoved was implemented; -It does nothing because list item is always created with correct class type for Avaline caller. -For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client -session. -This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call. + It does nothing because list item is always created with correct class type for Avaline caller. + For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client + session. + This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call. -Probably Avaline caller should be removed from the LLSpeakerMgr list ONLY if it ends call itself. -Asked in EXT-4301. + Probably Avaline caller should be removed from the LLSpeakerMgr list ONLY if it ends call itself. + Asked in EXT-4301. */ void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id) { @@ -428,16 +431,19 @@ void LLParticipantList::onAvalineCallerRemoved(const LLUUID& participant_id) void LLParticipantList::setSortOrder(EParticipantSortOrder order) { - if ( mSortOrder != order ) + const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder"); + + if ( speaker_sort_order != order ) { - mSortOrder = order; + gSavedSettings.setU32("SpeakerParticipantDefaultOrder", (U32)order); sort(); } } -LLParticipantList::EParticipantSortOrder LLParticipantList::getSortOrder() +const LLParticipantList::EParticipantSortOrder LLParticipantList::getSortOrder() const { - return mSortOrder; + const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder"); + return EParticipantSortOrder(speaker_sort_order); } void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t cb) @@ -536,28 +542,29 @@ void LLParticipantList::sort() if ( !mAvatarList ) return; - switch ( mSortOrder ) { - case E_SORT_BY_NAME : - // 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); + switch ( getSortOrder() ) + { + case E_SORT_BY_NAME : + // 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; + case E_SORT_BY_RECENT_SPEAKERS: + if (mSortByRecentSpeakers.isNull()) + mSortByRecentSpeakers = new LLAvatarItemRecentSpeakerComparator(*this); + mAvatarList->setComparator(mSortByRecentSpeakers.get()); mAvatarList->sort(); - } - break; - case E_SORT_BY_RECENT_SPEAKERS: - if (mSortByRecentSpeakers.isNull()) - mSortByRecentSpeakers = new LLAvatarItemRecentSpeakerComparator(*this); - mAvatarList->setComparator(mSortByRecentSpeakers.get()); - mAvatarList->sort(); - break; - default : - llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl; - return; + break; + default : + llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl; + return; } } @@ -630,7 +637,7 @@ bool LLParticipantList::SpeakerClearListener::handleEvent(LLPointer<LLOldEvents: // bool LLParticipantList::SpeakerModeratorUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) { - return mParent.onModeratorUpdateEvent(event, userdata); + return mParent.onModeratorUpdateEvent(event, userdata); } bool LLParticipantList::SpeakerMuteListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) @@ -852,7 +859,7 @@ void LLParticipantList::LLParticipantListMenu::confirmMuteAllCallback(const LLSD const LLUUID& session_id = payload["session_id"]; LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> ( - LLIMModel::getInstance()->getSpeakerManager(session_id)); + LLIMModel::getInstance()->getSpeakerManager(session_id)); if (speaker_manager) { speaker_manager->moderateVoiceAllParticipants(false); @@ -910,9 +917,9 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& } /* -Processed menu items with such parameters: - can_allow_text_chat - can_moderate_voice + Processed menu items with such parameters: + can_allow_text_chat + can_moderate_voice */ bool LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem(const LLSD& userdata) { @@ -963,11 +970,11 @@ bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD& } else if(item == "is_sorted_by_name") { - return E_SORT_BY_NAME == mParent.mSortOrder; + return E_SORT_BY_NAME == mParent.getSortOrder(); } else if(item == "is_sorted_by_recent_speakers") { - return E_SORT_BY_RECENT_SPEAKERS == mParent.mSortOrder; + return E_SORT_BY_RECENT_SPEAKERS == mParent.getSortOrder(); } return false; diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 722a749d19..e0b3d42c25 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -24,6 +24,9 @@ * $/LicenseInfo$ */ +#ifndef LL_PARTICIPANTLIST_H +#define LL_PARTICIPANTLIST_H + #include "llviewerprecompiledheaders.h" #include "llevent.h" #include "llavatarlist.h" // for LLAvatarItemRecentSpeakerComparator @@ -37,239 +40,247 @@ class LLAvalineUpdater; class LLParticipantList { LOG_CLASS(LLParticipantList); +public: + + 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, + bool can_toggle_icons = true); + ~LLParticipantList(); + void setSpeakingIndicatorsVisible(BOOL visible); + + enum EParticipantSortOrder + { + E_SORT_BY_NAME = 0, + E_SORT_BY_RECENT_SPEAKERS = 1, + }; + + /** + * 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); + const EParticipantSortOrder getSortOrder() const; + + /** + * Refreshes the participant list if it's in sort by recent speaker order. + */ + 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: + /** + * LLSpeakerMgr event handlers + */ + bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> 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 BaseSpeakerListener : public LLOldEvents::LLSimpleListener + { public: + BaseSpeakerListener(LLParticipantList& parent) : mParent(parent) {} + protected: + LLParticipantList& mParent; + }; - 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, bool can_toggle_icons = true); - ~LLParticipantList(); - void setSpeakingIndicatorsVisible(BOOL visible); - - typedef enum e_participant_sort_oder { - E_SORT_BY_NAME = 0, - E_SORT_BY_RECENT_SPEAKERS = 1, - } EParticipantSortOrder; + class SpeakerAddListener : public BaseSpeakerListener + { + public: + SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {} + /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + }; - /** - * 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); + class SpeakerRemoveListener : public BaseSpeakerListener + { + public: + SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {} + /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + }; - /** - * Set and sort Avatarlist by given order - */ - void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME); - EParticipantSortOrder getSortOrder(); + class SpeakerClearListener : public BaseSpeakerListener + { + public: + SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {} + /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + }; - /** - * Refreshes the participant list if it's in sort by recent speaker order. - */ - void updateRecentSpeakersOrder(); + class SpeakerModeratorUpdateListener : public BaseSpeakerListener + { + public: + SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {} + /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + }; + + class SpeakerMuteListener : public BaseSpeakerListener + { + public: + SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {} - /** - * 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); + /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + }; + /** + * Menu used in the participant list. + */ + class LLParticipantListMenu : public LLListContextMenu + { + public: + LLParticipantListMenu(LLParticipantList& parent):mParent(parent){}; + /*virtual*/ LLContextMenu* createMenu(); + /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); protected: + LLParticipantList& mParent; + private: + bool enableContextMenuItem(const LLSD& userdata); + bool enableModerateContextMenuItem(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); + void toggleMuteVoice(const LLSD& userdata); + /** - * LLSpeakerMgr event handlers + * Return true if Agent is group moderator(and moderator of group call). */ - bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); + bool isGroupModerator(); + // Voice moderation support /** - * Sorts the Avatarlist by stored order + * Check whether specified by argument avatar is muted for group chat or not. */ - 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 BaseSpeakerListner : public LLOldEvents::LLSimpleListener - { - public: - BaseSpeakerListner(LLParticipantList& parent) : mParent(parent) {} - protected: - LLParticipantList& mParent; - }; - - class SpeakerAddListener : public BaseSpeakerListner - { - public: - SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} - /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - }; - - class SpeakerRemoveListener : public BaseSpeakerListner - { - public: - SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} - /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - }; - - class SpeakerClearListener : public BaseSpeakerListner - { - public: - SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} - /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - }; - - class SpeakerModeratorUpdateListener : public BaseSpeakerListner - { - public: - SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} - /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - }; - - class SpeakerMuteListener : public BaseSpeakerListner - { - public: - SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} - - /*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata); - }; + bool isMuted(const LLUUID& avatar_id); /** - * Menu used in the participant list. + * Processes Voice moderation menu items. + * + * It calls either moderateVoiceParticipant() or moderateVoiceParticipant() depend on + * passed parameter. + * + * @param userdata can be "selected" or "others". + * + * @see moderateVoiceParticipant() + * @see moderateVoiceAllParticipants() */ - class LLParticipantListMenu : public LLListContextMenu - { - public: - LLParticipantListMenu(LLParticipantList& parent):mParent(parent){}; - /*virtual*/ LLContextMenu* createMenu(); - /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); - protected: - LLParticipantList& mParent; - private: - bool enableContextMenuItem(const LLSD& userdata); - bool enableModerateContextMenuItem(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); - void toggleMuteVoice(const LLSD& userdata); - - /** - * Return true if Agent is group moderator(and moderator of group call). - */ - bool isGroupModerator(); - - // Voice moderation support - /** - * Check whether specified by argument avatar is muted for group chat or not. - */ - bool isMuted(const LLUUID& avatar_id); - - /** - * Processes Voice moderation menu items. - * - * It calls either moderateVoiceParticipant() or moderateVoiceParticipant() depend on - * passed parameter. - * - * @param userdata can be "selected" or "others". - * - * @see moderateVoiceParticipant() - * @see moderateVoiceAllParticipants() - */ - void moderateVoice(const LLSD& userdata); - - /** - * Mutes/Unmutes avatar for current group voice chat. - * - * It only marks avatar as muted for session and does not use local Agent's Block list. - * It does not mute Agent itself. - * - * @param[in] avatar_id UUID of avatar to be processed - * @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted. - * - * @see moderateVoiceAllParticipants() - */ - void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); - - /** - * Mutes/Unmutes all avatars for current group voice chat. - * - * It only marks avatars as muted for session and does not use local Agent's Block list. - * - * @param[in] unmute if true - avatars will be muted, otherwise - unmuted. - * - * @see moderateVoiceParticipant() - */ - void moderateVoiceAllParticipants(bool unmute); - - static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response); - }; + void moderateVoice(const LLSD& userdata); /** - * Comparator for comparing avatar items by last spoken time + * Mutes/Unmutes avatar for current group voice chat. + * + * It only marks avatar as muted for session and does not use local Agent's Block list. + * It does not mute Agent itself. + * + * @param[in] avatar_id UUID of avatar to be processed + * @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted. + * + * @see moderateVoiceAllParticipants() */ - 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(LLUICtrl* ctrl); - void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param); - - void onAvalineCallerFound(const LLUUID& participant_id); - void onAvalineCallerRemoved(const LLUUID& participant_id); + void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); /** - * Adjusts passed participant to work properly. + * Mutes/Unmutes all avatars for current group voice chat. * - * Adds SpeakerMuteListener to process moderation actions. - */ - void adjustParticipant(const LLUUID& speaker_id); - - LLSpeakerMgr* mSpeakerMgr; - LLAvatarList* mAvatarList; - - std::set<LLUUID> mModeratorList; - std::set<LLUUID> mModeratorToRemoveList; - - LLPointer<SpeakerAddListener> mSpeakerAddListener; - LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener; - LLPointer<SpeakerClearListener> mSpeakerClearListener; - LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener; - LLPointer<SpeakerMuteListener> mSpeakerMuteListener; - - 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() + * It only marks avatars as muted for session and does not use local Agent's Block list. + * + * @param[in] unmute if true - avatars will be muted, otherwise - unmuted. + * + * @see moderateVoiceParticipant() */ - bool mExcludeAgent; + void moderateVoiceAllParticipants(bool unmute); - // boost::connections - boost::signals2::connection mAvatarListDoubleClickConnection; - boost::signals2::connection mAvatarListRefreshConnection; - boost::signals2::connection mAvatarListReturnConnection; - boost::signals2::connection mAvatarListToggleIconsConnection; + static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response); + }; - LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers; - validate_speaker_callback_t mValidateSpeakerCallback; - LLAvalineUpdater* mAvalineUpdater; + /** + * 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(LLUICtrl* ctrl); + void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param); + + void onAvalineCallerFound(const LLUUID& participant_id); + void onAvalineCallerRemoved(const LLUUID& participant_id); + + /** + * Adjusts passed participant to work properly. + * + * Adds SpeakerMuteListener to process moderation actions. + */ + void adjustParticipant(const LLUUID& speaker_id); + + LLSpeakerMgr* mSpeakerMgr; + LLAvatarList* mAvatarList; + + std::set<LLUUID> mModeratorList; + std::set<LLUUID> mModeratorToRemoveList; + + LLPointer<SpeakerAddListener> mSpeakerAddListener; + LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener; + LLPointer<SpeakerClearListener> mSpeakerClearListener; + LLPointer<SpeakerModeratorUpdateListener> mSpeakerModeratorListener; + LLPointer<SpeakerMuteListener> mSpeakerMuteListener; + + LLParticipantListMenu* mParticipantListMenu; + + /** + * 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; + boost::signals2::connection mAvatarListToggleIconsConnection; + + LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers; + validate_speaker_callback_t mValidateSpeakerCallback; + LLAvalineUpdater* mAvalineUpdater; }; + +#endif // LL_PARTICIPANTLIST_H |