Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 1529 files). Show all
Unified · Split
| @@ -191,6 +191,18 @@ void ScriptEngines::shutdownScripting() { · 190 unmodified lines | ||
| 191 | 191 | qCDebug(scriptengine) << "DONE Stopping all scripts...."; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | +/**jsdoc | |
| 195 | + * Information on a public script, i.e., a script that's included in the Interface installation. | |
| 196 | + * @typedef {object} ScriptDiscoveryService.PublicScript | |
| 197 | + * @property {string} name - The script's file name. | |
| 198 | + * @property {string} type - <code>"script"</code> or <code>"folder"</code>. | |
| 199 | + * <p class="important">Deprecated: This property is deprecated and will be removed. It currently always has the value, | |
| 200 | + * <code>"script"</code>.</p> | |
| 201 | + * @property {ScriptDiscoveryService.PublicScript[]} [children] - Only present if <code>type == "folder"</code>. | |
| 202 | + * <p class="important">Deprecated: This property is deprecated and will be removed. It currently is never present. | |
| 203 | + * @property {string} [url] - The full URL of the script — including the <code>"file:///"</code> scheme at the start. | |
| 204 | + * <p>Only present if <code>type == "script"</code>.</p> | |
| 205 | + */ | |
| 194 | 206 | QVariantList getPublicChildNodes(TreeNodeFolder* parent) { |
| 195 | 207 | QVariantList result; |
| 196 | 208 | QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(parent); |
| @@ -222,6 +234,13 @@ QVariantList ScriptEngines::getPublic() { · 25 unmodified lines | ||
| 222 | 234 | return getPublicChildNodes(NULL); |
| 223 | 235 | } |
| 224 | 236 | |
| 237 | +/**jsdoc | |
| 238 | + * Information on a local script. | |
| 239 | + * @typedef {object} ScriptDiscoveryService.LocalScript | |
| 240 | + * @property {string} name - The script's file name. | |
| 241 | + * @property {string} path - The script's path. | |
| 242 | + * @deprecated This type is deprecated and will be removed. | |
| 243 | + */ | |
| 225 | 244 | QVariantList ScriptEngines::getLocal() { |
| 226 | 245 | QVariantList result; |
| 227 | 246 | QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(NULL); |
| @@ -242,6 +261,15 @@ QVariantList ScriptEngines::getLocal() { · 14 unmodified lines | ||
| 242 | 261 | return result; |
| 243 | 262 | } |
| 244 | 263 | |
| 264 | +/**jsdoc | |
| 265 | + * Information on a running script. | |
| 266 | + * @typedef {object} ScriptDiscoveryService.RunningScript | |
| 267 | + * @property {boolean} local - <code>true</code> if the script is a local file (i.e., the scheme is "file"), <code>false</code> | |
| 268 | + * if it isn't (e.g., the scheme is "http"). | |
| 269 | + * @property {string} name - The script's file name. | |
| 270 | + * @property {string} path - The script's path and file name — excluding the scheme if a local file. | |
| 271 | + * @property {string} url - The full URL of the script — including the scheme if a local file. | |
| 272 | + */ | |
| 245 | 273 | QVariantList ScriptEngines::getRunning() { |
| 246 | 274 | QVariantList result; |
| 247 | 275 | auto runningScripts = getRunningScripts(); |
| @@ -334,6 +362,7 @@ void ScriptEngines::saveScripts() { · 86 unmodified lines | ||
| 334 | 362 | // the scripts that the user expects to be there when launched without the |
| 335 | 363 | // --scripts override. |
| 336 | 364 | if (_defaultScriptsLocationOverridden) { |
| 365 | + runningScriptsHandle.set(QVariantList{ DEFAULT_SCRIPTS_LOCATION }); | |
| 337 | 366 | return; |
| 338 | 367 | } |
| 339 | 368 | |
| @@ -383,13 +412,14 @@ void ScriptEngines::stopAllScripts(bool restart) { · 43 unmodified lines | ||
| 383 | 412 | continue; |
| 384 | 413 | } |
| 385 | 414 | |
| 415 | + bool isOverrideScript = it.key().toString().compare(this->_defaultScriptsOverride.toString()); | |
| 386 | 416 | // queue user scripts if restarting |
| 387 | − if (restart && scriptEngine->isUserLoaded()) { | |
| 417 | + if (restart && (scriptEngine->isUserLoaded() || isOverrideScript)) { | |
| 388 | 418 | _isReloading = true; |
| 389 | 419 | ScriptEngine::Type type = scriptEngine->getType(); |
| 390 | 420 | |
| 391 | − connect(scriptEngine.data(), &ScriptEngine::finished, this, [this, type] (QString scriptName) { | |
| 392 | − reloadScript(scriptName, true)->setType(type); | |
| 421 | + connect(scriptEngine.data(), &ScriptEngine::finished, this, [this, type, isOverrideScript] (QString scriptName) { | |
| 422 | + reloadScript(scriptName, !isOverrideScript)->setType(type); | |
| 393 | 423 | }); |
| 394 | 424 | } |
| 395 | 425 | |