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(); }
UserScript::UserScript(const UserScript &other) : QSharedData(other) { if (other.isNull()) return; scriptData.reset(new UserScriptData(*other.scriptData)); m_name = other.m_name; }
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); }
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); } }
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(); }
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); }