CHUI-479 : WIP : Add debug tracing into speaking indicator manager and monitors (to be deleted eventually).

master
Merov Linden 2012-11-14 10:40:51 -08:00
parent ab5a0a1d4d
commit 33068c6da8
7 changed files with 84 additions and 5 deletions

View File

@ -440,6 +440,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam
}
}
LLConversationItemSession* LLConversationItemParticipant::getParentSession()
{
LLConversationItemSession* parent_session = NULL;
if (hasParent())
{
parent_session = dynamic_cast<LLConversationItemSession*>(mParent);
}
return parent_session;
}
void LLConversationItemParticipant::dumpDebugData()
{
llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl;

View File

@ -195,6 +195,7 @@ public:
virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); }
void fetchAvatarName();
LLConversationItemSession* getParentSession();
void dumpDebugData();

View File

@ -327,6 +327,7 @@ 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);
}
@ -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)
@ -445,6 +452,29 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height)
return arranged;
}
void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& session_id)
{
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
@ -453,6 +483,7 @@ void LLConversationViewParticipant::refresh()
// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat
mSpeakingIndicator->setIsMuted(vmi->isMuted());
//mSpeakingIndicator->switchIndicator(true);
// Do the regular upstream refresh
LLFolderViewItem::refresh();
@ -471,6 +502,7 @@ void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder)
mAvatarIcon->setValue(mUUID);
//Allows the speaker indicator to be activated based on the user and conversation
// llinfos << "Merov debug : setSpeakerId of " << mUUID << ", session id = " << vmi->getUUID() << llendl;
mSpeakingIndicator->setSpeakerId(mUUID, vmi->getUUID());
}
}

View File

@ -94,7 +94,7 @@ private:
bool mMinimizedMode;
LLVoiceClientStatusObserver* mVoiceClientObserver;
boost::signals2::connection mActiveVoiceChannelConnection;
};
@ -116,7 +116,7 @@ public:
Params();
};
virtual ~LLConversationViewParticipant( void ) { }
virtual ~LLConversationViewParticipant( void );
bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
virtual void refresh();
@ -140,6 +140,8 @@ protected:
void onInfoBtnClick();
private:
void onCurrentVoiceSessionChanged(const LLUUID& session_id);
LLAvatarIconCtrl* mAvatarIcon;
LLButton * mInfoBtn;
LLOutputMonitorCtrl* mSpeakingIndicator;
@ -156,6 +158,8 @@ private:
static void initChildrenWidths(LLConversationViewParticipant* self);
void updateChildren();
LLView* getItemChildView(EAvatarListItemChildIndex child_view_index);
boost::signals2::connection mActiveVoiceChannelConnection;
};
#endif // LL_LLCONVERSATIONVIEW_H

View File

@ -278,21 +278,45 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */)
{
static LLUUID test_uuid("c684ce33-89fb-4544-8f7b-dae243c8b214");
bool test_on = (speaker_id == test_uuid);
if (test_on)
{
llinfos << "Merov debug : setSpeakerId, this = " << this << ", session_id = " << session_id << llendl;
}
if (speaker_id.isNull() && mSpeakerId.notNull())
{
LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
}
if (speaker_id.isNull() || speaker_id == mSpeakerId) return;
if (speaker_id.isNull() || speaker_id == mSpeakerId)
{
if (test_on)
{
llinfos << "Merov debug : setSpeakerId, nothing done because mSpeakerId == speaker_id" << llendl;
}
return;
}
if (mSpeakerId.notNull())
{
if (test_on)
{
llinfos << "Merov debug : setSpeakerId, unregisterSpeakingIndicator" << llendl;
}
// Unregister previous registration to avoid crash. EXT-4782.
LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
if (getTargetSessionID() == session_id)
{
LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
}
}
mShowParticipantsSpeaking = show_other_participants_speaking;
mSpeakerId = speaker_id;
if (test_on)
{
llinfos << "Merov debug : setSpeakerId, registerSpeakingIndicator" << llendl;
}
LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id);
//mute management
@ -320,6 +344,7 @@ void LLOutputMonitorCtrl::onChange()
// virtual
void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
{
llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << 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

@ -155,6 +155,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i
BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
speakers_uuids.insert(speaker_id);
llinfos << "Merov debug : registerSpeakingIndicator call switchSpeakerIndicators, switch = " << is_in_same_voice << llendl;
switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
}
@ -195,6 +196,7 @@ SpeakingIndicatorManager::~SpeakingIndicatorManager()
void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)
{
llinfos << "Merov debug : sOnCurrentChannelChanged call switchSpeakerIndicators, FALSE" << llendl;
switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
mSwitchedIndicatorsOn.clear();
}
@ -208,16 +210,21 @@ void SpeakingIndicatorManager::onParticipantsChanged()
LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
// switch all indicators off
llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, FALSE" << llendl;
switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE);
llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end FALSE switch" << llendl;
mSwitchedIndicatorsOn.clear();
LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL;
// then switch current voice participants indicators on
llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, TRUE" << llendl;
switchSpeakerIndicators(speakers_uuids, TRUE);
llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end TRUE switch" << llendl;
}
void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on)
{
llinfos << "Merov debug : switchSpeakerIndicators, switch_on = " << switch_on << llendl;
LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
LLUUID session_id;
if (voice_channel)

View File

@ -37,7 +37,7 @@ public:
virtual ~LLSpeakingIndicator(){}
virtual void switchIndicator(bool switch_on) = 0;
private:
//private:
friend class SpeakingIndicatorManager;
// Accessors for target voice session UUID.
// They are intended to be used only from SpeakingIndicatorManager to ensure target session is