mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -06:00
committed by
GitHub
parent
d2fceaa228
commit
5ef2a1df07
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/exceptions.h"
|
||||
#include "base/path.h"
|
||||
@@ -71,7 +71,7 @@ void BitTorrent::AbstractFileStorage::renameFolder(const Path &oldFolderPath, co
|
||||
if (newFolderPath.isAbsolute())
|
||||
throw RuntimeError(tr("Absolute path isn't allowed: '%1'.").arg(newFolderPath.toString()));
|
||||
|
||||
QVector<int> renamingFileIndexes;
|
||||
QList<int> renamingFileIndexes;
|
||||
renamingFileIndexes.reserve(filesCount());
|
||||
|
||||
for (int i = 0; i < filesCount(); ++i)
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/path.h"
|
||||
#include "base/tagset.h"
|
||||
@@ -62,7 +62,7 @@ namespace BitTorrent
|
||||
std::optional<bool> addStopped;
|
||||
std::optional<Torrent::StopCondition> stopCondition;
|
||||
PathList filePaths; // used if TorrentInfo is set
|
||||
QVector<DownloadPriority> filePriorities; // used if TorrentInfo is set
|
||||
QList<DownloadPriority> filePriorities; // used if TorrentInfo is set
|
||||
bool skipChecking = false;
|
||||
std::optional<BitTorrent::TorrentContentLayout> contentLayout;
|
||||
std::optional<bool> useAutoTMM;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace BitTorrent
|
||||
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const;
|
||||
void remove(const TorrentID &id) const;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const;
|
||||
void storeQueue(const QList<TorrentID> &queue) const;
|
||||
|
||||
private:
|
||||
const Path m_resumeDataDir;
|
||||
@@ -134,7 +134,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const Path &path,
|
||||
m_ioThread->start();
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentID> BitTorrent::BencodeResumeDataStorage::registeredTorrents() const
|
||||
QList<BitTorrent::TorrentID> BitTorrent::BencodeResumeDataStorage::registeredTorrents() const
|
||||
{
|
||||
return m_registeredTorrents;
|
||||
}
|
||||
@@ -354,7 +354,7 @@ void BitTorrent::BencodeResumeDataStorage::remove(const TorrentID &id) const
|
||||
});
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::storeQueue(const QVector<TorrentID> &queue) const
|
||||
void BitTorrent::BencodeResumeDataStorage::storeQueue(const QList<TorrentID> &queue) const
|
||||
{
|
||||
QMetaObject::invokeMethod(m_asyncWorker, [this, queue]()
|
||||
{
|
||||
@@ -460,7 +460,7 @@ void BitTorrent::BencodeResumeDataStorage::Worker::remove(const TorrentID &id) c
|
||||
Utils::Fs::removeFile(m_resumeDataDir / torrentFilename);
|
||||
}
|
||||
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::storeQueue(const QVector<TorrentID> &queue) const
|
||||
void BitTorrent::BencodeResumeDataStorage::Worker::storeQueue(const QList<TorrentID> &queue) const
|
||||
{
|
||||
QByteArray data;
|
||||
data.reserve(((BitTorrent::TorrentID::length() * 2) + 1) * queue.size());
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDir>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/pathfwd.h"
|
||||
#include "base/utils/thread.h"
|
||||
@@ -49,18 +49,18 @@ namespace BitTorrent
|
||||
public:
|
||||
explicit BencodeResumeDataStorage(const Path &path, QObject *parent = nullptr);
|
||||
|
||||
QVector<TorrentID> registeredTorrents() const override;
|
||||
QList<TorrentID> registeredTorrents() const override;
|
||||
LoadResumeDataResult load(const TorrentID &id) const override;
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const override;
|
||||
void remove(const TorrentID &id) const override;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const override;
|
||||
void storeQueue(const QList<TorrentID> &queue) const override;
|
||||
|
||||
private:
|
||||
void doLoadAll() const override;
|
||||
void loadQueue(const Path &queueFilename);
|
||||
LoadResumeDataResult loadTorrentResumeData(const QByteArray &data, const QByteArray &metadata) const;
|
||||
|
||||
QVector<TorrentID> m_registeredTorrents;
|
||||
QList<TorrentID> m_registeredTorrents;
|
||||
Utils::Thread::UniquePtr m_ioThread;
|
||||
|
||||
class Worker;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include <QMutex>
|
||||
#include <QSet>
|
||||
#include <QSqlDatabase>
|
||||
@@ -48,7 +49,6 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlRecord>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "base/exceptions.h"
|
||||
@@ -107,11 +107,11 @@ namespace
|
||||
class StoreQueueJob final : public Job
|
||||
{
|
||||
public:
|
||||
explicit StoreQueueJob(const QVector<TorrentID> &queue);
|
||||
explicit StoreQueueJob(const QList<TorrentID> &queue);
|
||||
void perform(QSqlDatabase db) override;
|
||||
|
||||
private:
|
||||
const QVector<TorrentID> m_queue;
|
||||
const QList<TorrentID> m_queue;
|
||||
};
|
||||
|
||||
struct Column
|
||||
@@ -168,7 +168,7 @@ namespace
|
||||
return u"CREATE TABLE %1 (%2)"_s.arg(quoted(tableName), items.join(u','));
|
||||
}
|
||||
|
||||
std::pair<QString, QString> joinColumns(const QVector<Column> &columns)
|
||||
std::pair<QString, QString> joinColumns(const QList<Column> &columns)
|
||||
{
|
||||
int namesSize = columns.size();
|
||||
int valuesSize = columns.size();
|
||||
@@ -193,21 +193,21 @@ namespace
|
||||
return std::make_pair(names, values);
|
||||
}
|
||||
|
||||
QString makeInsertStatement(const QString &tableName, const QVector<Column> &columns)
|
||||
QString makeInsertStatement(const QString &tableName, const QList<Column> &columns)
|
||||
{
|
||||
const auto [names, values] = joinColumns(columns);
|
||||
return u"INSERT INTO %1 (%2) VALUES (%3)"_s
|
||||
.arg(quoted(tableName), names, values);
|
||||
}
|
||||
|
||||
QString makeUpdateStatement(const QString &tableName, const QVector<Column> &columns)
|
||||
QString makeUpdateStatement(const QString &tableName, const QList<Column> &columns)
|
||||
{
|
||||
const auto [names, values] = joinColumns(columns);
|
||||
return u"UPDATE %1 SET (%2) = (%3)"_s
|
||||
.arg(quoted(tableName), names, values);
|
||||
}
|
||||
|
||||
QString makeOnConflictUpdateStatement(const Column &constraint, const QVector<Column> &columns)
|
||||
QString makeOnConflictUpdateStatement(const Column &constraint, const QList<Column> &columns)
|
||||
{
|
||||
const auto [names, values] = joinColumns(columns);
|
||||
return u" ON CONFLICT (%1) DO UPDATE SET (%2) = (%3)"_s
|
||||
@@ -308,7 +308,7 @@ namespace BitTorrent
|
||||
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData);
|
||||
void remove(const TorrentID &id);
|
||||
void storeQueue(const QVector<TorrentID> &queue);
|
||||
void storeQueue(const QList<TorrentID> &queue);
|
||||
|
||||
private:
|
||||
void addJob(std::unique_ptr<Job> job);
|
||||
@@ -356,7 +356,7 @@ BitTorrent::DBResumeDataStorage::~DBResumeDataStorage()
|
||||
QSqlDatabase::removeDatabase(DB_CONNECTION_NAME);
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorrents() const
|
||||
QList<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorrents() const
|
||||
{
|
||||
const auto selectTorrentIDStatement = u"SELECT %1 FROM %2 ORDER BY %3;"_s
|
||||
.arg(quoted(DB_COLUMN_TORRENT_ID.name), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
|
||||
@@ -367,7 +367,7 @@ QVector<BitTorrent::TorrentID> BitTorrent::DBResumeDataStorage::registeredTorren
|
||||
if (!query.exec(selectTorrentIDStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
QVector<TorrentID> registeredTorrents;
|
||||
QList<TorrentID> registeredTorrents;
|
||||
registeredTorrents.reserve(query.size());
|
||||
while (query.next())
|
||||
registeredTorrents.append(BitTorrent::TorrentID::fromString(query.value(0).toString()));
|
||||
@@ -413,7 +413,7 @@ void BitTorrent::DBResumeDataStorage::remove(const BitTorrent::TorrentID &id) co
|
||||
m_asyncWorker->remove(id);
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::storeQueue(const QVector<TorrentID> &queue) const
|
||||
void BitTorrent::DBResumeDataStorage::storeQueue(const QList<TorrentID> &queue) const
|
||||
{
|
||||
m_asyncWorker->storeQueue(queue);
|
||||
}
|
||||
@@ -438,7 +438,7 @@ void BitTorrent::DBResumeDataStorage::doLoadAll() const
|
||||
if (!query.exec(selectTorrentIDStatement))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
QVector<TorrentID> registeredTorrents;
|
||||
QList<TorrentID> registeredTorrents;
|
||||
registeredTorrents.reserve(query.size());
|
||||
while (query.next())
|
||||
registeredTorrents.append(TorrentID::fromString(query.value(0).toString()));
|
||||
@@ -747,7 +747,7 @@ void BitTorrent::DBResumeDataStorage::Worker::remove(const TorrentID &id)
|
||||
addJob(std::make_unique<RemoveJob>(id));
|
||||
}
|
||||
|
||||
void BitTorrent::DBResumeDataStorage::Worker::storeQueue(const QVector<TorrentID> &queue)
|
||||
void BitTorrent::DBResumeDataStorage::Worker::storeQueue(const QList<TorrentID> &queue)
|
||||
{
|
||||
addJob(std::make_unique<StoreQueueJob>(queue));
|
||||
}
|
||||
@@ -797,7 +797,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
QVector<Column> columns {
|
||||
QList<Column> columns {
|
||||
DB_COLUMN_TORRENT_ID,
|
||||
DB_COLUMN_NAME,
|
||||
DB_COLUMN_CATEGORY,
|
||||
@@ -929,7 +929,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
StoreQueueJob::StoreQueueJob(const QVector<TorrentID> &queue)
|
||||
StoreQueueJob::StoreQueueJob(const QList<TorrentID> &queue)
|
||||
: m_queue {queue}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace BitTorrent
|
||||
explicit DBResumeDataStorage(const Path &dbPath, QObject *parent = nullptr);
|
||||
~DBResumeDataStorage() override;
|
||||
|
||||
QVector<TorrentID> registeredTorrents() const override;
|
||||
QList<TorrentID> registeredTorrents() const override;
|
||||
LoadResumeDataResult load(const TorrentID &id) const override;
|
||||
|
||||
void store(const TorrentID &id, const LoadTorrentParams &resumeData) const override;
|
||||
void remove(const TorrentID &id) const override;
|
||||
void storeQueue(const QVector<TorrentID> &queue) const override;
|
||||
void storeQueue(const QList<TorrentID> &queue) const override;
|
||||
|
||||
private:
|
||||
void doLoadAll() const override;
|
||||
|
||||
@@ -133,7 +133,7 @@ int FilterParserThread::parseDATFilterFile()
|
||||
return ruleCount;
|
||||
}
|
||||
|
||||
std::vector<char> buffer(BUFFER_SIZE, 0); // seems a bit faster than QVector
|
||||
std::vector<char> buffer(BUFFER_SIZE, 0); // seems a bit faster than QList
|
||||
qint64 bytesRead = 0;
|
||||
int offset = 0;
|
||||
int start = 0;
|
||||
@@ -297,7 +297,7 @@ int FilterParserThread::parseP2PFilterFile()
|
||||
return ruleCount;
|
||||
}
|
||||
|
||||
std::vector<char> buffer(BUFFER_SIZE, 0); // seems a bit faster than QVector
|
||||
std::vector<char> buffer(BUFFER_SIZE, 0); // seems a bit faster than QList
|
||||
qint64 bytesRead = 0;
|
||||
int offset = 0;
|
||||
int start = 0;
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QList>
|
||||
#include <QMetaObject>
|
||||
#include <QMutexLocker>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
|
||||
const int TORRENTIDLIST_TYPEID = qRegisterMetaType<QVector<BitTorrent::TorrentID>>();
|
||||
const int TORRENTIDLIST_TYPEID = qRegisterMetaType<QList<BitTorrent::TorrentID>>();
|
||||
|
||||
BitTorrent::ResumeDataStorage::ResumeDataStorage(const Path &path, QObject *parent)
|
||||
: QObject(parent)
|
||||
|
||||
@@ -58,17 +58,17 @@ namespace BitTorrent
|
||||
|
||||
Path path() const;
|
||||
|
||||
virtual QVector<TorrentID> registeredTorrents() const = 0;
|
||||
virtual QList<TorrentID> registeredTorrents() const = 0;
|
||||
virtual LoadResumeDataResult load(const TorrentID &id) const = 0;
|
||||
virtual void store(const TorrentID &id, const LoadTorrentParams &resumeData) const = 0;
|
||||
virtual void remove(const TorrentID &id) const = 0;
|
||||
virtual void storeQueue(const QVector<TorrentID> &queue) const = 0;
|
||||
virtual void storeQueue(const QList<TorrentID> &queue) const = 0;
|
||||
|
||||
void loadAll() const;
|
||||
QList<LoadedResumeData> fetchLoadedResumeData() const;
|
||||
|
||||
signals:
|
||||
void loadStarted(const QVector<BitTorrent::TorrentID> &torrents);
|
||||
void loadStarted(const QList<BitTorrent::TorrentID> &torrents);
|
||||
void loadFinished();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace BitTorrent
|
||||
|
||||
virtual Torrent *getTorrent(const TorrentID &id) const = 0;
|
||||
virtual Torrent *findTorrent(const InfoHash &infoHash) const = 0;
|
||||
virtual QVector<Torrent *> torrents() const = 0;
|
||||
virtual QList<Torrent *> torrents() const = 0;
|
||||
virtual qsizetype torrentsCount() const = 0;
|
||||
virtual const SessionStatus &status() const = 0;
|
||||
virtual const CacheStatus &cacheStatus() const = 0;
|
||||
@@ -460,10 +460,10 @@ namespace BitTorrent
|
||||
virtual bool downloadMetadata(const TorrentDescriptor &torrentDescr) = 0;
|
||||
virtual bool cancelDownloadMetadata(const TorrentID &id) = 0;
|
||||
|
||||
virtual void increaseTorrentsQueuePos(const QVector<TorrentID> &ids) = 0;
|
||||
virtual void decreaseTorrentsQueuePos(const QVector<TorrentID> &ids) = 0;
|
||||
virtual void topTorrentsQueuePos(const QVector<TorrentID> &ids) = 0;
|
||||
virtual void bottomTorrentsQueuePos(const QVector<TorrentID> &ids) = 0;
|
||||
virtual void increaseTorrentsQueuePos(const QList<TorrentID> &ids) = 0;
|
||||
virtual void decreaseTorrentsQueuePos(const QList<TorrentID> &ids) = 0;
|
||||
virtual void topTorrentsQueuePos(const QList<TorrentID> &ids) = 0;
|
||||
virtual void bottomTorrentsQueuePos(const QList<TorrentID> &ids) = 0;
|
||||
|
||||
signals:
|
||||
void startupProgressUpdated(int progress);
|
||||
@@ -494,12 +494,12 @@ namespace BitTorrent
|
||||
void torrentStarted(Torrent *torrent);
|
||||
void torrentSavePathChanged(Torrent *torrent);
|
||||
void torrentSavingModeChanged(Torrent *torrent);
|
||||
void torrentsLoaded(const QVector<Torrent *> &torrents);
|
||||
void torrentsUpdated(const QVector<Torrent *> &torrents);
|
||||
void torrentsLoaded(const QList<Torrent *> &torrents);
|
||||
void torrentsUpdated(const QList<Torrent *> &torrents);
|
||||
void torrentTagAdded(Torrent *torrent, const Tag &tag);
|
||||
void torrentTagRemoved(Torrent *torrent, const Tag &tag);
|
||||
void trackerError(Torrent *torrent, const QString &tracker);
|
||||
void trackersAdded(Torrent *torrent, const QVector<TrackerEntry> &trackers);
|
||||
void trackersAdded(Torrent *torrent, const QList<TrackerEntry> &trackers);
|
||||
void trackersChanged(Torrent *torrent);
|
||||
void trackersRemoved(Torrent *torrent, const QStringList &trackers);
|
||||
void trackerSuccess(Torrent *torrent, const QString &tracker);
|
||||
|
||||
@@ -1306,7 +1306,7 @@ void SessionImpl::prepareStartup()
|
||||
context->startupStorage = m_resumeDataStorage;
|
||||
|
||||
connect(context->startupStorage, &ResumeDataStorage::loadStarted, context
|
||||
, [this, context](const QVector<TorrentID> &torrents)
|
||||
, [this, context](const QList<TorrentID> &torrents)
|
||||
{
|
||||
context->totalResumeDataCount = torrents.size();
|
||||
#ifdef QBT_USES_LIBTORRENT2
|
||||
@@ -2491,7 +2491,7 @@ bool SessionImpl::cancelDownloadMetadata(const TorrentID &id)
|
||||
return true;
|
||||
}
|
||||
|
||||
void SessionImpl::increaseTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
void SessionImpl::increaseTorrentsQueuePos(const QList<TorrentID> &ids)
|
||||
{
|
||||
using ElementType = std::pair<int, const TorrentImpl *>;
|
||||
std::priority_queue<ElementType
|
||||
@@ -2518,7 +2518,7 @@ void SessionImpl::increaseTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
m_torrentsQueueChanged = true;
|
||||
}
|
||||
|
||||
void SessionImpl::decreaseTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
void SessionImpl::decreaseTorrentsQueuePos(const QList<TorrentID> &ids)
|
||||
{
|
||||
using ElementType = std::pair<int, const TorrentImpl *>;
|
||||
std::priority_queue<ElementType> torrentQueue;
|
||||
@@ -2546,7 +2546,7 @@ void SessionImpl::decreaseTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
m_torrentsQueueChanged = true;
|
||||
}
|
||||
|
||||
void SessionImpl::topTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
void SessionImpl::topTorrentsQueuePos(const QList<TorrentID> &ids)
|
||||
{
|
||||
using ElementType = std::pair<int, const TorrentImpl *>;
|
||||
std::priority_queue<ElementType> torrentQueue;
|
||||
@@ -2571,7 +2571,7 @@ void SessionImpl::topTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
m_torrentsQueueChanged = true;
|
||||
}
|
||||
|
||||
void SessionImpl::bottomTorrentsQueuePos(const QVector<TorrentID> &ids)
|
||||
void SessionImpl::bottomTorrentsQueuePos(const QList<TorrentID> &ids)
|
||||
{
|
||||
using ElementType = std::pair<int, const TorrentImpl *>;
|
||||
std::priority_queue<ElementType
|
||||
@@ -2607,9 +2607,9 @@ void SessionImpl::handleTorrentResumeDataRequested(const TorrentImpl *torrent)
|
||||
++m_numResumeData;
|
||||
}
|
||||
|
||||
QVector<Torrent *> SessionImpl::torrents() const
|
||||
QList<Torrent *> SessionImpl::torrents() const
|
||||
{
|
||||
QVector<Torrent *> result;
|
||||
QList<Torrent *> result;
|
||||
result.reserve(m_torrents.size());
|
||||
for (TorrentImpl *torrent : asConst(m_torrents))
|
||||
result << torrent;
|
||||
@@ -3133,7 +3133,7 @@ void SessionImpl::saveResumeData()
|
||||
|
||||
void SessionImpl::saveTorrentsQueue()
|
||||
{
|
||||
QVector<TorrentID> queue;
|
||||
QList<TorrentID> queue;
|
||||
for (const TorrentImpl *torrent : asConst(m_torrents))
|
||||
{
|
||||
if (const int queuePos = torrent->queuePosition(); queuePos >= 0)
|
||||
@@ -4985,7 +4985,7 @@ void SessionImpl::handleTorrentSavingModeChanged(TorrentImpl *const torrent)
|
||||
emit torrentSavingModeChanged(torrent);
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentTrackersAdded(TorrentImpl *const torrent, const QVector<TrackerEntry> &newTrackers)
|
||||
void SessionImpl::handleTorrentTrackersAdded(TorrentImpl *const torrent, const QList<TrackerEntry> &newTrackers)
|
||||
{
|
||||
for (const TrackerEntry &newTracker : newTrackers)
|
||||
LogMsg(tr("Added tracker to torrent. Torrent: \"%1\". Tracker: \"%2\"").arg(torrent->name(), newTracker.url));
|
||||
@@ -5004,13 +5004,13 @@ void SessionImpl::handleTorrentTrackersChanged(TorrentImpl *const torrent)
|
||||
emit trackersChanged(torrent);
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentUrlSeedsAdded(TorrentImpl *const torrent, const QVector<QUrl> &newUrlSeeds)
|
||||
void SessionImpl::handleTorrentUrlSeedsAdded(TorrentImpl *const torrent, const QList<QUrl> &newUrlSeeds)
|
||||
{
|
||||
for (const QUrl &newUrlSeed : newUrlSeeds)
|
||||
LogMsg(tr("Added URL seed to torrent. Torrent: \"%1\". URL: \"%2\"").arg(torrent->name(), newUrlSeed.toString()));
|
||||
}
|
||||
|
||||
void SessionImpl::handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QVector<QUrl> &urlSeeds)
|
||||
void SessionImpl::handleTorrentUrlSeedsRemoved(TorrentImpl *const torrent, const QList<QUrl> &urlSeeds)
|
||||
{
|
||||
for (const QUrl &urlSeed : urlSeeds)
|
||||
LogMsg(tr("Removed URL seed from torrent. Torrent: \"%1\". URL: \"%2\"").arg(torrent->name(), urlSeed.toString()));
|
||||
@@ -5028,7 +5028,7 @@ void SessionImpl::handleTorrentStopped(TorrentImpl *const torrent)
|
||||
{
|
||||
torrent->resetTrackerEntryStatuses();
|
||||
|
||||
const QVector<TrackerEntryStatus> trackers = torrent->trackers();
|
||||
const QList<TrackerEntryStatus> trackers = torrent->trackers();
|
||||
QHash<QString, TrackerEntryStatus> updatedTrackers;
|
||||
updatedTrackers.reserve(trackers.size());
|
||||
|
||||
@@ -6056,7 +6056,7 @@ void SessionImpl::handleStorageMovedFailedAlert(const lt::storage_moved_failed_a
|
||||
|
||||
void SessionImpl::handleStateUpdateAlert(const lt::state_update_alert *alert)
|
||||
{
|
||||
QVector<Torrent *> updatedTorrents;
|
||||
QList<Torrent *> updatedTorrents;
|
||||
updatedTorrents.reserve(static_cast<decltype(updatedTorrents)::size_type>(alert->status.size()));
|
||||
|
||||
for (const lt::torrent_status &status : alert->status)
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/path.h"
|
||||
#include "base/settingvalue.h"
|
||||
@@ -423,7 +423,7 @@ namespace BitTorrent
|
||||
|
||||
Torrent *getTorrent(const TorrentID &id) const override;
|
||||
Torrent *findTorrent(const InfoHash &infoHash) const override;
|
||||
QVector<Torrent *> torrents() const override;
|
||||
QList<Torrent *> torrents() const override;
|
||||
qsizetype torrentsCount() const override;
|
||||
const SessionStatus &status() const override;
|
||||
const CacheStatus &cacheStatus() const override;
|
||||
@@ -437,10 +437,10 @@ namespace BitTorrent
|
||||
bool downloadMetadata(const TorrentDescriptor &torrentDescr) override;
|
||||
bool cancelDownloadMetadata(const TorrentID &id) override;
|
||||
|
||||
void increaseTorrentsQueuePos(const QVector<TorrentID> &ids) override;
|
||||
void decreaseTorrentsQueuePos(const QVector<TorrentID> &ids) override;
|
||||
void topTorrentsQueuePos(const QVector<TorrentID> &ids) override;
|
||||
void bottomTorrentsQueuePos(const QVector<TorrentID> &ids) override;
|
||||
void increaseTorrentsQueuePos(const QList<TorrentID> &ids) override;
|
||||
void decreaseTorrentsQueuePos(const QList<TorrentID> &ids) override;
|
||||
void topTorrentsQueuePos(const QList<TorrentID> &ids) override;
|
||||
void bottomTorrentsQueuePos(const QList<TorrentID> &ids) override;
|
||||
|
||||
// Torrent interface
|
||||
void handleTorrentResumeDataRequested(const TorrentImpl *torrent);
|
||||
@@ -456,11 +456,11 @@ namespace BitTorrent
|
||||
void handleTorrentStarted(TorrentImpl *torrent);
|
||||
void handleTorrentChecked(TorrentImpl *torrent);
|
||||
void handleTorrentFinished(TorrentImpl *torrent);
|
||||
void handleTorrentTrackersAdded(TorrentImpl *torrent, const QVector<TrackerEntry> &newTrackers);
|
||||
void handleTorrentTrackersAdded(TorrentImpl *torrent, const QList<TrackerEntry> &newTrackers);
|
||||
void handleTorrentTrackersRemoved(TorrentImpl *torrent, const QStringList &deletedTrackers);
|
||||
void handleTorrentTrackersChanged(TorrentImpl *torrent);
|
||||
void handleTorrentUrlSeedsAdded(TorrentImpl *torrent, const QVector<QUrl> &newUrlSeeds);
|
||||
void handleTorrentUrlSeedsRemoved(TorrentImpl *torrent, const QVector<QUrl> &urlSeeds);
|
||||
void handleTorrentUrlSeedsAdded(TorrentImpl *torrent, const QList<QUrl> &newUrlSeeds);
|
||||
void handleTorrentUrlSeedsRemoved(TorrentImpl *torrent, const QList<QUrl> &urlSeeds);
|
||||
void handleTorrentResumeDataReady(TorrentImpl *torrent, const LoadTorrentParams &data);
|
||||
void handleTorrentInfoHashChanged(TorrentImpl *torrent, const InfoHash &prevInfoHash);
|
||||
void handleTorrentStorageMovingStateChanged(TorrentImpl *torrent);
|
||||
@@ -749,8 +749,8 @@ namespace BitTorrent
|
||||
const bool m_wasPexEnabled = m_isPeXEnabled;
|
||||
|
||||
int m_numResumeData = 0;
|
||||
QVector<TrackerEntry> m_additionalTrackerEntries;
|
||||
QVector<QRegularExpression> m_excludedFileNamesRegExpList;
|
||||
QList<TrackerEntry> m_additionalTrackerEntries;
|
||||
QList<QRegularExpression> m_excludedFileNamesRegExpList;
|
||||
|
||||
// Statistics
|
||||
mutable QElapsedTimer m_statisticsLastUpdateTimer;
|
||||
|
||||
@@ -249,8 +249,8 @@ namespace BitTorrent
|
||||
virtual bool hasMissingFiles() const = 0;
|
||||
virtual bool hasError() const = 0;
|
||||
virtual int queuePosition() const = 0;
|
||||
virtual QVector<TrackerEntryStatus> trackers() const = 0;
|
||||
virtual QVector<QUrl> urlSeeds() const = 0;
|
||||
virtual QList<TrackerEntryStatus> trackers() const = 0;
|
||||
virtual QList<QUrl> urlSeeds() const = 0;
|
||||
virtual QString error() const = 0;
|
||||
virtual qlonglong totalDownload() const = 0;
|
||||
virtual qlonglong totalUpload() const = 0;
|
||||
@@ -274,10 +274,10 @@ namespace BitTorrent
|
||||
virtual bool isDHTDisabled() const = 0;
|
||||
virtual bool isPEXDisabled() const = 0;
|
||||
virtual bool isLSDDisabled() const = 0;
|
||||
virtual QVector<PeerInfo> peers() const = 0;
|
||||
virtual QList<PeerInfo> peers() const = 0;
|
||||
virtual QBitArray pieces() const = 0;
|
||||
virtual QBitArray downloadingPieces() const = 0;
|
||||
virtual QVector<int> pieceAvailability() const = 0;
|
||||
virtual QList<int> pieceAvailability() const = 0;
|
||||
virtual qreal distributedCopies() const = 0;
|
||||
virtual qreal maxRatio() const = 0;
|
||||
virtual int maxSeedingTime() const = 0;
|
||||
@@ -306,11 +306,11 @@ namespace BitTorrent
|
||||
virtual void setDHTDisabled(bool disable) = 0;
|
||||
virtual void setPEXDisabled(bool disable) = 0;
|
||||
virtual void setLSDDisabled(bool disable) = 0;
|
||||
virtual void addTrackers(QVector<TrackerEntry> trackers) = 0;
|
||||
virtual void addTrackers(QList<TrackerEntry> trackers) = 0;
|
||||
virtual void removeTrackers(const QStringList &trackers) = 0;
|
||||
virtual void replaceTrackers(QVector<TrackerEntry> trackers) = 0;
|
||||
virtual void addUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||
virtual void removeUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||
virtual void replaceTrackers(QList<TrackerEntry> trackers) = 0;
|
||||
virtual void addUrlSeeds(const QList<QUrl> &urlSeeds) = 0;
|
||||
virtual void removeUrlSeeds(const QList<QUrl> &urlSeeds) = 0;
|
||||
virtual bool connectPeer(const PeerAddress &peerAddress) = 0;
|
||||
virtual void clearPeers() = 0;
|
||||
virtual void setMetadata(const TorrentInfo &torrentInfo) = 0;
|
||||
@@ -324,9 +324,9 @@ namespace BitTorrent
|
||||
virtual nonstd::expected<QByteArray, QString> exportToBuffer() const = 0;
|
||||
virtual nonstd::expected<void, QString> exportToFile(const Path &path) const = 0;
|
||||
|
||||
virtual void fetchPeerInfo(std::function<void (QVector<PeerInfo>)> resultHandler) const = 0;
|
||||
virtual void fetchURLSeeds(std::function<void (QVector<QUrl>)> resultHandler) const = 0;
|
||||
virtual void fetchPieceAvailability(std::function<void (QVector<int>)> resultHandler) const = 0;
|
||||
virtual void fetchPeerInfo(std::function<void (QList<PeerInfo>)> resultHandler) const = 0;
|
||||
virtual void fetchURLSeeds(std::function<void (QList<QUrl>)> resultHandler) const = 0;
|
||||
virtual void fetchPieceAvailability(std::function<void (QList<int>)> resultHandler) const = 0;
|
||||
virtual void fetchDownloadingPieces(std::function<void (QBitArray)> resultHandler) const = 0;
|
||||
|
||||
TorrentID id() const;
|
||||
|
||||
@@ -44,18 +44,18 @@ namespace BitTorrent
|
||||
virtual bool hasMetadata() const = 0;
|
||||
virtual Path actualStorageLocation() const = 0;
|
||||
virtual Path actualFilePath(int fileIndex) const = 0;
|
||||
virtual QVector<DownloadPriority> filePriorities() const = 0;
|
||||
virtual QVector<qreal> filesProgress() const = 0;
|
||||
virtual QList<DownloadPriority> filePriorities() const = 0;
|
||||
virtual QList<qreal> filesProgress() const = 0;
|
||||
/**
|
||||
* @brief fraction of file pieces that are available at least from one peer
|
||||
*
|
||||
* This is not the same as torrrent availability, it is just a fraction of pieces
|
||||
* that can be downloaded right now. It varies between 0 to 1.
|
||||
*/
|
||||
virtual QVector<qreal> availableFileFractions() const = 0;
|
||||
virtual void fetchAvailableFileFractions(std::function<void (QVector<qreal>)> resultHandler) const = 0;
|
||||
virtual QList<qreal> availableFileFractions() const = 0;
|
||||
virtual void fetchAvailableFileFractions(std::function<void (QList<qreal>)> resultHandler) const = 0;
|
||||
|
||||
virtual void prioritizeFiles(const QVector<DownloadPriority> &priorities) = 0;
|
||||
virtual void prioritizeFiles(const QList<DownloadPriority> &priorities) = 0;
|
||||
virtual void flushCache() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -204,9 +204,9 @@ void BitTorrent::TorrentDescriptor::setTorrentInfo(TorrentInfo torrentInfo)
|
||||
}
|
||||
}
|
||||
|
||||
QVector<BitTorrent::TrackerEntry> BitTorrent::TorrentDescriptor::trackers() const
|
||||
QList<BitTorrent::TrackerEntry> BitTorrent::TorrentDescriptor::trackers() const
|
||||
{
|
||||
QVector<TrackerEntry> ret;
|
||||
QList<TrackerEntry> ret;
|
||||
ret.reserve(static_cast<decltype(ret)::size_type>(m_ltAddTorrentParams.trackers.size()));
|
||||
std::size_t i = 0;
|
||||
for (const std::string &tracker : m_ltAddTorrentParams.trackers)
|
||||
@@ -215,9 +215,9 @@ QVector<BitTorrent::TrackerEntry> BitTorrent::TorrentDescriptor::trackers() cons
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVector<QUrl> BitTorrent::TorrentDescriptor::urlSeeds() const
|
||||
QList<QUrl> BitTorrent::TorrentDescriptor::urlSeeds() const
|
||||
{
|
||||
QVector<QUrl> urlSeeds;
|
||||
QList<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(static_cast<decltype(urlSeeds)::size_type>(m_ltAddTorrentParams.url_seeds.size()));
|
||||
|
||||
for (const std::string &nativeURLSeed : m_ltAddTorrentParams.url_seeds)
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace BitTorrent
|
||||
QDateTime creationDate() const;
|
||||
QString creator() const;
|
||||
QString comment() const;
|
||||
QVector<TrackerEntry> trackers() const;
|
||||
QVector<QUrl> urlSeeds() const;
|
||||
QList<TrackerEntry> trackers() const;
|
||||
QList<QUrl> urlSeeds() const;
|
||||
const std::optional<TorrentInfo> &info() const;
|
||||
|
||||
void setTorrentInfo(TorrentInfo torrentInfo);
|
||||
|
||||
@@ -606,12 +606,12 @@ Path TorrentImpl::makeUserPath(const Path &path) const
|
||||
return userPath;
|
||||
}
|
||||
|
||||
QVector<TrackerEntryStatus> TorrentImpl::trackers() const
|
||||
QList<TrackerEntryStatus> TorrentImpl::trackers() const
|
||||
{
|
||||
return m_trackerEntryStatuses;
|
||||
}
|
||||
|
||||
void TorrentImpl::addTrackers(QVector<TrackerEntry> trackers)
|
||||
void TorrentImpl::addTrackers(QList<TrackerEntry> trackers)
|
||||
{
|
||||
trackers.removeIf([](const TrackerEntry &trackerEntry) { return trackerEntry.url.isEmpty(); });
|
||||
|
||||
@@ -624,7 +624,7 @@ void TorrentImpl::addTrackers(QVector<TrackerEntry> trackers)
|
||||
if (newTrackerSet.isEmpty())
|
||||
return;
|
||||
|
||||
trackers = QVector<TrackerEntry>(newTrackerSet.cbegin(), newTrackerSet.cend());
|
||||
trackers = QList<TrackerEntry>(newTrackerSet.cbegin(), newTrackerSet.cend());
|
||||
for (const TrackerEntry &tracker : asConst(trackers))
|
||||
{
|
||||
m_nativeHandle.add_tracker(makeNativeAnnounceEntry(tracker.url, tracker.tier));
|
||||
@@ -660,13 +660,13 @@ void TorrentImpl::removeTrackers(const QStringList &trackers)
|
||||
}
|
||||
}
|
||||
|
||||
void TorrentImpl::replaceTrackers(QVector<TrackerEntry> trackers)
|
||||
void TorrentImpl::replaceTrackers(QList<TrackerEntry> trackers)
|
||||
{
|
||||
trackers.removeIf([](const TrackerEntry &trackerEntry) { return trackerEntry.url.isEmpty(); });
|
||||
|
||||
// Filter out duplicate trackers
|
||||
const auto uniqueTrackers = QSet<TrackerEntry>(trackers.cbegin(), trackers.cend());
|
||||
trackers = QVector<TrackerEntry>(uniqueTrackers.cbegin(), uniqueTrackers.cend());
|
||||
trackers = QList<TrackerEntry>(uniqueTrackers.cbegin(), uniqueTrackers.cend());
|
||||
std::sort(trackers.begin(), trackers.end()
|
||||
, [](const TrackerEntry &left, const TrackerEntry &right) { return left.tier < right.tier; });
|
||||
|
||||
@@ -691,12 +691,12 @@ void TorrentImpl::replaceTrackers(QVector<TrackerEntry> trackers)
|
||||
m_session->handleTorrentTrackersChanged(this);
|
||||
}
|
||||
|
||||
QVector<QUrl> TorrentImpl::urlSeeds() const
|
||||
QList<QUrl> TorrentImpl::urlSeeds() const
|
||||
{
|
||||
return m_urlSeeds;
|
||||
}
|
||||
|
||||
void TorrentImpl::addUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
void TorrentImpl::addUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
{
|
||||
m_session->invokeAsync([urlSeeds, session = m_session
|
||||
, nativeHandle = m_nativeHandle
|
||||
@@ -705,12 +705,12 @@ void TorrentImpl::addUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
try
|
||||
{
|
||||
const std::set<std::string> nativeSeeds = nativeHandle.url_seeds();
|
||||
QVector<QUrl> currentSeeds;
|
||||
QList<QUrl> currentSeeds;
|
||||
currentSeeds.reserve(static_cast<decltype(currentSeeds)::size_type>(nativeSeeds.size()));
|
||||
for (const std::string &urlSeed : nativeSeeds)
|
||||
currentSeeds.append(QString::fromStdString(urlSeed));
|
||||
|
||||
QVector<QUrl> addedUrlSeeds;
|
||||
QList<QUrl> addedUrlSeeds;
|
||||
addedUrlSeeds.reserve(urlSeeds.size());
|
||||
|
||||
for (const QUrl &url : urlSeeds)
|
||||
@@ -740,7 +740,7 @@ void TorrentImpl::addUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
});
|
||||
}
|
||||
|
||||
void TorrentImpl::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
void TorrentImpl::removeUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
{
|
||||
m_session->invokeAsync([urlSeeds, session = m_session
|
||||
, nativeHandle = m_nativeHandle
|
||||
@@ -749,12 +749,12 @@ void TorrentImpl::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
try
|
||||
{
|
||||
const std::set<std::string> nativeSeeds = nativeHandle.url_seeds();
|
||||
QVector<QUrl> currentSeeds;
|
||||
QList<QUrl> currentSeeds;
|
||||
currentSeeds.reserve(static_cast<decltype(currentSeeds)::size_type>(nativeSeeds.size()));
|
||||
for (const std::string &urlSeed : nativeSeeds)
|
||||
currentSeeds.append(QString::fromStdString(urlSeed));
|
||||
|
||||
QVector<QUrl> removedUrlSeeds;
|
||||
QList<QUrl> removedUrlSeeds;
|
||||
removedUrlSeeds.reserve(urlSeeds.size());
|
||||
|
||||
for (const QUrl &url : urlSeeds)
|
||||
@@ -966,7 +966,7 @@ Path TorrentImpl::filePath(const int index) const
|
||||
|
||||
Path TorrentImpl::actualFilePath(const int index) const
|
||||
{
|
||||
const QVector<lt::file_index_t> nativeIndexes = m_torrentInfo.nativeIndexes();
|
||||
const QList<lt::file_index_t> nativeIndexes = m_torrentInfo.nativeIndexes();
|
||||
|
||||
Q_ASSERT(index >= 0);
|
||||
Q_ASSERT(index < nativeIndexes.size());
|
||||
@@ -1001,7 +1001,7 @@ PathList TorrentImpl::actualFilePaths() const
|
||||
return paths;
|
||||
}
|
||||
|
||||
QVector<DownloadPriority> TorrentImpl::filePriorities() const
|
||||
QList<DownloadPriority> TorrentImpl::filePriorities() const
|
||||
{
|
||||
return m_filePriorities;
|
||||
}
|
||||
@@ -1317,7 +1317,7 @@ qlonglong TorrentImpl::eta() const
|
||||
return (wantedSize() - completedSize()) / speedAverage.download;
|
||||
}
|
||||
|
||||
QVector<qreal> TorrentImpl::filesProgress() const
|
||||
QList<qreal> TorrentImpl::filesProgress() const
|
||||
{
|
||||
if (!hasMetadata())
|
||||
return {};
|
||||
@@ -1328,9 +1328,9 @@ QVector<qreal> TorrentImpl::filesProgress() const
|
||||
return {};
|
||||
|
||||
if (m_completedFiles.count(true) == count)
|
||||
return QVector<qreal>(count, 1);
|
||||
return QList<qreal>(count, 1);
|
||||
|
||||
QVector<qreal> result;
|
||||
QList<qreal> result;
|
||||
result.reserve(count);
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
@@ -1445,12 +1445,12 @@ bool TorrentImpl::isLSDDisabled() const
|
||||
return static_cast<bool>(m_nativeStatus.flags & lt::torrent_flags::disable_lsd);
|
||||
}
|
||||
|
||||
QVector<PeerInfo> TorrentImpl::peers() const
|
||||
QList<PeerInfo> TorrentImpl::peers() const
|
||||
{
|
||||
std::vector<lt::peer_info> nativePeers;
|
||||
m_nativeHandle.get_peer_info(nativePeers);
|
||||
|
||||
QVector<PeerInfo> peers;
|
||||
QList<PeerInfo> peers;
|
||||
peers.reserve(static_cast<decltype(peers)::size_type>(nativePeers.size()));
|
||||
|
||||
for (const lt::peer_info &peer : nativePeers)
|
||||
@@ -1477,7 +1477,7 @@ QBitArray TorrentImpl::downloadingPieces() const
|
||||
return result;
|
||||
}
|
||||
|
||||
QVector<int> TorrentImpl::pieceAvailability() const
|
||||
QList<int> TorrentImpl::pieceAvailability() const
|
||||
{
|
||||
std::vector<int> avail;
|
||||
m_nativeHandle.piece_availability(avail);
|
||||
@@ -2113,7 +2113,7 @@ void TorrentImpl::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p)
|
||||
// URL seed list have been changed by libtorrent for some reason, so we need to update cached one.
|
||||
// Unfortunately, URL seed list containing in "resume data" is generated according to different rules
|
||||
// than the list we usually cache, so we have to request it from the appropriate source.
|
||||
fetchURLSeeds([this](const QVector<QUrl> &urlSeeds) { m_urlSeeds = urlSeeds; });
|
||||
fetchURLSeeds([this](const QList<QUrl> &urlSeeds) { m_urlSeeds = urlSeeds; });
|
||||
}
|
||||
|
||||
if ((m_maintenanceJob == MaintenanceJob::HandleMetadata) && p->params.ti)
|
||||
@@ -2490,7 +2490,7 @@ void TorrentImpl::adjustStorageLocation()
|
||||
|
||||
void TorrentImpl::doRenameFile(const int index, const Path &path)
|
||||
{
|
||||
const QVector<lt::file_index_t> nativeIndexes = m_torrentInfo.nativeIndexes();
|
||||
const QList<lt::file_index_t> nativeIndexes = m_torrentInfo.nativeIndexes();
|
||||
|
||||
Q_ASSERT(index >= 0);
|
||||
Q_ASSERT(index < nativeIndexes.size());
|
||||
@@ -2872,15 +2872,15 @@ nonstd::expected<void, QString> TorrentImpl::exportToFile(const Path &path) cons
|
||||
return {};
|
||||
}
|
||||
|
||||
void TorrentImpl::fetchPeerInfo(std::function<void (QVector<PeerInfo>)> resultHandler) const
|
||||
void TorrentImpl::fetchPeerInfo(std::function<void (QList<PeerInfo>)> resultHandler) const
|
||||
{
|
||||
invokeAsync([nativeHandle = m_nativeHandle, allPieces = pieces()]() -> QVector<PeerInfo>
|
||||
invokeAsync([nativeHandle = m_nativeHandle, allPieces = pieces()]() -> QList<PeerInfo>
|
||||
{
|
||||
try
|
||||
{
|
||||
std::vector<lt::peer_info> nativePeers;
|
||||
nativeHandle.get_peer_info(nativePeers);
|
||||
QVector<PeerInfo> peers;
|
||||
QList<PeerInfo> peers;
|
||||
peers.reserve(static_cast<decltype(peers)::size_type>(nativePeers.size()));
|
||||
for (const lt::peer_info &peer : nativePeers)
|
||||
peers.append(PeerInfo(peer, allPieces));
|
||||
@@ -2893,14 +2893,14 @@ void TorrentImpl::fetchPeerInfo(std::function<void (QVector<PeerInfo>)> resultHa
|
||||
, std::move(resultHandler));
|
||||
}
|
||||
|
||||
void TorrentImpl::fetchURLSeeds(std::function<void (QVector<QUrl>)> resultHandler) const
|
||||
void TorrentImpl::fetchURLSeeds(std::function<void (QList<QUrl>)> resultHandler) const
|
||||
{
|
||||
invokeAsync([nativeHandle = m_nativeHandle]() -> QVector<QUrl>
|
||||
invokeAsync([nativeHandle = m_nativeHandle]() -> QList<QUrl>
|
||||
{
|
||||
try
|
||||
{
|
||||
const std::set<std::string> currentSeeds = nativeHandle.url_seeds();
|
||||
QVector<QUrl> urlSeeds;
|
||||
QList<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(static_cast<decltype(urlSeeds)::size_type>(currentSeeds.size()));
|
||||
for (const std::string &urlSeed : currentSeeds)
|
||||
urlSeeds.append(QString::fromStdString(urlSeed));
|
||||
@@ -2913,15 +2913,15 @@ void TorrentImpl::fetchURLSeeds(std::function<void (QVector<QUrl>)> resultHandle
|
||||
, std::move(resultHandler));
|
||||
}
|
||||
|
||||
void TorrentImpl::fetchPieceAvailability(std::function<void (QVector<int>)> resultHandler) const
|
||||
void TorrentImpl::fetchPieceAvailability(std::function<void (QList<int>)> resultHandler) const
|
||||
{
|
||||
invokeAsync([nativeHandle = m_nativeHandle]() -> QVector<int>
|
||||
invokeAsync([nativeHandle = m_nativeHandle]() -> QList<int>
|
||||
{
|
||||
try
|
||||
{
|
||||
std::vector<int> piecesAvailability;
|
||||
nativeHandle.piece_availability(piecesAvailability);
|
||||
return QVector<int>(piecesAvailability.cbegin(), piecesAvailability.cend());
|
||||
return QList<int>(piecesAvailability.cbegin(), piecesAvailability.cend());
|
||||
}
|
||||
catch (const std::exception &) {}
|
||||
|
||||
@@ -2955,9 +2955,9 @@ void TorrentImpl::fetchDownloadingPieces(std::function<void (QBitArray)> resultH
|
||||
, std::move(resultHandler));
|
||||
}
|
||||
|
||||
void TorrentImpl::fetchAvailableFileFractions(std::function<void (QVector<qreal>)> resultHandler) const
|
||||
void TorrentImpl::fetchAvailableFileFractions(std::function<void (QList<qreal>)> resultHandler) const
|
||||
{
|
||||
invokeAsync([nativeHandle = m_nativeHandle, torrentInfo = m_torrentInfo]() -> QVector<qreal>
|
||||
invokeAsync([nativeHandle = m_nativeHandle, torrentInfo = m_torrentInfo]() -> QList<qreal>
|
||||
{
|
||||
if (!torrentInfo.isValid() || (torrentInfo.filesCount() <= 0))
|
||||
return {};
|
||||
@@ -2969,9 +2969,9 @@ void TorrentImpl::fetchAvailableFileFractions(std::function<void (QVector<qreal>
|
||||
const int filesCount = torrentInfo.filesCount();
|
||||
// libtorrent returns empty array for seeding only torrents
|
||||
if (piecesAvailability.empty())
|
||||
return QVector<qreal>(filesCount, -1);
|
||||
return QList<qreal>(filesCount, -1);
|
||||
|
||||
QVector<qreal> result;
|
||||
QList<qreal> result;
|
||||
result.reserve(filesCount);
|
||||
for (int i = 0; i < filesCount; ++i)
|
||||
{
|
||||
@@ -2995,7 +2995,7 @@ void TorrentImpl::fetchAvailableFileFractions(std::function<void (QVector<qreal>
|
||||
, std::move(resultHandler));
|
||||
}
|
||||
|
||||
void TorrentImpl::prioritizeFiles(const QVector<DownloadPriority> &priorities)
|
||||
void TorrentImpl::prioritizeFiles(const QList<DownloadPriority> &priorities)
|
||||
{
|
||||
if (!hasMetadata())
|
||||
return;
|
||||
@@ -3004,7 +3004,7 @@ void TorrentImpl::prioritizeFiles(const QVector<DownloadPriority> &priorities)
|
||||
|
||||
// Reset 'm_hasSeedStatus' if needed in order to react again to
|
||||
// 'torrent_finished_alert' and eg show tray notifications
|
||||
const QVector<DownloadPriority> oldPriorities = filePriorities();
|
||||
const QList<DownloadPriority> oldPriorities = filePriorities();
|
||||
for (int i = 0; i < oldPriorities.size(); ++i)
|
||||
{
|
||||
if ((oldPriorities[i] == DownloadPriority::Ignored)
|
||||
@@ -3032,18 +3032,18 @@ void TorrentImpl::prioritizeFiles(const QVector<DownloadPriority> &priorities)
|
||||
manageActualFilePaths();
|
||||
}
|
||||
|
||||
QVector<qreal> TorrentImpl::availableFileFractions() const
|
||||
QList<qreal> TorrentImpl::availableFileFractions() const
|
||||
{
|
||||
Q_ASSERT(hasMetadata());
|
||||
|
||||
const int filesCount = this->filesCount();
|
||||
if (filesCount <= 0) return {};
|
||||
|
||||
const QVector<int> piecesAvailability = pieceAvailability();
|
||||
const QList<int> piecesAvailability = pieceAvailability();
|
||||
// libtorrent returns empty array for seeding only torrents
|
||||
if (piecesAvailability.empty()) return QVector<qreal>(filesCount, -1);
|
||||
if (piecesAvailability.empty()) return QList<qreal>(filesCount, -1);
|
||||
|
||||
QVector<qreal> res;
|
||||
QList<qreal> res;
|
||||
res.reserve(filesCount);
|
||||
for (int i = 0; i < filesCount; ++i)
|
||||
{
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
#include <QBitArray>
|
||||
#include <QDateTime>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/path.h"
|
||||
#include "base/tagset.h"
|
||||
@@ -154,7 +154,7 @@ namespace BitTorrent
|
||||
qlonglong fileSize(int index) const override;
|
||||
PathList filePaths() const override;
|
||||
PathList actualFilePaths() const override;
|
||||
QVector<DownloadPriority> filePriorities() const override;
|
||||
QList<DownloadPriority> filePriorities() const override;
|
||||
|
||||
TorrentInfo info() const override;
|
||||
bool isFinished() const override;
|
||||
@@ -176,15 +176,15 @@ namespace BitTorrent
|
||||
bool hasMissingFiles() const override;
|
||||
bool hasError() const override;
|
||||
int queuePosition() const override;
|
||||
QVector<TrackerEntryStatus> trackers() const override;
|
||||
QVector<QUrl> urlSeeds() const override;
|
||||
QList<TrackerEntryStatus> trackers() const override;
|
||||
QList<QUrl> urlSeeds() const override;
|
||||
QString error() const override;
|
||||
qlonglong totalDownload() const override;
|
||||
qlonglong totalUpload() const override;
|
||||
qlonglong activeTime() const override;
|
||||
qlonglong finishedTime() const override;
|
||||
qlonglong eta() const override;
|
||||
QVector<qreal> filesProgress() const override;
|
||||
QList<qreal> filesProgress() const override;
|
||||
int seedsCount() const override;
|
||||
int peersCount() const override;
|
||||
int leechsCount() const override;
|
||||
@@ -202,10 +202,10 @@ namespace BitTorrent
|
||||
bool isDHTDisabled() const override;
|
||||
bool isPEXDisabled() const override;
|
||||
bool isLSDDisabled() const override;
|
||||
QVector<PeerInfo> peers() const override;
|
||||
QList<PeerInfo> peers() const override;
|
||||
QBitArray pieces() const override;
|
||||
QBitArray downloadingPieces() const override;
|
||||
QVector<int> pieceAvailability() const override;
|
||||
QList<int> pieceAvailability() const override;
|
||||
qreal distributedCopies() const override;
|
||||
qreal maxRatio() const override;
|
||||
int maxSeedingTime() const override;
|
||||
@@ -219,7 +219,7 @@ namespace BitTorrent
|
||||
int connectionsCount() const override;
|
||||
int connectionsLimit() const override;
|
||||
qlonglong nextAnnounce() const override;
|
||||
QVector<qreal> availableFileFractions() const override;
|
||||
QList<qreal> availableFileFractions() const override;
|
||||
|
||||
void setName(const QString &name) override;
|
||||
void setSequentialDownload(bool enable) override;
|
||||
@@ -230,7 +230,7 @@ namespace BitTorrent
|
||||
void forceDHTAnnounce() override;
|
||||
void forceRecheck() override;
|
||||
void renameFile(int index, const Path &path) override;
|
||||
void prioritizeFiles(const QVector<DownloadPriority> &priorities) override;
|
||||
void prioritizeFiles(const QList<DownloadPriority> &priorities) override;
|
||||
void setUploadLimit(int limit) override;
|
||||
void setDownloadLimit(int limit) override;
|
||||
void setSuperSeeding(bool enable) override;
|
||||
@@ -238,11 +238,11 @@ namespace BitTorrent
|
||||
void setPEXDisabled(bool disable) override;
|
||||
void setLSDDisabled(bool disable) override;
|
||||
void flushCache() const override;
|
||||
void addTrackers(QVector<TrackerEntry> trackers) override;
|
||||
void addTrackers(QList<TrackerEntry> trackers) override;
|
||||
void removeTrackers(const QStringList &trackers) override;
|
||||
void replaceTrackers(QVector<TrackerEntry> trackers) override;
|
||||
void addUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||
void removeUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||
void replaceTrackers(QList<TrackerEntry> trackers) override;
|
||||
void addUrlSeeds(const QList<QUrl> &urlSeeds) override;
|
||||
void removeUrlSeeds(const QList<QUrl> &urlSeeds) override;
|
||||
bool connectPeer(const PeerAddress &peerAddress) override;
|
||||
void clearPeers() override;
|
||||
void setMetadata(const TorrentInfo &torrentInfo) override;
|
||||
@@ -257,11 +257,11 @@ namespace BitTorrent
|
||||
nonstd::expected<QByteArray, QString> exportToBuffer() const override;
|
||||
nonstd::expected<void, QString> exportToFile(const Path &path) const override;
|
||||
|
||||
void fetchPeerInfo(std::function<void (QVector<PeerInfo>)> resultHandler) const override;
|
||||
void fetchURLSeeds(std::function<void (QVector<QUrl>)> resultHandler) const override;
|
||||
void fetchPieceAvailability(std::function<void (QVector<int>)> resultHandler) const override;
|
||||
void fetchPeerInfo(std::function<void (QList<PeerInfo>)> resultHandler) const override;
|
||||
void fetchURLSeeds(std::function<void (QList<QUrl>)> resultHandler) const override;
|
||||
void fetchPieceAvailability(std::function<void (QList<int>)> resultHandler) const override;
|
||||
void fetchDownloadingPieces(std::function<void (QBitArray)> resultHandler) const override;
|
||||
void fetchAvailableFileFractions(std::function<void (QVector<qreal>)> resultHandler) const override;
|
||||
void fetchAvailableFileFractions(std::function<void (QList<qreal>)> resultHandler) const override;
|
||||
|
||||
bool needSaveResumeData() const;
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace BitTorrent
|
||||
TorrentInfo m_torrentInfo;
|
||||
PathList m_filePaths;
|
||||
QHash<lt::file_index_t, int> m_indexMap;
|
||||
QVector<DownloadPriority> m_filePriorities;
|
||||
QList<DownloadPriority> m_filePriorities;
|
||||
QBitArray m_completedFiles;
|
||||
SpeedMonitor m_payloadRateMonitor;
|
||||
|
||||
@@ -352,8 +352,8 @@ namespace BitTorrent
|
||||
|
||||
MaintenanceJob m_maintenanceJob = MaintenanceJob::None;
|
||||
|
||||
QVector<TrackerEntryStatus> m_trackerEntryStatuses;
|
||||
QVector<QUrl> m_urlSeeds;
|
||||
QList<TrackerEntryStatus> m_trackerEntryStatuses;
|
||||
QList<QUrl> m_urlSeeds;
|
||||
FileErrorInfo m_lastFileError;
|
||||
|
||||
// Persistent data
|
||||
@@ -384,7 +384,7 @@ namespace BitTorrent
|
||||
int m_uploadLimit = 0;
|
||||
|
||||
QBitArray m_pieces;
|
||||
QVector<std::int64_t> m_filesProgress;
|
||||
QList<std::int64_t> m_filesProgress;
|
||||
|
||||
bool m_deferredRequestResumeDataInvoked = false;
|
||||
};
|
||||
|
||||
@@ -270,13 +270,13 @@ qlonglong TorrentInfo::fileOffset(const int index) const
|
||||
return m_nativeInfo->orig_files().file_offset(m_nativeIndexes[index]);
|
||||
}
|
||||
|
||||
QVector<TrackerEntry> TorrentInfo::trackers() const
|
||||
QList<TrackerEntry> TorrentInfo::trackers() const
|
||||
{
|
||||
if (!isValid()) return {};
|
||||
|
||||
const std::vector<lt::announce_entry> trackers = m_nativeInfo->trackers();
|
||||
|
||||
QVector<TrackerEntry> ret;
|
||||
QList<TrackerEntry> ret;
|
||||
ret.reserve(static_cast<decltype(ret)::size_type>(trackers.size()));
|
||||
for (const lt::announce_entry &tracker : trackers)
|
||||
ret.append({.url = QString::fromStdString(tracker.url), .tier = tracker.tier});
|
||||
@@ -284,13 +284,13 @@ QVector<TrackerEntry> TorrentInfo::trackers() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
QVector<QUrl> TorrentInfo::urlSeeds() const
|
||||
QList<QUrl> TorrentInfo::urlSeeds() const
|
||||
{
|
||||
if (!isValid()) return {};
|
||||
|
||||
const std::vector<lt::web_seed_entry> &nativeWebSeeds = m_nativeInfo->web_seeds();
|
||||
|
||||
QVector<QUrl> urlSeeds;
|
||||
QList<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(static_cast<decltype(urlSeeds)::size_type>(nativeWebSeeds.size()));
|
||||
|
||||
for (const lt::web_seed_entry &webSeed : nativeWebSeeds)
|
||||
@@ -320,7 +320,7 @@ QByteArray TorrentInfo::metadata() const
|
||||
PathList TorrentInfo::filesForPiece(const int pieceIndex) const
|
||||
{
|
||||
// no checks here because fileIndicesForPiece() will return an empty list
|
||||
const QVector<int> fileIndices = fileIndicesForPiece(pieceIndex);
|
||||
const QList<int> fileIndices = fileIndicesForPiece(pieceIndex);
|
||||
|
||||
PathList res;
|
||||
res.reserve(fileIndices.size());
|
||||
@@ -330,14 +330,14 @@ PathList TorrentInfo::filesForPiece(const int pieceIndex) const
|
||||
return res;
|
||||
}
|
||||
|
||||
QVector<int> TorrentInfo::fileIndicesForPiece(const int pieceIndex) const
|
||||
QList<int> TorrentInfo::fileIndicesForPiece(const int pieceIndex) const
|
||||
{
|
||||
if (!isValid() || (pieceIndex < 0) || (pieceIndex >= piecesCount()))
|
||||
return {};
|
||||
|
||||
const std::vector<lt::file_slice> files = m_nativeInfo->map_block(
|
||||
lt::piece_index_t {pieceIndex}, 0, m_nativeInfo->piece_size(lt::piece_index_t {pieceIndex}));
|
||||
QVector<int> res;
|
||||
QList<int> res;
|
||||
res.reserve(static_cast<decltype(res)::size_type>(files.size()));
|
||||
for (const lt::file_slice &fileSlice : files)
|
||||
{
|
||||
@@ -349,13 +349,13 @@ QVector<int> TorrentInfo::fileIndicesForPiece(const int pieceIndex) const
|
||||
return res;
|
||||
}
|
||||
|
||||
QVector<QByteArray> TorrentInfo::pieceHashes() const
|
||||
QList<QByteArray> TorrentInfo::pieceHashes() const
|
||||
{
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
const int count = piecesCount();
|
||||
QVector<QByteArray> hashes;
|
||||
QList<QByteArray> hashes;
|
||||
hashes.reserve(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
@@ -450,7 +450,7 @@ std::shared_ptr<lt::torrent_info> TorrentInfo::nativeInfo() const
|
||||
return std::make_shared<lt::torrent_info>(*m_nativeInfo);
|
||||
}
|
||||
|
||||
QVector<lt::file_index_t> TorrentInfo::nativeIndexes() const
|
||||
QList<lt::file_index_t> TorrentInfo::nativeIndexes() const
|
||||
{
|
||||
return m_nativeIndexes;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <QtContainerFwd>
|
||||
#include <QCoreApplication>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/3rdparty/expected.hpp"
|
||||
#include "base/indexrange.h"
|
||||
@@ -80,12 +80,12 @@ namespace BitTorrent
|
||||
PathList filePaths() const;
|
||||
qlonglong fileSize(int index) const;
|
||||
qlonglong fileOffset(int index) const;
|
||||
QVector<TrackerEntry> trackers() const;
|
||||
QVector<QUrl> urlSeeds() const;
|
||||
QList<TrackerEntry> trackers() const;
|
||||
QList<QUrl> urlSeeds() const;
|
||||
QByteArray metadata() const;
|
||||
PathList filesForPiece(int pieceIndex) const;
|
||||
QVector<int> fileIndicesForPiece(int pieceIndex) const;
|
||||
QVector<QByteArray> pieceHashes() const;
|
||||
QList<int> fileIndicesForPiece(int pieceIndex) const;
|
||||
QList<QByteArray> pieceHashes() const;
|
||||
|
||||
using PieceRange = IndexRange<int>;
|
||||
// returns pair of the first and the last pieces into which
|
||||
@@ -96,7 +96,7 @@ namespace BitTorrent
|
||||
bool matchesInfoHash(const InfoHash &otherInfoHash) const;
|
||||
|
||||
std::shared_ptr<lt::torrent_info> nativeInfo() const;
|
||||
QVector<lt::file_index_t> nativeIndexes() const;
|
||||
QList<lt::file_index_t> nativeIndexes() const;
|
||||
|
||||
private:
|
||||
// returns file index or -1 if fileName is not found
|
||||
@@ -106,7 +106,7 @@ namespace BitTorrent
|
||||
|
||||
// internal indexes of files (payload only, excluding any .pad files)
|
||||
// by which they are addressed in libtorrent
|
||||
QVector<lt::file_index_t> m_nativeIndexes;
|
||||
QList<lt::file_index_t> m_nativeIndexes;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QHostAddress>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/global.h"
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Http
|
||||
HeaderMap headers;
|
||||
QHash<QString, QByteArray> query;
|
||||
QHash<QString, QString> posts;
|
||||
QVector<UploadedFile> files;
|
||||
QList<UploadedFile> files;
|
||||
};
|
||||
|
||||
struct ResponseStatus
|
||||
|
||||
@@ -31,14 +31,14 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
namespace
|
||||
{
|
||||
template <typename T>
|
||||
QVector<T> loadFromBuffer(const boost::circular_buffer_space_optimized<T> &src, const int offset = 0)
|
||||
QList<T> loadFromBuffer(const boost::circular_buffer_space_optimized<T> &src, const int offset = 0)
|
||||
{
|
||||
QVector<T> ret;
|
||||
QList<T> ret;
|
||||
ret.reserve(static_cast<typename decltype(ret)::size_type>(src.size()) - offset);
|
||||
std::copy((src.begin() + offset), src.end(), std::back_inserter(ret));
|
||||
return ret;
|
||||
@@ -90,7 +90,7 @@ void Logger::addPeer(const QString &ip, const bool blocked, const QString &reaso
|
||||
emit newLogPeer(msg);
|
||||
}
|
||||
|
||||
QVector<Log::Msg> Logger::getMessages(const int lastKnownId) const
|
||||
QList<Log::Msg> Logger::getMessages(const int lastKnownId) const
|
||||
{
|
||||
const QReadLocker locker(&m_lock);
|
||||
|
||||
@@ -106,7 +106,7 @@ QVector<Log::Msg> Logger::getMessages(const int lastKnownId) const
|
||||
return loadFromBuffer(m_messages, (size - diff));
|
||||
}
|
||||
|
||||
QVector<Log::Peer> Logger::getPeers(const int lastKnownId) const
|
||||
QList<Log::Peer> Logger::getPeers(const int lastKnownId) const
|
||||
{
|
||||
const QReadLocker locker(&m_lock);
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
|
||||
void addMessage(const QString &message, const Log::MsgType &type = Log::NORMAL);
|
||||
void addPeer(const QString &ip, bool blocked, const QString &reason = {});
|
||||
QVector<Log::Msg> getMessages(int lastKnownId = -1) const;
|
||||
QVector<Log::Peer> getPeers(int lastKnownId = -1) const;
|
||||
QList<Log::Msg> getMessages(int lastKnownId = -1) const;
|
||||
QList<Log::Peer> getPeers(int lastKnownId = -1) const;
|
||||
|
||||
signals:
|
||||
void newLogMessage(const Log::Msg &message);
|
||||
|
||||
@@ -673,11 +673,11 @@ void Preferences::setWebUIAuthSubnetWhitelistEnabled(const bool enabled)
|
||||
setValue(u"Preferences/WebUI/AuthSubnetWhitelistEnabled"_s, enabled);
|
||||
}
|
||||
|
||||
QVector<Utils::Net::Subnet> Preferences::getWebUIAuthSubnetWhitelist() const
|
||||
QList<Utils::Net::Subnet> Preferences::getWebUIAuthSubnetWhitelist() const
|
||||
{
|
||||
const auto subnets = value<QStringList>(u"Preferences/WebUI/AuthSubnetWhitelist"_s);
|
||||
|
||||
QVector<Utils::Net::Subnet> ret;
|
||||
QList<Utils::Net::Subnet> ret;
|
||||
ret.reserve(subnets.size());
|
||||
|
||||
for (const QString &rawSubnet : subnets)
|
||||
|
||||
@@ -185,7 +185,7 @@ public:
|
||||
void setWebUILocalAuthEnabled(bool enabled);
|
||||
bool isWebUIAuthSubnetWhitelistEnabled() const;
|
||||
void setWebUIAuthSubnetWhitelistEnabled(bool enabled);
|
||||
QVector<Utils::Net::Subnet> getWebUIAuthSubnetWhitelist() const;
|
||||
QList<Utils::Net::Subnet> getWebUIAuthSubnetWhitelist() const;
|
||||
void setWebUIAuthSubnetWhitelist(QStringList subnets);
|
||||
QString getWebUIUsername() const;
|
||||
void setWebUIUsername(const QString &username);
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
|
||||
#include "base/logger.h"
|
||||
#include "base/path.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "rss_article.h"
|
||||
|
||||
const int ARTICLEDATALIST_TYPEID = qRegisterMetaType<QVector<QVariantHash>>();
|
||||
const int ARTICLEDATALIST_TYPEID = qRegisterMetaType<QList<QVariantHash>>();
|
||||
|
||||
void RSS::Private::FeedSerializer::load(const Path &dataFileName, const QString &url)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ void RSS::Private::FeedSerializer::load(const Path &dataFileName, const QString
|
||||
emit loadingFinished(loadArticles(readResult.value(), url));
|
||||
}
|
||||
|
||||
void RSS::Private::FeedSerializer::store(const Path &dataFileName, const QVector<QVariantHash> &articlesData)
|
||||
void RSS::Private::FeedSerializer::store(const Path &dataFileName, const QList<QVariantHash> &articlesData)
|
||||
{
|
||||
QJsonArray arr;
|
||||
for (const QVariantHash &data : articlesData)
|
||||
@@ -81,7 +81,7 @@ void RSS::Private::FeedSerializer::store(const Path &dataFileName, const QVector
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QVariantHash> RSS::Private::FeedSerializer::loadArticles(const QByteArray &data, const QString &url)
|
||||
QList<QVariantHash> RSS::Private::FeedSerializer::loadArticles(const QByteArray &data, const QString &url)
|
||||
{
|
||||
QJsonParseError jsonError;
|
||||
const QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
|
||||
@@ -98,7 +98,7 @@ QVector<QVariantHash> RSS::Private::FeedSerializer::loadArticles(const QByteArra
|
||||
return {};
|
||||
}
|
||||
|
||||
QVector<QVariantHash> result;
|
||||
QList<QVariantHash> result;
|
||||
const QJsonArray jsonArr = jsonDoc.array();
|
||||
result.reserve(jsonArr.size());
|
||||
for (int i = 0; i < jsonArr.size(); ++i)
|
||||
|
||||
@@ -49,12 +49,12 @@ namespace RSS::Private
|
||||
using QObject::QObject;
|
||||
|
||||
void load(const Path &dataFileName, const QString &url);
|
||||
void store(const Path &dataFileName, const QVector<QVariantHash> &articlesData);
|
||||
void store(const Path &dataFileName, const QList<QVariantHash> &articlesData);
|
||||
|
||||
signals:
|
||||
void loadingFinished(const QVector<QVariantHash> &articles);
|
||||
void loadingFinished(const QList<QVariantHash> &articles);
|
||||
|
||||
private:
|
||||
QVector<QVariantHash> loadArticles(const QByteArray &data, const QString &url);
|
||||
QList<QVariantHash> loadArticles(const QByteArray &data, const QString &url);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/addtorrentmanager.h"
|
||||
#include "base/asyncfilestorage.h"
|
||||
@@ -68,7 +68,7 @@ const QString RULES_FILE_NAME = u"download_rules.json"_s;
|
||||
|
||||
namespace
|
||||
{
|
||||
QVector<RSS::AutoDownloadRule> rulesFromJSON(const QByteArray &jsonData)
|
||||
QList<RSS::AutoDownloadRule> rulesFromJSON(const QByteArray &jsonData)
|
||||
{
|
||||
QJsonParseError jsonError;
|
||||
const QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData, &jsonError);
|
||||
@@ -79,7 +79,7 @@ namespace
|
||||
throw RSS::ParsingError(RSS::AutoDownloader::tr("Invalid data format."));
|
||||
|
||||
const QJsonObject jsonObj {jsonDoc.object()};
|
||||
QVector<RSS::AutoDownloadRule> rules;
|
||||
QList<RSS::AutoDownloadRule> rules;
|
||||
for (auto it = jsonObj.begin(); it != jsonObj.end(); ++it)
|
||||
{
|
||||
const QJsonValue jsonVal {it.value()};
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QUrl>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/asyncfilestorage.h"
|
||||
#include "base/global.h"
|
||||
@@ -301,7 +301,7 @@ void Feed::store()
|
||||
m_dirty = false;
|
||||
m_savingTimer.stop();
|
||||
|
||||
QVector<QVariantHash> articlesData;
|
||||
QList<QVariantHash> articlesData;
|
||||
articlesData.reserve(m_articles.size());
|
||||
|
||||
for (Article *article :asConst(m_articles))
|
||||
@@ -395,7 +395,7 @@ int Feed::updateArticles(const QList<QVariantHash> &loadedArticles)
|
||||
return 0;
|
||||
|
||||
QDateTime dummyPubDate {QDateTime::currentDateTime()};
|
||||
QVector<QVariantHash> newArticles;
|
||||
QList<QVariantHash> newArticles;
|
||||
newArticles.reserve(loadedArticles.size());
|
||||
for (QVariantHash article : loadedArticles)
|
||||
{
|
||||
@@ -516,7 +516,7 @@ void Feed::handleArticleRead(Article *article)
|
||||
storeDeferred();
|
||||
}
|
||||
|
||||
void Feed::handleArticleLoadFinished(QVector<QVariantHash> articles)
|
||||
void Feed::handleArticleLoadFinished(QList<QVariantHash> articles)
|
||||
{
|
||||
Q_ASSERT(m_articles.isEmpty());
|
||||
Q_ASSERT(m_unreadCount == 0);
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace RSS
|
||||
void handleDownloadFinished(const Net::DownloadResult &result);
|
||||
void handleParsingFinished(const Private::ParsingResult &result);
|
||||
void handleArticleRead(Article *article);
|
||||
void handleArticleLoadFinished(QVector<QVariantHash> articles);
|
||||
void handleArticleLoadFinished(QList<QVariantHash> articles);
|
||||
|
||||
private:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QList>
|
||||
#include <QMetaObject>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/path.h"
|
||||
@@ -145,7 +145,7 @@ void SearchHandler::readSearchOutput()
|
||||
lines.prepend(m_searchResultLineTruncated + lines.takeFirst());
|
||||
m_searchResultLineTruncated = lines.takeLast().trimmed();
|
||||
|
||||
QVector<SearchResult> searchResultList;
|
||||
QList<SearchResult> searchResultList;
|
||||
searchResultList.reserve(lines.size());
|
||||
|
||||
for (const QByteArray &line : asConst(lines))
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
signals:
|
||||
void searchFinished(bool cancelled = false);
|
||||
void searchFailed();
|
||||
void newSearchResults(const QVector<SearchResult> &results);
|
||||
void newSearchResults(const QList<SearchResult> &results);
|
||||
|
||||
private:
|
||||
void readSearchOutput();
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <QSslCertificate>
|
||||
#include <QSslKey>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/global.h"
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace Utils
|
||||
|| (addr == QHostAddress(u"::ffff:127.0.0.1"_s));
|
||||
}
|
||||
|
||||
bool isIPInSubnets(const QHostAddress &addr, const QVector<Subnet> &subnets)
|
||||
bool isIPInSubnets(const QHostAddress &addr, const QList<Subnet> &subnets)
|
||||
{
|
||||
QHostAddress protocolEquivalentAddress;
|
||||
bool addrConversionOk = false;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Utils::Net
|
||||
bool isValidIP(const QString &ip);
|
||||
std::optional<Subnet> parseSubnet(const QString &subnetStr);
|
||||
bool isLoopbackAddress(const QHostAddress &addr);
|
||||
bool isIPInSubnets(const QHostAddress &addr, const QVector<Subnet> &subnets);
|
||||
bool isIPInSubnets(const QHostAddress &addr, const QList<Subnet> &subnets);
|
||||
QString subnetToString(const Subnet &subnet);
|
||||
QHostAddress canonicalIPv6Addr(const QHostAddress &addr);
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "bytearray.h"
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QList>
|
||||
#include <QLocale>
|
||||
#include <QRegularExpression>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
|
||||
// to send numbers instead of strings with suffixes
|
||||
QString Utils::String::fromDouble(const double n, const int precision)
|
||||
|
||||
Reference in New Issue
Block a user