Initial moap commit. /VERY/ WIP. Primarily committed to clean up unstaged changes. Do not run this, even if it may compile, as it will NOT work (for a myriad of reasons)!

This commit is contained in:
Shyotl
2013-05-31 05:33:41 -05:00
parent 641ada030e
commit ef3e918558
148 changed files with 15636 additions and 4633 deletions

View File

@@ -40,43 +40,117 @@
#include "llagent.h"
#include "llappviewer.h"
#include "llfloatermediabrowser.h"
#include "llfloaterwebcontent.h"
#include "llparcel.h"
#include "llsd.h"
#include "llui.h"
#include "lluri.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
#include "llviewernetwork.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llnotificationsutil.h"
#include "llalertdialog.h"
#include "sgversion.h"
bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async );
class URLLoader : public LLAlertDialog::URLLoader
{
virtual void load(const std::string& url , bool force_open_externally)
{
if (force_open_externally)
{
LLWeb::loadURLExternal(url);
}
else
{
LLWeb::loadURL(url);
}
}
};
static URLLoader sAlertURLLoader;
// static
void LLWeb::initClass()
{
LLAlertDialog::setURLLoader(&sAlertURLLoader);
}
// static
void LLWeb::loadURL(const std::string& url)
void LLWeb::loadURL(const std::string& url, const std::string& target, const std::string& uuid)
{
if (gSavedSettings.getBOOL("UseExternalBrowser"))
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
{
LLFloaterMediaBrowser::showInstance(url);
loadURLInternal(url, target, uuid);
}
}
// static
void LLWeb::loadURLExternal(const std::string& url)
// Explicitly open a Web URL using the Web content floater
void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
{
std::string escaped_url = escapeURL(url);
gViewerWindow->getWindow()->spawnWebBrowser(escaped_url,true);
LLFloaterWebContent::Params p;
p.url(url).target(target).id(uuid);
LLFloaterWebContent::showInstance("web_content", p);
}
// 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)
{
// Act like the proxy window was closed, since we won't be able to track targeted windows in the external browser.
LLViewerMedia::proxyWindowClosed(uuid);
if(gSavedSettings.getBOOL("DisableExternalBrowser"))
{
// Don't open an external browser under any circumstances.
llwarns << "Blocked attempt to open external browser." << llendl;
return;
}
LLSD payload;
payload["url"] = url;
LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, boost::bind(on_load_url_external_response, _1, _2, async));
}
// static
bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async )
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( 0 == option )
{
LLSD payload = notification["payload"];
std::string url = payload["url"].asString();
std::string escaped_url = LLWeb::escapeURL(url);
if (gViewerWindow)
{
gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
}
}
return false;
}
// static
std::string LLWeb::curlEscape(const std::string& url)
@@ -153,6 +227,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["VERSION_BUILD"] = gVersionBuild;
substitution["CHANNEL"] = gVersionChannel;
substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel();
substitution["GRID_LOWERCASE"] = utf8str_tolower(LLViewerLogin::getInstance()->getGridLabel());
substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
substitution["SESSION_ID"] = gAgent.getSessionID();
substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
@@ -191,12 +266,3 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
return LLWeb::escapeURL(expanded_url);
}
// virtual
void LLWeb::URLLoader::load(const std::string& url)
{
loadURL(url);
}
// static
LLWeb::URLLoader LLWeb::sAlertURLLoader;