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.
master
Rick Pasetto 2009-11-13 12:59:17 -08:00
parent ca630bf6bb
commit 2e70e4e2d7
4 changed files with 35 additions and 2 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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 ** )

View File

@ -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 ** );