CHUI-479 : WIP : Introduce a publicly available LLSpeakingIndicatorManager::updateSpeakingIndicators() method so to reset all indicators when creating new dialogs.

master
Merov Linden 2012-11-15 18:07:57 -08:00
parent bd62d1d337
commit ec5d1e48c4
4 changed files with 35 additions and 28 deletions

View File

@ -307,7 +307,9 @@ 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
llinfos << "Merov debug : LLConversationViewSession::refresh, updateSpeakingIndicators" << llendl;
LLSpeakingIndicatorManager::updateSpeakingIndicators();
// Do the regular upstream refresh
LLFolderViewFolder::refresh();
@ -327,7 +329,6 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi
mSpeakingIndicator->setSpeakerId(is_active ? gAgentID : LLUUID::null);
}
llinfos << "Merov debug : onCurrentVoiceSessionChanged, switchIndicator is_active = " << is_active << llendl;
mSpeakingIndicator->switchIndicator(is_active);
mCallIconLayoutPanel->setVisible(is_active);
}
@ -456,34 +457,32 @@ void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& s
{
llinfos << "Merov debug : onCurrentVoiceSessionChanged begin, uuid = " << mUUID << ", session_id = " << session_id << llendl;
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
//llinfos << "Merov debug : onCurrentVoiceSessionChanged participant_model = " << participant_model << llendl;
if (participant_model)
{
//llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 1" << llendl;
LLConversationItemSession* parent_session = participant_model->getParentSession();
//llinfos << "Merov debug : onCurrentVoiceSessionChanged parent_session = " << parent_session << llendl;
if (parent_session)
{
//llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 2" << llendl;
bool is_active = (parent_session->getUUID() == session_id);
//llinfos << "Merov debug : onCurrentVoiceSessionChanged, is_active = " << is_active << llendl;
mSpeakingIndicator->switchIndicator(is_active);
//llinfos << "Merov debug : onCurrentVoiceSessionChanged switchIndicator done" << llendl;
}
}
//llinfos << "Merov debug : onCurrentVoiceSessionChanged end" << llendl;
}
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->switchIndicator(true);
mSpeakingIndicator->setIsMuted(participant_model->isMuted());
//LLConversationItemSession* parent_session = participant_model->getParentSession();
//if (parent_session)
//{
// bool is_active = (parent_session->getUUID() == session_id);
// mSpeakingIndicator->switchIndicator(is_active);
//}
// Do the regular upstream refresh
LLFolderViewItem::refresh();

View File

@ -346,11 +346,6 @@ void LLOutputMonitorCtrl::onChange()
void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
{
llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << llendl;
bool test_on = (mSpeakerId == test_uuid);
if (test_on && !switch_on)
{
llinfos << "Merov debug : switching agent off!" << llendl;
}
// ensure indicator is visible in case it is not in visible chain
// to be called when parent became visible next time to notify parent that visibility is changed.
setVisible(TRUE);

View File

@ -74,6 +74,16 @@ public:
*/
void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
/**
* Callback of changing voice participant list (from LLVoiceClientParticipantObserver).
*
* Switches off indicators had been switched on and switches on indicators of current participants list.
* There is only a few indicators in lists should be switched off/on.
* So, method does not calculate difference between these list it only switches off already
* switched on indicators and switches on indicators of voice channel participants
*/
void onParticipantsChanged();
private:
typedef std::set<LLUUID> speaker_ids_t;
typedef std::multimap<LLUUID, LLSpeakingIndicator*> speaking_indicators_mmap_t;
@ -93,16 +103,6 @@ private:
*/
void sOnCurrentChannelChanged(const LLUUID& session_id);
/**
* Callback of changing voice participant list (from LLVoiceClientParticipantObserver).
*
* Switches off indicators had been switched on and switches on indicators of current participants list.
* There is only a few indicators in lists should be switched off/on.
* So, method does not calculate difference between these list it only switches off already
* switched on indicators and switches on indicators of voice channel participants
*/
void onParticipantsChanged();
/**
* Changes state of indicators specified by LLUUIDs
*
@ -321,5 +321,13 @@ void LLSpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speak
}
}
void LLSpeakingIndicatorManager::updateSpeakingIndicators()
{
if(SpeakingIndicatorManager::instanceExists())
{
SpeakingIndicatorManager::instance().onParticipantsChanged();
}
}
// EOF

View File

@ -78,6 +78,11 @@ namespace LLSpeakingIndicatorManager
* @param speaking_indicator instance of the speaker indicator to be unregistered.
*/
void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator);
/**
* Switch on/off registered speaking indicator according to the most current voice client status
*/
void updateSpeakingIndicators();
}
#endif // LL_LLSPEAKINGINDICATORMANAGER_H