mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 07:22:25 +02:00
apply Huffman's feedback to Sam's PR
This commit is contained in:
parent
fd5a5bb104
commit
f90f0ed1f3
2 changed files with 5 additions and 3 deletions
|
@ -70,7 +70,7 @@ mapping2.enable();
|
|||
|
||||
Controller.enableMapping("example2");
|
||||
*/
|
||||
var mapping3 = Controller.loadMapping("E:/Github/hifi/examples/controllers/example3.json");
|
||||
var mapping3 = Controller.loadMapping(Script.resolvePath("example3.json"));
|
||||
Controller.enableMapping("example3");
|
||||
|
||||
/*
|
||||
|
|
|
@ -209,6 +209,7 @@ namespace controller {
|
|||
}
|
||||
|
||||
QObject* ScriptingInterface::loadMapping(const QString& jsonUrl) {
|
||||
QObject* result = nullptr;
|
||||
auto request = ResourceManager::createResourceRequest(nullptr, QUrl(jsonUrl));
|
||||
if (request) {
|
||||
QEventLoop eventLoop;
|
||||
|
@ -220,12 +221,13 @@ namespace controller {
|
|||
}
|
||||
|
||||
if (request->getResult() == ResourceRequest::Success) {
|
||||
return parseMapping(QString(request->getData()));
|
||||
result = parseMapping(QString(request->getData()));
|
||||
} else {
|
||||
qDebug() << "Failed to load mapping url <" << jsonUrl << ">" << endl;
|
||||
return nullptr;
|
||||
}
|
||||
request->deleteLater();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Q_INVOKABLE QObject* newMapping(const QJsonObject& json);
|
||||
|
|
Loading…
Reference in a new issue