summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2009-12-11 17:00:49 +0200
committerMike Antipov <mantipov@productengine.com>2009-12-11 17:00:49 +0200
commiteca66a2aa6b507bad1e168bcfafb18e4d389caa1 (patch)
tree593fb2099cc6c2183bcc82782f651046e4d46e84
parentee7683f6311c95c8ae57ad0dd49121437de28908 (diff)
Work on major task EXT-2808 (Add speakers moderation (both voice and text) to the Voice Control Panel (Active Speakers List))
-- added updating of participant list to display participants not in voice as disabled. Unfortunatly I have to perform refreshing in a draw to mad it workable till beta 0. --HG-- branch : product-engine
-rw-r--r--indra/newview/llcallfloater.cpp29
-rw-r--r--indra/newview/llcallfloater.h11
-rw-r--r--indra/newview/llparticipantlist.cpp21
-rw-r--r--indra/newview/llparticipantlist.h10
4 files changed, 68 insertions, 3 deletions
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 4ab5ea1812..e6a6910d6d 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -82,6 +82,7 @@ LLCallFloater::LLCallFloater(const LLSD& key)
, mVoiceType(VC_LOCAL_CHAT)
{
mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL);
+ LLVoiceClient::getInstance()->addObserver(this);
}
LLCallFloater::~LLCallFloater()
@@ -89,6 +90,13 @@ LLCallFloater::~LLCallFloater()
mChannelChangedConnection.disconnect();
delete mPaticipants;
mPaticipants = NULL;
+
+ // Don't use LLVoiceClient::getInstance() here
+ // singleton MAY have already been destroyed.
+ if(gVoiceClient)
+ {
+ gVoiceClient->removeObserver(this);
+ }
}
// virtual
@@ -121,6 +129,26 @@ void LLCallFloater::onOpen(const LLSD& /*key*/)
{
}
+// virtual
+void LLCallFloater::draw()
+{
+ // we have to refresh participants to display ones not in voice as disabled.
+ // It should be done only when she joins or leaves voice chat.
+ // But seems that LLVoiceClientParticipantObserver is not enough to satisfy this requirement.
+ // *TODO: mantipov: remove from draw()
+ onChange();
+ LLDockableFloater::draw();
+}
+
+// virtual
+void LLCallFloater::onChange()
+{
+ if (NULL == mPaticipants) return;
+
+ mPaticipants->refreshVoiceState();
+}
+
+
//////////////////////////////////////////////////////////////////////////
/// PRIVATE SECTION
//////////////////////////////////////////////////////////////////////////
@@ -231,6 +259,7 @@ void LLCallFloater::refreshPartisipantList()
{
mAvatarList->setNoItemsCommentText(getString("no_one_near"));
}
+ mPaticipants->refreshVoiceState();
}
}
diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h
index b615f57d5b..52f9595435 100644
--- a/indra/newview/llcallfloater.h
+++ b/indra/newview/llcallfloater.h
@@ -35,6 +35,7 @@
#define LL_LLCALLFLOATER_H
#include "lldockablefloater.h"
+#include "llvoiceclient.h"
class LLAvatarList;
class LLNonAvatarCaller;
@@ -52,7 +53,7 @@ class LLSpeakerMgr;
* When the Resident is engaged in any chat except Nearby Chat, the Voice Control Panel also provides an
* 'Leave Call' button to allow the Resident to leave that voice channel.
*/
-class LLCallFloater : public LLDockableFloater
+class LLCallFloater : public LLDockableFloater, LLVoiceClientParticipantObserver
{
public:
LLCallFloater(const LLSD& key);
@@ -60,6 +61,14 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void draw();
+
+ /**
+ * Is called by LLVoiceClient::notifyParticipantObservers when voice participant list is changed.
+ *
+ * Refreshes list to display participants not in voice as disabled.
+ */
+ /*virtual*/ void onChange();
private:
typedef enum e_voice_controls_type
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index b787699a66..6b3f468ff1 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -224,6 +224,27 @@ void LLParticipantList::setSortOrder(EParticipantSortOrder order)
}
}
+void LLParticipantList::refreshVoiceState()
+{
+ LLSpeakerMgr::speaker_list_t speakers;
+ mSpeakerMgr->getSpeakerList(&speakers, TRUE);
+
+ for (LLSpeakerMgr::speaker_list_t::iterator iter = speakers.begin();
+ iter != speakers.end(); ++iter)
+ {
+ LLSpeaker* speakerp = (*iter).get();
+ const LLUUID& speaker_id = speakerp->mID;
+ LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*> (mAvatarList->getItemByValue(speaker_id));
+ if ( item )
+ {
+ // if voice is disabled for this speaker show non voice speakers as disabled
+ bool is_in_voice = speakerp->mStatus > LLSpeaker::STATUS_VOICE_ACTIVE
+ && speakerp->mStatus != LLSpeaker::STATUS_MUTED;
+ item->setOnline(!is_in_voice);
+ }
+ }
+}
+
bool LLParticipantList::onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
LLAvatarList::uuid_vector_t& group_members = mAvatarList->getIDs();
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index 9d7d3a0cbe..bc6c6c2b50 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -52,10 +52,16 @@ class LLParticipantList
} EParticipantSortOrder;
/**
- * Set and sort Avatarlist by given order
- */
+ * Set and sort Avatarlist by given order
+ */
void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME);
+ /**
+ * Refreshes participants to display ones not in voice as disabled.
+ * TODO: mantipov: probably should be moved into derived class for LLFloaterCall
+ */
+ void refreshVoiceState();
+
protected:
/**
* LLSpeakerMgr event handlers