Exemplo n.º 1
0
void OSRunner::prepareForUserScriptRun(const UserScript& userScript) {
    m_result = OSResult();
    m_measureName = userScript.name();
    std::stringstream ss;
    ss << "openstudio.ruleset." << m_measureName;
    m_channel = ss.str();
}
Exemplo n.º 2
0
UserScript::UserScript(const UserScript &other)
    : QSharedData(other)
{
    if (other.isNull())
        return;
    scriptData.reset(new UserScriptData(*other.scriptData));
    m_name = other.m_name;
}
Exemplo n.º 3
0
	void Plugin::AddScriptToManager (const UserScript& script)
	{
		QString scriptDesc = script.Description ();
		QStandardItem* name = new QStandardItem (script.Name ());
		QStandardItem* description = new QStandardItem (scriptDesc);

		name->setEditable (false);
		name->setData (script.IsEnabled (), EnabledRole);
		description->setEditable (false);
		WrapText (scriptDesc);
		description->setToolTip (scriptDesc);
		description->setData (script.IsEnabled (), EnabledRole);

		QList<QStandardItem*> items;
		items << name << description;
		Model_->appendRow (items);
	}
Exemplo n.º 4
0
void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVector& userScripts, UserScriptInjectionTime injectionTime)
{
    if (userScripts.isEmpty())
        return;

    Document* doc = document();
    if (!doc)
        return;

    Vector<ScriptSourceCode> sourceCode;
    unsigned count = userScripts.size();
    for (unsigned i = 0; i < count; ++i) {
        UserScript* script = userScripts[i].get();
        if (script->injectedFrames() == InjectInTopFrameOnly && ownerElement())
            continue;

        if (script->injectionTime() == injectionTime && UserContentURLPattern::matchesPatterns(doc->url(), script->whitelist(), script->blacklist()))
            m_script.evaluateInWorld(ScriptSourceCode(script->source(), script->url()), world);
    }
}
Exemplo n.º 5
0
bool UserScript::operator==(const UserScript &other) const
{
    if (isNull() != other.isNull())
        return false;
    if (isNull()) // neither is valid
        return true;
    return worldId() == other.worldId()
            && runsOnSubFrames() == other.runsOnSubFrames()
            && injectionPoint() == other.injectionPoint()
            && name() == other.name() && sourceCode() == other.sourceCode();
}
Exemplo n.º 6
0
	void UserScriptInstallerDialog::scriptFetchFinished ()
	{
		QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender ());

		QFile tempScript (TempScriptPath_);
		if (tempScript.open (QFile::ReadWrite))
		{
			tempScript.write (reply->readAll ());
			tempScript.close ();
		}

		UserScript script (TempScriptPath_);
		QString scriptDesc = QString ("<b>%1</b><br />%2<hr />%3<br /><i>%4</i>")
				.arg (script.Name ())
				.arg (script.Description ())
				.arg (tr ("runs on:"))
				.arg (script.Include ().join ("<br />"));

		if (!script.Exclude ().isEmpty ())
			scriptDesc.append (QString ("<br /><br />%1<br /><i>%2</i>")
					.arg (tr ("does not run on:"))
					.arg (script.Exclude ().join ("<br />")));
		Ui_.ScriptInfo_->setHtml (scriptDesc);
	}