mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-08 22:07:53 +00:00
- Improve tracker status detection when using libtorrent v0.14
This commit is contained in:
parent
2f4d27b422
commit
c52e0cf841
@ -1512,7 +1512,8 @@ void Bittorrent::readAlerts() {
|
||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||
data.last_message = misc::toQString(p->msg);
|
||||
#ifndef LIBTORRENT_0_15
|
||||
data.simply_warning = false;
|
||||
data.verified = false;
|
||||
++data.fail_count;
|
||||
#endif
|
||||
trackers_data.insert(tracker_url, data);
|
||||
trackersInfos[h.hash()] = trackers_data;
|
||||
@ -1531,6 +1532,10 @@ void Bittorrent::readAlerts() {
|
||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||
data.last_message = ""; // Reset error/warning message
|
||||
data.num_peers = p->num_peers;
|
||||
#ifndef LIBTORRENT_0_15
|
||||
data.fail_count = 0;
|
||||
data.verified = true;
|
||||
#endif
|
||||
trackers_data.insert(tracker_url, data);
|
||||
trackersInfos[h.hash()] = trackers_data;
|
||||
}
|
||||
@ -1543,7 +1548,8 @@ void Bittorrent::readAlerts() {
|
||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||
data.last_message = misc::toQString(p->msg); // Store warning message
|
||||
#ifndef LIBTORRENT_0_15
|
||||
data.simply_warning = true;
|
||||
data.verified = true;
|
||||
data.fail_count = 0;
|
||||
#endif
|
||||
trackers_data.insert(tracker_url, data);
|
||||
trackersInfos[h.hash()] = trackers_data;
|
||||
|
@ -56,7 +56,8 @@ public:
|
||||
QString last_message;
|
||||
unsigned long num_peers;
|
||||
#ifndef LIBTORRENT_0_15
|
||||
bool simply_warning;
|
||||
bool verified;
|
||||
uint fail_count;
|
||||
#endif
|
||||
|
||||
//TrackerInfos() {}
|
||||
@ -66,12 +67,14 @@ public:
|
||||
last_message = b.last_message;
|
||||
num_peers = b.num_peers;
|
||||
#ifndef LIBTORRENT_0_15
|
||||
simply_warning = b.simply_warning;
|
||||
verified = b.verified;
|
||||
fail_count = b.fail_count;
|
||||
#endif
|
||||
}
|
||||
TrackerInfos(QString name_or_url): name_or_url(name_or_url), last_message(""), num_peers(0) {
|
||||
#ifndef LIBTORRENT_0_15
|
||||
simply_warning = false;
|
||||
fail_count = 0;
|
||||
verified = false;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
@ -201,10 +201,13 @@ public slots:
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(error_message.isEmpty() || data.simply_warning) {
|
||||
if(data.verified) {
|
||||
item->setText(COL_STATUS, tr("Working"));
|
||||
} else {
|
||||
item->setText(COL_STATUS, tr("Not working"));
|
||||
if(data.fail_count > 0)
|
||||
item->setText(COL_STATUS, tr("Not working"));
|
||||
else
|
||||
item->setText(COL_STATUS, tr("Not contacted yet"));
|
||||
}
|
||||
#endif
|
||||
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
||||
|
Loading…
Reference in New Issue
Block a user