mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 11:24:15 +00:00
- Fixed compilation with libtorrent v0.14
This commit is contained in:
parent
5544f2a138
commit
8fe448d35f
@ -1511,6 +1511,9 @@ void Bittorrent::readAlerts() {
|
|||||||
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
|
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
data.last_message = misc::toQString(p->msg);
|
data.last_message = misc::toQString(p->msg);
|
||||||
|
#ifndef LIBTORRENT_0_15
|
||||||
|
data.simply_warning = false;
|
||||||
|
#endif
|
||||||
trackers_data.insert(tracker_url, data);
|
trackers_data.insert(tracker_url, data);
|
||||||
trackersInfos[h.hash()] = trackers_data;
|
trackersInfos[h.hash()] = trackers_data;
|
||||||
} else {
|
} else {
|
||||||
@ -1539,6 +1542,9 @@ void Bittorrent::readAlerts() {
|
|||||||
QString tracker_url = misc::toQString(p->url);
|
QString tracker_url = misc::toQString(p->url);
|
||||||
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
|
||||||
data.last_message = misc::toQString(p->msg); // Store warning message
|
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);
|
trackers_data.insert(tracker_url, data);
|
||||||
trackersInfos[h.hash()] = trackers_data;
|
trackersInfos[h.hash()] = trackers_data;
|
||||||
qDebug("Received a tracker warning from %s: %s", p->url.c_str(), p->msg.c_str());
|
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 name_or_url;
|
||||||
QString last_message;
|
QString last_message;
|
||||||
unsigned long num_peers;
|
unsigned long num_peers;
|
||||||
|
#ifndef LIBTORRENT_0_15
|
||||||
|
bool simply_warning;
|
||||||
|
#endif
|
||||||
|
|
||||||
//TrackerInfos() {}
|
//TrackerInfos() {}
|
||||||
TrackerInfos(const TrackerInfos &b) {
|
TrackerInfos(const TrackerInfos &b) {
|
||||||
@ -62,8 +65,14 @@ public:
|
|||||||
Q_ASSERT(!name_or_url.isEmpty());
|
Q_ASSERT(!name_or_url.isEmpty());
|
||||||
last_message = b.last_message;
|
last_message = b.last_message;
|
||||||
num_peers = b.num_peers;
|
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) {
|
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);
|
h.get_peer_info(peers);
|
||||||
std::vector<peer_info>::iterator it;
|
std::vector<peer_info>::iterator it;
|
||||||
for(it=peers.begin(); it!=peers.end(); it++) {
|
for(it=peers.begin(); it!=peers.end(); it++) {
|
||||||
if(it->source & peer_info::dht)
|
if(it->source & peer_info::dht)
|
||||||
++nb_dht;
|
++nb_dht;
|
||||||
if(it->source & peer_info::lsd)
|
if(it->source & peer_info::lsd)
|
||||||
++nb_lsd;
|
++nb_lsd;
|
||||||
if(it->source & peer_info::pex)
|
if(it->source & peer_info::pex)
|
||||||
++nb_pex;
|
++nb_pex;
|
||||||
}
|
}
|
||||||
// load DHT information
|
// load DHT information
|
||||||
if(properties->getBTSession()->isDHTEnabled() && !h.priv()) {
|
if(properties->getBTSession()->isDHTEnabled() && !h.priv()) {
|
||||||
@ -184,6 +184,9 @@ public slots:
|
|||||||
} else {
|
} else {
|
||||||
old_trackers_urls.removeOne(tracker_url);
|
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) {
|
if((*it).verified) {
|
||||||
item->setText(COL_STATUS, tr("Working"));
|
item->setText(COL_STATUS, tr("Working"));
|
||||||
} else {
|
} 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_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
|
// Remove old trackers
|
||||||
foreach(const QString &tracker, old_trackers_urls) {
|
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
|
// Enable/disable pause/start action given the DL state
|
||||||
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||||
bool has_pause = false, has_start = false, has_preview = false;
|
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;
|
#ifdef LIBTORRENT_0_15
|
||||||
bool super_seeding_mode = false, sequential_download_mode = false, prioritize_first_last = false;
|
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 one_has_metadata = false, one_not_seed = false;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
QTorrentHandle h;
|
QTorrentHandle h;
|
||||||
@ -846,7 +850,9 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
all_same_prio_firstlast = false;
|
all_same_prio_firstlast = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
#ifdef LIBTORRENT_0_15
|
||||||
|
else {
|
||||||
if(!one_not_seed && all_same_super_seeding) {
|
if(!one_not_seed && all_same_super_seeding) {
|
||||||
if(first) {
|
if(first) {
|
||||||
super_seeding_mode = h.super_seeding();
|
super_seeding_mode = h.super_seeding();
|
||||||
@ -857,6 +863,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(h.is_paused()) {
|
if(h.is_paused()) {
|
||||||
if(!has_start) {
|
if(!has_start) {
|
||||||
listMenu.addAction(&actionStart);
|
listMenu.addAction(&actionStart);
|
||||||
@ -880,6 +887,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
if(one_not_seed)
|
if(one_not_seed)
|
||||||
listMenu.addAction(&actionSet_download_limit);
|
listMenu.addAction(&actionSet_download_limit);
|
||||||
listMenu.addAction(&actionSet_upload_limit);
|
listMenu.addAction(&actionSet_upload_limit);
|
||||||
|
#ifdef LIBTORRENT_0_15
|
||||||
if(!one_not_seed && all_same_super_seeding) {
|
if(!one_not_seed && all_same_super_seeding) {
|
||||||
QIcon ico;
|
QIcon ico;
|
||||||
if(super_seeding_mode) {
|
if(super_seeding_mode) {
|
||||||
@ -890,6 +898,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
actionSuper_seeding_mode.setIcon(ico);
|
actionSuper_seeding_mode.setIcon(ico);
|
||||||
listMenu.addAction(&actionSuper_seeding_mode);
|
listMenu.addAction(&actionSuper_seeding_mode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
bool added_preview_action = false;
|
bool added_preview_action = false;
|
||||||
if(has_preview) {
|
if(has_preview) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user