mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 08:48:07 -06:00
Replace QList by QVector
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user