summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llsdparam.h8
-rw-r--r--indra/newview/llavataractions.cpp6
-rw-r--r--indra/newview/llfloatersearch.cpp60
-rw-r--r--indra/newview/llfloatersearch.h19
-rw-r--r--indra/newview/llfloaterwebcontent.cpp110
-rw-r--r--indra/newview/llfloaterwebcontent.h23
-rw-r--r--indra/newview/llnavigationbar.cpp2
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/llweb.cpp31
-rw-r--r--indra/newview/llworldmapview.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/floater_search.xml71
12 files changed, 154 insertions, 184 deletions
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 5b7b020881..9aae1afc62 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -253,7 +253,7 @@ public:
LLHandle<LLFloater> getHandle() const { return mHandle; }
const LLSD& getKey() { return mKey; }
- BOOL matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); }
+ virtual bool matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); }
const std::string& getInstanceName() { return mInstanceName; }
diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h
index 69dab2b411..827b8c8584 100644
--- a/indra/llui/llsdparam.h
+++ b/indra/llui/llsdparam.h
@@ -93,6 +93,14 @@ class LLSDParamAdapter : public T
LLParamSDParser parser;
parser.readSD(sd, *this);
}
+
+ operator LLSD() const
+ {
+ LLParamSDParser parser;
+ LLSD sd;
+ parser.writeSD(sd, *this);
+ return sd;
+ }
LLSDParamAdapter(const T& val)
{
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 8344b08bfb..48827676cd 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -316,7 +316,11 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa
// PROFILES: open in webkit window
const bool show_chrome = false;
static LLCachedControl<LLRect> profile_rect(gSavedSettings, "WebProfileRect");
- LLFloaterWebContent::create(url, "", agent_id.asString(), show_chrome, profile_rect);
+ LLFloaterWebContent::create(LLFloaterWebContent::Params().
+ url(url).
+ id(agent_id).
+ show_chrome(show_chrome).
+ preferred_media_size(profile_rect));
}
// static
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index d5806e375c..e9710c41a1 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -70,21 +70,25 @@ public:
}
// create the LLSD arguments for the search floater
- LLSD args;
- args["category"] = category;
- args["id"] = LLURI::unescape(search_text);
+ LLFloaterSearch::Params p;
+ p.category = category;
+ p.query = LLURI::unescape(search_text);
// open the search floater and perform the requested search
- LLFloaterReg::showInstance("search", args);
+ LLFloaterReg::showInstance("search", p);
return true;
}
};
LLSearchHandler gSearchHandler;
+LLFloaterSearch::_Params::_Params()
+: category("category", ""),
+ query("query")
+{}
+
+
LLFloaterSearch::LLFloaterSearch(const LLSD& key) :
- LLFloater(key),
- LLViewerMediaObserver(),
- mBrowser(NULL),
+ LLFloaterWebContent(key),
mSearchGodLevel(0)
{
// declare a map that transforms a category name into
@@ -102,53 +106,43 @@ LLFloaterSearch::LLFloaterSearch(const LLSD& key) :
BOOL LLFloaterSearch::postBuild()
{
- mBrowser = getChild<LLMediaCtrl>("browser");
- mBrowser->addObserver(this);
+ LLFloaterWebContent::postBuild();
+ mWebBrowser->addObserver(this);
return TRUE;
}
void LLFloaterSearch::onOpen(const LLSD& key)
{
+ LLFloaterWebContent::onOpen(key);
search(key);
}
void LLFloaterSearch::onClose(bool app_quitting)
{
+ LLFloaterWebContent::onClose(app_quitting);
// tear down the web view so we don't show the previous search
// result when the floater is opened next time
destroy();
}
-void LLFloaterSearch::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event)
-{
- switch (event)
- {
- case MEDIA_EVENT_NAVIGATE_BEGIN:
- getChild<LLUICtrl>("status_text")->setValue(getString("loading_text"));
- break;
-
- case MEDIA_EVENT_NAVIGATE_COMPLETE:
- getChild<LLUICtrl>("status_text")->setValue(getString("done_text"));
- break;
-
- default:
- break;
- }
-}
-
void LLFloaterSearch::godLevelChanged(U8 godlevel)
{
// search results can change based upon god level - if the user
// changes god level, then give them a warning (we don't refresh
// the search as this might undo any page navigation or
// AJAX-driven changes since the last search).
- getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
+
+ //FIXME: set status bar text
+
+ //getChildView("refresh_search")->setVisible( (godlevel != mSearchGodLevel));
}
void LLFloaterSearch::search(const LLSD &key)
{
- if (! mBrowser)
+ Params p(key);
+
+ if (! mWebBrowser || !p.validateBlock())
{
return;
}
@@ -159,10 +153,9 @@ void LLFloaterSearch::search(const LLSD &key)
// work out the subdir to use based on the requested category
LLSD subs;
- std::string category = key.has("category") ? key["category"].asString() : "";
- if (mCategoryPaths.has(category))
+ if (mCategoryPaths.has(p.category))
{
- subs["CATEGORY"] = mCategoryPaths[category].asString();
+ subs["CATEGORY"] = mCategoryPaths[p.category].asString();
}
else
{
@@ -170,8 +163,7 @@ void LLFloaterSearch::search(const LLSD &key)
}
// add the search query string
- std::string search_text = key.has("id") ? key["id"].asString() : "";
- subs["QUERY"] = LLURI::escape(search_text);
+ subs["QUERY"] = LLURI::escape(p.query);
// add the permissions token that login.cgi gave us
// We use "search_token", and fallback to "auth_token" if not present.
@@ -207,5 +199,5 @@ void LLFloaterSearch::search(const LLSD &key)
url = LLWeb::expandURLSubstitutions(url, subs);
// and load the URL in the web view
- mBrowser->navigateTo(url, "text/html");
+ mWebBrowser->navigateTo(url, "text/html");
}
diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h
index ba4dc4c0fa..2c59fa6d5d 100644
--- a/indra/newview/llfloatersearch.h
+++ b/indra/newview/llfloatersearch.h
@@ -28,7 +28,7 @@
#ifndef LL_LLFLOATERSEARCH_H
#define LL_LLFLOATERSEARCH_H
-#include "llfloater.h"
+#include "llfloaterwebcontent.h"
#include "llviewermediaobserver.h"
#include <string>
@@ -43,10 +43,19 @@ class LLMediaCtrl;
/// so that the user can click on teleport links in search results.
///
class LLFloaterSearch :
- public LLFloater,
- public LLViewerMediaObserver
+ public LLFloaterWebContent
{
public:
+ struct _Params : public LLInitParam::Block<_Params, LLFloaterWebContent::_Params>
+ {
+ Optional<std::string> category;
+ Optional<std::string> query;
+
+ _Params();
+ };
+
+ typedef LLSDParamAdapter<_Params> Params;
+
LLFloaterSearch(const LLSD& key);
/// show the search floater with a new search
@@ -70,10 +79,6 @@ public:
private:
/*virtual*/ BOOL postBuild();
- // inherited from LLViewerMediaObserver
- /*virtual*/ void handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event);
-
- LLMediaCtrl *mBrowser;
LLSD mCategoryPaths;
U8 mSearchGodLevel;
};
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 43eecbf048..4cc29267da 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -40,8 +40,16 @@
#include "llfloaterwebcontent.h"
+LLFloaterWebContent::_Params::_Params()
+: url("url"),
+ target("target"),
+ id("id"),
+ show_chrome("show_chrome", true),
+ preferred_media_size("preferred_media_size")
+{}
+
LLFloaterWebContent::LLFloaterWebContent( const LLSD& key )
- : LLFloater( key )
+: LLFloater( key )
{
mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
@@ -75,6 +83,12 @@ BOOL LLFloaterWebContent::postBuild()
return TRUE;
}
+bool LLFloaterWebContent::matchesKey(const LLSD& key)
+{
+ return key["target"].asString() == mKey["target"].asString();
+}
+
+
void LLFloaterWebContent::initializeURLHistory()
{
// start with an empty list
@@ -99,30 +113,23 @@ void LLFloaterWebContent::initializeURLHistory()
}
//static
-void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid, bool show_chrome, const LLRect& preferred_media_size)
+void LLFloaterWebContent::create( Params p)
{
- lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
+ lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id().asString() << llendl;
- std::string tag = target;
+ if (!p.id.isProvided())
+ {
+ p.id = LLUUID::generateNewID();
+ }
- if(target.empty() || target == "_blank")
+ if(!p.target.isProvided() || p.target() == "_blank")
{
- if(!uuid.empty())
- {
- tag = uuid;
- }
- else
- {
- // create a unique tag for this instance
- LLUUID id;
- id.generate();
- tag = id.asString();
- }
+ p.target = p.id().asString();
}
S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
- if(LLFloaterReg::findInstance("web_content", tag) != NULL)
+ if(LLFloaterReg::findInstance("web_content", p.target()) != NULL)
{
// There's already a web browser for this tag, so we won't be opening a new window.
}
@@ -136,7 +143,7 @@ void LLFloaterWebContent::create( const std::string &url, const std::string& tar
for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
{
- lldebugs << " " << (*iter)->getKey() << llendl;
+ lldebugs << " " << (*iter)->getKey()["target"] << llendl;
}
if(instances.size() >= (size_t)browser_window_limit)
@@ -146,30 +153,7 @@ void LLFloaterWebContent::create( const std::string &url, const std::string& tar
}
}
- LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag));
- llassert(browser);
- if(browser)
- {
- browser->mUUID = uuid;
-
- // tell the browser instance to load the specified URL
- browser->open_media(url, target);
- LLViewerMedia::proxyWindowOpened(target, uuid);
-
- browser->getChild<LLLayoutPanel>("status_bar")->setVisible(show_chrome);
- browser->getChild<LLLayoutPanel>("nav_controls")->setVisible(show_chrome);
-
- if (!show_chrome)
- {
- browser->setResizeLimits(100, 100);
- }
-
- if (!preferred_media_size.isEmpty())
- {
- //ignore x, y for now
- browser->geometryChanged(browser->getRect().mLeft, browser->getRect().mBottom, preferred_media_size.getWidth(), preferred_media_size.getHeight());
- }
- }
+ LLFloaterReg::showInstance("web_content", p);
}
//static
@@ -227,13 +211,45 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
setShape(geom);
}
-void LLFloaterWebContent::open_media(const std::string& web_url, const std::string& target)
+void LLFloaterWebContent::open_media(const Params& p)
{
// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
- mWebBrowser->setHomePageUrl(web_url, "text/html");
- mWebBrowser->setTarget(target);
- mWebBrowser->navigateTo(web_url, "text/html");
- set_current_url(web_url);
+ LLViewerMedia::proxyWindowOpened(p.target(), p.id().asString());
+ mWebBrowser->setHomePageUrl(p.url, "text/html");
+ mWebBrowser->setTarget(p.target);
+ mWebBrowser->navigateTo(p.url, "text/html");
+ set_current_url(p.url);
+
+ getChild<LLLayoutPanel>("status_bar")->setVisible(p.show_chrome);
+ getChild<LLLayoutPanel>("nav_controls")->setVisible(p.show_chrome);
+
+ if (!p.show_chrome)
+ {
+ setResizeLimits(100, 100);
+ }
+
+ if (!p.preferred_media_size().isEmpty())
+ {
+ //ignore x, y for now
+ geometryChanged(getRect().mLeft, getRect().mBottom, p.preferred_media_size().getWidth(), p.preferred_media_size().getHeight());
+ }
+
+}
+
+void LLFloaterWebContent::onOpen(const LLSD& key)
+{
+ Params params(key);
+
+ if (!params.validateBlock())
+ {
+ closeFloater();
+ return;
+ }
+
+ mUUID = params.id().asString();
+
+ // tell the browser instance to load the specified URL
+ open_media(params);
}
//virtual
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 56b6ef12c8..2cb6bd0831 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -29,6 +29,7 @@
#include "llfloater.h"
#include "llmediactrl.h"
+#include "llsdparam.h"
class LLMediaCtrl;
class LLComboBox;
@@ -42,20 +43,37 @@ class LLFloaterWebContent :
{
public:
LOG_CLASS(LLFloaterWebContent);
+
+ struct _Params : public LLInitParam::Block<_Params>
+ {
+ Optional<std::string> url,
+ target;
+ Optional<LLUUID> id;
+ Optional<bool> show_chrome;
+ Optional<LLRect> preferred_media_size;
+
+ _Params();
+ };
+
+ typedef LLSDParamAdapter<_Params> Params;
+
LLFloaterWebContent(const LLSD& key);
void initializeURLHistory();
- static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null, bool show_chrome = true, const LLRect& preferred_media_size = LLRect() );
+ static void create(Params);
static void closeRequest(const std::string &uuid);
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 onOpen(const LLSD& key);
+ /* virtual */ bool matchesKey(const LLSD& key);
/* virtual */ void onClose(bool app_quitting);
/* virtual */ void draw();
+protected:
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
@@ -66,8 +84,7 @@ public:
void onEnterAddress();
void onPopExternal();
-private:
- void open_media(const std::string& media_url, const std::string& target);
+ void open_media(const Params& );
void set_current_url(const std::string& url);
LLMediaCtrl* mWebBrowser;
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index b8832dfd8e..9d54ad7463 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -716,7 +716,7 @@ void LLNavigationBar::handleLoginComplete()
void LLNavigationBar::invokeSearch(std::string search_text)
{
- LLFloaterReg::showInstance("search", LLSD().with("category", "all").with("id", LLSD(search_text)));
+ LLFloaterReg::showInstance("search", LLSD().with("category", "all").with("query", LLSD(search_text)));
}
void LLNavigationBar::clearHistoryCache()
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 6ae8e79be4..0e58f54f8b 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -274,7 +274,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>);
LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
- LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
+ LLFloaterReg::add("search", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
LLFloaterUIPreviewUtil::registerFloater();
LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload");
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index b73017a51a..e4cdfaaaaf 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -81,19 +81,20 @@ void LLWeb::initClass()
// static
void LLWeb::loadURL(const std::string& url, const std::string& target, const std::string& uuid)
{
- if(target == "_internal")
- {
- // Force load in the internal browser, as if with a blank target.
- loadURLInternal(url, "", uuid);
- }
- else if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external"))
- {
- loadURLExternal(url);
- }
- else
- {
- loadURLInternal(url, target, uuid);
- }
+ loadWebURL(url, target, uuid);
+ //if(target == "_internal")
+ //{
+ // // Force load in the internal browser, as if with a blank target.
+ // loadURLInternal(url, "", uuid);
+ //}
+ //else if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external"))
+ //{
+ // loadURLExternal(url);
+ //}
+ //else
+ //{
+ // loadURLInternal(url, target, uuid);
+ //}
}
// static
@@ -124,17 +125,15 @@ void LLWeb::loadURLInternal(const std::string &url, const std::string& target, c
// Explicitly open a Web URL using the Web content floater
void LLWeb::loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
{
- LLFloaterWebContent::create(url, target, uuid);
+ LLFloaterWebContent::create(LLFloaterWebContent::Params().url(url).target(target).id(LLUUID(uuid)));
}
-
// static
void LLWeb::loadURLExternal(const std::string& url, const std::string& uuid)
{
loadURLExternal(url, true, uuid);
}
-
// static
void LLWeb::loadURLExternal(const std::string& url, bool async, const std::string& uuid)
{
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 8cdb615686..265d5dc801 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1752,13 +1752,13 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
case MAP_ITEM_LAND_FOR_SALE_ADULT:
{
LLFloaterReg::hideInstance("world_map");
- LLFloaterReg::showInstance("search", LLSD().with("category", "destinations").with("id", id));
+ LLFloaterReg::showInstance("search", LLSD().with("category", "destinations").with("query", id));
break;
}
case MAP_ITEM_CLASSIFIED:
{
LLFloaterReg::hideInstance("world_map");
- LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("id", id));
+ LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("query", id));
break;
}
default:
diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml
deleted file mode 100644
index 8770ede7e9..0000000000
--- a/indra/newview/skins/default/xui/en/floater_search.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<floater
- legacy_header_height="13"
- can_resize="true"
- height="600"
- layout="topleft"
- min_height="400"
- min_width="450"
- name="floater_search"
- help_topic="floater_search"
- save_rect="true"
- save_visibility="true"
- single_instance="true"
- title="FIND"
- width="650">
- <floater.string
- name="loading_text">
- Loading...
- </floater.string>
- <floater.string
- name="done_text">
- Done
- </floater.string>
- <layout_stack
- height="580"
- follows="left|right|top|bottom"
- layout="topleft"
- left="10"
- name="stack1"
- top="20"
- width="630">
- <layout_panel
- height="570"
- layout="topleft"
- left_delta="0"
- top_delta="0"
- name="browser_layout"
- user_resize="false"
- width="630">
- <web_browser
- trusted_content="true"
- follows="left|right|top|bottom"
- layout="topleft"
- left="0"
- name="browser"
- top="0"
- height="540"
- width="630" />
- <text
- follows="bottom|left"
- height="16"
- layout="topleft"
- left_delta="0"
- name="status_text"
- top_pad="10"
- width="150" />
- <text
- visible="false"
- follows="bottom|right"
- height="16"
- left_delta="0"
- name="refresh_search"
- left_pad="0"
- right="-10"
- halign="right"
- width="450">
- Redo search to reflect current God level
- </text>
- </layout_panel>
- </layout_stack>
-</floater>