Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 49 files). Show all
Unified · Split
| @@ -422,7 +422,7 @@ void ScriptEngines::stopAllScripts(bool restart) { · 421 unmodified lines | |||
| 422 | _isReloading = true; | 422 | _isReloading = true; |
| 423 | ScriptManager::Type type = scriptManager->getType(); | 423 | ScriptManager::Type type = scriptManager->getType(); |
| 424 | 424 | ||
| 425 | connect(scriptManager.data(), &ScriptManager::finished, this, [this, type, isOverrideScript](QString scriptName) { | 425 | connect(scriptManager.get(), &ScriptManager::finished, this, [this, type, isOverrideScript](QString scriptName) { |
| 426 | reloadScript(scriptName, !isOverrideScript)->setType(type); | 426 | reloadScript(scriptName, !isOverrideScript)->setType(type); |
| 427 | }); | 427 | }); |
| 428 | } | 428 | } |
| @@ -458,7 +458,7 @@ bool ScriptEngines::stopScript(const QString& rawScriptURL, bool restart) { · 29 unmodified lines | |||
| 458 | scriptCache->deleteScript(scriptURL); | 458 | scriptCache->deleteScript(scriptURL); |
| 459 | 459 | ||
| 460 | if (!scriptManager->isStopping()) { | 460 | if (!scriptManager->isStopping()) { |
| 461 | connect(scriptManager.data(), &ScriptManager::finished, | 461 | connect(scriptManager.get(), &ScriptManager::finished, |
| 462 | this, [this, isUserLoaded, type](QString scriptName, ScriptManagerPointer manager) { | 462 | this, [this, isUserLoaded, type](QString scriptName, ScriptManagerPointer manager) { |
| 463 | reloadScript(scriptName, isUserLoaded)->setType(type); | 463 | reloadScript(scriptName, isUserLoaded)->setType(type); |
| 464 | }); | 464 | }); |
| @@ -523,12 +523,12 @@ ScriptManagerPointer ScriptEngines::loadScript(const QUrl& scriptFilename, bool · 58 unmodified lines | |||
| 523 | launchScriptEngine(scriptManager); | 523 | launchScriptEngine(scriptManager); |
| 524 | } else { | 524 | } else { |
| 525 | // connect to the appropriate signals of this script engine | 525 | // connect to the appropriate signals of this script engine |
| 526 | connect(scriptManager.data(), &ScriptManager::scriptLoaded, this, &ScriptEngines::onScriptEngineLoaded); | 526 | connect(scriptManager.get(), &ScriptManager::scriptLoaded, this, &ScriptEngines::onScriptEngineLoaded); |
| 527 | connect(scriptManager.data(), &ScriptManager::errorLoadingScript, this, &ScriptEngines::onScriptEngineError); | 527 | connect(scriptManager.get(), &ScriptManager::errorLoadingScript, this, &ScriptEngines::onScriptEngineError); |
| 528 | 528 | ||
| 529 | // Shutdown Interface when script finishes, if requested | 529 | // Shutdown Interface when script finishes, if requested |
| 530 | if (quitWhenFinished) { | 530 | if (quitWhenFinished) { |
| 531 | connect(scriptManager.data(), &ScriptManager::finished, this, &ScriptEngines::quitWhenFinished); | 531 | connect(scriptManager.get(), &ScriptManager::finished, this, &ScriptEngines::quitWhenFinished); |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | // get the script engine object to load the script at the designated script URL | 534 | // get the script engine object to load the script at the designated script URL |
| @@ -554,7 +554,7 @@ ScriptManagerPointer ScriptEngines::getScriptEngine(const QUrl& rawScriptURL) { · 19 unmodified lines | |||
| 554 | // FIXME - change to new version of ScriptCache loading notification | 554 | // FIXME - change to new version of ScriptCache loading notification |
| 555 | void ScriptEngines::onScriptEngineLoaded(const QString& rawScriptURL) { | 555 | void ScriptEngines::onScriptEngineLoaded(const QString& rawScriptURL) { |
| 556 | UserActivityLogger::getInstance().loadedScript(rawScriptURL); | 556 | UserActivityLogger::getInstance().loadedScript(rawScriptURL); |
| 557 | ScriptManagerPointer scriptEngine = qobject_cast<ScriptManager*>(sender())->sharedFromThis(); | 557 | ScriptManagerPointer scriptEngine = qobject_cast<ScriptManager*>(sender())->shared_from_this(); |
| 558 | 558 | ||
| 559 | launchScriptEngine(scriptEngine); | 559 | launchScriptEngine(scriptEngine); |
| 560 | 560 | ||
| @@ -575,16 +575,18 @@ void ScriptEngines::quitWhenFinished() { · 14 unmodified lines | |||
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | int ScriptEngines::runScriptInitializers(ScriptManagerPointer scriptManager) { | 577 | int ScriptEngines::runScriptInitializers(ScriptManagerPointer scriptManager) { |
| 578 | auto nativeCount = DependencyManager::get<ScriptInitializers>()->runScriptInitializers(scriptManager->engine().data()); | 578 | auto nativeCount = DependencyManager::get<ScriptInitializers>()->runScriptInitializers(scriptManager->engine().get()); |
| 579 | return nativeCount + ScriptInitializerMixin<ScriptManagerPointer>::runScriptInitializers(scriptManager); | 579 | return nativeCount + ScriptInitializerMixin<ScriptManagerPointer>::runScriptInitializers(scriptManager); |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | void ScriptEngines::launchScriptEngine(ScriptManagerPointer scriptManager) { | 582 | void ScriptEngines::launchScriptEngine(ScriptManagerPointer scriptManager) { |
| 583 | connect(scriptManager.data(), &ScriptManager::finished, this, &ScriptEngines::onScriptFinished, Qt::DirectConnection); | 583 | connect(scriptManager.get(), &ScriptManager::finished, this, &ScriptEngines::onScriptFinished, Qt::DirectConnection); |
| 584 | connect(scriptManager.data(), &ScriptManager::loadScript, [this](const QString& scriptName, bool userLoaded) { | 584 | connect(scriptManager.get(), &ScriptManager::loadScript, |
| 585 | [this](const QString& scriptName, bool userLoaded) { | ||
| 585 | loadScript(scriptName, userLoaded); | 586 | loadScript(scriptName, userLoaded); |
| 586 | }); | 587 | }); |
| 587 | connect(scriptManager.data(), &ScriptManager::reloadScript, [this](const QString& scriptName, bool userLoaded) { | 588 | connect(scriptManager.get(), &ScriptManager::reloadScript, |
| 589 | [this](const QString& scriptName, bool userLoaded) { | ||
| 588 | loadScript(scriptName, userLoaded, false, false, true); | 590 | loadScript(scriptName, userLoaded, false, false, true); |
| 589 | }); | 591 | }); |
| 590 | 592 | ||