From 8369276a4967185985cb5957b22cda6897e2df29 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 21 Jun 2019 20:55:39 +0300 Subject: DRTVWR-493 LLViewerMedia to singleton --- indra/newview/llpanelnearbymedia.cpp | 55 +++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpanelnearbymedia.cpp') diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index f3a2ed9408..a85e9e3882 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -543,9 +543,10 @@ void LLPanelNearByMedia::refreshParcelItems() // Only show "special parcel items" if "All" or "Within" filter // (and if media is "enabled") bool should_include = (choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL); - + LLViewerMedia* media_inst = LLViewerMedia::getInstance(); + // First Parcel Media: add or remove it as necessary - if (gSavedSettings.getBOOL("AudioStreamingMedia") &&should_include && LLViewerMedia::hasParcelMedia()) + if (gSavedSettings.getBOOL("AudioStreamingMedia") && should_include && media_inst->hasParcelMedia()) { // Yes, there is parcel media. if (NULL == mParcelMediaItem) @@ -588,7 +589,7 @@ void LLPanelNearByMedia::refreshParcelItems() } // Next Parcel Audio: add or remove it as necessary (don't show if disabled in prefs) - if (should_include && LLViewerMedia::hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic")) + if (should_include && media_inst->hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic")) { // Yes, there is parcel audio. if (NULL == mParcelAudioItem) @@ -608,10 +609,10 @@ void LLPanelNearByMedia::refreshParcelItems() // ... then update it if (NULL != mParcelAudioItem) { - bool is_playing = LLViewerMedia::isParcelAudioPlaying(); + bool is_playing = media_inst->isParcelAudioPlaying(); std::string url; - url = LLViewerMedia::getParcelAudioURL(); + url = media_inst->getParcelAudioURL(); updateListItem(mParcelAudioItem, mParcelAudioName, @@ -653,7 +654,8 @@ void LLPanelNearByMedia::refreshList() refreshParcelItems(); // Get the canonical list from LLViewerMedia - LLViewerMedia::impl_list impls = LLViewerMedia::getPriorityList(); + LLViewerMedia* media_inst = LLViewerMedia::getInstance(); + LLViewerMedia::impl_list impls = media_inst->getPriorityList(); LLViewerMedia::impl_list::iterator priority_iter; U32 enabled_count = 0; @@ -706,17 +708,17 @@ void LLPanelNearByMedia::refreshList() } mDisableAllCtrl->setEnabled((gSavedSettings.getBOOL("AudioStreamingMusic") || gSavedSettings.getBOOL("AudioStreamingMedia")) && - (LLViewerMedia::isAnyMediaShowing() || - LLViewerMedia::isParcelMediaPlaying() || - LLViewerMedia::isParcelAudioPlaying())); + (media_inst->isAnyMediaShowing() || + media_inst->isParcelMediaPlaying() || + media_inst->isParcelAudioPlaying())); mEnableAllCtrl->setEnabled( (gSavedSettings.getBOOL("AudioStreamingMusic") || gSavedSettings.getBOOL("AudioStreamingMedia")) && (disabled_count > 0 || // parcel media (if we have it, and it isn't playing, enable "start") - (LLViewerMedia::hasParcelMedia() && ! LLViewerMedia::isParcelMediaPlaying()) || + (media_inst->hasParcelMedia() && ! media_inst->isParcelMediaPlaying()) || // parcel audio (if we have it, and it isn't playing, enable "start") - (LLViewerMedia::hasParcelAudio() && ! LLViewerMedia::isParcelAudioPlaying()))); + (media_inst->hasParcelAudio() && ! media_inst->isParcelAudioPlaying()))); // Iterate over the rows in the control, updating ones whose impl exists, and deleting ones whose impl has gone away. std::vector items = mMediaList->getAllData(); @@ -731,7 +733,7 @@ void LLPanelNearByMedia::refreshList() if (row_id != PARCEL_MEDIA_LIST_ITEM_UUID && row_id != PARCEL_AUDIO_LIST_ITEM_UUID) { - LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(row_id); + LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(row_id); if(impl) { updateListItem(item, impl); @@ -776,17 +778,17 @@ void LLPanelNearByMedia::updateColumns() void LLPanelNearByMedia::onClickEnableAll() { - LLViewerMedia::setAllMediaEnabled(true); + LLViewerMedia::getInstance()->setAllMediaEnabled(true); } void LLPanelNearByMedia::onClickDisableAll() { - LLViewerMedia::setAllMediaEnabled(false); + LLViewerMedia::getInstance()->setAllMediaEnabled(false); } void LLPanelNearByMedia::onClickEnableParcelMedia() { - if ( ! LLViewerMedia::isParcelMediaPlaying() ) + if ( ! LLViewerMedia::getInstance()->isParcelMediaPlaying() ) { LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } @@ -832,7 +834,7 @@ bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled) return true; } else { - LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(row_id); + LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(row_id); if(impl) { impl->setDisabled(disabled, true); @@ -889,7 +891,7 @@ void LLPanelNearByMedia::onClickParcelAudioPlay() } else { - LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL()); + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getInstance()->getParcelAudioURL()); } } @@ -981,16 +983,17 @@ void LLPanelNearByMedia::onMoreLess() void LLPanelNearByMedia::updateControls() { LLUUID selected_media_id = mMediaList->getValue().asUUID(); + LLViewerMedia* media_inst = LLViewerMedia::getInstance(); if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) { - if (!LLViewerMedia::hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic")) + if (!media_inst->getInstance()->hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic")) { // disable controls if audio streaming music is disabled from preference showDisabledControls(); } else { - showTimeBasedControls(LLViewerMedia::isParcelAudioPlaying(), + showTimeBasedControls(media_inst->isParcelAudioPlaying(), false, // include_zoom false, // is_zoomed gSavedSettings.getBOOL("MuteMusic"), @@ -999,7 +1002,7 @@ void LLPanelNearByMedia::updateControls() } else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) { - if (!LLViewerMedia::hasParcelMedia() || !gSavedSettings.getBOOL("AudioStreamingMedia")) + if (!media_inst->hasParcelMedia() || !gSavedSettings.getBOOL("AudioStreamingMedia")) { // disable controls if audio streaming media is disabled from preference showDisabledControls(); @@ -1021,7 +1024,7 @@ void LLPanelNearByMedia::updateControls() } else { // non-time-based parcel media - showBasicControls(LLViewerMedia::isParcelMediaPlaying(), + showBasicControls(media_inst->isParcelMediaPlaying(), false, false, impl->getVolume() == 0.0, @@ -1030,7 +1033,7 @@ void LLPanelNearByMedia::updateControls() } } else { - LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + LLViewerMediaImpl* impl = media_inst->getMediaImplFromTextureID(selected_media_id); if (NULL == impl || !gSavedSettings.getBOOL("AudioStreamingMedia")) { @@ -1116,7 +1119,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPlay() if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID) { LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { if (impl->isMediaTimeBased() && impl->isMediaPaused()) @@ -1145,7 +1148,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPause() onClickParcelMediaPause(); } else { - LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPlaying()) { impl->pause(); @@ -1162,7 +1165,7 @@ void LLPanelNearByMedia::onClickSelectedMediaMute() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { F32 volume = impl->getVolume(); @@ -1193,7 +1196,7 @@ void LLPanelNearByMedia::onCommitSelectedMediaVolume() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { impl->setVolume(mVolumeSlider->getValueF32()); -- cgit v1.2.3 From 30cc3ff01f39952b6138fad4095ea032d4b832a4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 21 Jun 2019 21:31:40 +0300 Subject: DRTVWR-493 LLViewerParcelMedia to singleton --- indra/newview/llpanelnearbymedia.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelnearbymedia.cpp') diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a85e9e3882..2dca55514d 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -567,7 +567,7 @@ void LLPanelNearByMedia::refreshParcelItems() if (NULL != mParcelMediaItem) { std::string name, url, tooltip; - getNameAndUrlHelper(LLViewerParcelMedia::getParcelMedia(), name, url, ""); + getNameAndUrlHelper(LLViewerParcelMedia::getInstance()->getParcelMedia(), name, url, ""); if (name.empty() || name == url) { tooltip = url; @@ -576,13 +576,13 @@ void LLPanelNearByMedia::refreshParcelItems() { tooltip = name + " : " + url; } - LLViewerMediaImpl *impl = LLViewerParcelMedia::getParcelMedia(); + LLViewerMediaImpl *impl = LLViewerParcelMedia::getInstance()->getParcelMedia(); updateListItem(mParcelMediaItem, mParcelMediaName, tooltip, -2, // Proximity closer than anything else, before Parcel Audio impl == NULL || impl->isMediaDisabled(), - impl != NULL && !LLViewerParcelMedia::getURL().empty(), + impl != NULL && !LLViewerParcelMedia::getInstance()->getURL().empty(), impl != NULL && impl->isMediaTimeBased() && impl->isMediaPlaying(), MEDIA_CLASS_ALL, "parcel media"); @@ -790,14 +790,14 @@ void LLPanelNearByMedia::onClickEnableParcelMedia() { if ( ! LLViewerMedia::getInstance()->isParcelMediaPlaying() ) { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } } void LLPanelNearByMedia::onClickDisableParcelMedia() { // This actually unloads the impl, as opposed to "stop"ping the media - LLViewerParcelMedia::stop(); + LLViewerParcelMedia::getInstance()->stop(); } void LLPanelNearByMedia::onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id) @@ -855,22 +855,22 @@ void LLPanelNearByMedia::onZoomMedia(void* user_data) void LLPanelNearByMedia::onClickParcelMediaPlay() { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } void LLPanelNearByMedia::onClickParcelMediaStop() { - if (LLViewerParcelMedia::getParcelMedia()) + if (LLViewerParcelMedia::getInstance()->getParcelMedia()) { // This stops the media playing, as opposed to unloading it like // LLViewerParcelMedia::stop() does - LLViewerParcelMedia::getParcelMedia()->stop(); + LLViewerParcelMedia::getInstance()->getParcelMedia()->stop(); } } void LLPanelNearByMedia::onClickParcelMediaPause() { - LLViewerParcelMedia::pause(); + LLViewerParcelMedia::getInstance()->pause(); } void LLPanelNearByMedia::onClickParcelAudioPlay() @@ -1008,7 +1008,7 @@ void LLPanelNearByMedia::updateControls() showDisabledControls(); } else { - LLViewerMediaImpl* impl = LLViewerParcelMedia::getParcelMedia(); + LLViewerMediaImpl* impl = LLViewerParcelMedia::getInstance()->getParcelMedia(); if (NULL == impl) { // Just means it hasn't started yet @@ -1119,7 +1119,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPlay() if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID) { LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { if (impl->isMediaTimeBased() && impl->isMediaPaused()) @@ -1130,7 +1130,7 @@ void LLPanelNearByMedia::onClickSelectedMediaPlay() } else if (impl->isParcelMedia()) { - LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + LLViewerParcelMedia::getInstance()->play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } } } @@ -1165,7 +1165,7 @@ void LLPanelNearByMedia::onClickSelectedMediaMute() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { F32 volume = impl->getVolume(); @@ -1196,7 +1196,7 @@ void LLPanelNearByMedia::onCommitSelectedMediaVolume() } else { LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? - ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); + ((LLViewerMediaImpl*)LLViewerParcelMedia::getInstance()->getParcelMedia()) : LLViewerMedia::getInstance()->getMediaImplFromTextureID(selected_media_id); if (NULL != impl) { impl->setVolume(mVolumeSlider->getValueF32()); -- cgit v1.2.3