History

Merge remote-tracking branch 'upstream/master' into kasenvr-kpi-v1-modkit-rc-merge

humbletim committed 7 years ago

Commit 271fac42 parents bad32e9 96f67931529 files · +58136 −6493Browse files

Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 1529 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngines.cpp+33−3
@@ -191,6 +191,18 @@ void ScriptEngines::shutdownScripting() { · 190 unmodified lines
191191 qCDebug(scriptengine) << "DONE Stopping all scripts....";
192192 }
193193
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 &mdash; including the <code>"file:///"</code> scheme at the start.
204+ * <p>Only present if <code>type == "script"</code>.</p>
205+ */
194206 QVariantList getPublicChildNodes(TreeNodeFolder* parent) {
195207 QVariantList result;
196208 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(parent);
@@ -222,6 +234,13 @@ QVariantList ScriptEngines::getPublic() { · 25 unmodified lines
222234 return getPublicChildNodes(NULL);
223235 }
224236
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+ */
225244 QVariantList ScriptEngines::getLocal() {
226245 QVariantList result;
227246 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(NULL);
@@ -242,6 +261,15 @@ QVariantList ScriptEngines::getLocal() { · 14 unmodified lines
242261 return result;
243262 }
244263
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 &mdash; excluding the scheme if a local file.
271+ * @property {string} url - The full URL of the script &mdash; including the scheme if a local file.
272+ */
245273 QVariantList ScriptEngines::getRunning() {
246274 QVariantList result;
247275 auto runningScripts = getRunningScripts();
@@ -334,6 +362,7 @@ void ScriptEngines::saveScripts() { · 86 unmodified lines
334362 // the scripts that the user expects to be there when launched without the
335363 // --scripts override.
336364 if (_defaultScriptsLocationOverridden) {
365+ runningScriptsHandle.set(QVariantList{ DEFAULT_SCRIPTS_LOCATION });
337366 return;
338367 }
339368
@@ -383,13 +412,14 @@ void ScriptEngines::stopAllScripts(bool restart) { · 43 unmodified lines
383412 continue;
384413 }
385414
415+ bool isOverrideScript = it.key().toString().compare(this->_defaultScriptsOverride.toString());
386416 // queue user scripts if restarting
387− if (restart && scriptEngine->isUserLoaded()) {
417+ if (restart && (scriptEngine->isUserLoaded() || isOverrideScript)) {
388418 _isReloading = true;
389419 ScriptEngine::Type type = scriptEngine->getType();
390420
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);
393423 });
394424 }
395425