summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermediabrowser.cpp
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2010-08-05 11:16:13 -0700
committerMonroe Linden <monroe@lindenlab.com>2010-08-05 11:16:13 -0700
commitd4668787addf870fca0dc1cbf03c756584838261 (patch)
tree9bd3b421026695821cb4c627d55fc7507d424d3d /indra/newview/llfloatermediabrowser.cpp
parentd042dd9598a91e7bdfa39ce580f935bb744f8970 (diff)
Allow targeted links in the embedded browser to open multiple media browser windows.
Added an optional "target" parameter" to LLWeb::loadURL and loadInternal. Made LLViewerMediaImpl::handleMediaEvent pass the target attribute of clicked links through. Set floater_media_browser.xml to allow multiple instances. Added LLFloaterMediaBrowser::create() and made LLFloaterMediaBrowser assume the incoming tag is the window's target, not the URL. Reviewed by Richard at http://codereview.lindenlab.com/2641050
Diffstat (limited to 'indra/newview/llfloatermediabrowser.cpp')
-rw-r--r--indra/newview/llfloatermediabrowser.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp
index 5405de2f9a..c38ef0c014 100644
--- a/indra/newview/llfloatermediabrowser.cpp
+++ b/indra/newview/llfloatermediabrowser.cpp
@@ -63,6 +63,30 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key)
}
+//static
+void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target)
+{
+ std::string tag = target;
+
+ if(target.empty() || target == "_blank")
+ {
+ // create a unique tag for this instance
+ LLUUID id;
+ id.generate();
+ tag = id.asString();
+ }
+
+ // TODO: Figure out whether we need to close an existing instance and/or warn the user about the number of instances they have open
+
+ LLFloaterMediaBrowser *browser = dynamic_cast<LLFloaterMediaBrowser*> (LLFloaterReg::showInstance("media_browser", tag));
+ llassert(browser);
+ if(browser)
+ {
+ // tell the browser instance to load the specified URL
+ browser->openMedia(url);
+ }
+}
+
void LLFloaterMediaBrowser::draw()
{
getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty());
@@ -197,12 +221,6 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url)
getChildView("reload")->setEnabled(TRUE);
}
-void LLFloaterMediaBrowser::onOpen(const LLSD& media_url)
-{
- LLFloater::onOpen(media_url);
- openMedia(media_url.asString());
-}
-
//static
void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data)
{