diff options
-rw-r--r-- | indra/newview/llavatarlist.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llavatarlist.h | 3 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 2 | ||||
-rw-r--r-- | indra/newview/lloutputmonitorctrl.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lloutputmonitorctrl.h | 10 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llspeakingindicatormanager.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llspeakingindicatormanager.h | 24 |
9 files changed, 85 insertions, 17 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 6784e6693b..50d8672083 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -329,7 +329,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is { LLAvatarListItem* item = new LLAvatarListItem(); item->setName(name); - item->setAvatarId(id, mIgnoreOnlineStatus); + item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus); item->setOnline(mIgnoreOnlineStatus ? true : is_online); item->showLastInteractionTime(mShowLastInteractionTime); diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index aeed4fee08..0e4215e91a 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -78,6 +78,8 @@ public: bool contains(const LLUUID& id); void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; } + void setSessionID(const LLUUID& session_id) { mSessionID = session_id; } + const LLUUID& getSessionID() { return mSessionID; } void toggleIcons(); void setSpeakingIndicatorsVisible(bool visible); @@ -119,6 +121,7 @@ private: std::string mIconParamName; std::string mNameFilter; uuid_vector_t mIDs; + LLUUID mSessionID; LLAvatarListItem::ContextMenu* mContextMenu; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 5011b191f4..9645e75e60 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -211,14 +211,14 @@ void LLAvatarListItem::setState(EItemState item_style) mAvatarIcon->setColor(item_icon_color_map[item_style]); } -void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes) +void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes) { if (mAvatarId.notNull()) LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this); mAvatarId = id; mAvatarIcon->setValue(id); - mSpeakingIndicator->setSpeakerId(id); + mSpeakingIndicator->setSpeakerId(id, session_id); // We'll be notified on avatar online status changes if (!ignore_status_changes && mAvatarId.notNull()) diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 426d80e0a8..cecb64add7 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -100,7 +100,7 @@ public: void setName(const std::string& name); void setHighlight(const std::string& highlight); void setState(EItemState item_style); - void setAvatarId(const LLUUID& id, bool ignore_status_changes = false); + void setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes = false); void setLastInteractionTime(U32 secs_since); //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly void setShowProfileBtn(bool show); diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 9857e37bc3..d6d48a4ead 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -247,7 +247,7 @@ void LLOutputMonitorCtrl::draw() gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE); } -void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id) +void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/) { if (speaker_id.isNull() && mSpeakerId.notNull()) { @@ -263,7 +263,7 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id) } mSpeakerId = speaker_id; - LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this); + LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id); //mute management if (mAutoUpdate) @@ -303,7 +303,7 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on) } // otherwise remember necessary state and mark itself as dirty. - // State will be applied i next draw when parents chain became visible. + // State will be applied in next draw when parents chain becomes visible. else { LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL; @@ -317,7 +317,7 @@ void LLOutputMonitorCtrl::switchIndicator(bool switch_on) ////////////////////////////////////////////////////////////////////////// void LLOutputMonitorCtrl::notifyParentVisibilityChanged() { - LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << " ,new_visibility: " << getVisible() << LL_ENDL; + LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << ", new_visibility: " << getVisible() << LL_ENDL; LLSD params = LLSD().with("visibility_changed", getVisible()); diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index 2bbfa251e9..b7454a5066 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -86,7 +86,15 @@ public: void setIsTalking(bool val) { mIsTalking = val; } - void setSpeakerId(const LLUUID& speaker_id); + /** + * Sets avatar UUID to interact with voice channel. + * + * @param speaker_id LLUUID of an avatar whose voice level is displayed. + * @param session_id session UUID for which indicator should be shown only. Passed to LLSpeakingIndicatorManager + * 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); //called by mute list virtual void onChange(); diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 1c4004c37a..2748daaffa 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -70,6 +70,8 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator"); mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); + LL_DEBUGS("SpeakingIndicator") << "Set session for speaking indicators: " << mSpeakerMgr->getSessionID() << LL_ENDL; + mAvatarList->setSessionID(mSpeakerMgr->getSessionID()); mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1)); mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); // Set onAvatarListDoubleClicked as default on_return action. diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index d33c050ee4..cc06179481 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -65,8 +65,12 @@ public: * * @param speaker_id LLUUID of an avatar whose speaking indicator is registered. * @param speaking_indicator instance of the speaking indicator to be registered. + * @param session_id session UUID for which indicator should be shown only. + * If this parameter is set registered indicator will be shown only in voice channel + * which has the same session id (EXT-5562). */ - void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator); + void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator, + const LLUUID& session_id = LLUUID::null); /** * Removes passed speaking indicator from observing. @@ -138,15 +142,18 @@ private: ////////////////////////////////////////////////////////////////////////// // PUBLIC SECTION ////////////////////////////////////////////////////////////////////////// -void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator) +void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator, + const LLUUID& session_id) { // do not exclude agent's indicators. They should be processed in the same way as others. See EXT-3889. - LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << "|"<< speaking_indicator << LL_ENDL; + LL_DEBUGS("SpeakingIndicator") << "Registering indicator: " << speaker_id << "|"<< speaking_indicator << ", session: " << session_id << LL_ENDL; ensureInstanceDoesNotExist(speaking_indicator); + speaking_indicator->setTargetSessionID(session_id); + speaking_indicator_value_t value_type(speaker_id, speaking_indicator); mSpeakingIndicators.insert(value_type); @@ -217,6 +224,13 @@ void SpeakingIndicatorManager::onChange() void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on) { + LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); + LLUUID session_id; + if (voice_channel) + { + session_id = voice_channel->getSessionID(); + } + speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin(); for (; it_uuid != speakers_uuids.end(); ++it_uuid) { @@ -224,18 +238,36 @@ void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& spea indicator_range_t it_range = mSpeakingIndicators.equal_range(*it_uuid); indicator_const_iterator it_indicator = it_range.first; bool was_found = false; + bool was_switched_on = false; for (; it_indicator != it_range.second; ++it_indicator) { was_found = true; LLSpeakingIndicator* indicator = (*it_indicator).second; - indicator->switchIndicator(switch_on); + + BOOL switch_current_on = switch_on; + + // we should show indicator for specified voice session only if this is current channel. EXT-5562. + if (switch_current_on && indicator->getTargetSessionID().notNull()) + { + switch_current_on = indicator->getTargetSessionID() == session_id; + LL_DEBUGS("SpeakingIndicator") << "Session: " << session_id << ", target: " << indicator->getTargetSessionID() << ", the same? = " << switch_current_on << LL_ENDL; + } + was_switched_on = was_switched_on || switch_current_on; + + indicator->switchIndicator(switch_current_on); + } if (was_found) { LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators where found" << LL_ENDL; - if (switch_on) + if (switch_on && !was_switched_on) + { + LL_DEBUGS("SpeakingIndicator") << "but non of them where switched on" << LL_ENDL; + } + + if (was_switched_on) { // store switched on indicator to be able switch it off mSwitchedIndicatorsOn.insert(*it_uuid); @@ -274,9 +306,10 @@ void SpeakingIndicatorManager::ensureInstanceDoesNotExist(LLSpeakingIndicator* c /* LLSpeakingIndicatorManager namespace implementation */ /************************************************************************/ -void LLSpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator) +void LLSpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator, + const LLUUID& session_id) { - SpeakingIndicatorManager::instance().registerSpeakingIndicator(speaker_id, speaking_indicator); + SpeakingIndicatorManager::instance().registerSpeakingIndicator(speaker_id, speaking_indicator, session_id); } void LLSpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator) diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h index ce0158f7d8..8d7aba1d6c 100644 --- a/indra/newview/llspeakingindicatormanager.h +++ b/indra/newview/llspeakingindicatormanager.h @@ -35,10 +35,28 @@ #ifndef LL_LLSPEAKINGINDICATORMANAGER_H #define LL_LLSPEAKINGINDICATORMANAGER_H +class SpeakingIndicatorManager; + class LLSpeakingIndicator { public: + virtual ~LLSpeakingIndicator(){} virtual void switchIndicator(bool switch_on) = 0; + +private: + friend class SpeakingIndicatorManager; + // Accessors for target voice session UUID. + // They are intended to be used only from SpeakingIndicatorManager to ensure target session is + // the same indicator was registered with. + void setTargetSessionID(const LLUUID& session_id) { mTargetSessionID = session_id; } + const LLUUID& getTargetSessionID() { return mTargetSessionID; } + + /** + * session UUID for which indicator should be shown only. + * If it is set, registered indicator will be shown only in voice channel + * which has the same session id (EXT-5562). + */ + LLUUID mTargetSessionID; }; // See EXT-3976. @@ -52,8 +70,12 @@ namespace LLSpeakingIndicatorManager * * @param speaker_id LLUUID of an avatar whose speaker indicator is registered. * @param speaking_indicator instance of the speaker indicator to be registered. + * @param session_id session UUID for which indicator should be shown only. + * If this parameter is set registered indicator will be shown only in voice channel + * which has the same session id (EXT-5562). */ - void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator); + void registerSpeakingIndicator(const LLUUID& speaker_id, LLSpeakingIndicator* const speaking_indicator, + const LLUUID& session_id); /** * Removes passed speaking indicator from observing. |