From 5062351a0a2a95c3cbca27297b57afddc23d7a4f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 4 Aug 2010 19:01:18 -0700 Subject: deprecated ADD_SORTED due to n^2 behavior, set the sort order on the scroll list instead --- indra/newview/llfloatermediabrowser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 5405de2f9a..d01488b6b1 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -105,6 +105,7 @@ BOOL LLFloaterMediaBrowser::postBuild() mAddressCombo = getChild("address"); mAddressCombo->setCommitCallback(onEnterAddress, this); + mAddressCombo->sortByName(); childSetAction("back", onClickBack, this); childSetAction("forward", onClickForward, this); @@ -185,7 +186,7 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) if (mCurrentURL != "about:blank") { mAddressCombo->remove(mCurrentURL); - mAddressCombo->add(mCurrentURL, ADD_SORTED); + mAddressCombo->add(mCurrentURL); mAddressCombo->selectByValue(mCurrentURL); // Serialize url history -- cgit v1.2.3 From d4668787addf870fca0dc1cbf03c756584838261 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 5 Aug 2010 11:16:13 -0700 Subject: 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 --- indra/newview/llfloatermediabrowser.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') 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 (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) { -- cgit v1.2.3 From 879d15903608b26f6b10f499d150bb72a65fa966 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 9 Aug 2010 17:40:17 -0700 Subject: Limit the number of media browser windows the viewer will open at once. The limit is controlled by the debug setting MediaBrowserWindowLimit. When opening a new window would take us over the limit, the least recently opened window will be closed first. --- indra/newview/llfloatermediabrowser.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 268a0e0b93..2fc5bd72de 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -76,8 +76,32 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta 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 + S32 browser_window_limit = gSavedSettings.getS32("MediaBrowserWindowLimit"); + if(LLFloaterReg::findInstance("media_browser", tag) != NULL) + { + // There's already a media browser for this tag, so we won't be opening a new window. + } + else if(browser_window_limit != 0) + { + // showInstance will open a new window. Figure out how many media browsers are already open, + // and close the least recently opened one if this will put us over the limit. + + LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("media_browser"); + lldebugs << "total instance count is " << instances.size() << llendl; + + for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) + { + lldebugs << " " << (*iter)->getKey() << llendl; + } + + if(instances.size() >= browser_window_limit) + { + // Destroy the least recently opened instance + (*instances.begin())->closeFloater(); + } + } + LLFloaterMediaBrowser *browser = dynamic_cast (LLFloaterReg::showInstance("media_browser", tag)); llassert(browser); if(browser) -- cgit v1.2.3 From 010ef13f560ca97807537484781acb332f48b8e2 Mon Sep 17 00:00:00 2001 From: callum Date: Tue, 10 Aug 2010 09:58:56 -0700 Subject: Fix for unsigned/sighed warning that breaks Windows build. --- indra/newview/llfloatermediabrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 2fc5bd72de..90147ff650 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -95,7 +95,7 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta lldebugs << " " << (*iter)->getKey() << llendl; } - if(instances.size() >= browser_window_limit) + if(instances.size() >= (size_t)browser_window_limit) { // Destroy the least recently opened instance (*instances.begin())->closeFloater(); -- cgit v1.2.3