Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 3 files). Show all
Unified · Split
| @@ -156,7 +156,7 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL, · 155 unmodified lines | |||
| 156 | } else { | 156 | } else { |
| 157 | NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); | 157 | NetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); |
| 158 | QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); | 158 | QNetworkReply* reply = networkAccessManager.get(QNetworkRequest(url)); |
| 159 | qDebug() << "Downloading included script at" << url; | 159 | qDebug() << "Downloading script at" << url; |
| 160 | QEventLoop loop; | 160 | QEventLoop loop; |
| 161 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); | 161 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); |
| 162 | loop.exec(); | 162 | loop.exec(); |
| @@ -681,12 +681,12 @@ void ScriptEngine::include(const QString& includeFile) { · 518 unmodified lines | |||
| 681 | #endif | 681 | #endif |
| 682 | QFile scriptFile(fileName); | 682 | QFile scriptFile(fileName); |
| 683 | if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { | 683 | if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { |
| 684 | qDebug() << "Loading file:" << fileName; | 684 | qDebug() << "Including file:" << fileName; |
| 685 | QTextStream in(&scriptFile); | 685 | QTextStream in(&scriptFile); |
| 686 | includeContents = in.readAll(); | 686 | includeContents = in.readAll(); |
| 687 | } else { | 687 | } else { |
| 688 | qDebug() << "ERROR Loading file:" << fileName; | 688 | qDebug() << "ERROR Including file:" << fileName; |
| 689 | emit errorMessage("ERROR Loading file:" + fileName); | 689 | emit errorMessage("ERROR Including file:" + fileName); |
| 690 | } | 690 | } |
| 691 | } | 691 | } |
| 692 | 692 | ||
| @@ -699,6 +699,11 @@ void ScriptEngine::include(const QString& includeFile) { · 6 unmodified lines | |||
| 699 | } | 699 | } |
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | void ScriptEngine::load(const QString& loadFile) { | ||
| 703 | QUrl url = resolveInclude(loadFile); | ||
| 704 | emit loadScript(url.toString()); | ||
| 705 | } | ||
| 706 | |||
| 702 | void ScriptEngine::nodeKilled(SharedNodePointer node) { | 707 | void ScriptEngine::nodeKilled(SharedNodePointer node) { |
| 703 | _outgoingScriptAudioSequenceNumbers.remove(node->getUUID()); | 708 | _outgoingScriptAudioSequenceNumbers.remove(node->getUUID()); |
| 704 | } | 709 | } |