Provide asynchronous results via QFuture

Makes asynchronous logic to look more straightforward.
Allows caller to choose blocking or non-blocking way of obtaining asynchronous results via the same interface.

PR #22598.
This commit is contained in:
Vladimir Golovnev
2025-04-27 16:24:07 +03:00
committed by GitHub
parent 33aaa867b5
commit 732b2bcbdb
15 changed files with 165 additions and 223 deletions

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2018-2024 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2018-2025 Vladimir Golovnev <glassez@yandex.ru>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -28,6 +28,7 @@
#include "synccontroller.h"
#include <QFuture>
#include <QJsonArray>
#include <QJsonObject>
#include <QMetaObject>
@@ -745,7 +746,7 @@ void SyncController::torrentPeersAction()
QVariantMap data;
QVariantHash peers;
const QList<BitTorrent::PeerInfo> peersList = torrent->peers();
const QList<BitTorrent::PeerInfo> peersList = torrent->fetchPeerInfo().takeResult();
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();