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
191 qCDebug(scriptengine) << "DONE Stopping all scripts....";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 &mdash; including the <code>"file:///"</code> scheme at the start.
204 * <p>Only present if <code>type == "script"</code>.</p>
205 */
194QVariantList getPublicChildNodes(TreeNodeFolder* parent) {206QVariantList getPublicChildNodes(TreeNodeFolder* parent) {
195 QVariantList result;207 QVariantList result;
196 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(parent);208 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(parent);
@@ -222,6 +234,13 @@ QVariantList ScriptEngines::getPublic() { · 25 unmodified lines
222 return getPublicChildNodes(NULL);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 */
225QVariantList ScriptEngines::getLocal() {244QVariantList ScriptEngines::getLocal() {
226 QVariantList result;245 QVariantList result;
227 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(NULL);246 QList<TreeNodeBase*> treeNodes = getScriptsModel().getFolderNodes(NULL);
@@ -242,6 +261,15 @@ QVariantList ScriptEngines::getLocal() { · 14 unmodified lines
242 return result;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 &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 */
245QVariantList ScriptEngines::getRunning() {273QVariantList ScriptEngines::getRunning() {
246 QVariantList result;274 QVariantList result;
247 auto runningScripts = getRunningScripts();275 auto runningScripts = getRunningScripts();
@@ -334,6 +362,7 @@ void ScriptEngines::saveScripts() { · 86 unmodified lines
334 // the scripts that the user expects to be there when launched without the362 // the scripts that the user expects to be there when launched without the
335 // --scripts override.363 // --scripts override.
336 if (_defaultScriptsLocationOverridden) {364 if (_defaultScriptsLocationOverridden) {
365 runningScriptsHandle.set(QVariantList{ DEFAULT_SCRIPTS_LOCATION });
337 return;366 return;
338 }367 }
339 368
@@ -383,13 +412,14 @@ void ScriptEngines::stopAllScripts(bool restart) { · 43 unmodified lines
383 continue;412 continue;
384 }413 }
385 414
415 bool isOverrideScript = it.key().toString().compare(this->_defaultScriptsOverride.toString());
386 // queue user scripts if restarting416 // queue user scripts if restarting
387 if (restart && scriptEngine->isUserLoaded()) {417 if (restart && (scriptEngine->isUserLoaded() || isOverrideScript)) {
388 _isReloading = true;418 _isReloading = true;
389 ScriptEngine::Type type = scriptEngine->getType();419 ScriptEngine::Type type = scriptEngine->getType();
390 420
391 connect(scriptEngine.data(), &ScriptEngine::finished, this, [this, type] (QString scriptName) {421 connect(scriptEngine.data(), &ScriptEngine::finished, this, [this, type, isOverrideScript] (QString scriptName) {
392 reloadScript(scriptName, true)->setType(type);422 reloadScript(scriptName, !isOverrideScript)->setType(type);
393 });423 });
394 }424 }
395 425