mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Rework the GUI code for private torrents.
This commit is contained in:
parent
b9bdd1c985
commit
27c641ffaa
2 changed files with 20 additions and 12 deletions
|
@ -198,27 +198,33 @@ void TrackerList::clear() {
|
|||
}
|
||||
|
||||
void TrackerList::loadStickyItems(const QTorrentHandle &h) {
|
||||
QString working = tr("Working");
|
||||
QString disabled = tr("Disabled");
|
||||
|
||||
// load DHT information
|
||||
if (QBtSession::instance()->isDHTEnabled() && (!h.has_metadata() || !h.priv())) {
|
||||
dht_item->setText(COL_STATUS, tr("Working"));
|
||||
} else {
|
||||
dht_item->setText(COL_STATUS, tr("Disabled"));
|
||||
}
|
||||
if (h.has_metadata() && h.priv()) {
|
||||
dht_item->setText(COL_MSG, tr("This torrent is private"));
|
||||
}
|
||||
if (QBtSession::instance()->isDHTEnabled() && !h.priv())
|
||||
dht_item->setText(COL_STATUS, working);
|
||||
else
|
||||
dht_item->setText(COL_STATUS, disabled);
|
||||
|
||||
// Load PeX Information
|
||||
if (QBtSession::instance()->isPexEnabled() && !h.priv())
|
||||
pex_item->setText(COL_STATUS, tr("Working"));
|
||||
pex_item->setText(COL_STATUS, working);
|
||||
else
|
||||
pex_item->setText(COL_STATUS, tr("Disabled"));
|
||||
pex_item->setText(COL_STATUS, disabled);
|
||||
|
||||
// Load LSD Information
|
||||
if (QBtSession::instance()->isLSDEnabled() && !h.priv())
|
||||
lsd_item->setText(COL_STATUS, tr("Working"));
|
||||
lsd_item->setText(COL_STATUS, working);
|
||||
else
|
||||
lsd_item->setText(COL_STATUS, tr("Disabled"));
|
||||
lsd_item->setText(COL_STATUS, disabled);
|
||||
|
||||
if (h.priv()) {
|
||||
QString privateMsg = tr("This torrent is private");
|
||||
dht_item->setText(COL_MSG, privateMsg);
|
||||
pex_item->setText(COL_MSG, privateMsg);
|
||||
lsd_item->setText(COL_MSG, privateMsg);
|
||||
}
|
||||
|
||||
// XXX: libtorrent should provide this info...
|
||||
// Count peers from DHT, LSD, PeX
|
||||
|
|
|
@ -336,6 +336,8 @@ bool QTorrentHandle::is_sequential_download() const {
|
|||
}
|
||||
|
||||
bool QTorrentHandle::priv() const {
|
||||
if (!has_metadata())
|
||||
return false;
|
||||
#if LIBTORRENT_VERSION_NUM < 10000
|
||||
return torrent_handle::get_torrent_info().priv();
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue