summaryrefslogtreecommitdiff
path: root/indra/test_apps/llplugintest
diff options
context:
space:
mode:
Diffstat (limited to 'indra/test_apps/llplugintest')
-rw-r--r--[-rwxr-xr-x]indra/test_apps/llplugintest/CMakeLists.txt0
-rw-r--r--[-rwxr-xr-x]indra/test_apps/llplugintest/bookmarks.txt0
-rw-r--r--[-rwxr-xr-x]indra/test_apps/llplugintest/llmediaplugintest.cpp88
-rw-r--r--[-rwxr-xr-x]indra/test_apps/llplugintest/llmediaplugintest.h6
4 files changed, 84 insertions, 10 deletions
diff --git a/indra/test_apps/llplugintest/CMakeLists.txt b/indra/test_apps/llplugintest/CMakeLists.txt
index b4043b0fd9..b4043b0fd9 100755..100644
--- a/indra/test_apps/llplugintest/CMakeLists.txt
+++ b/indra/test_apps/llplugintest/CMakeLists.txt
diff --git a/indra/test_apps/llplugintest/bookmarks.txt b/indra/test_apps/llplugintest/bookmarks.txt
index 2ff64f217f..2ff64f217f 100755..100644
--- a/indra/test_apps/llplugintest/bookmarks.txt
+++ b/indra/test_apps/llplugintest/bookmarks.txt
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp
index 7a544debb2..5bed0fc3a8 100755..100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.cpp
+++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp
@@ -961,6 +961,23 @@ mediaPanel* LLMediaPluginTest::findMediaPanel( LLPluginClassMedia* source )
////////////////////////////////////////////////////////////////////////////////
//
+mediaPanel* LLMediaPluginTest::findMediaPanel( const std::string &target_name )
+{
+ mediaPanel *result = NULL;
+
+ for( int panel = 0; panel < (int)mMediaPanels.size(); ++panel )
+ {
+ if ( mMediaPanels[ panel ]->mTarget == target_name )
+ {
+ result = mMediaPanels[ panel ];
+ }
+ }
+
+ return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
void LLMediaPluginTest::navigateToNewURI( std::string uri )
{
if ( uri.length() )
@@ -1571,7 +1588,7 @@ std::string LLMediaPluginTest::pluginNameFromMimeType( std::string& mime_type )
////////////////////////////////////////////////////////////////////////////////
//
-void LLMediaPluginTest::addMediaPanel( std::string url )
+mediaPanel* LLMediaPluginTest::addMediaPanel( std::string url )
{
// Get the plugin filename using the URL
std::string mime_type = mimeTypeFromUrl( url );
@@ -1603,7 +1620,7 @@ void LLMediaPluginTest::addMediaPanel( std::string url )
if (NULL == getcwd( cwd, FILENAME_MAX - 1 ))
{
std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl;
- return;
+ return NULL;
}
std::string user_data_path = std::string( cwd ) + "/";
#endif
@@ -1673,6 +1690,8 @@ void LLMediaPluginTest::addMediaPanel( std::string url )
std::cout << "Adding new media panel for " << url << "(" << media_width << "x" << media_height << ") with index " << panel->mId << " - total panels = " << mMediaPanels.size() << std::endl;
}
+
+ return panel;
}
////////////////////////////////////////////////////////////////////////////////
@@ -1778,15 +1797,15 @@ void LLMediaPluginTest::updateMediaPanel( mediaPanel* panel )
////////////////////////////////////////////////////////////////////////////////
//
-void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
+mediaPanel* LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
{
// no media panels so we can't change anything - have to add
if ( mMediaPanels.size() == 0 )
- return;
+ return NULL;
// sanity check
if ( ! panel )
- return;
+ return NULL;
int index;
for(index = 0; index < (int)mMediaPanels.size(); index++)
@@ -1798,7 +1817,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
if(index >= (int)mMediaPanels.size())
{
// panel isn't in mMediaPanels
- return;
+ return NULL;
}
std::cout << "Replacing media panel with index " << panel->mId << std::endl;
@@ -1840,7 +1859,7 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
if (NULL == getcwd( cwd, FILENAME_MAX - 1 ))
{
std::cerr << "Couldn't get cwd - probably too long - failing to init." << std::endl;
- return;
+ return NULL;
}
std::string user_data_path = std::string( cwd ) + "/";
#endif
@@ -1880,6 +1899,8 @@ void LLMediaPluginTest::replaceMediaPanel( mediaPanel* panel, std::string url )
// load and start the URL
panel->mMediaSource->loadURI( url );
panel->mMediaSource->start();
+
+ return panel;
}
////////////////////////////////////////////////////////////////////////////////
@@ -2139,7 +2160,39 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
break;
case MEDIA_EVENT_CLICK_LINK_HREF:
- std::cerr << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << std::endl;
+ {
+ std::cerr << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, uri is " << self->getClickURL() << ", target is " << self->getClickTarget() << std::endl;
+ // retrieve the event parameters
+ std::string url = self->getClickURL();
+ std::string target = self->getClickTarget();
+
+ if(target == "_external")
+ {
+ // this should open in an external browser, but since this is a test app we don't care.
+ }
+ else if(target == "_blank")
+ {
+ // Create a new panel with the specified URL.
+ addMediaPanel(url);
+ }
+ else // other named target
+ {
+ mediaPanel *target_panel = findMediaPanel(target);
+ if(target_panel)
+ {
+ target_panel = replaceMediaPanel(target_panel, url);
+ }
+ else
+ {
+ target_panel = addMediaPanel(url);
+ }
+
+ if(target_panel)
+ {
+ target_panel->mTarget = target;
+ }
+ }
+ }
break;
case MEDIA_EVENT_CLICK_LINK_NOFOLLOW:
@@ -2153,6 +2206,25 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
std::cerr << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << std::endl;
break;
+
+ case MEDIA_EVENT_CLOSE_REQUEST:
+ std::cerr << "Media event: MEDIA_EVENT_CLOSE_REQUEST" << std::endl;
+ break;
+
+ case MEDIA_EVENT_PICK_FILE_REQUEST:
+ std::cerr << "Media event: MEDIA_EVENT_PICK_FILE_REQUEST" << std::endl;
+ // TODO: display an actual file picker
+ self->sendPickFileResponse("cake");
+ break;
+
+ case MEDIA_EVENT_GEOMETRY_CHANGE:
+ std::cerr << "Media event: MEDIA_EVENT_GEOMETRY_CHANGE, uuid is " << self->getClickUUID()
+ << ", x = " << self->getGeometryX()
+ << ", y = " << self->getGeometryY()
+ << ", width = " << self->getGeometryWidth()
+ << ", height = " << self->getGeometryHeight()
+ << std::endl;
+ break;
}
}
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.h b/indra/test_apps/llplugintest/llmediaplugintest.h
index 5d08e42148..ecd6cbfc4f 100755..100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.h
+++ b/indra/test_apps/llplugintest/llmediaplugintest.h
@@ -56,6 +56,7 @@ struct mediaPanel
int mId;
std::string mStartUrl;
std::string mMimeType;
+ std::string mTarget;
LLPluginClassMedia *mMediaSource;
int mMediaWidth;
int mMediaHeight;
@@ -96,16 +97,17 @@ class LLMediaPluginTest : public LLPluginClassMediaOwner
void draw( int draw_type );
void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id );
- void addMediaPanel( std::string url );
+ mediaPanel* addMediaPanel( std::string url );
void updateMediaPanel( mediaPanel* panel );
void remMediaPanel( mediaPanel* panel );
- void replaceMediaPanel( mediaPanel* panel, std::string url );
+ mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url );
void getRandomMediaSize( int& width, int& height, std::string mime_type );
void navigateToNewURI( std::string uri );
void initUrlHistory( std::string uri );
void selectPanelById( int id );
void selectPanel( mediaPanel* panel );
mediaPanel* findMediaPanel( LLPluginClassMedia* panel );
+ mediaPanel* findMediaPanel( const std::string &target_name );
void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels );
void makeChrome();
void resetView();