|
|
@ -186,42 +186,45 @@ void TrackerList::clear() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TrackerList::loadStickyItems(const QTorrentHandle &h) { |
|
|
|
void TrackerList::loadStickyItems(const QTorrentHandle &h) { |
|
|
|
// XXX: libtorrent should provide this info...
|
|
|
|
|
|
|
|
// Count peers from DHT, LSD, PeX
|
|
|
|
|
|
|
|
uint nb_dht = 0, nb_lsd = 0, nb_pex = 0; |
|
|
|
|
|
|
|
std::vector<peer_info> peers; |
|
|
|
|
|
|
|
h.get_peer_info(peers); |
|
|
|
|
|
|
|
std::vector<peer_info>::iterator it = peers.begin(); |
|
|
|
|
|
|
|
std::vector<peer_info>::iterator end = peers.end(); |
|
|
|
|
|
|
|
for ( ; it != end; ++it) { |
|
|
|
|
|
|
|
if (it->source & peer_info::dht) |
|
|
|
|
|
|
|
++nb_dht; |
|
|
|
|
|
|
|
if (it->source & peer_info::lsd) |
|
|
|
|
|
|
|
++nb_lsd; |
|
|
|
|
|
|
|
if (it->source & peer_info::pex) |
|
|
|
|
|
|
|
++nb_pex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// load DHT information
|
|
|
|
// load DHT information
|
|
|
|
if (QBtSession::instance()->isDHTEnabled() && !h.priv()) { |
|
|
|
if (QBtSession::instance()->isDHTEnabled() && (!h.has_metadata() || !h.priv())) { |
|
|
|
dht_item->setText(COL_STATUS, tr("Working")); |
|
|
|
dht_item->setText(COL_STATUS, tr("Working")); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dht_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
dht_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
} |
|
|
|
} |
|
|
|
dht_item->setText(COL_PEERS, QString::number(nb_dht)); |
|
|
|
|
|
|
|
if (h.has_metadata() && h.priv()) { |
|
|
|
if (h.has_metadata() && h.priv()) { |
|
|
|
dht_item->setText(COL_MSG, tr("This torrent is private")); |
|
|
|
dht_item->setText(COL_MSG, tr("This torrent is private")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Load PeX Information
|
|
|
|
// Load PeX Information
|
|
|
|
if (QBtSession::instance()->isPexEnabled()) |
|
|
|
if (QBtSession::instance()->isPexEnabled()) |
|
|
|
pex_item->setText(COL_STATUS, tr("Working")); |
|
|
|
pex_item->setText(COL_STATUS, tr("Working")); |
|
|
|
else |
|
|
|
else |
|
|
|
pex_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
pex_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
pex_item->setText(COL_PEERS, QString::number(nb_pex)); |
|
|
|
|
|
|
|
// Load LSD Information
|
|
|
|
// Load LSD Information
|
|
|
|
if (QBtSession::instance()->isLSDEnabled()) |
|
|
|
if (QBtSession::instance()->isLSDEnabled()) |
|
|
|
lsd_item->setText(COL_STATUS, tr("Working")); |
|
|
|
lsd_item->setText(COL_STATUS, tr("Working")); |
|
|
|
else |
|
|
|
else |
|
|
|
lsd_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
lsd_item->setText(COL_STATUS, tr("Disabled")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// XXX: libtorrent should provide this info...
|
|
|
|
|
|
|
|
// Count peers from DHT, LSD, PeX
|
|
|
|
|
|
|
|
uint nb_dht = 0, nb_lsd = 0, nb_pex = 0; |
|
|
|
|
|
|
|
std::vector<peer_info> peers; |
|
|
|
|
|
|
|
h.get_peer_info(peers); |
|
|
|
|
|
|
|
std::vector<peer_info>::iterator it = peers.begin(); |
|
|
|
|
|
|
|
std::vector<peer_info>::iterator end = peers.end(); |
|
|
|
|
|
|
|
for ( ; it != end; ++it) { |
|
|
|
|
|
|
|
if (it->source & peer_info::dht) |
|
|
|
|
|
|
|
++nb_dht; |
|
|
|
|
|
|
|
if (it->source & peer_info::lsd) |
|
|
|
|
|
|
|
++nb_lsd; |
|
|
|
|
|
|
|
if (it->source & peer_info::pex) |
|
|
|
|
|
|
|
++nb_pex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dht_item->setText(COL_PEERS, QString::number(nb_dht)); |
|
|
|
|
|
|
|
pex_item->setText(COL_PEERS, QString::number(nb_pex)); |
|
|
|
lsd_item->setText(COL_PEERS, QString::number(nb_lsd)); |
|
|
|
lsd_item->setText(COL_PEERS, QString::number(nb_lsd)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|