diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatertools.cpp | 85 | ||||
-rw-r--r-- | indra/newview/llfloatertools.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_tools.xml | 15 |
3 files changed, 95 insertions, 11 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 3bec6f9e73..5fee84190b 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -49,6 +49,7 @@ #include "llfloaterreg.h" #include "llfocusmgr.h" #include "llmediaentry.h" +#include "llmediactrl.h" #include "llmenugl.h" #include "llpanelcontents.h" #include "llpanelface.h" @@ -221,6 +222,7 @@ BOOL LLFloaterTools::postBuild() mRadioGroupMove = getChild<LLRadioGroup>("move_radio_group"); mRadioGroupEdit = getChild<LLRadioGroup>("edit_radio_group"); mBtnGridOptions = getChild<LLButton>("Options..."); + mTitleMedia = getChild<LLMediaCtrl>("title_media"); mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts"); childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); @@ -304,6 +306,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mCheckSnapToGrid(NULL), mBtnGridOptions(NULL), + mTitleMedia(NULL), mTextGridMode(NULL), mComboGridMode(NULL), mCheckStretchUniform(NULL), @@ -335,7 +338,8 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mPanelLandInfo(NULL), mTabLand(NULL), - mDirty(TRUE) + mDirty(TRUE), + mNeedMediaTitle(TRUE) { gFloaterTools = this; @@ -440,6 +444,9 @@ void LLFloaterTools::draw() mDirty = FALSE; } + // grab media name/title and update the UI widget + updateMediaTitle(); + // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); LLFloater::draw(); } @@ -736,6 +743,10 @@ void LLFloaterTools::onClose(bool app_quitting) LLViewerJoystick::getInstance()->moveAvatar(false); + // destroy media source used to grab media title + if( mTitleMedia ) + mTitleMedia->unloadMediaSource(); + // Different from handle_reset_view in that it doesn't actually // move the camera if EditCameraMovement is not set. gAgent.resetView(gSavedSettings.getBOOL("EditCameraMovement")); @@ -1108,6 +1119,7 @@ void LLFloaterTools::getMediaState() std::string multi_media_info_str = LLTrans::getString("Multiple Media"); std::string media_title = ""; + mNeedMediaTitle = false; // update UI depending on whether "object" (prim or face) has media // and whether or not you are allowed to edit it. @@ -1123,18 +1135,19 @@ void LLFloaterTools::getMediaState() // Media data is valid if(media_data_get!=default_media_data) { - //TODO: get media title - //media_title = media_data_get->getTitle(); - //LLFloaterMediaSettings::getInstance()->mIdenticalValidMedia = true; + // initial media title is the media URL (until we get the name) media_title = media_data_get.getHomeURL(); + + // kick off a navigate and flag that we need to update the title + navigateToTitleMedia( media_data_get.getHomeURL() ); + mNeedMediaTitle = true; } // else all faces might be empty. - - } else // there' re Different Medias' been set on on the faces. { media_title = multi_media_info_str; + mNeedMediaTitle = false; } childSetEnabled("media_tex", bool_has_media & editable); @@ -1152,17 +1165,20 @@ void LLFloaterTools::getMediaState() if(LLFloaterMediaSettings::getInstance()->mMultipleValidMedia) { media_title = multi_media_info_str; + mNeedMediaTitle = false; } else { // Media data is valid if(media_data_get!=default_media_data) { - //TODO: get media title - //media_title = media_data_get->getTitle(); + // initial media title is the media URL (until we get the name) media_title = media_data_get.getHomeURL(); + + // kick off a navigate and flag that we need to update the title + navigateToTitleMedia( media_data_get.getHomeURL() ); + mNeedMediaTitle = true; } - } media_info->setEnabled(false); @@ -1253,12 +1269,63 @@ bool LLFloaterTools::deleteMediaConfirm(const LLSD& notification, const LLSD& re return false; } +////////////////////////////////////////////////////////////////////////////// +// void LLFloaterTools::clearMediaSettings() { LLFloaterMediaSettings::getInstance(); LLFloaterMediaSettings::clearValues(false); } + +////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterTools::navigateToTitleMedia( const std::string url ) +{ + if ( mTitleMedia ) + { + LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin(); + if ( media_plugin ) + { + // if it's a movie, we don't want to hear it + media_plugin->setVolume( 0 ); + }; + mTitleMedia->navigateTo( url ); + }; +} + +////////////////////////////////////////////////////////////////////////////// +// +void LLFloaterTools::updateMediaTitle() +{ + // only get the media name if we need it + if ( ! mNeedMediaTitle ) + return; + + // get plugin impl + LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin(); + if ( media_plugin ) + { + // get the media name (asynchronous - must call repeatedly) + std::string media_title = media_plugin->getMediaName(); + + // only replace the title if what we get contains something + if ( ! media_title.empty() ) + { + // update the UI widget + LLLineEditor* media_title_field = getChild<LLLineEditor>("media_info"); + if ( media_title_field ) + { + media_title_field->setText( media_title ); + + // stop looking for a title when we get one + // FIXME: check this is the right approach + mNeedMediaTitle = false; + }; + }; + }; +} + ////////////////////////////////////////////////////////////////////////////// // void LLFloaterTools::updateMediaSettings() diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 59acef6071..a3e0cac034 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -51,6 +51,7 @@ class LLRadioGroup; class LLSlider; class LLTabContainer; class LLTextBox; +class LLMediaCtrl; class LLTool; class LLParcelSelection; class LLObjectSelection; @@ -107,6 +108,8 @@ public: void onClickBtnAddMedia(); void onClickBtnEditMedia(); void clearMediaSettings(); + void updateMediaTitle(); + void navigateToTitleMedia( const std::string url ); bool selectedMediaEditable(); private: @@ -182,6 +185,9 @@ public: LLParcelSelectionHandle mParcelSelection; LLObjectSelectionHandle mObjectSelection; + LLMediaCtrl *mTitleMedia; + bool mNeedMediaTitle; + private: BOOL mDirty; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 4d5654071e..e6ac39e40b 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2738,8 +2738,19 @@ <button.commit_callback function="BuildTool.EditMedia"/> </button> - - <button + <web_browser + visible="false" + enabled="false" + border_visible="true" + bottom_delta="0" + follows="top|left" + left="0" + name="title_media" + width="4" + height="4" + start_url="about:blank" + decouple_texture_size="true" /> + <button follows="left|top" font="SansSerifSmall" height="19" |