mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:57:00 +02:00
remove nullptr request checks in AssetMappingsScriptingInterface
This commit is contained in:
parent
99718e9c4e
commit
fccad7dca4
1 changed files with 37 additions and 61 deletions
|
@ -51,7 +51,6 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback
|
|||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
auto request = assetClient->createGetMappingRequest(path);
|
||||
|
||||
if (request) {
|
||||
connect(request, &GetMappingRequest::finished, this, [this, callback](GetMappingRequest* request) mutable {
|
||||
QJSValueList args { uint8_t(request->getError()), request->getHash() };
|
||||
|
||||
|
@ -62,18 +61,12 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback
|
|||
});
|
||||
|
||||
request->start();
|
||||
} else {
|
||||
// not connected to an Asset Server, return network error
|
||||
QJSValueList args { uint8_t(MappingRequest::NetworkError) };
|
||||
callback.call(args);
|
||||
}
|
||||
}
|
||||
|
||||
void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue callback) {
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
auto request = assetClient->createDeleteMappingsRequest(paths);
|
||||
|
||||
if (request) {
|
||||
connect(request, &DeleteMappingsRequest::finished, this, [this, callback](DeleteMappingsRequest* request) mutable {
|
||||
QJSValueList args { uint8_t(request->getError()) };
|
||||
|
||||
|
@ -84,18 +77,12 @@ void AssetMappingsScriptingInterface::deleteMappings(QStringList paths, QJSValue
|
|||
});
|
||||
|
||||
request->start();
|
||||
} else {
|
||||
// not connected to an Asset Server, return network error
|
||||
QJSValueList args { uint8_t(MappingRequest::NetworkError) };
|
||||
callback.call(args);
|
||||
}
|
||||
}
|
||||
|
||||
void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
auto request = assetClient->createGetAllMappingsRequest();
|
||||
|
||||
if (request) {
|
||||
connect(request, &GetAllMappingsRequest::finished, this, [this, callback](GetAllMappingsRequest* request) mutable {
|
||||
auto mappings = request->getMappings();
|
||||
auto map = callback.engine()->newObject();
|
||||
|
@ -113,18 +100,12 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
|
|||
});
|
||||
|
||||
request->start();
|
||||
} else {
|
||||
// not connected to an Asset Server, return network error
|
||||
QJSValueList args { uint8_t(MappingRequest::NetworkError) };
|
||||
callback.call(args);
|
||||
}
|
||||
}
|
||||
|
||||
void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString newPath, QJSValue callback) {
|
||||
auto assetClient = DependencyManager::get<AssetClient>();
|
||||
auto request = assetClient->createRenameMappingRequest(oldPath, newPath);
|
||||
|
||||
if (request) {
|
||||
connect(request, &RenameMappingRequest::finished, this, [this, callback](RenameMappingRequest* request) mutable {
|
||||
QJSValueList args { uint8_t(request->getError()) };
|
||||
|
||||
|
@ -135,11 +116,6 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new
|
|||
});
|
||||
|
||||
request->start();
|
||||
} else {
|
||||
// not connected to an Asset Server, return network error
|
||||
QJSValueList args { uint8_t(MappingRequest::NetworkError) };
|
||||
callback.call(args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue