diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatermediasettings.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingsgeneral.cpp | 69 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingsgeneral.h | 23 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingspermissions.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingspermissions.h | 46 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingssecurity.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llpanelmediasettingssecurity.h | 56 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 5 |
8 files changed, 164 insertions, 119 deletions
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index d941f24f49..44e68d7745 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -145,13 +145,18 @@ LLFloaterMediaSettings* LLFloaterMediaSettings::getInstance() //static void LLFloaterMediaSettings::apply() { - LLSD settings; + sInstance->mPanelMediaSettingsGeneral->preApply(); sInstance->mPanelMediaSettingsGeneral->getValues( settings ); - sInstance->mPanelMediaSettingsSecurity->getValues( settings ); + sInstance->mPanelMediaSettingsSecurity->preApply(); + sInstance->mPanelMediaSettingsSecurity->getValues( settings ); + sInstance->mPanelMediaSettingsPermissions->preApply(); sInstance->mPanelMediaSettingsPermissions->getValues( settings ); LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA ); LLSelectMgr::getInstance()->selectionSetMediaData(settings); + sInstance->mPanelMediaSettingsGeneral->postApply(); + sInstance->mPanelMediaSettingsSecurity->postApply(); + sInstance->mPanelMediaSettingsPermissions->postApply(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index 5186a5888b..2cf56d5571 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -366,21 +366,15 @@ void LLPanelMediaSettingsGeneral::onCommitHomeURL( LLUICtrl* ctrl, void *userdat void LLPanelMediaSettingsGeneral::onBtnResetCurrentUrl(LLUICtrl* ctrl, void *userdata) { LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata; - self->navigateHomeSelectedFace(); + self->navigateHomeSelectedFace(false); } //////////////////////////////////////////////////////////////////////////////// -// static -void LLPanelMediaSettingsGeneral::apply( void* userdata ) +// +void LLPanelMediaSettingsGeneral::preApply() { - LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata; - self->mHomeURL->onCommit(); - // build LLSD Fragment - LLSD media_data_general; - self->getValues(media_data_general); - - // this merges contents of LLSD passed in with what's there so this is ok - LLSelectMgr::getInstance()->selectionSetMediaData( media_data_general ); + // Make sure the home URL entry is committed + mHomeURL->onCommit(); } //////////////////////////////////////////////////////////////////////////////// @@ -392,7 +386,8 @@ void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in ) 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(); - fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue(); + //Don't fill in current URL: this is only supposed to get changed via navigate + // 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(); @@ -400,39 +395,53 @@ void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in ) } //////////////////////////////////////////////////////////////////////////////// +// +void LLPanelMediaSettingsGeneral::postApply() +{ + // Make sure to navigate to the home URL if the current URL is empty and + // autoplay is on + navigateHomeSelectedFace(true); +} + + +//////////////////////////////////////////////////////////////////////////////// // void LLPanelMediaSettingsGeneral::setParent( LLFloaterMediaSettings* parent ) { mParent = parent; }; -bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace() +//////////////////////////////////////////////////////////////////////////////// +// +bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_is_empty) { - // HACK: This is directly referencing an impl name. BAD! - // This can be removed when we have a truly generic media browser that only - // builds an impl based on the type of url it is passed. struct functor_navigate_media : public LLSelectedTEGetFunctor< bool> { + functor_navigate_media(bool flag) : only_if_current_is_empty(flag) {} bool get( LLViewerObject* object, S32 face ) { - if ( object ) - if ( object->getTE(face) ) - if ( object->getTE(face)->getMediaData() ) + if ( object && object->getTE(face) && object->permModify() ) + { + const LLMediaEntry *media_data = object->getTE(face)->getMediaData(); + if ( media_data ) + { + if (!only_if_current_is_empty || (media_data->getCurrentURL().empty() && media_data->getAutoPlay())) { - if(object->permModify()) + viewer_media_t media_impl = + LLViewerMedia::getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID()); + if(media_impl) { - viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID()); - if(media_impl) - { - media_impl->navigateHome(); - return true; - } - } + media_impl->navigateHome(); + return true; + } } - return false; - }; + } + } + return false; + }; + bool only_if_current_is_empty; - } functor_navigate_media; + } functor_navigate_media(only_if_current_is_empty); bool all_face_media_navigated = false; LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection(); diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h index b48e081a1b..f8b8f0d224 100644 --- a/indra/newview/llpanelmediasettingsgeneral.h +++ b/indra/newview/llpanelmediasettingsgeneral.h @@ -47,21 +47,30 @@ class LLFloaterMediaSettings; class LLPanelMediaSettingsGeneral : public LLPanel { public: + LLPanelMediaSettingsGeneral(); + ~LLPanelMediaSettingsGeneral(); + + // XXX TODO: put these into a common parent class? + // Hook that the floater calls before applying changes from the panel + void preApply(); + // Function that asks the panel to fill in values associated with the panel + void getValues(LLSD &fill_me_in); + // Hook that the floater calls after applying changes to the panel + void postApply(); + BOOL postBuild(); /*virtual*/ void draw(); /*virtual*/ void onClose(bool app_quitting); - static void apply(void*); - void getValues(LLSD &fill_me_in); - - LLPanelMediaSettingsGeneral(); - ~LLPanelMediaSettingsGeneral(); - void setParent( LLFloaterMediaSettings* parent ); static void initValues( void* userdata, const LLSD& media_settings ,bool editable); static void clearValues( void* userdata, bool editable); - bool navigateHomeSelectedFace(); + // Navigates the current selected face to the Home URL. + // If 'only_if_current_is_empty' is "true", it only performs + // the operation if: 1) the current URL is empty, and 2) auto play is true. + bool navigateHomeSelectedFace(bool only_if_current_is_empty); + void updateMediaPreview(); const std::string getHomeUrl(); diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp index 4d84874e7a..2f3f550e35 100644 --- a/indra/newview/llpanelmediasettingspermissions.cpp +++ b/indra/newview/llpanelmediasettingspermissions.cpp @@ -218,17 +218,10 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me } //////////////////////////////////////////////////////////////////////////////// -// static -void LLPanelMediaSettingsPermissions::apply( void* userdata ) +// +void LLPanelMediaSettingsPermissions::preApply() { - LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata; - - // build LLSD Fragment - LLSD media_data_permissions; - self->getValues(media_data_permissions); - - // this merges contents of LLSD passed in with what's there so this is ok - LLSelectMgr::getInstance()->selectionSetMediaData( media_data_permissions ); + // no-op } //////////////////////////////////////////////////////////////////////////////// @@ -254,3 +247,11 @@ void LLPanelMediaSettingsPermissions::getValues( LLSD &fill_me_in ) fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control; fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact; } + + +//////////////////////////////////////////////////////////////////////////////// +// +void LLPanelMediaSettingsPermissions::postApply() +{ + // no-op +} diff --git a/indra/newview/llpanelmediasettingspermissions.h b/indra/newview/llpanelmediasettingspermissions.h index ecc50e3582..45a596c615 100644 --- a/indra/newview/llpanelmediasettingspermissions.h +++ b/indra/newview/llpanelmediasettingspermissions.h @@ -46,26 +46,32 @@ class LLNameBox; class LLPanelMediaSettingsPermissions : public LLPanel { - public: - BOOL postBuild(); - virtual void draw(); - static void apply(void*); - void getValues(LLSD &fill_me_in); - - LLPanelMediaSettingsPermissions(); - ~LLPanelMediaSettingsPermissions(); - - static void initValues( void* userdata, const LLSD& media_settings, bool editable ); - static void clearValues( void* userdata, bool editable); - - private: - LLCheckBoxCtrl* mPermsOwnerInteract; - LLCheckBoxCtrl* mPermsOwnerControl; - LLNameBox* mPermsGroupName; - LLCheckBoxCtrl* mPermsGroupInteract; - LLCheckBoxCtrl* mPermsGroupControl; - LLCheckBoxCtrl* mPermsWorldInteract; - LLCheckBoxCtrl* mPermsWorldControl; +public: + LLPanelMediaSettingsPermissions(); + ~LLPanelMediaSettingsPermissions(); + + BOOL postBuild(); + virtual void draw(); + + // XXX TODO: put these into a common parent class? + // Hook that the floater calls before applying changes from the panel + void preApply(); + // Function that asks the panel to fill in values associated with the panel + void getValues(LLSD &fill_me_in); + // Hook that the floater calls after applying changes to the panel + void postApply(); + + static void initValues( void* userdata, const LLSD& media_settings, bool editable ); + static void clearValues( void* userdata, bool editable); + +private: + LLCheckBoxCtrl* mPermsOwnerInteract; + LLCheckBoxCtrl* mPermsOwnerControl; + LLNameBox* mPermsGroupName; + LLCheckBoxCtrl* mPermsGroupInteract; + LLCheckBoxCtrl* mPermsGroupControl; + LLCheckBoxCtrl* mPermsWorldInteract; + LLCheckBoxCtrl* mPermsWorldControl; }; #endif // LL_LLPANELMEDIAMEDIASETTINGSPERMISSIONS_H diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp index 3577f63340..bec2494eac 100644 --- a/indra/newview/llpanelmediasettingssecurity.cpp +++ b/indra/newview/llpanelmediasettingssecurity.cpp @@ -198,17 +198,12 @@ void LLPanelMediaSettingsSecurity::clearValues( void* userdata , bool editable) self->mEnableWhiteList->setEnabled(editable);
self->mWhiteListList->setEnabled(editable);
}
+
////////////////////////////////////////////////////////////////////////////////
-// static
-void LLPanelMediaSettingsSecurity::apply( void* userdata )
+//
+void LLPanelMediaSettingsSecurity::preApply()
{
- LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
-
- // build LLSD Fragment
- LLSD media_data_security;
- self->getValues(media_data_security);
- // this merges contents of LLSD passed in with what's there so this is ok
- LLSelectMgr::getInstance()->selectionSetMediaData( media_data_security );
+ // no-op
}
////////////////////////////////////////////////////////////////////////////////
@@ -220,7 +215,9 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in ) // iterate over white list and extract items
std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
- fill_me_in[LLMediaEntry::WHITELIST_KEY].clear();
+ // *NOTE: need actually set the key to be an emptyArray(), or the merge
+ // we do with this LLSD will think there's nothing to change.
+ fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
while( iter != white_list_items.end() )
{
std::string white_list_url = (*iter)->getValue().asString();
@@ -229,23 +226,30 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in ) };
}
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLPanelMediaSettingsSecurity::postApply()
+{
+ // no-op
+}
+
///////////////////////////////////////////////////////////////////////////////
// Try to make a valid URL if a fragment (
// white list list box widget and build a list to test against. Can also
const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url )
{
// use LLURI to determine if we have a valid scheme
- LLURI candidate_url( src_url ); - if ( candidate_url.scheme().empty() ) - { + LLURI candidate_url( src_url );
+ if ( candidate_url.scheme().empty() )
+ {
// build a URL comprised of default scheme and the original fragment
const std::string default_scheme( "http://" );
return default_scheme + src_url;
- }; - - // we *could* test the "default scheme" + "original fragment" URL again - // using LLURI to see if it's valid but I think the outcome is the same - // in either case - our only option is to return the original URL + };
+
+ // we *could* test the "default scheme" + "original fragment" URL again
+ // using LLURI to see if it's valid but I think the outcome is the same
+ // in either case - our only option is to return the original URL
// we *think* the original url passed in was valid
return src_url;
@@ -332,10 +336,10 @@ void LLPanelMediaSettingsSecurity::onBtnDel( void* userdata ) self->mWhiteListList->deleteSelectedItems();
}
-//////////////////////////////////////////////////////////////////////////////// -// -void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent ) -{ - mParent = parent; -}; - +////////////////////////////////////////////////////////////////////////////////
+//
+void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
+{
+ mParent = parent;
+};
+
diff --git a/indra/newview/llpanelmediasettingssecurity.h b/indra/newview/llpanelmediasettingssecurity.h index 2555bb8dc8..638664e59d 100644 --- a/indra/newview/llpanelmediasettingssecurity.h +++ b/indra/newview/llpanelmediasettingssecurity.h @@ -41,31 +41,37 @@ class LLFloaterMediaSettings; class LLPanelMediaSettingsSecurity : public LLPanel { - public: - BOOL postBuild(); - virtual void draw(); - static void apply(void*); - void getValues(LLSD &fill_me_in); - - LLPanelMediaSettingsSecurity(); - ~LLPanelMediaSettingsSecurity(); - - static void initValues( void* userdata, const LLSD& media_settings,bool editable ); - static void clearValues( void* userdata, bool editable); - void addWhiteListItem(const std::string& url); - void setParent( LLFloaterMediaSettings* parent ); - const std::string makeValidUrl( const std::string& src_url ); - bool passesWhiteList( const std::string& added_url, const std::string& test_url ); - - protected: - LLFloaterMediaSettings* mParent; - - private: - LLCheckBoxCtrl* mEnableWhiteList; - LLScrollListCtrl* mWhiteListList; - - static void onBtnAdd(void*); - static void onBtnDel(void*); +public: + LLPanelMediaSettingsSecurity(); + ~LLPanelMediaSettingsSecurity(); + + BOOL postBuild(); + virtual void draw(); + + // XXX TODO: put these into a common parent class? + // Hook that the floater calls before applying changes from the panel + void preApply(); + // Function that asks the panel to fill in values associated with the panel + void getValues(LLSD &fill_me_in); + // Hook that the floater calls after applying changes to the panel + void postApply(); + + static void initValues( void* userdata, const LLSD& media_settings,bool editable ); + static void clearValues( void* userdata, bool editable); + void addWhiteListItem(const std::string& url); + void setParent( LLFloaterMediaSettings* parent ); + const std::string makeValidUrl( const std::string& src_url ); + bool passesWhiteList( const std::string& added_url, const std::string& test_url ); + +protected: + LLFloaterMediaSettings* mParent; + +private: + LLCheckBoxCtrl* mEnableWhiteList; + LLScrollListCtrl* mWhiteListList; + + static void onBtnAdd(void*); + static void onBtnDel(void*); }; #endif // LL_LLPANELMEDIAMEDIASETTINGSSECURITY_H diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c987dd1764..5ac6dcce5a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -108,6 +108,11 @@ public: if (te->getMediaData() != NULL) { result = te->getMediaData()->asLLSD(); + // XXX HACK: workaround bug in asLLSD() where whitelist is not set properly + if (!result.has(LLMediaEntry::WHITELIST_KEY)) + { + result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray(); + } } } return result; |