|
|
@ -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(); |
|
|
|
const std::set<std::string> seeds = m_nativeHandle.url_seeds(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVector<QUrl> urlSeeds; |
|
|
|
|
|
|
|
urlSeeds.reserve(seeds.size()); |
|
|
|
|
|
|
|
|
|
|
|
for (const std::string &urlSeed : seeds) |
|
|
|
for (const std::string &urlSeed : seeds) |
|
|
|
urlSeeds.append(QUrl(urlSeed.c_str())); |
|
|
|
urlSeeds.append(QUrl(urlSeed.c_str())); |
|
|
|
|
|
|
|
|
|
|
|
return urlSeeds; |
|
|
|
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) { |
|
|
|
for (const QUrl &urlSeed : urlSeeds) { |
|
|
|
if (addUrlSeed(urlSeed)) |
|
|
|
if (addUrlSeed(urlSeed)) |
|
|
|
addedUrlSeeds << urlSeed; |
|
|
|
addedUrlSeeds << urlSeed; |
|
|
@ -498,9 +501,10 @@ void TorrentHandle::addUrlSeeds(const QList<QUrl> &urlSeeds) |
|
|
|
m_session->handleTorrentUrlSeedsAdded(this, addedUrlSeeds); |
|
|
|
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) { |
|
|
|
for (const QUrl &urlSeed : urlSeeds) { |
|
|
|
if (removeUrlSeed(urlSeed)) |
|
|
|
if (removeUrlSeed(urlSeed)) |
|
|
|
removedUrlSeeds << urlSeed; |
|
|
|
removedUrlSeeds << urlSeed; |
|
|
@ -512,7 +516,7 @@ void TorrentHandle::removeUrlSeeds(const QList<QUrl> &urlSeeds) |
|
|
|
|
|
|
|
|
|
|
|
bool TorrentHandle::addUrlSeed(const QUrl &urlSeed) |
|
|
|
bool TorrentHandle::addUrlSeed(const QUrl &urlSeed) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QList<QUrl> seeds = urlSeeds(); |
|
|
|
const QVector<QUrl> seeds = urlSeeds(); |
|
|
|
if (seeds.contains(urlSeed)) return false; |
|
|
|
if (seeds.contains(urlSeed)) return false; |
|
|
|
|
|
|
|
|
|
|
|
m_nativeHandle.add_url_seed(urlSeed.toString().toStdString()); |
|
|
|
m_nativeHandle.add_url_seed(urlSeed.toString().toStdString()); |
|
|
@ -521,7 +525,7 @@ bool TorrentHandle::addUrlSeed(const QUrl &urlSeed) |
|
|
|
|
|
|
|
|
|
|
|
bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed) |
|
|
|
bool TorrentHandle::removeUrlSeed(const QUrl &urlSeed) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QList<QUrl> seeds = urlSeeds(); |
|
|
|
const QVector<QUrl> seeds = urlSeeds(); |
|
|
|
if (!seeds.contains(urlSeed)) return false; |
|
|
|
if (!seeds.contains(urlSeed)) return false; |
|
|
|
|
|
|
|
|
|
|
|
m_nativeHandle.remove_url_seed(urlSeed.toString().toStdString()); |
|
|
|
m_nativeHandle.remove_url_seed(urlSeed.toString().toStdString()); |
|
|
@ -1170,16 +1174,15 @@ bool TorrentHandle::superSeeding() const |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QList<PeerInfo> TorrentHandle::peers() const |
|
|
|
QVector<PeerInfo> TorrentHandle::peers() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
QList<PeerInfo> peers; |
|
|
|
|
|
|
|
std::vector<lt::peer_info> nativePeers; |
|
|
|
std::vector<lt::peer_info> nativePeers; |
|
|
|
|
|
|
|
|
|
|
|
m_nativeHandle.get_peer_info(nativePeers); |
|
|
|
m_nativeHandle.get_peer_info(nativePeers); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVector<PeerInfo> peers; |
|
|
|
|
|
|
|
peers.reserve(nativePeers.size()); |
|
|
|
for (const lt::peer_info &peer : nativePeers) |
|
|
|
for (const lt::peer_info &peer : nativePeers) |
|
|
|
peers << PeerInfo(this, peer); |
|
|
|
peers << PeerInfo(this, peer); |
|
|
|
|
|
|
|
|
|
|
|
return peers; |
|
|
|
return peers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|