diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinspectobject.cpp | 117 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 55 | ||||
-rw-r--r-- | indra/newview/lltoolpie.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/inspect_object.xml | 27 |
4 files changed, 181 insertions, 20 deletions
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index 81544904e3..050a61c79b 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -35,10 +35,12 @@ // Viewer #include "llinspect.h" +#include "llmediaentry.h" #include "llnotifications.h" // *TODO: Eliminate, add LLNotificationsUtil wrapper #include "llselectmgr.h" #include "llslurl.h" #include "llviewermenu.h" // handle_object_touch(), handle_buy() +#include "llviewermedia.h" #include "llviewerobjectlist.h" // to select the requested object // Linden libraries @@ -92,8 +94,10 @@ private: void updateName(LLSelectNode* nodep); void updateDescription(LLSelectNode* nodep); void updatePrice(LLSelectNode* nodep); - void updateCreator(LLSelectNode* nodep); + + void updateMediaCurrentURL(); + void updateSecureBrowsing(); void onClickBuy(); void onClickPay(); @@ -107,14 +111,16 @@ private: private: LLUUID mObjectID; S32 mObjectFace; + viewer_media_t mMediaImpl; LLSafeHandle<LLObjectSelection> mObjectSelection; }; LLInspectObject::LLInspectObject(const LLSD& sd) : LLInspect( LLSD() ), // single_instance, doesn't really need key - mObjectID(), // set in onOpen() + mObjectID(NULL), // set in onOpen() mObjectFace(0), - mObjectSelection() + mObjectSelection(NULL), + mMediaImpl(NULL) { // can't make the properties request until the widgets are constructed // as it might return immediately, so do it in postBuild. @@ -141,7 +147,7 @@ BOOL LLInspectObject::postBuild(void) getChild<LLUICtrl>("object_name")->setValue(""); getChild<LLUICtrl>("object_creator")->setValue(""); getChild<LLUICtrl>("object_description")->setValue(""); - + getChild<LLUICtrl>("object_media_url")->setValue(""); // Set buttons invisible until we know what this object can do hideButtons(); @@ -219,6 +225,17 @@ void LLInspectObject::onOpen(const LLSD& data) } } functor; mObjectSelection->applyToNodes(&functor); + + // Does this face have media? + const LLTextureEntry* tep = obj->getTE(mObjectFace); + if (!tep) + return; + + const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; + if(!mep) + return; + + mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); } } @@ -249,6 +266,30 @@ void LLInspectObject::update() updateDescription(nodep); updateCreator(nodep); updatePrice(nodep); + + LLViewerObject* obj = nodep->getObject(); + if(!obj) + return; + + if ( mObjectFace < 0 + || mObjectFace >= obj->getNumTEs() ) + { + return; + } + + // Does this face have media? + const LLTextureEntry* tep = obj->getTE(mObjectFace); + if (!tep) + return; + + const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; + if(!mep) + return; + + mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); + + updateMediaCurrentURL(); + updateSecureBrowsing(); } void LLInspectObject::hideButtons() @@ -387,6 +428,40 @@ void LLInspectObject::updateDescription(LLSelectNode* nodep) } } +void LLInspectObject::updateMediaCurrentURL() +{ + LLTextBox* textbox = getChild<LLTextBox>("object_media_url"); + std::string media_url = ""; + textbox->setValue(media_url); + textbox->setToolTip(media_url); + + if(mMediaImpl.notNull() && mMediaImpl->hasMedia()) + { + LLStringUtil::format_map_t args; + LLPluginClassMedia* media_plugin = NULL; + media_plugin = mMediaImpl->getMediaPlugin(); + if(media_plugin) + { + if(media_plugin->pluginSupportsMediaTime()) + { + args["[CurrentURL]"] = mMediaImpl->getMediaURL(); + } + else + { + args["[CurrentURL]"] = media_plugin->getLocation(); + } + media_url = LLTrans::getString("CurrentURL", args); + textbox->setText(media_url); + textbox->setToolTip(media_url); + } + } + else + { + textbox->setText(media_url); + textbox->setToolTip(media_url); + } +} + void LLInspectObject::updateCreator(LLSelectNode* nodep) { // final information for display @@ -459,6 +534,40 @@ void LLInspectObject::updatePrice(LLSelectNode* nodep) getChild<LLUICtrl>("price_icon")->setVisible(show_price_icon); } +void LLInspectObject::updateSecureBrowsing() +{ + bool is_secure_browsing = false; + + if(mMediaImpl.notNull() + && mMediaImpl->hasMedia()) + { + LLPluginClassMedia* media_plugin = NULL; + std::string current_url = ""; + media_plugin = mMediaImpl->getMediaPlugin(); + if(media_plugin) + { + if(media_plugin->pluginSupportsMediaTime()) + { + current_url = mMediaImpl->getMediaURL(); + } + else + { + current_url = media_plugin->getLocation(); + } + } + + std::string prefix = std::string("https://"); + std::string test_prefix = current_url.substr(0, prefix.length()); + LLStringUtil::toLower(test_prefix); + if(test_prefix == prefix) + { + is_secure_browsing = true; + } + } + getChild<LLUICtrl>("secure_browsing")->setVisible(is_secure_browsing); +} + + void LLInspectObject::onClickBuy() { handle_buy(); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 2ba4d97674..304f1dffaf 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -734,6 +734,7 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) } bool is_time_based_media = false; + bool is_web_based_media = false; bool is_media_playing = false; // Does this face have media? @@ -756,12 +757,14 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) { if(media_plugin->pluginSupportsMediaTime()) { is_time_based_media = true; + is_web_based_media = false; args["[CurrentURL]"] = media_impl->getMediaURL(); is_media_playing = media_impl->isMediaPlaying(); } else { is_time_based_media = false; + is_web_based_media = true; args["[CurrentURL]"] = media_plugin->getLocation(); } //tooltip_msg.append(LLTrans::getString("CurrentURL", args)); @@ -781,8 +784,10 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) .image(LLUI::getUIImage("Info_Off")) .click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace)) .time_based_media(is_time_based_media) + .web_based_media(is_web_based_media) .media_playing(is_media_playing) - .click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick)) + .click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick)) + .click_homepage_callback(boost::bind(VisitHomePage, mHoverPick)) .visible_time_near(6.f) .visible_time_far(3.f) .wrap(false)); @@ -1030,8 +1035,8 @@ void LLToolPie::playCurrentMedia(const LLPickInfo& info) LLPluginClassMedia* media_plugin = NULL; - if (gSavedSettings.getBOOL("MediaOnAPrimUI")) - { +// if (gSavedSettings.getBOOL("MediaOnAPrimUI")) +// { viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); if(media_impl.notNull() && media_impl->hasMedia()) @@ -1052,10 +1057,52 @@ void LLToolPie::playCurrentMedia(const LLPickInfo& info) } } - } +// } } +// static +void LLToolPie::VisitHomePage(const LLPickInfo& info) +{ + //FIXME: how do we handle object in different parcel than us? + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (!parcel) return; + + LLPointer<LLViewerObject> objectp = info.getObject(); + + // Early out cases. Must clear media hover. + // did not hit an object or did not hit a valid face + if ( objectp.isNull() || + info.mObjectFace < 0 || + info.mObjectFace >= objectp->getNumTEs() ) + { + return; + } + + // Does this face have media? + const LLTextureEntry* tep = objectp->getTE(info.mObjectFace); + if (!tep) + return; + + const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; + if(!mep) + return; + + LLPluginClassMedia* media_plugin = NULL; + + viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); + + if(media_impl.notNull() && media_impl->hasMedia()) + { + media_plugin = media_impl->getMediaPlugin(); + + if (media_plugin && !(media_plugin->pluginSupportsMediaTime())) + { + media_impl->navigateHome(); + } + } +} + void LLToolPie::handleDeselect() { diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 3cf9cbde55..3660c68552 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -80,6 +80,8 @@ public: static void showObjectInspector(const LLUUID& object_id); static void showObjectInspector(const LLUUID& object_id, const S32& object_face); static void playCurrentMedia(const LLPickInfo& info); + static void VisitHomePage(const LLPickInfo& info); + private: BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); BOOL pickLeftMouseDownCallback(); diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml index 76b6e2c173..fe492e0ae8 100644 --- a/indra/newview/skins/default/xui/en/inspect_object.xml +++ b/indra/newview/skins/default/xui/en/inspect_object.xml @@ -84,6 +84,17 @@ This is a really long description for an object being as how it is at least 80 c </text> <!-- Overlapping buttons for all default actions. Show "Buy" if for sale, "Sit" if can sit, etc. --> + <text + follows="all" + height="15" + left_delta="0" + name="object_media_url" + top_pad="-5" + width="291" + max_length = "50" + use_ellipses="true" + word_wrap="true"/> + <button follows="top|left" font="SansSerif" @@ -139,24 +150,16 @@ This is a really long description for an object being as how it is at least 80 c top_delta="0" width="75" /> <icon - name="secure_icon" + name="secure_browsing" image_name="map_infohub.tga" left_delta="80" width="16" height="16" - top_delta="0" + top_delta="2" + tool_tip="Secure Browsing" follows="left|top"/> - <!-- <text - follows="left|top" - height="30" - left_delta="20" - name="object_media_url" - top_pad="-20" - width="150" - use_ellipses="true" - word_wrap="true"> - non-overlapping buttons here --> + <!-- non-overlapping buttons here --> <menu_button follows="top|left" height="18" |