mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 08:48:17 +00:00
Merge pull request #11010 from Chocobo1/qvector
Replace QList by QVector
This commit is contained in:
commit
2b617b0e71
@ -80,6 +80,7 @@ MagnetUri::MagnetUri(const QString &source)
|
||||
for (const std::string &tracker : m_addTorrentParams.trackers)
|
||||
m_trackers.append(lt::announce_entry {tracker});
|
||||
|
||||
m_urlSeeds.reserve(m_addTorrentParams.url_seeds.size());
|
||||
for (const std::string &urlSeed : m_addTorrentParams.url_seeds)
|
||||
m_urlSeeds.append(QUrl(QString::fromStdString(urlSeed)));
|
||||
}
|
||||
@ -104,7 +105,7 @@ QVector<TrackerEntry> MagnetUri::trackers() const
|
||||
return m_trackers;
|
||||
}
|
||||
|
||||
QList<QUrl> MagnetUri::urlSeeds() const
|
||||
QVector<QUrl> MagnetUri::urlSeeds() const
|
||||
{
|
||||
return m_urlSeeds;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include <libtorrent/add_torrent_params.hpp>
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
@ -51,7 +50,7 @@ namespace BitTorrent
|
||||
InfoHash hash() const;
|
||||
QString name() const;
|
||||
QVector<TrackerEntry> trackers() const;
|
||||
QList<QUrl> urlSeeds() const;
|
||||
QVector<QUrl> urlSeeds() const;
|
||||
QString url() const;
|
||||
|
||||
lt::add_torrent_params addTorrentParams() const;
|
||||
@ -62,7 +61,7 @@ namespace BitTorrent
|
||||
InfoHash m_hash;
|
||||
QString m_name;
|
||||
QVector<TrackerEntry> m_trackers;
|
||||
QList<QUrl> m_urlSeeds;
|
||||
QVector<QUrl> m_urlSeeds;
|
||||
lt::add_torrent_params m_addTorrentParams;
|
||||
};
|
||||
}
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "base/bittorrent/torrenthandle.h"
|
||||
#include "base/net/geoipmanager.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "peeraddress.h"
|
||||
|
||||
using namespace BitTorrent;
|
||||
@ -261,20 +260,18 @@ qreal PeerInfo::relevance() const
|
||||
|
||||
void PeerInfo::determineFlags()
|
||||
{
|
||||
QStringList flagsDescriptionList;
|
||||
|
||||
if (isInteresting()) {
|
||||
// d = Your client wants to download, but peer doesn't want to send (interested and choked)
|
||||
if (isRemoteChocked()) {
|
||||
m_flags += "d ";
|
||||
flagsDescriptionList += "d = "
|
||||
+ tr("Interested(local) and Choked(peer)");
|
||||
m_flagsDescription += ("d = "
|
||||
+ tr("Interested(local) and Choked(peer)") + '\n');
|
||||
}
|
||||
else {
|
||||
// D = Currently downloading (interested and not choked)
|
||||
m_flags += "D ";
|
||||
flagsDescriptionList += "D = "
|
||||
+ tr("interested(local) and unchoked(peer)");
|
||||
m_flagsDescription += ("D = "
|
||||
+ tr("interested(local) and unchoked(peer)") + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,95 +279,87 @@ void PeerInfo::determineFlags()
|
||||
// u = Peer wants your client to upload, but your client doesn't want to (interested and choked)
|
||||
if (isChocked()) {
|
||||
m_flags += "u ";
|
||||
flagsDescriptionList += "u = "
|
||||
+ tr("interested(peer) and choked(local)");
|
||||
m_flagsDescription += ("u = "
|
||||
+ tr("interested(peer) and choked(local)") + '\n');
|
||||
}
|
||||
else {
|
||||
// U = Currently uploading (interested and not choked)
|
||||
m_flags += "U ";
|
||||
flagsDescriptionList += "U = "
|
||||
+ tr("interested(peer) and unchoked(local)");
|
||||
m_flagsDescription += ("U = "
|
||||
+ tr("interested(peer) and unchoked(local)") + '\n');
|
||||
}
|
||||
}
|
||||
|
||||
// O = Optimistic unchoke
|
||||
if (optimisticUnchoke()) {
|
||||
m_flags += "O ";
|
||||
flagsDescriptionList += "O = "
|
||||
+ tr("optimistic unchoke");
|
||||
m_flagsDescription += ("O = " + tr("optimistic unchoke") + '\n');
|
||||
}
|
||||
|
||||
// S = Peer is snubbed
|
||||
if (isSnubbed()) {
|
||||
m_flags += "S ";
|
||||
flagsDescriptionList += "S = "
|
||||
+ tr("peer snubbed");
|
||||
m_flagsDescription += ("S = " + tr("peer snubbed") + '\n');
|
||||
}
|
||||
|
||||
// I = Peer is an incoming connection
|
||||
if (!isLocalConnection()) {
|
||||
m_flags += "I ";
|
||||
flagsDescriptionList += "I = "
|
||||
+ tr("incoming connection");
|
||||
m_flagsDescription += ("I = " + tr("incoming connection") + '\n');
|
||||
}
|
||||
|
||||
// K = Peer is unchoking your client, but your client is not interested
|
||||
if (!isRemoteChocked() && !isInteresting()) {
|
||||
m_flags += "K ";
|
||||
flagsDescriptionList += "K = "
|
||||
+ tr("not interested(local) and unchoked(peer)");
|
||||
m_flagsDescription += ("K = "
|
||||
+ tr("not interested(local) and unchoked(peer)") + '\n');
|
||||
}
|
||||
|
||||
// ? = Your client unchoked the peer but the peer is not interested
|
||||
if (!isChocked() && !isRemoteInterested()) {
|
||||
m_flags += "? ";
|
||||
flagsDescriptionList += "? = "
|
||||
+ tr("not interested(peer) and unchoked(local)");
|
||||
m_flagsDescription += ("? = "
|
||||
+ tr("not interested(peer) and unchoked(local)") + '\n');
|
||||
}
|
||||
|
||||
// X = Peer was included in peerlists obtained through Peer Exchange (PEX)
|
||||
if (fromPeX()) {
|
||||
m_flags += "X ";
|
||||
flagsDescriptionList += "X = "
|
||||
+ tr("peer from PEX");
|
||||
m_flagsDescription += ("X = " + tr("peer from PEX") + '\n');
|
||||
}
|
||||
|
||||
// H = Peer was obtained through DHT
|
||||
if (fromDHT()) {
|
||||
m_flags += "H ";
|
||||
flagsDescriptionList += "H = "
|
||||
+ tr("peer from DHT");
|
||||
m_flagsDescription += ("H = " + tr("peer from DHT") + '\n');
|
||||
}
|
||||
|
||||
// E = Peer is using Protocol Encryption (all traffic)
|
||||
if (isRC4Encrypted()) {
|
||||
m_flags += "E ";
|
||||
flagsDescriptionList += "E = "
|
||||
+ tr("encrypted traffic");
|
||||
m_flagsDescription += ("E = " + tr("encrypted traffic") + '\n');
|
||||
}
|
||||
|
||||
// e = Peer is using Protocol Encryption (handshake)
|
||||
if (isPlaintextEncrypted()) {
|
||||
m_flags += "e ";
|
||||
flagsDescriptionList += "e = "
|
||||
+ tr("encrypted handshake");
|
||||
m_flagsDescription += ("e = " + tr("encrypted handshake") + '\n');
|
||||
}
|
||||
|
||||
// P = Peer is using uTorrent uTP
|
||||
if (useUTPSocket()) {
|
||||
m_flags += "P ";
|
||||
flagsDescriptionList += "P = "
|
||||
+ QString::fromUtf8(C_UTP);
|
||||
m_flagsDescription += ("P = " + QString::fromUtf8(C_UTP) + '\n');
|
||||
}
|
||||
|
||||
// L = Peer is local
|
||||
if (fromLSD()) {
|
||||
m_flags += 'L';
|
||||
flagsDescriptionList += "L = "
|
||||
+ tr("peer from LSD");
|
||||
m_flags += "L ";
|
||||
m_flagsDescription += ("L = " + tr("peer from LSD") + '\n');
|
||||
}
|
||||
|
||||
m_flags = m_flags.trimmed();
|
||||
m_flagsDescription = flagsDescriptionList.join('\n');
|
||||
m_flagsDescription = m_flagsDescription.trimmed();
|
||||
}
|
||||
|
||||
QString PeerInfo::flags() const
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <libtorrent/peer_info.hpp>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QHostAddress>
|
||||
|
||||
class QBitArray;
|
||||
|
||||
@ -46,6 +45,7 @@ namespace BitTorrent
|
||||
Q_DECLARE_TR_FUNCTIONS(PeerInfo)
|
||||
|
||||
public:
|
||||
PeerInfo() = default;
|
||||
PeerInfo(const TorrentHandle *torrent, const lt::peer_info &nativeInfo);
|
||||
|
||||
bool fromDHT() const;
|
||||
@ -98,8 +98,8 @@ namespace BitTorrent
|
||||
void calcRelevance(const TorrentHandle *torrent);
|
||||
void determineFlags();
|
||||
|
||||
lt::peer_info m_nativeInfo;
|
||||
qreal m_relevance;
|
||||
lt::peer_info m_nativeInfo = {};
|
||||
qreal m_relevance = 0;
|
||||
QString m_flags;
|
||||
QString m_flagsDescription;
|
||||
};
|
||||
|
@ -3409,14 +3409,14 @@ void Session::handleTorrentTrackersChanged(TorrentHandle *const torrent)
|
||||
emit trackersChanged(torrent);
|
||||
}
|
||||
|
||||
void Session::handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QList<QUrl> &newUrlSeeds)
|
||||
void Session::handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QVector<QUrl> &newUrlSeeds)
|
||||
{
|
||||
torrent->saveResumeData();
|
||||
for (const QUrl &newUrlSeed : newUrlSeeds)
|
||||
LogMsg(tr("URL seed '%1' was added to torrent '%2'").arg(newUrlSeed.toString(), torrent->name()));
|
||||
}
|
||||
|
||||
void Session::handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QList<QUrl> &urlSeeds)
|
||||
void Session::handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QVector<QUrl> &urlSeeds)
|
||||
{
|
||||
torrent->saveResumeData();
|
||||
for (const QUrl &urlSeed : urlSeeds)
|
||||
|
@ -36,10 +36,10 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QNetworkConfigurationManager>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/settingvalue.h"
|
||||
#include "base/types.h"
|
||||
@ -439,8 +439,8 @@ namespace BitTorrent
|
||||
void handleTorrentTrackersAdded(TorrentHandle *const torrent, const QVector<TrackerEntry> &newTrackers);
|
||||
void handleTorrentTrackersRemoved(TorrentHandle *const torrent, const QVector<TrackerEntry> &deletedTrackers);
|
||||
void handleTorrentTrackersChanged(TorrentHandle *const torrent);
|
||||
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QList<QUrl> &newUrlSeeds);
|
||||
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QList<QUrl> &urlSeeds);
|
||||
void handleTorrentUrlSeedsAdded(TorrentHandle *const torrent, const QVector<QUrl> &newUrlSeeds);
|
||||
void handleTorrentUrlSeedsRemoved(TorrentHandle *const torrent, const QVector<QUrl> &urlSeeds);
|
||||
void handleTorrentResumeDataReady(TorrentHandle *const torrent, const lt::entry &data);
|
||||
void handleTorrentResumeDataFailed(TorrentHandle *const torrent);
|
||||
void handleTorrentTrackerReply(TorrentHandle *const torrent, const QString &trackerUrl);
|
||||
|
@ -475,20 +475,23 @@ void TorrentHandle::replaceTrackers(const QVector<TrackerEntry> &trackers)
|
||||
}
|
||||
}
|
||||
|
||||
QList<QUrl> TorrentHandle::urlSeeds() const
|
||||
QVector<QUrl> TorrentHandle::urlSeeds() const
|
||||
{
|
||||
QList<QUrl> urlSeeds;
|
||||
const std::set<std::string> seeds = m_nativeHandle.url_seeds();
|
||||
|
||||
QVector<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(seeds.size());
|
||||
|
||||
for (const std::string &urlSeed : seeds)
|
||||
urlSeeds.append(QUrl(urlSeed.c_str()));
|
||||
|
||||
return urlSeeds;
|
||||
}
|
||||
|
||||
void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
void TorrentHandle::addUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
{
|
||||
QList<QUrl> addedUrlSeeds;
|
||||
QVector<QUrl> addedUrlSeeds;
|
||||
addedUrlSeeds.reserve(urlSeeds.size());
|
||||
for (const QUrl &urlSeed : urlSeeds) {
|
||||
if (addUrlSeed(urlSeed))
|
||||
addedUrlSeeds << urlSeed;
|
||||
@ -498,9 +501,10 @@ void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
m_session->handleTorrentUrlSeedsAdded(this, addedUrlSeeds);
|
||||
}
|
||||
|
||||
void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
void TorrentHandle::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
{
|
||||
QList<QUrl> removedUrlSeeds;
|
||||
QVector<QUrl> removedUrlSeeds;
|
||||
removedUrlSeeds.reserve(urlSeeds.size());
|
||||
for (const QUrl &urlSeed : urlSeeds) {
|
||||
if (removeUrlSeed(urlSeed))
|
||||
removedUrlSeeds << urlSeed;
|
||||
@ -512,7 +516,7 @@ void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds)
|
||||
|
||||
bool TorrentHandle::addUrlSeed(const QUrl &urlSeed)
|
||||
{
|
||||
QList<QUrl> seeds = urlSeeds();
|
||||
const QVector<QUrl> seeds = urlSeeds();
|
||||
if (seeds.contains(urlSeed)) return false;
|
||||
|
||||
m_nativeHandle.add_url_seed(urlSeed.toString().toStdString());
|
||||
@ -521,7 +525,7 @@ bool TorrentHandle::addUrlSeed(const QUrl &urlSeed)
|
||||
|
||||
bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed)
|
||||
{
|
||||
QList<QUrl> seeds = urlSeeds();
|
||||
const QVector<QUrl> seeds = urlSeeds();
|
||||
if (!seeds.contains(urlSeed)) return false;
|
||||
|
||||
m_nativeHandle.remove_url_seed(urlSeed.toString().toStdString());
|
||||
@ -1170,16 +1174,15 @@ bool TorrentHandle::superSeeding() const
|
||||
#endif
|
||||
}
|
||||
|
||||
QList<PeerInfo> TorrentHandle::peers() const
|
||||
QVector<PeerInfo> TorrentHandle::peers() const
|
||||
{
|
||||
QList<PeerInfo> peers;
|
||||
std::vector<lt::peer_info> nativePeers;
|
||||
|
||||
m_nativeHandle.get_peer_info(nativePeers);
|
||||
|
||||
QVector<PeerInfo> peers;
|
||||
peers.reserve(nativePeers.size());
|
||||
for (const lt::peer_info &peer : nativePeers)
|
||||
peers << PeerInfo(this, peer);
|
||||
|
||||
return peers;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <libtorrent/torrent_status.hpp>
|
||||
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QQueue>
|
||||
#include <QSet>
|
||||
@ -263,7 +262,7 @@ namespace BitTorrent
|
||||
int queuePosition() const;
|
||||
QVector<TrackerEntry> trackers() const;
|
||||
QHash<QString, TrackerInfo> trackerInfos() const;
|
||||
QList<QUrl> urlSeeds() const;
|
||||
QVector<QUrl> urlSeeds() const;
|
||||
QString error() const;
|
||||
qlonglong totalDownload() const;
|
||||
qlonglong totalUpload() const;
|
||||
@ -288,7 +287,7 @@ namespace BitTorrent
|
||||
int downloadLimit() const;
|
||||
int uploadLimit() const;
|
||||
bool superSeeding() const;
|
||||
QList<PeerInfo> peers() const;
|
||||
QVector<PeerInfo> peers() const;
|
||||
QBitArray pieces() const;
|
||||
QBitArray downloadingPieces() const;
|
||||
QVector<int> pieceAvailability() const;
|
||||
@ -326,8 +325,8 @@ namespace BitTorrent
|
||||
void flushCache();
|
||||
void addTrackers(const QVector<TrackerEntry> &trackers);
|
||||
void replaceTrackers(const QVector<TrackerEntry> &trackers);
|
||||
void addUrlSeeds(const QList<QUrl> &urlSeeds);
|
||||
void removeUrlSeeds(const QList<QUrl> &urlSeeds);
|
||||
void addUrlSeeds(const QVector<QUrl> &urlSeeds);
|
||||
void removeUrlSeeds(const QVector<QUrl> &urlSeeds);
|
||||
bool connectPeer(const PeerAddress &peerAddress);
|
||||
|
||||
QString toMagnetUri() const;
|
||||
|
@ -278,14 +278,19 @@ QVector<TrackerEntry> TorrentInfo::trackers() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<QUrl> TorrentInfo::urlSeeds() const
|
||||
QVector<QUrl> TorrentInfo::urlSeeds() const
|
||||
{
|
||||
if (!isValid()) return {};
|
||||
|
||||
QList<QUrl> urlSeeds;
|
||||
for (const lt::web_seed_entry &webSeed : m_nativeInfo->web_seeds())
|
||||
const std::vector<lt::web_seed_entry> &nativeWebSeeds = m_nativeInfo->web_seeds();
|
||||
|
||||
QVector<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(nativeWebSeeds.size());
|
||||
|
||||
for (const lt::web_seed_entry &webSeed : nativeWebSeeds) {
|
||||
if (webSeed.type == lt::web_seed_entry::url_seed)
|
||||
urlSeeds.append(QUrl(webSeed.url.c_str()));
|
||||
}
|
||||
|
||||
return urlSeeds;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/indexrange.h"
|
||||
@ -89,7 +88,7 @@ namespace BitTorrent
|
||||
qlonglong fileSize(int index) const;
|
||||
qlonglong fileOffset(int index) const;
|
||||
QVector<TrackerEntry> trackers() const;
|
||||
QList<QUrl> urlSeeds() const;
|
||||
QVector<QUrl> urlSeeds() const;
|
||||
QByteArray metadata() const;
|
||||
QStringList filesForPiece(int pieceIndex) const;
|
||||
QVector<int> fileIndicesForPiece(int pieceIndex) const;
|
||||
|
@ -32,8 +32,8 @@
|
||||
#include <QDir>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
class QStringList;
|
||||
|
||||
@ -67,7 +67,7 @@ private:
|
||||
QHash<QString, int> m_partialTorrents;
|
||||
QTimer m_partialTorrentTimer;
|
||||
|
||||
QList<QDir> m_watchedFolders;
|
||||
QVector<QDir> m_watchedFolders;
|
||||
QTimer m_watchTimer;
|
||||
};
|
||||
|
||||
|
@ -528,17 +528,21 @@ void Preferences::setWebUiAuthSubnetWhitelistEnabled(const bool enabled)
|
||||
setValue("Preferences/WebUI/AuthSubnetWhitelistEnabled", enabled);
|
||||
}
|
||||
|
||||
QList<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
|
||||
QVector<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
|
||||
{
|
||||
QList<Utils::Net::Subnet> subnets;
|
||||
for (const QString &rawSubnet : asConst(value("Preferences/WebUI/AuthSubnetWhitelist").toStringList())) {
|
||||
const QStringList subnets = value("Preferences/WebUI/AuthSubnetWhitelist").toStringList();
|
||||
|
||||
QVector<Utils::Net::Subnet> ret;
|
||||
ret.reserve(subnets.size());
|
||||
|
||||
for (const QString &rawSubnet : subnets) {
|
||||
bool ok = false;
|
||||
const Utils::Net::Subnet subnet = Utils::Net::parseSubnet(rawSubnet.trimmed(), &ok);
|
||||
if (ok)
|
||||
subnets.append(subnet);
|
||||
ret.append(subnet);
|
||||
}
|
||||
|
||||
return subnets;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
void setWebUiLocalAuthEnabled(bool enabled);
|
||||
bool isWebUiAuthSubnetWhitelistEnabled() const;
|
||||
void setWebUiAuthSubnetWhitelistEnabled(bool enabled);
|
||||
QList<Utils::Net::Subnet> getWebUiAuthSubnetWhitelist() const;
|
||||
QVector<Utils::Net::Subnet> getWebUiAuthSubnetWhitelist() const;
|
||||
void setWebUiAuthSubnetWhitelist(QStringList subnets);
|
||||
QString getWebUiUsername() const;
|
||||
void setWebUiUsername(const QString &username);
|
||||
|
@ -127,13 +127,16 @@ void SearchHandler::processFinished(const int exitcode)
|
||||
void SearchHandler::readSearchOutput()
|
||||
{
|
||||
QByteArray output = m_searchProcess->readAllStandardOutput();
|
||||
output.replace("\r", "");
|
||||
output.replace('\r', "");
|
||||
|
||||
QList<QByteArray> lines = output.split('\n');
|
||||
if (!m_searchResultLineTruncated.isEmpty())
|
||||
lines.prepend(m_searchResultLineTruncated + lines.takeFirst());
|
||||
m_searchResultLineTruncated = lines.takeLast().trimmed();
|
||||
|
||||
QList<SearchResult> searchResultList;
|
||||
QVector<SearchResult> searchResultList;
|
||||
searchResultList.reserve(lines.size());
|
||||
|
||||
for (const QByteArray &line : asConst(lines)) {
|
||||
SearchResult searchResult;
|
||||
if (parseSearchResult(QString::fromUtf8(line), searchResult))
|
||||
@ -141,7 +144,8 @@ void SearchHandler::readSearchOutput()
|
||||
}
|
||||
|
||||
if (!searchResultList.isEmpty()) {
|
||||
m_results.append(searchResultList);
|
||||
for (const SearchResult &result : searchResultList)
|
||||
m_results.append(result);
|
||||
emit newSearchResults(searchResultList);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
class QProcess;
|
||||
class QTimer;
|
||||
@ -71,7 +72,7 @@ public:
|
||||
signals:
|
||||
void searchFinished(bool cancelled = false);
|
||||
void searchFailed();
|
||||
void newSearchResults(const QList<SearchResult> &results);
|
||||
void newSearchResults(const QVector<SearchResult> &results);
|
||||
|
||||
private:
|
||||
void readSearchOutput();
|
||||
|
@ -64,7 +64,7 @@ namespace Utils
|
||||
|| (addr == QHostAddress(QLatin1String("::ffff:127.0.0.1")));
|
||||
}
|
||||
|
||||
bool isIPInRange(const QHostAddress &addr, const QList<Subnet> &subnets)
|
||||
bool isIPInRange(const QHostAddress &addr, const QVector<Subnet> &subnets)
|
||||
{
|
||||
QHostAddress protocolEquivalentAddress;
|
||||
bool addrConversionOk = false;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <QHostAddress>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QVector>
|
||||
|
||||
class QSslCertificate;
|
||||
class QSslKey;
|
||||
@ -47,7 +48,7 @@ namespace Utils
|
||||
Subnet parseSubnet(const QString &subnetStr, bool *ok = nullptr);
|
||||
bool canParseSubnet(const QString &subnetStr);
|
||||
bool isLoopbackAddress(const QHostAddress &addr);
|
||||
bool isIPInRange(const QHostAddress &addr, const QList<Subnet> &subnets);
|
||||
bool isIPInRange(const QHostAddress &addr, const QVector<Subnet> &subnets);
|
||||
QString subnetToString(const Subnet &subnet);
|
||||
|
||||
const int MAX_SSL_FILE_SIZE = 1024 * 1024;
|
||||
|
@ -239,7 +239,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
|
||||
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
|
||||
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
|
||||
{
|
||||
const QList<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
|
||||
const QVector<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
|
||||
int peerCount = 0;
|
||||
for (const BitTorrent::PeerAddress &addr : peersList) {
|
||||
if (torrent->connectPeer(addr)) {
|
||||
@ -336,7 +336,7 @@ void PeerListWidget::loadPeers(BitTorrent::TorrentHandle *const torrent, bool fo
|
||||
{
|
||||
if (!torrent) return;
|
||||
|
||||
const QList<BitTorrent::PeerInfo> peers = torrent->peers();
|
||||
const QVector<BitTorrent::PeerInfo> peers = torrent->peers();
|
||||
QSet<QString> oldPeersSet = m_peerItems.keys().toSet();
|
||||
|
||||
for (const BitTorrent::PeerInfo &peer : peers) {
|
||||
|
@ -48,7 +48,7 @@ PeersAdditionDialog::~PeersAdditionDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QList<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
|
||||
QVector<BitTorrent::PeerAddress> PeersAdditionDialog::askForPeers(QWidget *parent)
|
||||
{
|
||||
PeersAdditionDialog dlg(parent);
|
||||
dlg.exec();
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define PEERADDITION_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
|
||||
@ -47,14 +47,14 @@ public:
|
||||
PeersAdditionDialog(QWidget *parent);
|
||||
~PeersAdditionDialog();
|
||||
|
||||
static QList<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
|
||||
static QVector<BitTorrent::PeerAddress> askForPeers(QWidget *parent);
|
||||
|
||||
protected slots:
|
||||
void validateInput();
|
||||
|
||||
private:
|
||||
Ui::PeersAdditionDialog *m_ui;
|
||||
QList<BitTorrent::PeerAddress> m_peersList;
|
||||
QVector<BitTorrent::PeerAddress> m_peersList;
|
||||
};
|
||||
|
||||
#endif // PEERADDITION_H
|
||||
|
@ -495,7 +495,7 @@ void PropertiesWidget::loadUrlSeeds()
|
||||
{
|
||||
m_ui->listWebSeeds->clear();
|
||||
qDebug("Loading URL seeds");
|
||||
const QList<QUrl> hcSeeds = m_torrent->urlSeeds();
|
||||
const QVector<QUrl> hcSeeds = m_torrent->urlSeeds();
|
||||
// Add url seeds
|
||||
for (const QUrl &hcSeed : hcSeeds) {
|
||||
qDebug("Loading URL seed: %s", qUtf8Printable(hcSeed.toString()));
|
||||
@ -715,7 +715,7 @@ void PropertiesWidget::askWebSeed()
|
||||
return;
|
||||
}
|
||||
if (m_torrent)
|
||||
m_torrent->addUrlSeeds(QList<QUrl>() << urlSeed);
|
||||
m_torrent->addUrlSeeds({urlSeed});
|
||||
// Refresh the seeds list
|
||||
loadUrlSeeds();
|
||||
}
|
||||
@ -725,7 +725,9 @@ void PropertiesWidget::deleteSelectedUrlSeeds()
|
||||
const QList<QListWidgetItem *> selectedItems = m_ui->listWebSeeds->selectedItems();
|
||||
if (selectedItems.isEmpty()) return;
|
||||
|
||||
QList<QUrl> urlSeeds;
|
||||
QVector<QUrl> urlSeeds;
|
||||
urlSeeds.reserve(selectedItems.size());
|
||||
|
||||
for (const QListWidgetItem *item : selectedItems)
|
||||
urlSeeds << item->text();
|
||||
|
||||
@ -766,8 +768,8 @@ void PropertiesWidget::editWebSeed()
|
||||
return;
|
||||
}
|
||||
|
||||
m_torrent->removeUrlSeeds(QList<QUrl>() << oldSeed);
|
||||
m_torrent->addUrlSeeds(QList<QUrl>() << newSeed);
|
||||
m_torrent->removeUrlSeeds({oldSeed});
|
||||
m_torrent->addUrlSeeds({newSeed});
|
||||
loadUrlSeeds();
|
||||
}
|
||||
|
||||
|
@ -238,9 +238,10 @@ void PluginSelectDialog::setRowColor(const int row, const QString &color)
|
||||
}
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
|
||||
QVector<QTreeWidgetItem*> PluginSelectDialog::findItemsWithUrl(const QString &url)
|
||||
{
|
||||
QList<QTreeWidgetItem*> res;
|
||||
QVector<QTreeWidgetItem*> res;
|
||||
res.reserve(m_ui->pluginsTree->topLevelItemCount());
|
||||
|
||||
for (int i = 0; i < m_ui->pluginsTree->topLevelItemCount(); ++i) {
|
||||
QTreeWidgetItem *item = m_ui->pluginsTree->topLevelItem(i);
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
explicit PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent = nullptr);
|
||||
~PluginSelectDialog() override;
|
||||
|
||||
QList<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
|
||||
QVector<QTreeWidgetItem*> findItemsWithUrl(const QString &url);
|
||||
QTreeWidgetItem *findItemWithID(const QString &id);
|
||||
|
||||
protected:
|
||||
|
@ -506,7 +506,7 @@ void SearchJobWidget::searchFailed()
|
||||
setStatus(Status::Error);
|
||||
}
|
||||
|
||||
void SearchJobWidget::appendSearchResults(const QList<SearchResult> &results)
|
||||
void SearchJobWidget::appendSearchResults(const QVector<SearchResult> &results)
|
||||
{
|
||||
for (const SearchResult &result : results) {
|
||||
// Add item to search result list
|
||||
|
@ -100,7 +100,7 @@ private:
|
||||
void onItemDoubleClicked(const QModelIndex &index);
|
||||
void searchFinished(bool cancelled);
|
||||
void searchFailed();
|
||||
void appendSearchResults(const QList<SearchResult> &results);
|
||||
void appendSearchResults(const QVector<SearchResult> &results);
|
||||
void updateResultsCount();
|
||||
void setStatus(Status value);
|
||||
void downloadTorrent(const QModelIndex &rowIndex);
|
||||
|
@ -198,7 +198,7 @@ namespace
|
||||
|
||||
TorrentContentModel::TorrentContentModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
, m_rootItem(new TorrentContentModelFolder(QList<QVariant>({ tr("Name"), tr("Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
|
||||
, m_rootItem(new TorrentContentModelFolder(QVector<QVariant>({ tr("Name"), tr("Size"), tr("Progress"), tr("Download Priority"), tr("Remaining"), tr("Availability") })))
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
m_fileIconProvider = new WinShellFileIconProvider();
|
||||
|
@ -43,7 +43,7 @@ TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, Torren
|
||||
m_name.chop(4);
|
||||
}
|
||||
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QList<QVariant> &data)
|
||||
TorrentContentModelFolder::TorrentContentModelFolder(const QVector<QVariant> &data)
|
||||
: TorrentContentModelItem(nullptr)
|
||||
{
|
||||
Q_ASSERT(data.size() == NB_COL);
|
||||
@ -67,7 +67,7 @@ void TorrentContentModelFolder::deleteAllChildren()
|
||||
m_childItems.clear();
|
||||
}
|
||||
|
||||
const QList<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
|
||||
const QVector<TorrentContentModelItem *> &TorrentContentModelFolder::children() const
|
||||
{
|
||||
return m_childItems;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
TorrentContentModelFolder(const QString &name, TorrentContentModelFolder *parent);
|
||||
|
||||
// Invisible root item constructor
|
||||
explicit TorrentContentModelFolder(const QList<QVariant> &data);
|
||||
explicit TorrentContentModelFolder(const QVector<QVariant> &data);
|
||||
|
||||
~TorrentContentModelFolder() override;
|
||||
|
||||
@ -57,14 +57,14 @@ public:
|
||||
void setPriority(BitTorrent::DownloadPriority newPriority, bool updateParent = true) override;
|
||||
|
||||
void deleteAllChildren();
|
||||
const QList<TorrentContentModelItem*> &children() const;
|
||||
const QVector<TorrentContentModelItem*> &children() const;
|
||||
void appendChild(TorrentContentModelItem *item);
|
||||
TorrentContentModelItem *child(int row) const;
|
||||
TorrentContentModelFolder *childFolderWithName(const QString &name) const;
|
||||
int childCount() const;
|
||||
|
||||
private:
|
||||
QList<TorrentContentModelItem*> m_childItems;
|
||||
QVector<TorrentContentModelItem*> m_childItems;
|
||||
};
|
||||
|
||||
#endif // TORRENTCONTENTMODELFOLDER_H
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef TORRENTCONTENTMODELITEM_H
|
||||
#define TORRENTCONTENTMODELITEM_H
|
||||
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
protected:
|
||||
TorrentContentModelFolder *m_parentItem;
|
||||
// Root item members
|
||||
QList<QVariant> m_itemData;
|
||||
QVector<QVariant> m_itemData;
|
||||
// Non-root item members
|
||||
QString m_name;
|
||||
qulonglong m_size;
|
||||
|
@ -490,7 +490,8 @@ void SyncController::torrentPeersAction()
|
||||
|
||||
QVariantMap data;
|
||||
QVariantHash peers;
|
||||
const QList<BitTorrent::PeerInfo> peersList = torrent->peers();
|
||||
|
||||
const QVector<BitTorrent::PeerInfo> peersList = torrent->peers();
|
||||
|
||||
#ifndef DISABLE_COUNTRIES_RESOLUTION
|
||||
bool resolvePeerCountries = Preferences::instance()->resolvePeerCountries();
|
||||
|
@ -145,7 +145,7 @@ private:
|
||||
|
||||
bool m_isLocalAuthEnabled;
|
||||
bool m_isAuthSubnetWhitelistEnabled;
|
||||
QList<Utils::Net::Subnet> m_authSubnetWhitelist;
|
||||
QVector<Utils::Net::Subnet> m_authSubnetWhitelist;
|
||||
int m_sessionTimeout;
|
||||
|
||||
// security related
|
||||
|
Loading…
Reference in New Issue
Block a user