Don't use eventLoop, since that will block the UI

This commit is contained in:
Zach Fox 2018-02-23 10:19:00 -08:00
parent 249f0568a1
commit 5ee28297f3

View file

@ -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) {