mirror of
https://github.com/lubosz/overte.git
synced 2025-04-28 07:05:52 +02:00
commit
df27de3c73
2 changed files with 8 additions and 2 deletions
|
@ -3523,12 +3523,13 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript
|
||||||
} else {
|
} else {
|
||||||
// start the script on a new thread...
|
// start the script on a new thread...
|
||||||
scriptEngine = new ScriptEngine(scriptUrl, &_controllerScriptingInterface);
|
scriptEngine = new ScriptEngine(scriptUrl, &_controllerScriptingInterface);
|
||||||
_scriptEnginesHash.insert(scriptURLString, scriptEngine);
|
|
||||||
|
|
||||||
if (!scriptEngine->hasScript()) {
|
if (!scriptEngine->hasScript()) {
|
||||||
qDebug() << "Application::loadScript(), script failed to load...";
|
qDebug() << "Application::loadScript(), script failed to load...";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_scriptEnginesHash.insert(scriptURLString, scriptEngine);
|
||||||
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,12 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||||
loop.exec();
|
loop.exec();
|
||||||
_scriptContents = reply->readAll();
|
if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {
|
||||||
|
_scriptContents = reply->readAll();
|
||||||
|
} else {
|
||||||
|
qDebug() << "ERROR Loading file:" << url.toString();
|
||||||
|
emit errorMessage("ERROR Loading file:" + url.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue