summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmediasettingsgeneral.cpp
diff options
context:
space:
mode:
authorMark Palange (Mani) <palange@lindenlab.com>2009-11-09 13:16:04 -0800
committerMark Palange (Mani) <palange@lindenlab.com>2009-11-09 13:16:04 -0800
commitdc5db676efd340bccd2c6f376c0bcba77e0507c4 (patch)
treeaba1c368d923d106789cddc59b5e4626f048dc44 /indra/newview/llpanelmediasettingsgeneral.cpp
parent2b5faa0b9cac3736b9d96a68cd13e05ee39ab7d1 (diff)
parent3b98043d227db07a2396b1fba056e911abd04621 (diff)
merge
Diffstat (limited to 'indra/newview/llpanelmediasettingsgeneral.cpp')
-rw-r--r--indra/newview/llpanelmediasettingsgeneral.cpp101
1 files changed, 64 insertions, 37 deletions
diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp
index 85efe0f93e..5186a5888b 100644
--- a/indra/newview/llpanelmediasettingsgeneral.cpp
+++ b/indra/newview/llpanelmediasettingsgeneral.cpp
@@ -55,6 +55,8 @@
#include "llfloatertools.h"
#include "lltrans.h"
+const char *CHECKERBOARD_DATA_URL = "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";
+
////////////////////////////////////////////////////////////////////////////////
//
LLPanelMediaSettingsGeneral::LLPanelMediaSettingsGeneral() :
@@ -97,7 +99,6 @@ BOOL LLPanelMediaSettingsGeneral::postBuild()
childSetCommitCallback( "current_url_reset_btn",onBtnResetCurrentUrl, this);
// interrogates controls and updates widgets as required
updateMediaPreview();
- updateCurrentURL();
return true;
}
@@ -160,9 +161,9 @@ void LLPanelMediaSettingsGeneral::draw()
};
};
- // current URL can change over time.
-// updateCurrentURL();
-
+ // current URL can change over time, update it here
+ updateCurrentUrl();
+
LLPermissions perm;
bool user_can_press_reset = mMediaEditable;
@@ -215,26 +216,15 @@ void LLPanelMediaSettingsGeneral::clearValues( void* userdata, bool editable)
self->updateMediaPreview();
}
-////////////////////////////////////////////////////////////////////////////////
-// static
-void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_settings ,bool editable)
+// static
+bool LLPanelMediaSettingsGeneral::isMultiple()
{
- LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
- self->mMediaEditable = editable;
-
- //llinfos << "---------------" << llendl;
- //llinfos << ll_pretty_print_sd(media_settings) << llendl;
- //llinfos << "---------------" << llendl;
-
// IF all the faces have media (or all dont have media)
if ( LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo )
{
if(LLFloaterMediaSettings::getInstance()->mMultipleMedia)
{
- self->clearValues(self, self->mMediaEditable);
- // only show multiple
- self->mHomeURL ->setText(LLTrans::getString("Multiple Media"));
- return;
+ return true;
}
}
@@ -242,13 +232,32 @@ void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_
{
if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia)
{
- self->clearValues(self, self->mMediaEditable);
- // only show multiple
- self->mHomeURL ->setText(LLTrans::getString("Multiple Media"));
- return;
- }
-
+ return true;
+ }
}
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// static
+void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_settings ,bool editable)
+{
+ LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
+ self->mMediaEditable = editable;
+
+ //llinfos << "---------------" << llendl;
+ //llinfos << ll_pretty_print_sd(media_settings) << llendl;
+ //llinfos << "---------------" << llendl;
+
+ if ( LLPanelMediaSettingsGeneral::isMultiple() )
+ {
+ self->clearValues(self, self->mMediaEditable);
+ // only show multiple
+ self->mHomeURL->setText(LLTrans::getString("Multiple Media"));
+ self->mCurrentURL->setText(LLTrans::getString("Multiple Media"));
+ return;
+ }
+
std::string base_key( "" );
std::string tentative_key( "" );
@@ -305,7 +314,6 @@ void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& media_
// interrogates controls and updates widgets as required
self->updateMediaPreview();
- self->updateCurrentURL();
}
////////////////////////////////////////////////////////////////////////////////
@@ -320,22 +328,11 @@ void LLPanelMediaSettingsGeneral::updateMediaPreview()
// new home URL will be empty if media is deleted so display a
// "preview goes here" data url page
{
- 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" );
+ mPreviewMedia->navigateTo( CHECKERBOARD_DATA_URL );
};
}
////////////////////////////////////////////////////////////////////////////////
-// Helper to set current URL
-void LLPanelMediaSettingsGeneral::updateCurrentURL()
-{
- if( mCurrentURL->getText().empty() )
- {
- childSetText( "current_url", mHomeURL->getText() );
- }
-
-}
-
-////////////////////////////////////////////////////////////////////////////////
// virtual
void LLPanelMediaSettingsGeneral::onClose(bool app_quitting)
@@ -441,6 +438,8 @@ bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace()
LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection();
selected_objects->getSelectedTEValue( &functor_navigate_media, all_face_media_navigated );
+ // Note: we don't update the 'current URL' field until the media data itself changes
+
return all_face_media_navigated;
}
@@ -451,3 +450,31 @@ const std::string LLPanelMediaSettingsGeneral::getHomeUrl()
return mHomeURL->getValue().asString();
}
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLPanelMediaSettingsGeneral::updateCurrentUrl()
+{
+ // Get the current URL from the selection
+
+ const LLMediaEntry default_media_data;
+ std::string value_str = default_media_data.getCurrentURL();
+ struct functor_getter_current_url : public LLSelectedTEGetFunctor< std::string >
+ {
+ functor_getter_current_url(const LLMediaEntry& entry): mMediaEntry(entry) {}
+
+ std::string get( LLViewerObject* object, S32 face )
+ {
+ if ( object )
+ if ( object->getTE(face) )
+ if ( object->getTE(face)->getMediaData() )
+ return object->getTE(face)->getMediaData()->getCurrentURL();
+ return mMediaEntry.getCurrentURL();
+ };
+
+ const LLMediaEntry & mMediaEntry;
+
+ } func_current_url(default_media_data);
+ bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_current_url, value_str );
+ mCurrentURL->setText(value_str);
+ mCurrentURL->setTentative(identical);
+}