From b4af6c3da8e5ef3e897cedfb2e1d677a3f37abe9 Mon Sep 17 00:00:00 2001
From: angela <angela@lindenlab.com>
Date: Tue, 3 Nov 2009 14:14:39 +0800
Subject: display the current URL in object inspector for media without going
 through media plugin

---
 indra/newview/llinspectobject.cpp | 33 ++++++++++++++++++++-------------
 indra/newview/lltoolpie.cpp       | 39 +++++++++++++++++++--------------------
 2 files changed, 39 insertions(+), 33 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 050a61c79b..e3780f93ff 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -112,6 +112,7 @@ private:
 	LLUUID				mObjectID;
 	S32					mObjectFace;
 	viewer_media_t		mMediaImpl;
+	LLMediaEntry*       mMediaEntry;
 	LLSafeHandle<LLObjectSelection> mObjectSelection;
 };
 
@@ -120,7 +121,8 @@ LLInspectObject::LLInspectObject(const LLSD& sd)
 	mObjectID(NULL),			// set in onOpen()
 	mObjectFace(0),
 	mObjectSelection(NULL),
-	mMediaImpl(NULL)
+	mMediaImpl(NULL),
+	mMediaEntry(NULL)
 {
 	// can't make the properties request until the widgets are constructed
 	// as it might return immediately, so do it in postBuild.
@@ -231,11 +233,11 @@ void LLInspectObject::onOpen(const LLSD& data)
 		if (!tep)
 			return;
 		
-		const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
-		if(!mep)
+		mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
+		if(!mMediaEntry)
 			return;
 		
-		mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
+		mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mMediaEntry->getMediaID());
 	}
 }
 
@@ -282,11 +284,11 @@ void LLInspectObject::update()
 	if (!tep)
 		return;
 	
-	const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
-	if(!mep)
+	mMediaEntry = tep->hasMedia() ? tep->getMediaData() : NULL;
+	if(!mMediaEntry)
 		return;
 	
-	mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
+	mMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mMediaEntry->getMediaID());
 	
 	updateMediaCurrentURL();
 	updateSecureBrowsing();
@@ -430,14 +432,17 @@ void LLInspectObject::updateDescription(LLSelectNode* nodep)
 
 void LLInspectObject::updateMediaCurrentURL()
 {	
+	if(!mMediaEntry)
+		return;
 	LLTextBox* textbox = getChild<LLTextBox>("object_media_url");
 	std::string media_url = "";
 	textbox->setValue(media_url);
 	textbox->setToolTip(media_url);
+	LLStringUtil::format_map_t args;
 	
 	if(mMediaImpl.notNull() && mMediaImpl->hasMedia())
 	{
-		LLStringUtil::format_map_t args;
+		
 		LLPluginClassMedia* media_plugin = NULL;
 		media_plugin = mMediaImpl->getMediaPlugin();
 		if(media_plugin)
@@ -451,15 +456,17 @@ void LLInspectObject::updateMediaCurrentURL()
 				args["[CurrentURL]"] =  media_plugin->getLocation();
 			}
 			media_url = LLTrans::getString("CurrentURL", args);
-			textbox->setText(media_url);
-			textbox->setToolTip(media_url);
+
 		}
 	}
-	else
+	else if(mMediaEntry->getCurrentURL() != "")
 	{
-		textbox->setText(media_url);
-		textbox->setToolTip(media_url);
+		args["[CurrentURL]"] = mMediaEntry->getCurrentURL();
+		media_url = LLTrans::getString("CurrentURL", args);
 	}
+
+	textbox->setText(media_url);
+	textbox->setToolTip(media_url);
 }
 
 void LLInspectObject::updateCreator(LLSelectNode* nodep)
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 0a9e72506b..24017202cc 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -761,14 +761,14 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
 								{
 									is_time_based_media = true;
 									is_web_based_media = false;
-									args["[CurrentURL]"] =  media_impl->getMediaURL();
+									//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();
+									//args["[CurrentURL]"] =  media_plugin->getLocation();
 								}
 								//tooltip_msg.append(LLTrans::getString("CurrentURL", args));
 							}
@@ -1039,31 +1039,28 @@ void LLToolPie::playCurrentMedia(const LLPickInfo& info)
 	if(!mep)
 		return;
 	
+	//TODO: Can you Use it? 
+
 	LLPluginClassMedia* media_plugin = NULL;
 	
-//	if (gSavedSettings.getBOOL("MediaOnAPrimUI"))
-//	{		
-		viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
+	viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
 		
-		if(media_impl.notNull() && media_impl->hasMedia())
+	if(media_impl.notNull() && media_impl->hasMedia())
+	{
+		media_plugin = media_impl->getMediaPlugin();
+		if (media_plugin && media_plugin->pluginSupportsMediaTime())
 		{
-			media_plugin = media_impl->getMediaPlugin();
-			
-			if (media_plugin && media_plugin->pluginSupportsMediaTime())
+			if(media_impl->isMediaPlaying())
 			{
-				if(media_impl->isMediaPlaying())
-				{
-					media_impl->pause();
-				}
-				else //if(media_impl->isMediaPaused())
-				{
-					media_impl->play();
-				}
-				
+				media_impl->pause();
+			}
+			else 
+			{
+				media_impl->play();
 			}
-					
 		}
-//	 }
+	}
+
 
 }
 
@@ -1094,6 +1091,8 @@ void LLToolPie::VisitHomePage(const LLPickInfo& info)
 	if(!mep)
 		return;
 	
+	//TODO: Can you Use it? 
+	
 	LLPluginClassMedia* media_plugin = NULL;
 	
 	viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
-- 
cgit v1.2.3