mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 19:26:59 +03:00
- Fixed compilation with libtorrent v0.14
This commit is contained in:
parent
5544f2a138
commit
8fe448d35f
4 changed files with 44 additions and 10 deletions
|
@ -1511,6 +1511,9 @@ void Bittorrent::readAlerts() {
|
|||
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
|
||||
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;
|
||||
#endif
|
||||
trackers_data.insert(tracker_url, data);
|
||||
trackersInfos[h.hash()] = trackers_data;
|
||||
} else {
|
||||
|
@ -1539,6 +1542,9 @@ void Bittorrent::readAlerts() {
|
|||
QString tracker_url = misc::toQString(p->url);
|
||||
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;
|
||||
#endif
|
||||
trackers_data.insert(tracker_url, data);
|
||||
trackersInfos[h.hash()] = trackers_data;
|
||||
qDebug("Received a tracker warning from %s: %s", p->url.c_str(), p->msg.c_str());
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
QString name_or_url;
|
||||
QString last_message;
|
||||
unsigned long num_peers;
|
||||
#ifndef LIBTORRENT_0_15
|
||||
bool simply_warning;
|
||||
#endif
|
||||
|
||||
//TrackerInfos() {}
|
||||
TrackerInfos(const TrackerInfos &b) {
|
||||
|
@ -62,8 +65,14 @@ public:
|
|||
Q_ASSERT(!name_or_url.isEmpty());
|
||||
last_message = b.last_message;
|
||||
num_peers = b.num_peers;
|
||||
#ifndef LIBTORRENT_0_15
|
||||
simply_warning = b.simply_warning;
|
||||
#endif
|
||||
}
|
||||
TrackerInfos(QString name_or_url): name_or_url(name_or_url), last_message(""), num_peers(0) {
|
||||
#ifndef LIBTORRENT_0_15
|
||||
simply_warning = false;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -134,12 +134,12 @@ public slots:
|
|||
h.get_peer_info(peers);
|
||||
std::vector<peer_info>::iterator it;
|
||||
for(it=peers.begin(); it!=peers.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;
|
||||
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
|
||||
if(properties->getBTSession()->isDHTEnabled() && !h.priv()) {
|
||||
|
@ -184,6 +184,9 @@ public slots:
|
|||
} else {
|
||||
old_trackers_urls.removeOne(tracker_url);
|
||||
}
|
||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||
QString error_message = data.last_message.trimmed();
|
||||
#ifdef LIBTORRENT_0_15
|
||||
if((*it).verified) {
|
||||
item->setText(COL_STATUS, tr("Working"));
|
||||
} else {
|
||||
|
@ -197,8 +200,15 @@ public slots:
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(error_message.isEmpty() || data.simply_warning) {
|
||||
item->setText(COL_STATUS, tr("Working"));
|
||||
} else {
|
||||
item->setText(COL_STATUS, tr("Not working"));
|
||||
}
|
||||
#endif
|
||||
item->setText(COL_PEERS, QString::number(trackers_data.value(tracker_url, TrackerInfos(tracker_url)).num_peers));
|
||||
item->setText(COL_MSG, trackers_data.value(tracker_url, TrackerInfos(tracker_url)).last_message);
|
||||
item->setText(COL_MSG, error_message);
|
||||
}
|
||||
// Remove old trackers
|
||||
foreach(const QString &tracker, old_trackers_urls) {
|
||||
|
|
|
@ -819,8 +819,12 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||
// Enable/disable pause/start action given the DL state
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
bool has_pause = false, has_start = false, has_preview = false;
|
||||
bool all_same_super_seeding = true, all_same_sequential_download_mode = true, all_same_prio_firstlast = true;
|
||||
bool super_seeding_mode = false, sequential_download_mode = false, prioritize_first_last = false;
|
||||
#ifdef LIBTORRENT_0_15
|
||||
bool all_same_super_seeding = true;
|
||||
bool super_seeding_mode = false;
|
||||
#endif
|
||||
bool all_same_sequential_download_mode = true, all_same_prio_firstlast = true;
|
||||
bool sequential_download_mode = false, prioritize_first_last = false;
|
||||
bool one_has_metadata = false, one_not_seed = false;
|
||||
bool first = true;
|
||||
QTorrentHandle h;
|
||||
|
@ -846,7 +850,9 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||
all_same_prio_firstlast = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
#ifdef LIBTORRENT_0_15
|
||||
else {
|
||||
if(!one_not_seed && all_same_super_seeding) {
|
||||
if(first) {
|
||||
super_seeding_mode = h.super_seeding();
|
||||
|
@ -857,6 +863,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(h.is_paused()) {
|
||||
if(!has_start) {
|
||||
listMenu.addAction(&actionStart);
|
||||
|
@ -880,6 +887,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||
if(one_not_seed)
|
||||
listMenu.addAction(&actionSet_download_limit);
|
||||
listMenu.addAction(&actionSet_upload_limit);
|
||||
#ifdef LIBTORRENT_0_15
|
||||
if(!one_not_seed && all_same_super_seeding) {
|
||||
QIcon ico;
|
||||
if(super_seeding_mode) {
|
||||
|
@ -890,6 +898,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||
actionSuper_seeding_mode.setIcon(ico);
|
||||
listMenu.addAction(&actionSuper_seeding_mode);
|
||||
}
|
||||
#endif
|
||||
listMenu.addSeparator();
|
||||
bool added_preview_action = false;
|
||||
if(has_preview) {
|
||||
|
|
Loading…
Reference in a new issue