Verified Commit 8e9709ca authored by Daniel Vrátil's avatar Daniel Vrátil 🤖
Browse files

Fix build against Qt < 5.14

parent f3c1ec7c
...@@ -215,23 +215,24 @@ static bool hasAllParts(const ItemRetrievalRequest &req, const QSet<QByteArray> ...@@ -215,23 +215,24 @@ static bool hasAllParts(const ItemRetrievalRequest &req, const QSet<QByteArray>
bool ItemRetriever::runItemRetrievalRequests(std::list<ItemRetrievalRequest> requests) bool ItemRetriever::runItemRetrievalRequests(std::list<ItemRetrievalRequest> requests)
{ {
QEventLoop eventLoop; QEventLoop eventLoop;
QVector<ItemRetrievalRequest::Id> pendingRequests; std::vector<ItemRetrievalRequest::Id> pendingRequests;
connect(&mItemRetrievalManager, &ItemRetrievalManager::requestFinished, connect(&mItemRetrievalManager, &ItemRetrievalManager::requestFinished,
this, [this, &eventLoop, &pendingRequests](const ItemRetrievalResult &result) { this, [this, &eventLoop, &pendingRequests](const ItemRetrievalResult &result) {
if (pendingRequests.contains(result.request.id)) { const auto requestId = std::find(pendingRequests.begin(), pendingRequests.end(), result.request.id);
if (mCanceled) { if (requestId != pendingRequests.end()) {
eventLoop.exit(1); if (mCanceled) {
} else if (result.errorMsg.has_value()) { eventLoop.exit(1);
mLastError = result.errorMsg->toUtf8(); } else if (result.errorMsg.has_value()) {
eventLoop.exit(1); mLastError = result.errorMsg->toUtf8();
} else { eventLoop.exit(1);
Q_EMIT itemsRetrieved(result.request.ids); } else {
pendingRequests.removeOne(result.request.id); Q_EMIT itemsRetrieved(result.request.ids);
if (pendingRequests.empty()) { pendingRequests.erase(requestId);
eventLoop.quit(); if (pendingRequests.empty()) {
} eventLoop.quit();
} }
} }
}
}, Qt::UniqueConnection); }, Qt::UniqueConnection);
if (mConnection) { if (mConnection) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment