diff options
Diffstat (limited to 'indra/newview/llconversationview.cpp')
-rwxr-xr-x | indra/newview/llconversationview.cpp | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index d1649a93b1..4c52794e4c 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -307,7 +307,8 @@ void LLConversationViewSession::refresh() mSessionTitle->setText(vmi->getDisplayName()); } - // Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh() + // Update all speaking indicators + LLSpeakingIndicatorManager::updateSpeakingIndicators(); // Do the regular upstream refresh LLFolderViewFolder::refresh(); @@ -366,6 +367,11 @@ LLConversationViewParticipant::LLConversationViewParticipant( const LLConversati { } +LLConversationViewParticipant::~LLConversationViewParticipant() +{ + mActiveVoiceChannelConnection.disconnect(); +} + void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params) { LLAvatarIconCtrl::Params avatar_icon_params(params.avatar_icon()); @@ -392,6 +398,7 @@ BOOL LLConversationViewParticipant::postBuild() mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); mInfoBtn->setVisible(false); + mActiveVoiceChannelConnection = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLConversationViewParticipant::onCurrentVoiceSessionChanged, this, _1)); mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator"); if (!sStaticInitialized) @@ -457,14 +464,29 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height) return arranged; } +void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& session_id) +{ + LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); + + if (participant_model) + { + LLConversationItemSession* parent_session = participant_model->getParentSession(); + if (parent_session) + { + bool is_active = (parent_session->getUUID() == session_id); + mSpeakingIndicator->switchIndicator(is_active); + } + } +} + void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data - LLConversationItemParticipant* vmi = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); - vmi->resetRefresh(); + LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); + participant_model->resetRefresh(); // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat - mSpeakingIndicator->setIsMuted(vmi->isMuted()); + mSpeakingIndicator->setIsMuted(participant_model->isMuted()); // Do the regular upstream refresh LLFolderViewItem::refresh(); @@ -472,21 +494,26 @@ void LLConversationViewParticipant::refresh() void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder) { - //Add the item to the folder (conversation) + // Add the item to the folder (conversation) LLFolderViewItem::addToFolder(folder); - //Now retrieve the folder (conversation) UUID, which is the speaker session + // Retrieve the folder (conversation) UUID, which is also the speaker session UUID LLConversationItem* vmi = this->getParentFolder() ? dynamic_cast<LLConversationItem*>(this->getParentFolder()->getViewModelItem()) : NULL; - if(vmi) + if (vmi) { - //Allows speaking icon image to be loaded based on mUUID - mAvatarIcon->setValue(mUUID); - - //Allows the speaker indicator to be activated based on the user and conversation - mSpeakingIndicator->setSpeakerId(mUUID, vmi->getUUID()); + addToSession(vmi->getUUID()); } } +void LLConversationViewParticipant::addToSession(const LLUUID& session_id) +{ + //Allows speaking icon image to be loaded based on mUUID + mAvatarIcon->setValue(mUUID); + + //Allows the speaker indicator to be activated based on the user and conversation + mSpeakingIndicator->setSpeakerId(mUUID, session_id); +} + void LLConversationViewParticipant::onInfoBtnClick() { LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID)); |