mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
Don't use eventLoop, since that will block the UI
This commit is contained in:
parent
249f0568a1
commit
5ee28297f3
1 changed files with 34 additions and 36 deletions
|
@ -233,19 +233,14 @@ bool QmlCommerce::installApp(const QString& itemHref) {
|
|||
|
||||
QUrl appHref(itemHref);
|
||||
|
||||
auto request =
|
||||
std::unique_ptr<ResourceRequest>(DependencyManager::get<ResourceManager>()->createResourceRequest(this, appHref));
|
||||
auto request = DependencyManager::get<ResourceManager>()->createResourceRequest(this, appHref);
|
||||
|
||||
if (!request) {
|
||||
qCDebug(commerce) << "Couldn't create resource request for app.";
|
||||
return false;
|
||||
}
|
||||
|
||||
QEventLoop loop;
|
||||
connect(request.get(), &ResourceRequest::finished, &loop, &QEventLoop::quit);
|
||||
request->send();
|
||||
loop.exec();
|
||||
|
||||
connect(request, &ResourceRequest::finished, this, [=]() {
|
||||
if (request->getResult() != ResourceRequest::Success) {
|
||||
qCDebug(commerce) << "Failed to get .app.json file from remote.";
|
||||
return false;
|
||||
|
@ -277,6 +272,9 @@ bool QmlCommerce::installApp(const QString& itemHref) {
|
|||
|
||||
emit appInstalled(itemHref);
|
||||
return true;
|
||||
});
|
||||
request->send();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QmlCommerce::uninstallApp(const QString& itemHref) {
|
||||
|
|
Loading…
Reference in a new issue