summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmediasettingsgeneral.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelmediasettingsgeneral.cpp')
-rw-r--r--indra/newview/llpanelmediasettingsgeneral.cpp47
1 files changed, 30 insertions, 17 deletions
diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp
index 3177ef9a21..85efe0f93e 100644
--- a/indra/newview/llpanelmediasettingsgeneral.cpp
+++ b/indra/newview/llpanelmediasettingsgeneral.cpp
@@ -32,6 +32,7 @@
#include "llviewerprecompiledheaders.h"
+#include "llagent.h"
#include "llpanelmediasettingsgeneral.h"
#include "llcombobox.h"
#include "llcheckboxctrl.h"
@@ -48,6 +49,7 @@
#include "llmediaentry.h"
#include "llmediactrl.h"
#include "llpanelcontents.h"
+#include "llpermissions.h"
#include "llpluginclassmedia.h"
#include "llfloatermediasettings.h"
#include "llfloatertools.h"
@@ -66,15 +68,11 @@ LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() :
mHeightPixels( NULL ),
mHomeURL( NULL ),
mCurrentURL( NULL ),
- mAltImageEnable( NULL ),
mParent( NULL ),
mMediaEditable(false)
{
// build dialog from XML
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_media_settings_general.xml");
-// mCommitCallbackRegistrar.add("Media.ResetCurrentUrl", boost::bind(&LLPanelMediaSettingsGeneral::onBtnResetCurrentUrl, this));
-// mCommitCallbackRegistrar.add("Media.CommitHomeURL", boost::bind(&LLPanelMediaSettingsGeneral::onCommitHomeURL, this));
-
}
////////////////////////////////////////////////////////////////////////////////
@@ -82,7 +80,6 @@ LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() :
BOOL LLPanelMediaSettingsGeneral::postBuild()
{
// connect member vars with UI widgets
- mAltImageEnable = getChild< LLCheckBoxCtrl >( LLMediaEntry::ALT_IMAGE_ENABLE_KEY );
mAutoLoop = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_LOOP_KEY );
mAutoPlay = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_PLAY_KEY );
mAutoScale = getChild< LLCheckBoxCtrl >( LLMediaEntry::AUTO_SCALE_KEY );
@@ -137,6 +134,11 @@ void LLPanelMediaSettingsGeneral::draw()
LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin();
if( media_plugin )
{
+ // turn off volume (if we can) for preview. Note: this really only
+ // works for QuickTime movies right now - no way to control the
+ // volume of a flash app embedded in a page for example
+ media_plugin->setVolume( 0 );
+
// some controls are only appropriate for time or browser type plugins
// so we selectively enable/disable them - need to do it in draw
// because the information from plugins arrives assynchronously
@@ -161,8 +163,7 @@ void LLPanelMediaSettingsGeneral::draw()
// current URL can change over time.
// updateCurrentURL();
- // enable/disable RESRET button depending on permissions
- // since this is the same as a navigate action
+ LLPermissions perm;
bool user_can_press_reset = mMediaEditable;
// several places modify this widget so we must collect states in one place
@@ -191,7 +192,6 @@ void LLPanelMediaSettingsGeneral::draw()
void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
{
LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
- self->mAltImageEnable ->clear();
self->mAutoLoop->clear();
self->mAutoPlay->clear();
self->mAutoScale->clear();
@@ -202,7 +202,6 @@ void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
self->mHeightPixels->clear();
self->mHomeURL->clear();
self->mWidthPixels->clear();
- self->mAltImageEnable ->setEnabled(editable);
self->mAutoLoop ->setEnabled(editable);
self->mAutoPlay ->setEnabled(editable);
self->mAutoScale ->setEnabled(editable);
@@ -213,7 +212,7 @@ void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
self->mHeightPixels ->setEnabled(editable);
self->mHomeURL ->setEnabled(editable);
self->mWidthPixels ->setEnabled(editable);
- self->mPreviewMedia->unloadMediaSource();
+ self->updateMediaPreview();
}
////////////////////////////////////////////////////////////////////////////////
@@ -271,7 +270,6 @@ void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_
{ LLMediaEntry::HOME_URL_KEY, self->mHomeURL, "LLLineEditor" },
{ LLMediaEntry::FIRST_CLICK_INTERACT_KEY, self->mFirstClick, "LLCheckBoxCtrl" },
{ LLMediaEntry::WIDTH_PIXELS_KEY, self->mWidthPixels, "LLSpinCtrl" },
- { LLMediaEntry::ALT_IMAGE_ENABLE_KEY, self->mAltImageEnable, "LLCheckBoxCtrl" },
{ "", NULL , "" }
};
@@ -319,10 +317,10 @@ void LLPanelMediaSettingsGeneral::updateMediaPreview()
mPreviewMedia->navigateTo( mHomeURL->getValue().asString() );
}
else
- // new home URL will be empty if media is deleted but
- // we still need to clean out the preview.
+ // new home URL will be empty if media is deleted so display a
+ // "preview goes here" data url page
{
- mPreviewMedia->unloadMediaSource();
+ mPreviewMedia->navigateTo( "data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22100%%22 height=%22100%%22 %3E%3Cdefs%3E%3Cpattern id=%22checker%22 patternUnits=%22userSpaceOnUse%22 x=%220%22 y=%220%22 width=%22128%22 height=%22128%22 viewBox=%220 0 128 128%22 %3E%3Crect x=%220%22 y=%220%22 width=%2264%22 height=%2264%22 fill=%22#ddddff%22 /%3E%3Crect x=%2264%22 y=%2264%22 width=%2264%22 height=%2264%22 fill=%22#ddddff%22 /%3E%3C/pattern%3E%3C/defs%3E%3Crect x=%220%22 y=%220%22 width=%22100%%22 height=%22100%%22 fill=%22url(#checker)%22 /%3E%3C/svg%3E" );
};
}
@@ -353,6 +351,16 @@ void LLPanelMediaSettingsGeneral::onClose(bool app_quitting)
void LLPanelMediaSettingsGeneral::onCommitHomeURL( LLUICtrl* ctrl, void *userdata )
{
LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
+
+ // check url user is trying to enter for home URL will pass whitelist
+ // and decline to accept it if it doesn't.
+ std::string home_url = self->mHomeURL->getValue().asString();
+ if ( ! self->mParent->passesWhiteList( home_url ) )
+ {
+ LLNotifications::instance().add("WhiteListInvalidatesHomeUrl");
+ return;
+ };
+
self->updateMediaPreview();
}
@@ -382,14 +390,12 @@ void LLPanelMediaSettingsGeneral::apply( void* userdata )
//
void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in )
{
- fill_me_in[LLMediaEntry::ALT_IMAGE_ENABLE_KEY] = mAltImageEnable->getValue();
fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = mAutoLoop->getValue();
fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = mAutoPlay->getValue();
fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = mAutoScale->getValue();
fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = mAutoZoom->getValue();
fill_me_in[LLMediaEntry::CONTROLS_KEY] = mControls->getCurrentIndex();
- // XXX Don't send current URL!
- //fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
+ fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = mHeightPixels->getValue();
fill_me_in[LLMediaEntry::HOME_URL_KEY] = mHomeURL->getValue();
fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = mFirstClick->getValue();
@@ -438,3 +444,10 @@ bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace()
return all_face_media_navigated;
}
+////////////////////////////////////////////////////////////////////////////////
+//
+const std::string LLPanelMediaSettingsGeneral::getHomeUrl()
+{
+ return mHomeURL->getValue().asString();
+}
+