This replaces those uses with QMultiHash and QMultiMap
Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 17 files). Show all
Unified · Split
| @@ -69,7 +69,7 @@ ScriptEngines::ScriptEngines(ScriptEngine::Context context, const QUrl& defaultS · 68 unmodified lines | |||
| 69 | : _context(context), _defaultScriptsOverride(defaultScriptsOverride) | 69 | : _context(context), _defaultScriptsOverride(defaultScriptsOverride) |
| 70 | { | 70 | { |
| 71 | scriptGatekeeper.initialize(); | 71 | scriptGatekeeper.initialize(); |
| 72 | 72 | ||
| 73 | _scriptsModelFilter.setSourceModel(&_scriptsModel); | 73 | _scriptsModelFilter.setSourceModel(&_scriptsModel); |
| 74 | _scriptsModelFilter.sort(0, Qt::AscendingOrder); | 74 | _scriptsModelFilter.sort(0, Qt::AscendingOrder); |
| 75 | _scriptsModelFilter.setDynamicSortFilter(true); | 75 | _scriptsModelFilter.setDynamicSortFilter(true); |
| @@ -198,7 +198,7 @@ void ScriptEngines::shutdownScripting() { · 122 unmodified lines | |||
| 198 | * @typedef {object} ScriptDiscoveryService.PublicScript | 198 | * @typedef {object} ScriptDiscoveryService.PublicScript |
| 199 | * @property {string} name - The script's file name. | 199 | * @property {string} name - The script's file name. |
| 200 | * @property {string} type - <code>"script"</code> or <code>"folder"</code>. | 200 | * @property {string} type - <code>"script"</code> or <code>"folder"</code>. |
| 201 | * <p class="important">Deprecated: This property is deprecated and will be removed. It currently always has the value, | 201 | * <p class="important">Deprecated: This property is deprecated and will be removed. It currently always has the value, |
| 202 | * <code>"script"</code>.</p> | 202 | * <code>"script"</code>.</p> |
| 203 | * @property {ScriptDiscoveryService.PublicScript[]} [children] - Only present if <code>type == "folder"</code>. | 203 | * @property {ScriptDiscoveryService.PublicScript[]} [children] - Only present if <code>type == "folder"</code>. |
| 204 | * <p class="important">Deprecated: This property is deprecated and will be removed. It currently is never present. | 204 | * <p class="important">Deprecated: This property is deprecated and will be removed. It currently is never present. |
| @@ -266,7 +266,7 @@ QVariantList ScriptEngines::getLocal() { · 61 unmodified lines | |||
| 266 | /*@jsdoc | 266 | /*@jsdoc |
| 267 | * Information on a running script. | 267 | * Information on a running script. |
| 268 | * @typedef {object} ScriptDiscoveryService.RunningScript | 268 | * @typedef {object} ScriptDiscoveryService.RunningScript |
| 269 | * @property {boolean} local - <code>true</code> if the script is a local file (i.e., the scheme is "file"), <code>false</code> | 269 | * @property {boolean} local - <code>true</code> if the script is a local file (i.e., the scheme is "file"), <code>false</code> |
| 270 | * if it isn't (e.g., the scheme is "http"). | 270 | * if it isn't (e.g., the scheme is "http"). |
| 271 | * @property {string} name - The script's file name. | 271 | * @property {string} name - The script's file name. |
| 272 | * @property {string} path - The script's path and file name — excluding the scheme if a local file. | 272 | * @property {string} path - The script's path and file name — excluding the scheme if a local file. |
| @@ -448,7 +448,7 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) { · 175 unmodified lines | |||
| 448 | 448 | ||
| 449 | QReadLocker lock(&_scriptEnginesHashLock); | 449 | QReadLocker lock(&_scriptEnginesHashLock); |
| 450 | if (_scriptEnginesHash.contains(scriptURL)) { | 450 | if (_scriptEnginesHash.contains(scriptURL)) { |
| 451 | ScriptEnginePointer scriptEngine = _scriptEnginesHash[scriptURL]; | 451 | ScriptEnginePointer scriptEngine = _scriptEnginesHash.value(scriptURL); |
| 452 | if (restart) { | 452 | if (restart) { |
| 453 | bool isUserLoaded = scriptEngine->isUserLoaded(); | 453 | bool isUserLoaded = scriptEngine->isUserLoaded(); |
| 454 | ScriptEngine::Type type = scriptEngine->getType(); | 454 | ScriptEngine::Type type = scriptEngine->getType(); |
| @@ -561,7 +561,7 @@ void ScriptEngines::onScriptEngineLoaded(const QString& rawScriptURL) { · 106 unmodified lines | |||
| 561 | QWriteLocker lock(&_scriptEnginesHashLock); | 561 | QWriteLocker lock(&_scriptEnginesHashLock); |
| 562 | QUrl url = QUrl(rawScriptURL); | 562 | QUrl url = QUrl(rawScriptURL); |
| 563 | QUrl normalized = normalizeScriptURL(url); | 563 | QUrl normalized = normalizeScriptURL(url); |
| 564 | _scriptEnginesHash.insertMulti(normalized, scriptEngine); | 564 | _scriptEnginesHash.insert(normalized, scriptEngine); |
| 565 | } | 565 | } |
| 566 | 566 | ||
| 567 | // Update settings with new script | 567 | // Update settings with new script |