diff options
author | Rick Pasetto <rick@lindenlab.com> | 2009-11-13 12:59:17 -0800 |
---|---|---|
committer | Rick Pasetto <rick@lindenlab.com> | 2009-11-13 12:59:17 -0800 |
commit | 2e70e4e2d7adbca52884186975623e26ab7fb9fb (patch) | |
tree | 43e212e384b4a357681dfc2ad6eb48b6f6b8c89a /indra | |
parent | ca630bf6bb1c7c8e04f5ed1e7d649d29d504a6e1 (diff) |
Add functionality to nearby media floater: parcel media & autoplay
This change implements the enabling/disabling of parcel media,
as well as setting the user's autoplay preference. I still
am quite confused by this UI, so we'll need to play with it a bit
to ensure it is what we want to present to users.
This adds a few helpers to llviewerparcelmedia to get the name and URL
of media.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewermedia.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmedia.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llviewerparcelmedia.h | 2 |
4 files changed, 35 insertions, 2 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 69d4da373e..36fef07989 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -54,6 +54,8 @@ #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> +/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "AutoPlayMedia"; + // Move this to its own file. LLViewerMediaEventEmitter::~LLViewerMediaEventEmitter() @@ -313,7 +315,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent, // do a navigate. - if((was_loaded || (media_entry->getAutoPlay() && gSavedSettings.getBOOL("AutoPlayMedia"))) && !update_from_self) + if((was_loaded || (media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))) && !update_from_self) { needs_navigate = (media_entry->getCurrentURL() != previous_url); } @@ -330,7 +332,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s media_impl->setHomeURL(media_entry->getHomeURL()); - if(media_entry->getAutoPlay() && gSavedSettings.getBOOL("AutoPlayMedia")) + if(media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING)) { needs_navigate = true; } diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 719deb28bf..639aed4b8a 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -74,6 +74,9 @@ class LLViewerMedia LOG_CLASS(LLViewerMedia); public: + // String to get/set media autoplay in gSavedSettings + static const char *AUTO_PLAY_MEDIA_SETTING; + typedef std::vector<LLViewerMediaImpl*> impl_list; // Special case early init for just web browser component diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 336d7f684e..7559fd8e72 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -324,10 +324,36 @@ std::string LLViewerParcelMedia::getMimeType() { return sMediaImpl.notNull() ? sMediaImpl->getMimeType() : "none/none"; } + +//static +std::string LLViewerParcelMedia::getURL() +{ + std::string url; + if(sMediaImpl.notNull()) + url = sMediaImpl->getMediaURL(); + + if (url.empty()) + url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaCurrentURL(); + + if (url.empty()) + url = LLViewerParcelMgr::getInstance()->getAgentParcel()->getMediaURL(); + + return url; +} + +//static +std::string LLViewerParcelMedia::getName() +{ + if(sMediaImpl.notNull()) + return sMediaImpl->getName(); + return ""; +} + viewer_media_t LLViewerParcelMedia::getParcelMedia() { return sMediaImpl; } + ////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerParcelMedia::processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ) diff --git a/indra/newview/llviewerparcelmedia.h b/indra/newview/llviewerparcelmedia.h index 3f7f898356..19e1ef78d4 100644 --- a/indra/newview/llviewerparcelmedia.h +++ b/indra/newview/llviewerparcelmedia.h @@ -71,6 +71,8 @@ class LLViewerParcelMedia : public LLViewerMediaObserver static LLPluginClassMediaOwner::EMediaStatus getStatus(); static std::string getMimeType(); + static std::string getURL(); + static std::string getName(); static viewer_media_t getParcelMedia(); static void processParcelMediaCommandMessage( LLMessageSystem *msg, void ** ); |