History

Redownload scripts that are loaded via Script.load() when reloading all

David Rowe committed 11 years ago

Commit 17f7d761 parent 5dab9771 file · +11 −3Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+11−3
@@ -4357,16 +4357,24 @@ void Application::scriptFinished(const QString& scriptName) { · 4356 unmodified lines
4357}4357}
4358 4358
4359void Application::stopAllScripts(bool restart) {4359void Application::stopAllScripts(bool restart) {
4360 auto scriptCache = DependencyManager::get<ScriptCache>();4360 if (restart) {
4361 // Delete all running scripts from cache so that they are re-downloaded when they are restarted
4362 auto scriptCache = DependencyManager::get<ScriptCache>();
4363 for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin();
4364 it != _scriptEnginesHash.constEnd(); it++) {
4365 if (!it.value()->isFinished()) {
4366 scriptCache->deleteScript(it.key());
4367 }
4368 }
4369 }
4361 4370
4362 // stops all current running scripts4371 // Stop and possibly restart all currently running scripts
4363 for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin();4372 for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin();
4364 it != _scriptEnginesHash.constEnd(); it++) {4373 it != _scriptEnginesHash.constEnd(); it++) {
4365 if (it.value()->isFinished()) {4374 if (it.value()->isFinished()) {
4366 continue;4375 continue;
4367 }4376 }
4368 if (restart && it.value()->isUserLoaded()) {4377 if (restart && it.value()->isUserLoaded()) {
4369 scriptCache->deleteScript(it.key());
4370 connect(it.value(), SIGNAL(finished(const QString&)), SLOT(loadScript(const QString&)));4378 connect(it.value(), SIGNAL(finished(const QString&)), SLOT(loadScript(const QString&)));
4371 }4379 }
4372 it.value()->stop();4380 it.value()->stop();