diff options
author | Paul ProductEngine <pguslisty@productengine.com> | 2012-09-27 17:46:11 +0300 |
---|---|---|
committer | Paul ProductEngine <pguslisty@productengine.com> | 2012-09-27 17:46:11 +0300 |
commit | f7f15900ea4c61c499427a8b6416dc08e9a972f7 (patch) | |
tree | 31dc8b2c606ca4e269adaafbbe252c6da0c694fc /indra | |
parent | 30ea13381884bca7a07e2bca16e5bde0ccacb530 (diff) |
CHUI-346 ADDITIONAL FIX (LLConversationViewSession: enable current voice channel indicator)
- When voice initialized show voice channel indicator for nearby chat session
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llconversationview.cpp | 58 | ||||
-rwxr-xr-x | indra/newview/llconversationview.h | 6 | ||||
-rw-r--r-- | indra/newview/lloutputmonitorctrl.cpp | 7 | ||||
-rw-r--r-- | indra/newview/lloutputmonitorctrl.h | 6 |
4 files changed, 61 insertions, 16 deletions
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index ab15e20d89..c2898d9a47 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -45,6 +45,30 @@ static LLDefaultChildRegistry::Register<LLConversationViewSession> r_conversatio const LLColor4U DEFAULT_WHITE(255, 255, 255); +class LLNearbyVoiceClientStatusObserver : public LLVoiceClientStatusObserver +{ +public: + + LLNearbyVoiceClientStatusObserver(LLConversationViewSession* conv) + : conversation(conv) + {} + + virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal) + { + if (conversation + && status != STATUS_JOINING + && status != STATUS_LEFT_CHANNEL + && LLVoiceClient::getInstance()->voiceEnabled() + && LLVoiceClient::getInstance()->isVoiceWorking()) + { + conversation->showVoiceIndicator(); + } + } + +private: + LLConversationViewSession* conversation; +}; + LLConversationViewSession::Params::Params() : container() {} @@ -55,13 +79,19 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes mItemPanel(NULL), mCallIconLayoutPanel(NULL), mSessionTitle(NULL), - mSpeakingIndicator(NULL) + mSpeakingIndicator(NULL), + mVoiceClientObserver(NULL) { } LLConversationViewSession::~LLConversationViewSession() { mActiveVoiceChannelConnection.disconnect(); + + if(LLVoiceClient::instanceExists() && mVoiceClientObserver) + { + LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver); + } } BOOL LLConversationViewSession::postBuild() @@ -91,8 +121,7 @@ BOOL LLConversationViewSession::postBuild() LLAvatarIconCtrl* icon = mItemPanel->getChild<LLAvatarIconCtrl>("avatar_icon"); icon->setVisible(true); icon->setValue(session->mOtherParticipantID); - mSpeakingIndicator->setSpeakerId(gAgentID, session->mSessionID); - mSpeakingIndicator->setShowParticipantsTalking(true); + mSpeakingIndicator->setSpeakerId(gAgentID, session->mSessionID, true); } break; } @@ -100,27 +129,28 @@ BOOL LLConversationViewSession::postBuild() { LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon"); icon->setVisible(true); - mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID()); - mSpeakingIndicator->setShowParticipantsTalking(true); + mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true); } case LLConversationItem::CONV_SESSION_GROUP: { LLGroupIconCtrl* icon = mItemPanel->getChild<LLGroupIconCtrl>("group_icon"); icon->setVisible(true); icon->setValue(vmi->getUUID()); - mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID()); - mSpeakingIndicator->setShowParticipantsTalking(true); + mSpeakingIndicator->setSpeakerId(gAgentID, vmi->getUUID(), true); break; } case LLConversationItem::CONV_SESSION_NEARBY: { LLIconCtrl* icon = mItemPanel->getChild<LLIconCtrl>("nearby_chat_icon"); icon->setVisible(true); - mSpeakingIndicator->setSpeakerId(gAgentID); - mSpeakingIndicator->setShowParticipantsTalking(true); + mSpeakingIndicator->setSpeakerId(gAgentID, LLUUID::null, true); + if(LLVoiceClient::instanceExists()) + { + LLNearbyVoiceClientStatusObserver* mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this); + LLVoiceClient::getInstance()->addObserver(mVoiceClientObserver); + } break; } - default: break; } @@ -232,6 +262,14 @@ LLConversationViewParticipant* LLConversationViewSession::findParticipant(const return (iter == getItemsEnd() ? NULL : participant); } +void LLConversationViewSession::showVoiceIndicator() +{ + if (LLVoiceChannel::getCurrentVoiceChannel()->getSessionID().isNull()) + { + mCallIconLayoutPanel->setVisible(true); + } +} + void LLConversationViewSession::refresh() { // Refresh the session view from its model data diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index dbc7f3b1bb..064239eeb1 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -38,6 +38,8 @@ class LLIMFloaterContainer; class LLConversationViewSession; class LLConversationViewParticipant; +class LLVoiceClientStatusObserver; + // Implementation of conversations list session widgets class LLConversationViewSession : public LLFolderViewFolder @@ -68,6 +70,8 @@ public: void setVisibleIfDetached(BOOL visible); LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); + void showVoiceIndicator(); + virtual void refresh(); private: @@ -79,6 +83,8 @@ private: LLTextBox* mSessionTitle; LLOutputMonitorCtrl* mSpeakingIndicator; + LLVoiceClientStatusObserver* mVoiceClientObserver; + boost::signals2::connection mActiveVoiceChannelConnection; }; diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 1c412b15f7..c3cbca68c7 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -75,7 +75,7 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p) mIsAgentControl(false), mIsSwitchDirty(false), mShouldSwitchOn(false), - mShowParticipantsTalking(false) + mShowParticipantsSpeaking(false) { //static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange); //static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red); @@ -158,7 +158,7 @@ void LLOutputMonitorCtrl::draw() } } - if ((mPower == 0.f && !mIsTalking) && mShowParticipantsTalking) + if ((mPower == 0.f && !mIsTalking) && mShowParticipantsSpeaking) { std::set<LLUUID> participant_uuids; LLVoiceClient::instance().getParticipantList(participant_uuids); @@ -272,7 +272,7 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) return TRUE; } -void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/) +void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */) { if (speaker_id.isNull() && mSpeakerId.notNull()) { @@ -287,6 +287,7 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& s LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); } + mShowParticipantsSpeaking = show_other_participants_speaking; mSpeakerId = speaker_id; LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id); diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index 44d4d6f64b..1fa6ef41f8 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -82,7 +82,7 @@ public: void setIsTalking(bool val) { mIsTalking = val; } - void setShowParticipantsTalking(bool show) { mShowParticipantsTalking = show; } + void setShowParticipantsSpeaking(bool show) { mShowParticipantsSpeaking = show; } /** * Sets avatar UUID to interact with voice channel. @@ -92,7 +92,7 @@ public: * If this parameter is set registered indicator will be shown only in voice channel * which has the same session id (EXT-5562). */ - void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null); + void setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id = LLUUID::null, bool show_other_participants_speaking = false); //called by mute list virtual void onChange(); @@ -134,7 +134,7 @@ private: bool mIsAgentControl; bool mIsMuted; bool mIsTalking; - bool mShowParticipantsTalking; + bool mShowParticipantsSpeaking; LLPointer<LLUIImage> mImageMute; LLPointer<LLUIImage> mImageOff; LLPointer<LLUIImage> mImageOn; |