diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagent.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llfloateruipreview.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llstatusbar.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llstatusbar.h | 4 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 50 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_status_bar.xml | 9 |
7 files changed, 80 insertions, 10 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2354323a66..f1eb942b52 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 3e804bef9d..81dafea018 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 a2648e4c3a..48de23fab1 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 21a98dd753..9532bbbd22 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -87,6 +87,7 @@ public: S32 getSquareMetersCommitted() const; S32 getSquareMetersLeft() const; + private: // simple method to setup the part that holds the date void setupDate(); @@ -96,6 +97,8 @@ private: static void onMouseEnterVolume(LLUICtrl* ctrl); static void onClickStatGraph(void* data); + + static void onClickMediaToggle(void* data); private: LLTextBox *mTextHealth; @@ -105,6 +108,7 @@ private: LLStatGraph *mSGPacketLoss; LLButton *mBtnVolume; + LLButton *mMediaToggle; S32 mBalance; S32 mHealth; diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 3063341ade..c4f2f0eed7 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. @@ -901,6 +922,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() { gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL); @@ -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 b6aaca8cfa..c9e9017e5a 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 77eb9f2a75..96c61b69f5 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" |