mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 22:03:27 -07:00
Apply suggestions
This commit is contained in:
parent
6104242022
commit
4c59c33533
14 changed files with 38 additions and 16 deletions
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
|
||||
#include "filesearcher.h"
|
||||
|
||||
#include <QPromise>
|
||||
|
||||
#include "base/bittorrent/common.h"
|
||||
|
||||
namespace
|
||||
|
@ -73,6 +76,6 @@ void FileSearcher::search(const PathList &originalFileNames, const Path &savePat
|
|||
findInDir(usedPath, adjustedFileNames, forceAppendExt);
|
||||
}
|
||||
|
||||
promise.addResult(FileSearchResult {usedPath, adjustedFileNames});
|
||||
promise.addResult(FileSearchResult {.savePath = usedPath, .fileNames = adjustedFileNames});
|
||||
promise.finish();
|
||||
}
|
||||
|
|
|
@ -29,10 +29,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QPromise>
|
||||
|
||||
#include "base/path.h"
|
||||
|
||||
template <typename T> class QPromise;
|
||||
|
||||
struct FileSearchResult
|
||||
{
|
||||
Path savePath;
|
||||
|
@ -41,6 +42,7 @@ struct FileSearchResult
|
|||
|
||||
class FileSearcher final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(FileSearcher)
|
||||
|
||||
public:
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include <QDeadlineTimer>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFuture>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
|
@ -69,6 +70,7 @@
|
|||
#include <QMutexLocker>
|
||||
#include <QNetworkAddressEntry>
|
||||
#include <QNetworkInterface>
|
||||
#include <QPromise>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QThread>
|
||||
|
@ -97,6 +99,7 @@
|
|||
#include "dbresumedatastorage.h"
|
||||
#include "downloadpriority.h"
|
||||
#include "extensiondata.h"
|
||||
#include "filesearcher.h"
|
||||
#include "filterparserthread.h"
|
||||
#include "loadtorrentparams.h"
|
||||
#include "lttypecast.h"
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include <QtContainerFwd>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFuture>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
@ -54,7 +53,6 @@
|
|||
#include "addtorrentparams.h"
|
||||
#include "cachestatus.h"
|
||||
#include "categoryoptions.h"
|
||||
#include "filesearcher.h"
|
||||
#include "session.h"
|
||||
#include "sessionstatus.h"
|
||||
#include "torrentinfo.h"
|
||||
|
@ -63,11 +61,16 @@ class QString;
|
|||
class QTimer;
|
||||
class QUrl;
|
||||
|
||||
template <typename T> class QFuture;
|
||||
|
||||
class BandwidthScheduler;
|
||||
class FileSearcher;
|
||||
class FilterParserThread;
|
||||
class FreeDiskSpaceChecker;
|
||||
class NativeSessionExtension;
|
||||
|
||||
struct FileSearchResult;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
enum class MoveStorageMode;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <QtContainerFwd>
|
||||
#include <QtTypes>
|
||||
#include <QFuture>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
|
@ -46,6 +45,8 @@ class QByteArray;
|
|||
class QDateTime;
|
||||
class QUrl;
|
||||
|
||||
template <typename T> class QFuture;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
enum class DownloadPriority;
|
||||
|
|
|
@ -28,13 +28,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <QFuture>
|
||||
#include <QObject>
|
||||
|
||||
#include "base/pathfwd.h"
|
||||
#include "abstractfilestorage.h"
|
||||
#include "downloadpriority.h"
|
||||
|
||||
template <typename T> class QFuture;
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class TorrentContentHandler : public QObject, public AbstractFileStorage
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <QByteArray>
|
||||
#include <QCache>
|
||||
#include <QDebug>
|
||||
#include <QFuture>
|
||||
#include <QPointer>
|
||||
#include <QPromise>
|
||||
#include <QSet>
|
||||
|
@ -68,6 +69,7 @@
|
|||
#include "common.h"
|
||||
#include "downloadpriority.h"
|
||||
#include "extensiondata.h"
|
||||
#include "filesearcher.h"
|
||||
#include "loadtorrentparams.h"
|
||||
#include "ltqbitarray.h"
|
||||
#include "lttypecast.h"
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QFuture>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2023 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2023-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QFuture>
|
||||
#include <QHeaderView>
|
||||
#include <QHostAddress>
|
||||
#include <QList>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2022-2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2022-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include <QClipboard>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QFuture>
|
||||
#include <QListWidgetItem>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2022-2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2022-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006-2012 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <QFileIconProvider>
|
||||
#include <QFileInfo>
|
||||
#include <QFuture>
|
||||
#include <QIcon>
|
||||
#include <QMimeData>
|
||||
#include <QPointer>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2023-2024 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2023-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include <QColor>
|
||||
#include <QDateTime>
|
||||
#include <QFuture>
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
#include <QScopeGuard>
|
||||
|
|
|
@ -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->fetchPeerInfo().result();
|
||||
const QList<BitTorrent::PeerInfo> peersList = torrent->fetchPeerInfo().takeResult();
|
||||
|
||||
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2018-2023 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
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include <functional>
|
||||
|
||||
#include <QBitArray>
|
||||
#include <QFuture>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
|
@ -180,7 +181,7 @@ namespace
|
|||
QJsonArray getStickyTrackers(const BitTorrent::Torrent *const torrent)
|
||||
{
|
||||
int seedsDHT = 0, seedsPeX = 0, seedsLSD = 0, leechesDHT = 0, leechesPeX = 0, leechesLSD = 0;
|
||||
const QList<BitTorrent::PeerInfo> peersList = torrent->fetchPeerInfo().result();
|
||||
const QList<BitTorrent::PeerInfo> peersList = torrent->fetchPeerInfo().takeResult();
|
||||
for (const BitTorrent::PeerInfo &peer : peersList)
|
||||
{
|
||||
if (peer.isConnecting())
|
||||
|
@ -729,7 +730,7 @@ void TorrentsController::filesAction()
|
|||
{
|
||||
const QList<BitTorrent::DownloadPriority> priorities = torrent->filePriorities();
|
||||
const QList<qreal> fp = torrent->filesProgress();
|
||||
const QList<qreal> fileAvailability = torrent->fetchAvailableFileFractions().result();
|
||||
const QList<qreal> fileAvailability = torrent->fetchAvailableFileFractions().takeResult();
|
||||
const BitTorrent::TorrentInfo info = torrent->info();
|
||||
for (const int index : asConst(fileIndexes))
|
||||
{
|
||||
|
@ -798,7 +799,7 @@ void TorrentsController::pieceStatesAction()
|
|||
for (int i = 0; i < states.size(); ++i)
|
||||
pieceStates.append(static_cast<int>(states[i]) * 2);
|
||||
|
||||
const QBitArray dlstates = torrent->fetchDownloadingPieces().result();
|
||||
const QBitArray dlstates = torrent->fetchDownloadingPieces().takeResult();
|
||||
for (int i = 0; i < states.size(); ++i)
|
||||
{
|
||||
if (dlstates[i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue