From 0e234edcc67ecf534df15f088158ef236f6de102 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Tue, 16 Feb 2010 15:42:33 -0800 Subject: EXT-5270: Implement "dynamic" controls based on the selected item in Nearby Media Review #112 This change adds controls that change state based on the selection in the nearby media panel. There are basically 3 sets: - Time-based - Web-based ("Normal") - Disabled Again, these change based on what you've got selected in the panel --- indra/newview/llpanelnearbymedia.cpp | 309 +++++++++-- indra/newview/llpanelnearbymedia.h | 49 +- indra/newview/llpanelprimmediacontrols.h | 17 +- indra/newview/llviewermedia.cpp | 8 +- indra/newview/llviewermedia.h | 2 +- indra/newview/llviewermediafocus.cpp | 13 + indra/newview/llviewermediafocus.h | 3 + indra/newview/llviewerparcelmgr.cpp | 3 +- .../skins/default/xui/en/panel_nearby_media.xml | 618 ++++++++++++++------- 9 files changed, 745 insertions(+), 277 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 464ba97278..6a88c916d7 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -41,6 +41,7 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llscrolllistcell.h" +#include "llslider.h" #include "llsliderctrl.h" #include "llagent.h" #include "llagentui.h" @@ -75,28 +76,26 @@ static const LLUUID PARCEL_AUDIO_LIST_ITEM_UUID = LLUUID("DF4B020D-8A24-4B95-AB5 LLPanelNearByMedia::LLPanelNearByMedia() : mMediaList(NULL), mEnableAllCtrl(NULL), - mEnableParcelMediaCtrl(NULL), mAllMediaDisabled(false), mDebugInfoVisible(false), mParcelMediaItem(NULL), mParcelAudioItem(NULL) { - mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING); + mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) && + gSavedSettings.getBOOL("MediaTentativeAutoPlay"); mCommitCallbackRegistrar.add("MediaListCtrl.EnableAll", boost::bind(&LLPanelNearByMedia::onClickEnableAll, this)); mCommitCallbackRegistrar.add("MediaListCtrl.DisableAll", boost::bind(&LLPanelNearByMedia::onClickDisableAll, this)); mCommitCallbackRegistrar.add("MediaListCtrl.GoMediaPrefs", boost::bind(&LLPanelNearByMedia::onAdvancedButtonClick, this)); mCommitCallbackRegistrar.add("MediaListCtrl.MoreLess", boost::bind(&LLPanelNearByMedia::onMoreLess, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.ParcelMediaVolume", boost::bind(&LLPanelNearByMedia::onParcelMediaVolumeSlider, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.MuteParcelMedia", boost::bind(&LLPanelNearByMedia::onClickMuteParcelMedia, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.EnableParcelMedia", boost::bind(&LLPanelNearByMedia::onClickEnableParcelMedia, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.DisableParcelMedia", boost::bind(&LLPanelNearByMedia::onClickDisableParcelMedia, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickParcelMediaPlay, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickParcelMediaStop, this)); - mCommitCallbackRegistrar.add("ParcelMediaCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickParcelMediaPause, this)); - mCommitCallbackRegistrar.add("ParcelAudioCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickParcelAudioPlay, this)); - mCommitCallbackRegistrar.add("ParcelAudioCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickParcelAudioStop, this)); - mCommitCallbackRegistrar.add("ParcelAudioCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickParcelAudioPause, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Stop", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaStop, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Play", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPlay, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Pause", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaPause, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Mute", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaMute, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Volume", boost::bind(&LLPanelNearByMedia::onCommitSelectedMediaVolume, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Zoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaZoom, this)); + mCommitCallbackRegistrar.add("SelectedMediaCtrl.Unzoom", boost::bind(&LLPanelNearByMedia::onClickSelectedMediaUnzoom, this)); + LLUICtrlFactory::instance().buildPanel(this, "panel_nearby_media.xml"); } @@ -121,18 +120,19 @@ BOOL LLPanelNearByMedia::postBuild() mMediaList = getChild("media_list"); mEnableAllCtrl = getChild("all_nearby_media_enable_btn"); mDisableAllCtrl = getChild("all_nearby_media_disable_btn"); - mParcelMediaVolumeSlider = getChild("parcel_media_volume"); - mParcelMediaMuteCtrl = getChild("parcel_media_mute"); - mEnableParcelMediaCtrl = getChild("parcel_media_enable_btn"); - mDisableParcelMediaCtrl = getChild("parcel_media_disable_btn"); mItemCountText = getChild("media_item_count"); - mParcelMediaPlayCtrl = getChild("parcel_media_play_btn"); - mParcelMediaPauseCtrl = getChild("parcel_media_pause_btn"); - mParcelMediaCtrl = getChild("parcel_media_ctrls"); - mParcelAudioPlayCtrl = getChild("parcel_audio_play_btn"); - mParcelAudioPauseCtrl = getChild("parcel_audio_pause_btn"); - mParcelAudioCtrl = getChild("parcel_audio_ctrls"); mShowCtrl = getChild("show_combo"); + + // Dynamic (selection-dependent) controls + mStopCtrl = getChild("stop"); + mPlayCtrl = getChild("play"); + mPauseCtrl = getChild("pause"); + mMuteCtrl = getChild("mute"); + mVolumeSliderCtrl = getChild("volume_slider_ctrl"); + mZoomCtrl = getChild("zoom"); + mUnzoomCtrl = getChild("unzoom"); + mVolumeSlider = getChild("volume_slider"); + mMuteBtn = getChild("mute_btn"); mEmptyNameString = getString("empty_item_text"); mParcelMediaName = getString("parcel_media_name"); @@ -142,7 +142,9 @@ BOOL LLPanelNearByMedia::postBuild() mMediaList->setDoubleClickCallback(onZoomMedia, this); mMediaList->sortByColumnIndex(PROXIMITY_COLUMN, TRUE); mMediaList->sortByColumnIndex(VISIBILITY_COLUMN, FALSE); + refreshList(); + updateControls(); updateColumns(); LLView* minimized_controls = getChildView("minimized_controls"); @@ -234,6 +236,7 @@ void LLPanelNearByMedia::draw() mItemCountText->setValue(llformat(getString("media_item_count_format").c_str(), mMediaList->getItemCount())); refreshList(); + updateControls(); F32 alpha = mHoverTimer.getStarted() ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), AUTO_CLOSE_FADE_TIME_START, AUTO_CLOSE_FADE_TIME_END, 1.f, 0.f) @@ -527,10 +530,12 @@ void LLPanelNearByMedia::refreshParcelItems() mMediaList->setNeedsSort(true); } } - else if (NULL != mParcelMediaItem) { - removeListItem(PARCEL_MEDIA_LIST_ITEM_UUID); - mParcelMediaItem = NULL; - mMediaList->setNeedsSort(true); + else { + if (NULL != mParcelMediaItem) { + removeListItem(PARCEL_MEDIA_LIST_ITEM_UUID); + mParcelMediaItem = NULL; + mMediaList->setNeedsSort(true); + } } // ... then update it @@ -538,7 +543,7 @@ void LLPanelNearByMedia::refreshParcelItems() { std::string name, url, tooltip; getNameAndUrlHelper(LLViewerParcelMedia::getParcelMedia(), name, url, ""); - if (name.empty()) + if (name.empty() || name == url) { tooltip = url; } @@ -567,10 +572,12 @@ void LLPanelNearByMedia::refreshParcelItems() mMediaList->setNeedsSort(true); } } - else if (NULL != mParcelAudioItem) { - removeListItem(PARCEL_AUDIO_LIST_ITEM_UUID); - mParcelAudioItem = NULL; - mMediaList->setNeedsSort(true); + else { + if (NULL != mParcelAudioItem) { + removeListItem(PARCEL_AUDIO_LIST_ITEM_UUID); + mParcelAudioItem = NULL; + mMediaList->setNeedsSort(true); + } } // ... then update it @@ -716,12 +723,14 @@ void LLPanelNearByMedia::updateColumns() { if (!mDebugInfoVisible) { + if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1); if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(-1); if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(-1); if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(-1); if (mMediaList->getColumn(DEBUG_COLUMN)) mMediaList->getColumn(DEBUG_COLUMN)->setWidth(-1); } else { + if (mMediaList->getColumn(CHECKBOX_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20); if (mMediaList->getColumn(VISIBILITY_COLUMN)) mMediaList->getColumn(VISIBILITY_COLUMN)->setWidth(20); if (mMediaList->getColumn(PROXIMITY_COLUMN)) mMediaList->getColumn(PROXIMITY_COLUMN)->setWidth(30); if (mMediaList->getColumn(CLASS_COLUMN)) mMediaList->getColumn(CLASS_COLUMN)->setWidth(20); @@ -778,7 +787,7 @@ bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled) LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(row_id); if(impl) { - impl->setDisabled(disabled); + impl->setDisabled(disabled, true); return true; } } @@ -794,23 +803,6 @@ void LLPanelNearByMedia::onZoomMedia(void* user_data) LLViewerMediaFocus::getInstance()->focusZoomOnMedia(media_id); } -void LLPanelNearByMedia::onClickMuteParcelMedia() -{ - if (LLViewerParcelMedia::getParcelMedia()) - { - bool muted = mParcelMediaMuteCtrl->getValue(); - LLViewerParcelMedia::getParcelMedia()->setVolume(muted ? (F32)0 : mParcelMediaVolumeSlider->getValueF32() ); - } -} - -void LLPanelNearByMedia::onParcelMediaVolumeSlider() -{ - if (LLViewerParcelMedia::getParcelMedia()) - { - LLViewerParcelMedia::getParcelMedia()->setVolume(mParcelMediaVolumeSlider->getValueF32()); - } -} - void LLPanelNearByMedia::onClickParcelMediaPlay() { LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); @@ -941,7 +933,226 @@ void LLPanelNearByMedia::onMoreLess() setShape(new_rect); } + +void LLPanelNearByMedia::updateControls() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + showTimeBasedControls(LLViewerMedia::isParcelAudioPlaying(), + false, // include_zoom + false, // is_zoomed + gSavedSettings.getBOOL("MuteMusic"), + gSavedSettings.getF32("AudioLevelMusic") ); + } + else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + if (!LLViewerMedia::hasParcelMedia()) + { + // Shouldn't happen, but do this anyway + showDisabledControls(); + } + else { + LLViewerMediaImpl* impl = LLViewerParcelMedia::getParcelMedia(); + if (NULL == impl) + { + // Just means it hasn't started yet + showBasicControls(false, false, false); + } + else if (impl->isMediaTimeBased()) + { + showTimeBasedControls(impl->isMediaPlaying(), + false, // include_zoom + false, // is_zoomed + impl->getVolume() == 0.0, + impl->getVolume() ); + } + else { + // non-time-based parcel media + showBasicControls(LLViewerMedia::isParcelMediaPlaying(), false, false); + } + } + } + else { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL == impl) + { + showDisabledControls(); + } + else { + if (impl->isMediaTimeBased()) + { + showTimeBasedControls(impl->isMediaPlaying(), + ! impl->isParcelMedia(), // include_zoom + LLViewerMediaFocus::getInstance()->isZoomed(), + impl->getVolume() == 0.0, + impl->getVolume()); + } + else { + showBasicControls(!impl->isMediaDisabled(), + ! impl->isParcelMedia(), // include_zoom + LLViewerMediaFocus::getInstance()->isZoomed()); + } + } + } +} + +void LLPanelNearByMedia::showBasicControls(bool playing, bool include_zoom, bool is_zoomed) +{ + mStopCtrl->setVisible(playing); + mPlayCtrl->setVisible(!playing); + mPauseCtrl->setVisible(false); + mMuteCtrl->setVisible(false); + mVolumeSliderCtrl->setVisible(false); + mZoomCtrl->setVisible(include_zoom && !is_zoomed); + mUnzoomCtrl->setVisible(include_zoom && is_zoomed); + mStopCtrl->setEnabled(true); + mZoomCtrl->setEnabled(true); +} + +void LLPanelNearByMedia::showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume) +{ + mStopCtrl->setVisible(true); + mPlayCtrl->setVisible(!playing); + mPauseCtrl->setVisible(playing); + mMuteCtrl->setVisible(true); + mVolumeSliderCtrl->setVisible(true); + mZoomCtrl->setVisible(include_zoom); + mZoomCtrl->setVisible(include_zoom && !is_zoomed); + mUnzoomCtrl->setVisible(include_zoom && is_zoomed); + mStopCtrl->setEnabled(true); + mZoomCtrl->setEnabled(true); + mMuteBtn->setValue(muted); + mVolumeSlider->setValue(volume); +} + +void LLPanelNearByMedia::showDisabledControls() +{ + mStopCtrl->setVisible(true); + mPlayCtrl->setVisible(false); + mPauseCtrl->setVisible(false); + mMuteCtrl->setVisible(false); + mVolumeSliderCtrl->setVisible(false); + mZoomCtrl->setVisible(true); + mUnzoomCtrl->setVisible(false); + mStopCtrl->setEnabled(false); + mZoomCtrl->setEnabled(false); +} + +void LLPanelNearByMedia::onClickSelectedMediaStop() +{ + setDisabled(mMediaList->getValue().asUUID(), true); +} + +void LLPanelNearByMedia::onClickSelectedMediaPlay() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + + // First enable it + setDisabled(selected_media_id, false); + + // Special code to make play "unpause" if time-based and playing + 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); + if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPaused()) + { + // Aha! It's really time-based media that's paused, so unpause + impl->play(); + return; + } + else if (impl->isParcelMedia()) + { + LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaPause() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + onClickParcelAudioPause(); + } + else if (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + { + onClickParcelMediaPause(); + } + else { + LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl && impl->isMediaTimeBased() && impl->isMediaPlaying()) + { + impl->pause(); + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaMute() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + gSavedSettings.setBOOL("MuteMusic", mMuteBtn->getValue()); + } + else { + LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl && impl->isMediaTimeBased()) + { + F32 volume = impl->getVolume(); + if(volume > 0.0) + { + impl->setVolume(0.0); + } + else if (mVolumeSlider->getValueF32() == 0.0) + { + impl->setVolume(1.0); + mVolumeSlider->setValue(1.0); + } + else + { + impl->setVolume(mVolumeSlider->getValueF32()); + } + } + } +} + +void LLPanelNearByMedia::onCommitSelectedMediaVolume() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID) + { + F32 vol = mVolumeSlider->getValueF32(); + gSavedSettings.setF32("AudioLevelMusic", vol); + } + else { + LLViewerMediaImpl* impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ? + ((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id); + if (NULL != impl && impl->isMediaTimeBased()) + { + impl->setVolume(mVolumeSlider->getValueF32()); + } + } +} + +void LLPanelNearByMedia::onClickSelectedMediaZoom() +{ + LLUUID selected_media_id = mMediaList->getValue().asUUID(); + if (selected_media_id == PARCEL_AUDIO_LIST_ITEM_UUID || selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) + return; + LLViewerMediaFocus::getInstance()->focusZoomOnMedia(selected_media_id); +} + +void LLPanelNearByMedia::onClickSelectedMediaUnzoom() +{ + LLViewerMediaFocus::getInstance()->unZoom(); +} + + // static void LLPanelNearByMedia::getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName) { diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index 654a8544af..eedfd447de 100644 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -38,6 +38,7 @@ class LLPanelNearbyMedia; class LLButton; class LLScrollListCtrl; +class LLSlider; class LLSliderCtrl; class LLCheckBoxCtrl; class LLTextBox; @@ -134,23 +135,37 @@ private: bool shouldShow(LLViewerMediaImpl* impl); + void showBasicControls(bool playing, bool include_zoom, bool is_zoomed); + void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume); + void showDisabledControls(); + void updateControls(); + + void onClickSelectedMediaStop(); + void onClickSelectedMediaPlay(); + void onClickSelectedMediaPause(); + void onClickSelectedMediaMute(); + void onCommitSelectedMediaVolume(); + void onClickSelectedMediaZoom(); + void onClickSelectedMediaUnzoom(); + LLUICtrl* mNearbyMediaPanel; - LLScrollListCtrl* mMediaList; + LLTextBox* mItemCountText; + LLScrollListCtrl* mMediaList; LLUICtrl* mEnableAllCtrl; LLUICtrl* mDisableAllCtrl; - LLSliderCtrl* mParcelMediaVolumeSlider; - LLButton* mParcelMediaMuteCtrl; - LLUICtrl* mEnableParcelMediaCtrl; - LLUICtrl* mDisableParcelMediaCtrl; - LLTextBox* mItemCountText; - LLUICtrl* mParcelMediaCtrl; - LLUICtrl* mParcelMediaPlayCtrl; - LLUICtrl* mParcelMediaPauseCtrl; - LLUICtrl* mParcelAudioCtrl; - LLUICtrl* mParcelAudioPlayCtrl; - LLUICtrl* mParcelAudioPauseCtrl; LLComboBox* mShowCtrl; + // Dynamic (selection-dependent) controls + LLUICtrl* mStopCtrl; + LLUICtrl* mPlayCtrl; + LLUICtrl* mPauseCtrl; + LLUICtrl* mMuteCtrl; + LLUICtrl* mVolumeSliderCtrl; + LLUICtrl* mZoomCtrl; + LLUICtrl* mUnzoomCtrl; + LLSlider* mVolumeSlider; + LLButton* mMuteBtn; + bool mAllMediaDisabled; bool mDebugInfoVisible; bool mParcelAudioAutoStart; @@ -159,11 +174,11 @@ private: std::string mParcelMediaName; std::string mParcelAudioName; - S32 mMoreHeight; - S32 mLessHeight; - LLFrameTimer mHoverTimer; - LLScrollListItem* mParcelMediaItem; - LLScrollListItem* mParcelAudioItem; + S32 mMoreHeight; + S32 mLessHeight; + LLFrameTimer mHoverTimer; + LLScrollListItem* mParcelMediaItem; + LLScrollListItem* mParcelAudioItem; }; diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h index 743cec70a1..2e0de7866c 100644 --- a/indra/newview/llpanelprimmediacontrols.h +++ b/indra/newview/llpanelprimmediacontrols.h @@ -58,6 +58,16 @@ public: void updateShape(); bool isMouseOver(); + + enum EZoomLevel + { + ZOOM_NONE = 0, + ZOOM_FAR, + ZOOM_MEDIUM, + ZOOM_NEAR + }; + + EZoomLevel getZoomLevel() const { return mCurrentZoom; } void nextZoomLevel(); void resetZoomLevel(bool reset_camera = true); void close(); @@ -66,13 +76,6 @@ public: void setMediaFace(LLPointer objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero); - enum EZoomLevel - { - ZOOM_NONE = 0, - ZOOM_FAR, - ZOOM_MEDIUM, - ZOOM_NEAR - }; static const EZoomLevel kZoomLevels[]; static const int kNumZoomLevels; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 7b5d1d9814..3fc578aa5e 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -939,12 +939,12 @@ void LLViewerMedia::setAllMediaEnabled(bool val) // Also do Parcel Media and Parcel Audio if (val) { - if (!LLViewerMedia::isParcelMediaPlaying()) + if (!LLViewerMedia::isParcelMediaPlaying() && LLViewerMedia::hasParcelMedia()) { LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel()); } - if (!LLViewerMedia::isParcelAudioPlaying() && gAudiop) + if (!LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio()) { gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); } @@ -2246,7 +2246,7 @@ void LLViewerMediaImpl::resetPreviousMediaState() ////////////////////////////////////////////////////////////////////////////////////////// // -void LLViewerMediaImpl::setDisabled(bool disabled) +void LLViewerMediaImpl::setDisabled(bool disabled, bool forcePlayOnEnable) { if(mIsDisabled != disabled) { @@ -2261,7 +2261,7 @@ void LLViewerMediaImpl::setDisabled(bool disabled) else { // We just (re)enabled this media. Do a navigate if auto-play is in order. - if(isAutoPlayable()) + if(isAutoPlayable() || forcePlayOnEnable) { navigateTo(mMediaEntryURL, "", true, true); } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index ec25744fa2..9dbffa78b3 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -230,7 +230,7 @@ public: void setMediaFailed(bool val) { mMediaSourceFailed = val; } void resetPreviousMediaState(); - void setDisabled(bool disabled); + void setDisabled(bool disabled, bool forcePlayOnEnable = false); bool isMediaDisabled() const { return mIsDisabled; }; void setInNearbyMediaList(bool in_list) { mInNearbyMediaList = in_list; } diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index f508a3462a..88e7cfec86 100644 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -559,6 +559,19 @@ void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id) } } +void LLViewerMediaFocus::unZoom() +{ + if(mMediaControls.get()) + { + mMediaControls.get()->resetZoomLevel(); + } +} + +bool LLViewerMediaFocus::isZoomed() const +{ + return (mMediaControls.get() && mMediaControls.get()->getZoomLevel() != LLPanelPrimMediaControls::ZOOM_NONE); +} + LLUUID LLViewerMediaFocus::getControlsMediaID() { if(getFocusedMediaImpl()) diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index 002044ea2e..d9ddc7432b 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -85,6 +85,9 @@ public: // Try to focus/zoom on the specified media (if it's on an object in world). void focusZoomOnMedia(LLUUID media_id); + // Are we zoomed in? + bool isZoomed() const; + void unZoom(); // Return the ID of the media instance the controls are currently attached to (either focus or hover). LLUUID getControlsMediaID(); diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 0c0936c103..1f6bbcbae8 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1800,7 +1800,8 @@ void optionally_start_music(const std::string& music_url) nearby_media_panel->getParcelAudioAutoStart()) || // or they have expressed no opinion in the UI, but have autoplay on... (!nearby_media_panel && - gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING))) + gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) && + gSavedSettings.getBOOL("MediaTentativeAutoPlay"))) { llinfos << "Starting parcel music " << music_url << llendl; gAudiop->startInternetStream(music_url); diff --git a/indra/newview/skins/default/xui/en/panel_nearby_media.xml b/indra/newview/skins/default/xui/en/panel_nearby_media.xml index f332ab273d..4a71be370e 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_media.xml @@ -2,11 +2,11 @@ (%ld media items) @@ -14,241 +14,463 @@ Parcel Streaming Media Parcel Streaming Audio (playing) - - - + - - - - + + - + - Nearby Media - - - + + - Show: - - + - - - - - - + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + left="10"/> + + + + -- cgit v1.2.3