Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -31,13 +31,28 @@ void AssetScriptingInterface::uploadData(QString data, QScriptValue callback) { · 30 unmodified lines | |||
| 31 | QObject::connect(upload, &AssetUpload::finished, this, [this, callback](AssetUpload* upload, const QString& hash) mutable { | 31 | QObject::connect(upload, &AssetUpload::finished, this, [this, callback](AssetUpload* upload, const QString& hash) mutable { |
| 32 | if (callback.isFunction()) { | 32 | if (callback.isFunction()) { |
| 33 | QString url = "atp:" + hash; | 33 | QString url = "atp:" + hash; |
| 34 | QScriptValueList args { url }; | 34 | QScriptValueList args { url, hash }; |
| 35 | callback.call(_engine->currentContext()->thisObject(), args); | 35 | callback.call(_engine->currentContext()->thisObject(), args); |
| 36 | } | 36 | } |
| 37 | upload->deleteLater(); | ||
| 37 | }); | 38 | }); |
| 38 | upload->start(); | 39 | upload->start(); |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 42 | void AssetScriptingInterface::setMapping(QString path, QString hash, QScriptValue callback) { | ||
| 43 | auto setMappingRequest = DependencyManager::get<AssetClient>()->createSetMappingRequest(path, hash); | ||
| 44 | |||
| 45 | QObject::connect(setMappingRequest, &SetMappingRequest::finished, this, [this, callback](SetMappingRequest* request) mutable { | ||
| 46 | if (callback.isFunction()) { | ||
| 47 | QScriptValueList args { }; | ||
| 48 | callback.call(_engine->currentContext()->thisObject(), args); | ||
| 49 | } | ||
| 50 | request->deleteLater(); | ||
| 51 | }); | ||
| 52 | setMappingRequest->start(); | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 41 | void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) { | 56 | void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callback) { |
| 42 | const QString ATP_SCHEME { "atp:" }; | 57 | const QString ATP_SCHEME { "atp:" }; |
| 43 | 58 | ||