From 50a99d5419cd0ea9fe3375726bdc6a34e8102824 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Mon, 22 Feb 2010 19:04:27 -0800 Subject: FIX (unposted bug): "hasMedia" and "hasAudio" no longer checks preferences: it's now up to callers to decide to do that Review #137 --- indra/newview/llpanelnearbymedia.cpp | 28 ++++++++++++++++------------ indra/newview/llstatusbar.cpp | 6 ++++-- indra/newview/llviewermedia.cpp | 5 ++--- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 877b31513a..b73d7db770 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -535,7 +535,9 @@ void LLPanelNearByMedia::refreshParcelItems() const LLSD &choice_llsd = mShowCtrl->getSelectedValue(); MediaClass choice = (MediaClass)choice_llsd.asInteger(); // Only show "special parcel items" if "All" or "Within" filter - bool should_include = choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL; + // (and if media is "enabled") + bool should_include = gSavedSettings.getBOOL("AudioStreamingMedia") && + (choice == MEDIA_CLASS_ALL || choice == MEDIA_CLASS_WITHIN_PARCEL); // First Parcel Media: add or remove it as necessary if (should_include && LLViewerMedia::hasParcelMedia()) @@ -579,8 +581,8 @@ void LLPanelNearByMedia::refreshParcelItems() "parcel media"); } - // Next Parcel Audio: add or remove it as necessary - if (should_include && LLViewerMedia::hasParcelAudio()) + // Next Parcel Audio: add or remove it as necessary (don't show if disabled in prefs) + if (should_include && LLViewerMedia::hasParcelAudio() && gSavedSettings.getBOOL("AudioStreamingMusic")) { // Yes, there is parcel audio. if (NULL == mParcelAudioItem) @@ -692,14 +694,16 @@ void LLPanelNearByMedia::refreshList() } } } - mDisableAllCtrl->setEnabled(LLViewerMedia::isAnyMediaShowing() || - LLViewerMedia::isParcelMediaPlaying() || - LLViewerMedia::isParcelAudioPlaying()); - mEnableAllCtrl->setEnabled(disabled_count > 0 || - // parcel media (if we have it, and it isn't playing, enable "start") - (LLViewerMedia::hasParcelMedia() && ! LLViewerMedia::isParcelMediaPlaying()) || - // parcel audio (if we have it, and it isn't playing, enable "start") - (LLViewerMedia::hasParcelAudio() && ! LLViewerMedia::isParcelAudioPlaying())); + mDisableAllCtrl->setEnabled(gSavedSettings.getBOOL("AudioStreamingMedia") && + (LLViewerMedia::isAnyMediaShowing() || + LLViewerMedia::isParcelMediaPlaying() || + LLViewerMedia::isParcelAudioPlaying())); + mEnableAllCtrl->setEnabled(gSavedSettings.getBOOL("AudioStreamingMedia") && + (disabled_count > 0 || + // parcel media (if we have it, and it isn't playing, enable "start") + (LLViewerMedia::hasParcelMedia() && ! LLViewerMedia::isParcelMediaPlaying()) || + // parcel audio (if we have it, and it isn't playing, enable "start") + (LLViewerMedia::hasParcelAudio() && ! LLViewerMedia::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(); @@ -964,7 +968,7 @@ void LLPanelNearByMedia::updateControls() if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) { - if (!LLViewerMedia::hasParcelAudio()) + if (!LLViewerMedia::hasParcelAudio() || !gSavedSettings.getBOOL("AudioStreamingMusic")) { // Shouldn't happen, but do this anyway showDisabledControls(); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index d90a019697..732c23982b 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -358,8 +358,10 @@ void LLStatusBar::refresh() bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); mBtnVolume->setToggleState(mute_audio); - // Don't show media toggle if there's no media, parcel media, and no parcel audio - mMediaToggle->setEnabled(LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()); + // Disable media toggle if there's no media, parcel media, and no parcel audio + // (or if media is disabled) + mMediaToggle->setEnabled(gSavedSettings.getBOOL("AudioStreamingMedia") && + (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio())); // Note the "sense" of the toggle is opposite whether media is playing or not mMediaToggle->setValue(! (LLViewerMedia::isAnyMediaShowing() || LLViewerMedia::isParcelMediaPlaying() || diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index b066db6307..0f785079a6 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -972,7 +972,6 @@ bool LLViewerMedia::isParcelAudioPlaying() bool LLViewerMedia::hasInWorldMedia() { - if (! gSavedSettings.getBOOL("AudioStreamingMedia")) return false; if (sInWorldMediaDisabled) return false; impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); @@ -993,14 +992,14 @@ bool LLViewerMedia::hasInWorldMedia() // static bool LLViewerMedia::hasParcelMedia() { - return gSavedSettings.getBOOL("AudioStreamingMedia") && !LLViewerParcelMedia::getURL().empty(); + return !LLViewerParcelMedia::getURL().empty(); } ////////////////////////////////////////////////////////////////////////////////////////// // static bool LLViewerMedia::hasParcelAudio() { - return gSavedSettings.getBOOL("AudioStreamingMedia") && !LLViewerMedia::getParcelAudioURL().empty(); + return !LLViewerMedia::getParcelAudioURL().empty(); } ////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3