Use QList explicitly

PR #21016.
This commit is contained in:
Vladimir Golovnev
2024-07-04 08:30:39 +03:00
committed by GitHub
parent d2fceaa228
commit 5ef2a1df07
95 changed files with 408 additions and 373 deletions

View File

@@ -32,8 +32,8 @@
#include <QHash>
#include <QJsonDocument>
#include <QList>
#include <QMetaObject>
#include <QVector>
#include "apierror.h"
@@ -72,7 +72,7 @@ const DataMap &APIController::data() const
return m_data;
}
void APIController::requireParams(const QVector<QString> &requiredParams) const
void APIController::requireParams(const QList<QString> &requiredParams) const
{
const bool hasAllRequiredParams = std::all_of(requiredParams.cbegin(), requiredParams.cend()
, [this](const QString &requiredParam)

View File

@@ -60,7 +60,7 @@ public:
protected:
const StringMap &params() const;
const DataMap &data() const;
void requireParams(const QVector<QString> &requiredParams) const;
void requireParams(const QList<QString> &requiredParams) const;
void setResult(const QString &result);
void setResult(const QJsonArray &result);

View File

@@ -30,7 +30,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QVector>
#include <QList>
#include "base/global.h"
#include "base/logger.h"

View File

@@ -32,7 +32,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QVector>
#include <QList>
#include "base/rss/rss_article.h"
#include "base/rss/rss_autodownloader.h"

View File

@@ -29,7 +29,7 @@
#include "serialize_torrent.h"
#include <QDateTime>
#include <QVector>
#include <QList>
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/torrent.h"

View File

@@ -732,7 +732,7 @@ void SyncController::torrentPeersAction()
QVariantMap data;
QVariantHash peers;
const QVector<BitTorrent::PeerInfo> peersList = torrent->peers();
const QList<BitTorrent::PeerInfo> peersList = torrent->peers();
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();
@@ -912,7 +912,7 @@ void SyncController::onTorrentTagRemoved(BitTorrent::Torrent *torrent, [[maybe_u
m_updatedTorrents.insert(torrent->id());
}
void SyncController::onTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents)
void SyncController::onTorrentsUpdated(const QList<BitTorrent::Torrent *> &torrents)
{
for (const BitTorrent::Torrent *torrent : torrents)
m_updatedTorrents.insert(torrent->id());
@@ -922,7 +922,7 @@ void SyncController::onTorrentTrackersChanged(BitTorrent::Torrent *torrent)
{
using namespace BitTorrent;
const QVector<TrackerEntryStatus> trackers = torrent->trackers();
const QList<TrackerEntryStatus> trackers = torrent->trackers();
QSet<QString> currentTrackers;
currentTrackers.reserve(trackers.size());

View File

@@ -77,7 +77,7 @@ private:
void onTorrentSavingModeChanged(BitTorrent::Torrent *torrent);
void onTorrentTagAdded(BitTorrent::Torrent *torrent, const Tag &tag);
void onTorrentTagRemoved(BitTorrent::Torrent *torrent, const Tag &tag);
void onTorrentsUpdated(const QVector<BitTorrent::Torrent *> &torrents);
void onTorrentsUpdated(const QList<BitTorrent::Torrent *> &torrents);
void onTorrentTrackersChanged(BitTorrent::Torrent *torrent);
qint64 m_freeDiskSpace = 0;

View File

@@ -242,9 +242,9 @@ namespace
return {dht, pex, lsd};
}
QVector<BitTorrent::TorrentID> toTorrentIDs(const QStringList &idStrings)
QList<BitTorrent::TorrentID> toTorrentIDs(const QStringList &idStrings)
{
QVector<BitTorrent::TorrentID> idList;
QList<BitTorrent::TorrentID> idList;
idList.reserve(idStrings.size());
for (const QString &hash : idStrings)
idList << BitTorrent::TorrentID::fromString(hash);
@@ -576,7 +576,7 @@ void TorrentsController::filesAction()
throw APIError(APIErrorType::NotFound);
const int filesCount = torrent->filesCount();
QVector<int> fileIndexes;
QList<int> fileIndexes;
const auto idxIt = params().constFind(u"indexes"_s);
if (idxIt != params().cend())
{
@@ -604,9 +604,9 @@ void TorrentsController::filesAction()
QJsonArray fileList;
if (torrent->hasMetadata())
{
const QVector<BitTorrent::DownloadPriority> priorities = torrent->filePriorities();
const QVector<qreal> fp = torrent->filesProgress();
const QVector<qreal> fileAvailability = torrent->availableFileFractions();
const QList<BitTorrent::DownloadPriority> priorities = torrent->filePriorities();
const QList<qreal> fp = torrent->filesProgress();
const QList<qreal> fileAvailability = torrent->availableFileFractions();
const BitTorrent::TorrentInfo info = torrent->info();
for (const int index : asConst(fileIndexes))
{
@@ -648,7 +648,7 @@ void TorrentsController::pieceHashesAction()
QJsonArray pieceHashes;
if (torrent->hasMetadata())
{
const QVector<QByteArray> hashes = torrent->info().pieceHashes();
const QList<QByteArray> hashes = torrent->info().pieceHashes();
for (const QByteArray &hash : hashes)
pieceHashes.append(QString::fromLatin1(hash.toHex()));
}
@@ -889,7 +889,7 @@ void TorrentsController::addPeersAction()
const QStringList hashes = params()[u"hashes"_s].split(u'|');
const QStringList peers = params()[u"peers"_s].split(u'|');
QVector<BitTorrent::PeerAddress> peerList;
QList<BitTorrent::PeerAddress> peerList;
peerList.reserve(peers.size());
for (const QString &peer : peers)
{
@@ -956,7 +956,7 @@ void TorrentsController::filePrioAction()
throw APIError(APIErrorType::Conflict, tr("Torrent's metadata has not yet downloaded"));
const int filesCount = torrent->filesCount();
QVector<BitTorrent::DownloadPriority> priorities = torrent->filePriorities();
QList<BitTorrent::DownloadPriority> priorities = torrent->filePriorities();
bool priorityChanged = false;
for (const QString &fileID : params()[u"id"_s].split(u'|'))
{

View File

@@ -29,7 +29,7 @@
#include "transfercontroller.h"
#include <QJsonObject>
#include <QVector>
#include <QList>
#include "base/bittorrent/peeraddress.h"
#include "base/bittorrent/peerinfo.h"