mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Support selective reannounce with libtorrent 1.0
This commit is contained in:
parent
0ce28eb28f
commit
f319678457
@ -405,6 +405,33 @@ void TrackerList::editSelectedTracker() {
|
|||||||
loadTrackers();
|
loadTrackers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
void TrackerList::reannounceSelected() {
|
||||||
|
try {
|
||||||
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
|
if (selected_items.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::vector<announce_entry> trackers = h.trackers();
|
||||||
|
for (int i = 0; i < trackers.size(); ++i) {
|
||||||
|
foreach (QTreeWidgetItem* w, selected_items) {
|
||||||
|
if (w->text(COL_URL) == misc::toQString(trackers[i].url)) {
|
||||||
|
h.force_reannounce(0, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(invalid_handle&) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTrackers();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void TrackerList::showTrackerListMenu(QPoint) {
|
void TrackerList::showTrackerListMenu(QPoint) {
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if (!h.is_valid()) return;
|
if (!h.is_valid()) return;
|
||||||
@ -420,6 +447,9 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
copyAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker url"));
|
copyAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker url"));
|
||||||
editAct = menu.addAction(IconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URL"));
|
editAct = menu.addAction(IconProvider::instance()->getIcon("edit-rename"),tr("Edit selected tracker URL"));
|
||||||
}
|
}
|
||||||
|
#if LIBTORRENT_VERSION_MAJOR >= 1
|
||||||
|
QAction *reannounceSelAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
|
||||||
|
#endif
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
QAction *reannounceAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
|
QAction *reannounceAct = menu.addAction(IconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
|
||||||
QAction *act = menu.exec(QCursor::pos());
|
QAction *act = menu.exec(QCursor::pos());
|
||||||
@ -436,6 +466,12 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
deleteSelectedTrackers();
|
deleteSelectedTrackers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if LIBTORRENT_VERSION_MAJOR >= 1
|
||||||
|
if (act == reannounceSelAct) {
|
||||||
|
reannounceSelected();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (act == reannounceAct) {
|
if (act == reannounceAct) {
|
||||||
properties->getCurrentTorrent().force_reannounce();
|
properties->getCurrentTorrent().force_reannounce();
|
||||||
return;
|
return;
|
||||||
|
@ -74,6 +74,9 @@ public slots:
|
|||||||
void loadTrackers();
|
void loadTrackers();
|
||||||
void askForTrackers();
|
void askForTrackers();
|
||||||
void copyTrackerUrl();
|
void copyTrackerUrl();
|
||||||
|
#if LIBTORRENT_VERSION_NUM >= 10000
|
||||||
|
void reannounceSelected();
|
||||||
|
#endif
|
||||||
void deleteSelectedTrackers();
|
void deleteSelectedTrackers();
|
||||||
void editSelectedTracker();
|
void editSelectedTracker();
|
||||||
void showTrackerListMenu(QPoint);
|
void showTrackerListMenu(QPoint);
|
||||||
|
Loading…
Reference in New Issue
Block a user