コード例 #1
0
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
	lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl;

	if (!p.id.isProvided())
	{
		p.id = LLUUID::generateNewID().asString();
	}

	if(p.target().empty() || p.target() == "_blank")
	{
		p.target = p.id();
	}

	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
	if(browser_window_limit != 0)
	{
		// showInstance will open a new window.  Figure out how many web 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(p.window_class);
		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()["target"] << llendl;
		}

		if(instances.size() >= (size_t)browser_window_limit)
		{
			// Destroy the least recently opened instance
			(*instances.begin())->closeFloater();
		}
	}
}
コード例 #2
0
ファイル: llimpanel.cpp プロジェクト: mightymarc/SWAMPWATER
void show_log_browser(const std::string& name, const std::string& id)
{
#if LL_WINDOWS // Singu TODO: Other platforms?
	if (gSavedSettings.getBOOL("LiruLegacyLogLaunch"))
	{
		gViewerWindow->getWindow()->ShellEx("\"" + LLLogChat::makeLogFileName(name) + "\"");
		return;
	}
#endif
	LLFloaterWebContent::Params p;
	p.url("file:///" + LLLogChat::makeLogFileName(name));
	p.id(id);
	p.show_chrome(false);
	p.trusted_content(true);
	LLFloaterWebContent::showInstance("log", p); // If we passed id instead of "log", there would be no control over how many log browsers opened at once.
}
コード例 #3
0
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
    LL_DEBUGS() << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << LL_ENDL;

    if (!p.id.isProvided())
    {
        p.id = LLUUID::generateNewID().asString();
    }

    if(p.target().empty() || p.target() == "_blank")
    {
        p.target = p.id();
    }

    S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
    if(browser_window_limit != 0)
    {
        // showInstance will open a new window.  Figure out how many web browsers are already open,
        // and close the least recently opened one if this will put us over the limit.

        std::vector<LLFloaterWebContent*> instances;
        instances.reserve(instanceCount());
        for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
        {
            if(it->mKey["window_class"].asString() == p.window_class.getValue())
                instances.push_back(&*it);
        }

        std::sort(instances.begin(), instances.end(), CompareAgeDescending());

        //LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
        LL_DEBUGS() << "total instance count is " << instances.size() << LL_ENDL;

        for(std::vector<LLFloaterWebContent*>::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
        {
            LL_DEBUGS() << "    " << (*iter)->mKey["target"] << LL_ENDL;
        }

        if(instances.size() >= (size_t)browser_window_limit)
        {
            // Destroy the least recently opened instance
            (*instances.begin())->close();
        }
    }
}
コード例 #4
0
void show_log_browser(const std::string& name, const std::string& id)
{
	const std::string file(LLLogChat::makeLogFileName(name));
	if (gSavedSettings.getBOOL("LiruLegacyLogLaunch"))
	{
#if LL_WINDOWS || LL_DARWIN
		gViewerWindow->getWindow()->ShellEx(file);
#elif LL_LINUX
		// xdg-open might not actually be installed on all distros, but it's our best bet.
		if (!std::system(("/usr/bin/xdg-open \"" + file +'"').c_str())) // 0 = success, otherwise fallback on internal browser.
#endif
		return;
	}
	LLFloaterWebContent::Params p;
	p.url("file:///" + file);
	p.id(id);
	p.show_chrome(false);
	p.trusted_content(true);
	LLFloaterWebContent::showInstance("log", p); // If we passed id instead of "log", there would be no control over how many log browsers opened at once.
}