summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcallum <none@none>2010-12-02 14:50:57 -0800
committercallum <none@none>2010-12-02 14:50:57 -0800
commita991bd7f90157a9cc661ef17a6f96e8473e3bd58 (patch)
tree9b17a955d93398cc6e499fbbb531a6104ffa3453
parentadb62e958ff3a4be2eb43fbb1754358ec60a118c (diff)
SOCIAL-311 FIX Media browser has too many oddities to be useful for viewer web apps
Completes MVP
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp4
-rw-r--r--indra/llplugin/llpluginclassmedia.h4
-rw-r--r--indra/newview/llfloaterwebcontent.cpp59
-rw-r--r--indra/newview/llfloaterwebcontent.h5
-rw-r--r--indra/newview/skins/default/textures/textures.xml4
5 files changed, 52 insertions, 24 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index de4456aa4e..e6c901dd5c 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -1049,8 +1049,8 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
}
else if(message_name == "link_hovered")
{
- // Link and text are not currently used -- the tooltip hover text is taken from the "title".
- // message.getValue("link");
+ // text is not currently used -- the tooltip hover text is taken from the "title".
+ mHoverLink = message.getValue("link");
mHoverText = message.getValue("title");
// message.getValue("text");
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index fa4dc2b43f..abc472f501 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -242,8 +242,9 @@ public:
std::string getAuthURL() const { return mAuthURL; };
std::string getAuthRealm() const { return mAuthRealm; };
- // This is valid during MEDIA_EVENT_LINK_HOVERED
+ // These are valid during MEDIA_EVENT_LINK_HOVERED
std::string getHoverText() const { return mHoverText; };
+ std::string getHoverLink() const { return mHoverLink; };
std::string getMediaName() const { return mMediaName; };
std::string getMediaDescription() const { return mMediaDescription; };
@@ -385,6 +386,7 @@ protected:
std::string mAuthURL;
std::string mAuthRealm;
std::string mHoverText;
+ std::string mHoverLink;
/////////////////////////////////////////
// media_time class
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 8e5638f549..31b6c3fc49 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -37,26 +37,26 @@
#include "llfloaterwebcontent.h"
-LLFloaterWebContent::LLFloaterWebContent(const LLSD& key)
- : LLFloater(key)
+LLFloaterWebContent::LLFloaterWebContent( const LLSD& key )
+ : LLFloater( key )
{
- mCommitCallbackRegistrar.add("WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this));
- mCommitCallbackRegistrar.add("WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this));
- mCommitCallbackRegistrar.add("WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this));
+ mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
+ mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
+ mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
- mCommitCallbackRegistrar.add("WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this));
+ mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
}
BOOL LLFloaterWebContent::postBuild()
{
// these are used in a bunch of places so cache them
- mWebBrowser = getChild<LLMediaCtrl>("webbrowser");
- mAddressCombo = getChild<LLComboBox>("address");
- mStatusBarText = getChild<LLTextBox>("statusbartext");
- mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress");
+ mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" );
+ mAddressCombo = getChild< LLComboBox >( "address" );
+ mStatusBarText = getChild< LLTextBox >( "statusbartext" );
+ mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
// observe browser events
- mWebBrowser->addObserver(this);
+ mWebBrowser->addObserver( this );
// these button are always enabled
getChildView("reload")->setEnabled( true );
@@ -65,7 +65,7 @@ BOOL LLFloaterWebContent::postBuild()
}
//static
-void LLFloaterWebContent::create(const std::string &url, const std::string& target, const std::string& uuid)
+void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid )
{
lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
@@ -194,11 +194,22 @@ void LLFloaterWebContent::onClose(bool app_quitting)
destroy();
}
+// virtual
+void LLFloaterWebContent::draw()
+{
+ // this is asychronous so we need to keep checking
+ getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() );
+ getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() );
+
+ LLFloater::draw();
+}
+
+// virtual
void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
{
if(event == MEDIA_EVENT_LOCATION_CHANGED)
{
- const std::string url = self->getStatusText();
+ const std::string url = self->getLocation();
if ( url.length() )
mStatusBarText->setText( url );
@@ -211,11 +222,11 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
- // manually decide on the state of this button
+ // toggle visibility of these buttons based on browser state
getChildView("reload")->setVisible( false );
getChildView("stop")->setVisible( true );
- // turn "on" progress bar now we're loaded
+ // turn "on" progress bar now we're about to start loading
mStatusBarProgress->setVisible( true );
}
else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
@@ -224,12 +235,16 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
- // manually decide on the state of this button
+ // toggle visibility of these buttons based on browser state
getChildView("reload")->setVisible( true );
getChildView("stop")->setVisible( false );
// turn "off" progress bar now we're loaded
mStatusBarProgress->setVisible( false );
+
+ // we populate the status bar with URLs as they change so clear it now we're done
+ const std::string end_str = "";
+ mStatusBarText->setText( end_str );
}
else if(event == MEDIA_EVENT_CLOSE_REQUEST)
{
@@ -256,6 +271,11 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent
std::string page_title = self->getMediaName();
setTitle( page_title );
}
+ else if(event == MEDIA_EVENT_LINK_HOVERED )
+ {
+ const std::string link = self->getHoverLink();
+ mStatusBarText->setText( link );
+ }
}
void LLFloaterWebContent::set_current_url(const std::string& url)
@@ -300,5 +320,10 @@ void LLFloaterWebContent::onClickStop()
void LLFloaterWebContent::onEnterAddress()
{
- mWebBrowser->navigateTo( mAddressCombo->getValue().asString() );
+ // make sure there is at least something there.
+ // (perhaps this test should be for minimum length of a URL)
+ if ( mAddressCombo->getValue().asString().length() > 0 )
+ {
+ mWebBrowser->navigateTo( mAddressCombo->getValue().asString() );
+ };
}
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index b41da57a6f..1effa2c4ab 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -49,8 +49,9 @@ public:
static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
void geometryChanged(S32 x, S32 y, S32 width, S32 height);
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_quitting);
+ /* virtual */ BOOL postBuild();
+ /* virtual */ void onClose(bool app_quitting);
+ /* virtual */ void draw();
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index b2658d2525..0314ef2cff 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -392,7 +392,7 @@ with the same filename but different name
<texture name="RadioButton_On_Disabled" file_name="widgets/RadioButton_On_Disabled.png" preload="true" />
- <texture name="Refresh_Off" file_name="icons/Refresh_Off.png" preload="false" />
+ <texture name="Refresh_Off" file_name="icons/Refresh_Off.png" preload="true" />
<texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true" />
@@ -468,7 +468,7 @@ with the same filename but different name
<texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="false" />
<texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="false" />
- <texture name="Stop_Off" file_name="icons/Stop_Off.png" preload="false" />
+ <texture name="Stop_Off" file_name="icons/Stop_Off.png" preload="true" />
<texture name="StopReload_Off" file_name="icons/StopReload_Off.png" preload="false" />
<texture name="StopReload_Over" file_name="icons/StopReload_Over.png" preload="false" />