mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Rework the GUI code for private torrents.
Conflicts: src/qtlibtorrent/qtorrenthandle.cpp
This commit is contained in:
parent
4aa9ed946f
commit
d8c40084a7
2 changed files with 20 additions and 12 deletions
|
@ -198,27 +198,33 @@ void TrackerList::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackerList::loadStickyItems(const QTorrentHandle &h) {
|
void TrackerList::loadStickyItems(const QTorrentHandle &h) {
|
||||||
|
QString working = tr("Working");
|
||||||
|
QString disabled = tr("Disabled");
|
||||||
|
|
||||||
// load DHT information
|
// load DHT information
|
||||||
if (QBtSession::instance()->isDHTEnabled() && (!h.has_metadata() || !h.priv())) {
|
if (QBtSession::instance()->isDHTEnabled() && !h.priv())
|
||||||
dht_item->setText(COL_STATUS, tr("Working"));
|
dht_item->setText(COL_STATUS, working);
|
||||||
} else {
|
else
|
||||||
dht_item->setText(COL_STATUS, tr("Disabled"));
|
dht_item->setText(COL_STATUS, disabled);
|
||||||
}
|
|
||||||
if (h.has_metadata() && h.priv()) {
|
|
||||||
dht_item->setText(COL_MSG, tr("This torrent is private"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load PeX Information
|
// Load PeX Information
|
||||||
if (QBtSession::instance()->isPexEnabled() && !h.priv())
|
if (QBtSession::instance()->isPexEnabled() && !h.priv())
|
||||||
pex_item->setText(COL_STATUS, tr("Working"));
|
pex_item->setText(COL_STATUS, working);
|
||||||
else
|
else
|
||||||
pex_item->setText(COL_STATUS, tr("Disabled"));
|
pex_item->setText(COL_STATUS, disabled);
|
||||||
|
|
||||||
// Load LSD Information
|
// Load LSD Information
|
||||||
if (QBtSession::instance()->isLSDEnabled() && !h.priv())
|
if (QBtSession::instance()->isLSDEnabled() && !h.priv())
|
||||||
lsd_item->setText(COL_STATUS, tr("Working"));
|
lsd_item->setText(COL_STATUS, working);
|
||||||
else
|
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...
|
// XXX: libtorrent should provide this info...
|
||||||
// Count peers from DHT, LSD, PeX
|
// Count peers from DHT, LSD, PeX
|
||||||
|
|
|
@ -550,6 +550,8 @@ int QTorrentHandle::connections_limit() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QTorrentHandle::priv() const {
|
bool QTorrentHandle::priv() const {
|
||||||
|
if (!has_metadata())
|
||||||
|
return false;
|
||||||
return torrent_handle::get_torrent_info().priv();
|
return torrent_handle::get_torrent_info().priv();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue