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 From 124bc854dd7c3dffc044f306cf836a5d6c68bd2e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 16 Aug 2010 17:44:23 -0700 Subject: moved buildFloater out of lluictrlfactory to llfloater.cpp --- indra/newview/llfloatermediabrowser.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 90147ff650..ad996b5dc8 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -59,8 +59,6 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key) : LLFloater(key) { -// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_media_browser.xml"); - } //static -- cgit v1.2.3 From a2657be5782f20c3cbab542b5a3775d78e21cdfa Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 17 Aug 2010 17:56:54 -0700 Subject: Viewer side changes to support javascript window.close handling. --- indra/newview/llfloatermediabrowser.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index ad996b5dc8..bf797fdc95 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -223,6 +223,11 @@ void LLFloaterMediaBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEve getChildView("back")->setEnabled(self->getHistoryBackAvailable()); getChildView("forward")->setEnabled(self->getHistoryForwardAvailable()); } + else if(event == MEDIA_EVENT_CLOSE_REQUEST) + { + // The browser instance wants its window closed. + closeFloater(); + } } void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) { -- cgit v1.2.3 From 531b77a9485db77df31a25a766e66ec1443a49f6 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 15 Sep 2010 14:39:42 -0700 Subject: Enable web popups to specify size and position of the Media Browser window from javascript. This includes a Mac build of llqtwebkit from the following sources: revision aacdf69cbf5aa12d77c179296e31ef643ed1ef4a of http://qt.gitorious.org/+lindenqt/qt/lindenqt (currently head of the 'lindenqt' branch) revision 81ab5ae326f0 of http://hg.secondlife.com/llqtwebkit (currently head of the default branch) Reviewed by Callum. --- indra/newview/llfloatermediabrowser.cpp | 93 ++++++++++++++++++++++++++++++--- 1 file changed, 85 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 5d0df1f037..5e06a2e078 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -45,7 +45,8 @@ #include "llviewermedia.h" #include "llviewerparcelmedia.h" #include "llcombobox.h" - +#include "llwindow.h" +#include "lllayoutstack.h" // TEMP #include "llsdutil.h" @@ -56,16 +57,25 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key) } //static -void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target) +void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target, const std::string& uuid) { + lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl; + std::string tag = target; if(target.empty() || target == "_blank") { - // create a unique tag for this instance - LLUUID id; - id.generate(); - tag = id.asString(); + if(!uuid.empty()) + { + tag = uuid; + } + else + { + // create a unique tag for this instance + LLUUID id; + id.generate(); + tag = id.asString(); + } } S32 browser_window_limit = gSavedSettings.getS32("MediaBrowserWindowLimit"); @@ -98,11 +108,70 @@ void LLFloaterMediaBrowser::create(const std::string &url, const std::string& ta llassert(browser); if(browser) { + browser->mUUID = uuid; + // tell the browser instance to load the specified URL - browser->openMedia(url); + browser->openMedia(url, target); + LLViewerMedia::proxyWindowOpened(target, uuid); } } +//static +void LLFloaterMediaBrowser::closeRequest(const std::string &uuid) +{ + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("media_browser"); + lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl; + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) + { + LLFloaterMediaBrowser* i = dynamic_cast(*iter); + lldebugs << " " << i->mUUID << llendl; + if (i && i->mUUID == uuid) + { + i->closeFloater(false); + return; + } + } +} + +//static +void LLFloaterMediaBrowser::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height) +{ + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("media_browser"); + lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl; + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) + { + LLFloaterMediaBrowser* i = dynamic_cast(*iter); + lldebugs << " " << i->mUUID << llendl; + if (i && i->mUUID == uuid) + { + i->geometryChanged(x, y, width, height); + return; + } + } +} + +void LLFloaterMediaBrowser::geometryChanged(S32 x, S32 y, S32 width, S32 height) +{ + // Make sure the layout of the browser control is updated, so this calculation is correct. + LLLayoutStack::updateClass(); + + // TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc. + LLCoordWindow window_size; + getWindow()->getSize(&window_size); + + // Adjust width and height for the size of the chrome on the Media Browser window. + width += getRect().getWidth() - mBrowser->getRect().getWidth(); + height += getRect().getHeight() - mBrowser->getRect().getHeight(); + + LLRect geom; + geom.setOriginAndSize(x, window_size.mY - (y + height), width, height); + + lldebugs << "geometry change: " << geom << llendl; + + handleReshape(geom,false); +} + + void LLFloaterMediaBrowser::draw() { getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty()); @@ -161,6 +230,7 @@ BOOL LLFloaterMediaBrowser::postBuild() childSetAction("assign", onClickAssign, this); buildURLHistory(); + return TRUE; } @@ -201,6 +271,7 @@ std::string LLFloaterMediaBrowser::getSupportURL() //virtual void LLFloaterMediaBrowser::onClose(bool app_quitting) { + LLViewerMedia::proxyWindowClosed(mUUID); //setVisible(FALSE); destroy(); } @@ -222,7 +293,12 @@ void LLFloaterMediaBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEve // The browser instance wants its window closed. closeFloater(); } + else if(event == MEDIA_EVENT_GEOMETRY_CHANGE) + { + geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight()); + } } + void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) { mCurrentURL = url; @@ -368,9 +444,10 @@ void LLFloaterMediaBrowser::onClickSeek(void* user_data) if(self->mBrowser->getMediaPlugin()) self->mBrowser->getMediaPlugin()->start(2.0f); } -void LLFloaterMediaBrowser::openMedia(const std::string& media_url) +void LLFloaterMediaBrowser::openMedia(const std::string& media_url, const std::string& target) { mBrowser->setHomePageUrl(media_url); + mBrowser->setTarget(target); mBrowser->navigateTo(media_url); setCurrentURL(media_url); } -- cgit v1.2.3 From 387011a1ff519d0e339b446ff5d02f0d009b7e5d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 00:45:27 -0700 Subject: EXP-29 WIP Implement popup blocking added web popup notification overlay --- indra/newview/llfloatermediabrowser.cpp | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index 5d0df1f037..ba8128e902 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -45,7 +45,10 @@ #include "llviewermedia.h" #include "llviewerparcelmedia.h" #include "llcombobox.h" +#include "lllayoutstack.h" +#include "llcheckboxctrl.h" +#include "llnotifications.h" // TEMP #include "llsdutil.h" @@ -141,12 +144,16 @@ void LLFloaterMediaBrowser::draw() BOOL LLFloaterMediaBrowser::postBuild() { mBrowser = getChild("browser"); + mBrowser->setMediaID(mKey); mBrowser->addObserver(this); mAddressCombo = getChild("address"); mAddressCombo->setCommitCallback(onEnterAddress, this); mAddressCombo->sortByName(); + LLButton& notification_close = getChildRef("close_notification"); + notification_close.setClickedCallback(boost::bind(&LLFloaterMediaBrowser::onCloseNotification, this), NULL); + childSetAction("back", onClickBack, this); childSetAction("forward", onClickForward, this); childSetAction("reload", onClickRefresh, this); @@ -243,6 +250,73 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) getChildView("reload")->setEnabled(TRUE); } +void LLFloaterMediaBrowser::showNotification(LLNotificationPtr notify) +{ + mCurNotification = notify; + + // add popup here + LLSD payload = notify->getPayload(); + + LLNotificationFormPtr formp = notify->getForm(); + LLLayoutPanel& panel = getChildRef("notification_area"); + panel.setVisible(true); + panel.getChild("notification_icon")->setValue(notify->getIcon()); + panel.getChild("notification_text")->setValue(notify->getMessage()); + panel.getChild("notification_text")->setToolTip(notify->getMessage()); + LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); + LLLayoutPanel& form_elements = panel.getChildRef("form_elements"); + + const S32 FORM_PADDING_HORIZONTAL = 10; + const S32 FORM_PADDING_VERTICAL = 5; + S32 cur_x = FORM_PADDING_HORIZONTAL; + + if (ignore_type != LLNotificationForm::IGNORE_NO) + { + LLCheckBoxCtrl::Params checkbox_p; + checkbox_p.name = "ignore_check"; + checkbox_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); + checkbox_p.label = formp->getIgnoreMessage(); + checkbox_p.label_text.text_color = LLColor4::black; + checkbox_p.commit_callback.function = boost::bind(&LLFloaterMediaBrowser::onClickIgnore, this, _1); + + LLCheckBoxCtrl* check = LLUICtrlFactory::create(checkbox_p); + check->setRect(check->getBoundingRect()); + form_elements.addChild(check); + cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL; + } + + for (S32 i = 0; i < formp->getNumElements(); i++) + { + LLSD form_element = formp->getElement(i); + if (form_element["type"].asString() == "button") + { + LLButton::Params button_p; + button_p.name = form_element["name"]; + button_p.label = form_element["text"]; + button_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); + button_p.commit_callback.function = boost::bind(&LLFloaterMediaBrowser::onClickNotificationButton, this, form_element["name"].asString()); + button_p.auto_resize = true; + + LLButton* button = LLUICtrlFactory::create(button_p); + button->autoResize(); + form_elements.addChild(button); + + cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; + } + } + + + form_elements.reshape(cur_x, form_elements.getRect().getHeight()); + + //LLWeb::loadURL(payload["url"], payload["target"]); +} + +void LLFloaterMediaBrowser::hideNotification() +{ + LLLayoutPanel& panel = getChildRef("notification_area"); + panel.setVisible(FALSE); +} + //static void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data) { @@ -374,3 +448,29 @@ void LLFloaterMediaBrowser::openMedia(const std::string& media_url) mBrowser->navigateTo(media_url); setCurrentURL(media_url); } + +void LLFloaterMediaBrowser::onCloseNotification() +{ + LLNotifications::instance().cancel(mCurNotification); +} + +void LLFloaterMediaBrowser::onClickIgnore(LLUICtrl* ctrl) +{ + bool check = ctrl->getValue().asBoolean(); + if (mCurNotification && mCurNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) + { + // question was "show again" so invert value to get "ignore" + check = !check; + } + mCurNotification->setIgnored(check); +} + +void LLFloaterMediaBrowser::onClickNotificationButton(const std::string& name) +{ + if (!mCurNotification) return; + + LLSD response = mCurNotification->getResponseTemplate(); + response[name] = true; + + mCurNotification->respond(response); +} -- cgit v1.2.3 From d2a0327b6e89ca678e50e58dd685ea80e4c51cb5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 Sep 2010 16:29:53 -0700 Subject: popup blocking notifications now handled in all web_browser instances, not just llfloatermediabrowser --- indra/newview/llfloatermediabrowser.cpp | 95 --------------------------------- 1 file changed, 95 deletions(-) (limited to 'indra/newview/llfloatermediabrowser.cpp') diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp index ba8128e902..3e99b27f7f 100644 --- a/indra/newview/llfloatermediabrowser.cpp +++ b/indra/newview/llfloatermediabrowser.cpp @@ -144,16 +144,12 @@ void LLFloaterMediaBrowser::draw() BOOL LLFloaterMediaBrowser::postBuild() { mBrowser = getChild("browser"); - mBrowser->setMediaID(mKey); mBrowser->addObserver(this); mAddressCombo = getChild("address"); mAddressCombo->setCommitCallback(onEnterAddress, this); mAddressCombo->sortByName(); - LLButton& notification_close = getChildRef("close_notification"); - notification_close.setClickedCallback(boost::bind(&LLFloaterMediaBrowser::onCloseNotification, this), NULL); - childSetAction("back", onClickBack, this); childSetAction("forward", onClickForward, this); childSetAction("reload", onClickRefresh, this); @@ -250,73 +246,6 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url) getChildView("reload")->setEnabled(TRUE); } -void LLFloaterMediaBrowser::showNotification(LLNotificationPtr notify) -{ - mCurNotification = notify; - - // add popup here - LLSD payload = notify->getPayload(); - - LLNotificationFormPtr formp = notify->getForm(); - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(true); - panel.getChild("notification_icon")->setValue(notify->getIcon()); - panel.getChild("notification_text")->setValue(notify->getMessage()); - panel.getChild("notification_text")->setToolTip(notify->getMessage()); - LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); - LLLayoutPanel& form_elements = panel.getChildRef("form_elements"); - - const S32 FORM_PADDING_HORIZONTAL = 10; - const S32 FORM_PADDING_VERTICAL = 5; - S32 cur_x = FORM_PADDING_HORIZONTAL; - - if (ignore_type != LLNotificationForm::IGNORE_NO) - { - LLCheckBoxCtrl::Params checkbox_p; - checkbox_p.name = "ignore_check"; - checkbox_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - checkbox_p.label = formp->getIgnoreMessage(); - checkbox_p.label_text.text_color = LLColor4::black; - checkbox_p.commit_callback.function = boost::bind(&LLFloaterMediaBrowser::onClickIgnore, this, _1); - - LLCheckBoxCtrl* check = LLUICtrlFactory::create(checkbox_p); - check->setRect(check->getBoundingRect()); - form_elements.addChild(check); - cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - - for (S32 i = 0; i < formp->getNumElements(); i++) - { - LLSD form_element = formp->getElement(i); - if (form_element["type"].asString() == "button") - { - LLButton::Params button_p; - button_p.name = form_element["name"]; - button_p.label = form_element["text"]; - button_p.rect = LLRect(cur_x, form_elements.getRect().getHeight() - FORM_PADDING_VERTICAL, cur_x, FORM_PADDING_VERTICAL); - button_p.commit_callback.function = boost::bind(&LLFloaterMediaBrowser::onClickNotificationButton, this, form_element["name"].asString()); - button_p.auto_resize = true; - - LLButton* button = LLUICtrlFactory::create(button_p); - button->autoResize(); - form_elements.addChild(button); - - cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL; - } - } - - - form_elements.reshape(cur_x, form_elements.getRect().getHeight()); - - //LLWeb::loadURL(payload["url"], payload["target"]); -} - -void LLFloaterMediaBrowser::hideNotification() -{ - LLLayoutPanel& panel = getChildRef("notification_area"); - panel.setVisible(FALSE); -} - //static void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data) { @@ -449,28 +378,4 @@ void LLFloaterMediaBrowser::openMedia(const std::string& media_url) setCurrentURL(media_url); } -void LLFloaterMediaBrowser::onCloseNotification() -{ - LLNotifications::instance().cancel(mCurNotification); -} - -void LLFloaterMediaBrowser::onClickIgnore(LLUICtrl* ctrl) -{ - bool check = ctrl->getValue().asBoolean(); - if (mCurNotification && mCurNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) - { - // question was "show again" so invert value to get "ignore" - check = !check; - } - mCurNotification->setIgnored(check); -} -void LLFloaterMediaBrowser::onClickNotificationButton(const std::string& name) -{ - if (!mCurNotification) return; - - LLSD response = mCurNotification->getResponseTemplate(); - response[name] = true; - - mCurNotification->respond(response); -} -- cgit v1.2.3