diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2354323a66d82006316ee8c8738d2146c1acf4bc..f1eb942b52ff9cee265185f76cbeb5831774ea6f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5981,6 +5981,11 @@ bool LLAgent::teleportCore(bool is_local) // This was breaking the case of teleporting within a single sim. Backing it out for now. // gVoiceClient->leaveChannel(); + // Clear the "tentative" autoplay flag (i.e. set it to true) + // XXX: Do we also want to re-enable all media, because we might teleport + // somewhere where that media would still exist? + gSavedSettings.setBOOL("MediaTentativeAutoPlay", true); + return true; } diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 3e804bef9d68e766a0ff16b83bd6837d89ef7a2f..81dafea0181706d9b8a3f0481d3543ec105b81e8 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -362,7 +362,6 @@ BOOL LLFadeEventTimer::tick() if(NULL == mParent) // no more need to tick, so suicide { - delete this; return FALSE; } diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index a2648e4c3a332ed30eb9f85b594912543460545b..48de23fab18651675bfebac8acad8631155b36d4 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -61,6 +61,7 @@ #include "llresmgr.h" #include "llworld.h" #include "llstatgraph.h" +#include "llviewermedia.h" #include "llviewermenu.h" // for gMenuBarView #include "llviewerparcelmgr.h" #include "llviewerthrottle.h" @@ -188,8 +189,9 @@ BOOL LLStatusBar::postBuild() mBtnVolume->setClickedCallback( onClickVolume, this ); mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); - LLButton* media_toggle = getChild<LLButton>("media_toggle_btn"); - media_toggle->setMouseEnterCallback(boost::bind(&LLFloaterReg::showInstance, "nearby_media", LLSD(), true)); + mMediaToggle = getChild<LLButton>("media_toggle_btn"); + mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this ); + mMediaToggle->setMouseEnterCallback(boost::bind(&LLFloaterReg::showInstance, "nearby_media", LLSD(), true)); gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2)); @@ -354,6 +356,8 @@ void LLStatusBar::refresh() // update the master volume button state bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); mBtnVolume->setToggleState(mute_audio); + + mMediaToggle->setValue(!LLViewerMedia::isAnyMediaShowing()); } void LLStatusBar::setVisibleForMouselook(bool visible) @@ -525,6 +529,14 @@ static void onClickVolume(void* data) LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); } +//static +void LLStatusBar::onClickMediaToggle(void* data) +{ + LLStatusBar *status_bar = (LLStatusBar*)data; + // "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media + LLViewerMedia::setAllMediaEnabled(! status_bar->mMediaToggle->getValue()); +} + // sets the static variables necessary for the date void LLStatusBar::setupDate() { diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 21a98dd7531e0b07b9c87ad5703e04e3dd3849f1..9532bbbd228253722733f6ebcb27bb026e86670f 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -87,6 +87,7 @@ class LLStatusBar S32 getSquareMetersCommitted() const; S32 getSquareMetersLeft() const; + private: // simple method to setup the part that holds the date void setupDate(); @@ -96,6 +97,8 @@ class LLStatusBar static void onMouseEnterVolume(LLUICtrl* ctrl); static void onClickStatGraph(void* data); + + static void onClickMediaToggle(void* data); private: LLTextBox *mTextHealth; @@ -105,6 +108,7 @@ class LLStatusBar LLStatGraph *mSGPacketLoss; LLButton *mBtnVolume; + LLButton *mMediaToggle; S32 mBalance; S32 mHealth; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 3063341ade10b3a4a9553842e3b158af8c10baf4..c4f2f0eed7153183ab6b3b36e73dc0a62c75e733 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -261,6 +261,7 @@ static LLTimer sMediaCreateTimer; static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f; static F32 sGlobalVolume = 1.0f; static F64 sLowestLoadableImplInterest = 0.0f; +static bool sAnyMediaShowing = false; ////////////////////////////////////////////////////////////////////////////////////////// static void add_media_impl(LLViewerMediaImpl* media) @@ -694,6 +695,7 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi // static void LLViewerMedia::updateMedia(void *dummy_arg) { + sAnyMediaShowing = false; impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); @@ -860,6 +862,25 @@ void LLViewerMedia::updateMedia(void *dummy_arg) } total_cpu += pimpl->getCPUUsage(); + + if (!pimpl->getUsedInUI()) + { + if (! pimpl->isParcelMedia()) + { + if (pimpl->hasMedia()) + { + sAnyMediaShowing = true; + } + } + else { + // Parcel media showing? + if (!LLViewerParcelMedia::getURL().empty() && LLViewerParcelMedia::getParcelMedia().notNull()) + { + sAnyMediaShowing = true; + } + } + } + } // Re-calculate this every time. @@ -899,6 +920,33 @@ void LLViewerMedia::updateMedia(void *dummy_arg) } +////////////////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMedia::isAnyMediaShowing() +{ + return sAnyMediaShowing; +} + +////////////////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMedia::setAllMediaEnabled(bool val) +{ + // Set "tentative" autoplay first. We need to do this here or else + // re-enabling won't start up the media below. + gSavedSettings.setBOOL("MediaTentativeAutoPlay", val); + + // Then + impl_list::iterator iter = sViewerMediaImplList.begin(); + impl_list::iterator end = sViewerMediaImplList.end(); + + for(; iter != end; iter++) + { + LLViewerMediaImpl* pimpl = *iter; + if (!pimpl->getUsedInUI()) + pimpl->setDisabled(!val); + } +} + ////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::initClass() @@ -913,8 +961,6 @@ void LLViewerMedia::cleanupClass() gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL); } - // XXX TODO: what to do about other AUTO_PLAY settings? - // XXX TODO: what to do about other AUTO_PLAY settings? ////////////////////////////////////////////////////////////////////////////////////////// // LLViewerMediaImpl ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index b6aaca8cfa3255e03b3502a4220b0a0d71538152..c9e9017e5a4c3ad083ad6b5448400d4772274edd 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -102,6 +102,11 @@ class LLViewerMedia static bool textureHasMedia(const LLUUID& texture_id); static void setVolume(F32 volume); + // Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI. + static bool isAnyMediaShowing(); + // Set all media enabled or disabled, depending on val. Does not include media in the UI. + static void setAllMediaEnabled(bool val); + static void updateMedia(void* dummy_arg = NULL); static void initClass(); diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 77eb9f2a758d9e08a3b24bb1879c27f165cdbff9..96c61b69f54503412752283e0e8590d743f9bba4 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -94,10 +94,10 @@ <button follows="right|top" height="15" - image_selected="button_anim_play.tga" - image_unselected="button_anim_pause.tga" - image_pressed="button_anim_pause_selected.tga" - image_pressed_selected="button_anim_play_selected.tga" + image_selected="Pause_Off" + image_unselected="Play_Off" + image_pressed="Play_Press" + image_pressed_selected="Pause_Press" is_toggle="true" left_pad="15" top="2" @@ -105,7 +105,6 @@ tool_tip="Click to toggle media" width="16" > </button> - <button follows="right|top" height="15"