mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-09 14:27:56 +00:00
commit
6fddbd8178
@ -297,6 +297,19 @@ void TrackerList::askForTrackers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackerList::copyTrackerUrl() {
|
||||||
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
|
if (selected_items.isEmpty()) return;
|
||||||
|
QStringList urls_to_copy;
|
||||||
|
foreach (QTreeWidgetItem *item, selected_items) {
|
||||||
|
QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString();
|
||||||
|
qDebug() << QString("Copy: ") + tracker_url;
|
||||||
|
urls_to_copy << tracker_url;
|
||||||
|
}
|
||||||
|
QApplication::clipboard()->setText(urls_to_copy.join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrackerList::deleteSelectedTrackers() {
|
void TrackerList::deleteSelectedTrackers() {
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
QTorrentHandle h = properties->getCurrentTorrent();
|
||||||
if (!h.is_valid()) {
|
if (!h.is_valid()) {
|
||||||
@ -336,6 +349,7 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
QMenu menu;
|
QMenu menu;
|
||||||
// Add actions
|
// Add actions
|
||||||
QAction *addAct = menu.addAction(IconProvider::instance()->getIcon("list-add"), tr("Add a new tracker..."));
|
QAction *addAct = menu.addAction(IconProvider::instance()->getIcon("list-add"), tr("Add a new tracker..."));
|
||||||
|
QAction *copyAct = menu.addAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker url"));
|
||||||
QAction *delAct = 0;
|
QAction *delAct = 0;
|
||||||
if (!getSelectedTrackerItems().isEmpty()) {
|
if (!getSelectedTrackerItems().isEmpty()) {
|
||||||
delAct = menu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove tracker"));
|
delAct = menu.addAction(IconProvider::instance()->getIcon("list-remove"), tr("Remove tracker"));
|
||||||
@ -346,6 +360,10 @@ void TrackerList::showTrackerListMenu(QPoint) {
|
|||||||
askForTrackers();
|
askForTrackers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (act == copyAct) {
|
||||||
|
copyTrackerUrl();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (act == delAct) {
|
if (act == delAct) {
|
||||||
deleteSelectedTrackers();
|
deleteSelectedTrackers();
|
||||||
return;
|
return;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QClipboard>
|
||||||
|
|
||||||
#include <libtorrent/version.hpp>
|
#include <libtorrent/version.hpp>
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
@ -69,6 +70,7 @@ public slots:
|
|||||||
void loadStickyItems(const QTorrentHandle &h);
|
void loadStickyItems(const QTorrentHandle &h);
|
||||||
void loadTrackers();
|
void loadTrackers();
|
||||||
void askForTrackers();
|
void askForTrackers();
|
||||||
|
void copyTrackerUrl();
|
||||||
void deleteSelectedTrackers();
|
void deleteSelectedTrackers();
|
||||||
void showTrackerListMenu(QPoint);
|
void showTrackerListMenu(QPoint);
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
Loading…
Reference in New Issue
Block a user