Showing the changes to interface/src/scripting/AssetMappingsScriptingInterface.cpp (1 of 19 files). Show all
Unified · Split
| @@ -39,9 +39,7 @@ AssetMappingsScriptingInterface::AssetMappingsScriptingInterface() { · 38 unmodified lines | |||
| 39 | void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJSValue callback) { | 39 | void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJSValue callback) { |
| 40 | auto assetClient = DependencyManager::get<AssetClient>(); | 40 | auto assetClient = DependencyManager::get<AssetClient>(); |
| 41 | auto request = assetClient->createSetMappingRequest(path, hash); | 41 | auto request = assetClient->createSetMappingRequest(path, hash); |
| 42 | #if !defined(Q_OS_ANDROID) | 42 | connect(request, &SetMappingRequest::finished, this, [callback](SetMappingRequest* request) mutable { |
| 43 | // TODO: just to make android compile | ||
| 44 | connect(request, &SetMappingRequest::finished, this, [this, callback](SetMappingRequest* request) mutable { | ||
| 45 | if (callback.isCallable()) { | 43 | if (callback.isCallable()) { |
| 46 | QJSValueList args { request->getErrorString(), request->getPath() }; | 44 | QJSValueList args { request->getErrorString(), request->getPath() }; |
| 47 | callback.call(args); | 45 | callback.call(args); |
| @@ -49,17 +47,13 @@ void AssetMappingsScriptingInterface::setMapping(QString path, QString hash, QJS · 1 unmodified line | |||
| 49 | 47 | ||
| 50 | request->deleteLater(); | 48 | request->deleteLater(); |
| 51 | }); | 49 | }); |
| 52 | #endif | ||
| 53 | |||
| 54 | request->start(); | 50 | request->start(); |
| 55 | } | 51 | } |
| 56 | 52 | ||
| 57 | void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback) { | 53 | void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback) { |
| 58 | auto assetClient = DependencyManager::get<AssetClient>(); | 54 | auto assetClient = DependencyManager::get<AssetClient>(); |
| 59 | auto request = assetClient->createGetMappingRequest(path); | 55 | auto request = assetClient->createGetMappingRequest(path); |
| 60 | #if !defined(Q_OS_ANDROID) | 56 | connect(request, &GetMappingRequest::finished, this, [callback](GetMappingRequest* request) mutable { |
| 61 | // TODO: just to make android compile | ||
| 62 | connect(request, &GetMappingRequest::finished, this, [this, callback](GetMappingRequest* request) mutable { | ||
| 63 | auto hash = request->getHash(); | 57 | auto hash = request->getHash(); |
| 64 | 58 | ||
| 65 | if (callback.isCallable()) { | 59 | if (callback.isCallable()) { |
| @@ -69,7 +63,6 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback · 3 unmodified lines | |||
| 69 | 63 | ||
| 70 | request->deleteLater(); | 64 | request->deleteLater(); |
| 71 | }); | 65 | }); |
| 72 | #endif | ||
| 73 | 66 | ||
| 74 | request->start(); | 67 | request->start(); |
| 75 | } | 68 | } |