mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-26 22:44:36 +00:00
Copy tracker URL to the clipboard
- code cleanup
This commit is contained in:
parent
d85ff9e088
commit
84322976ba
@ -297,25 +297,16 @@ void TrackerList::askForTrackers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy tracker URL to clipboard
|
|
||||||
void TrackerList::copyTrackerUrl() {
|
void TrackerList::copyTrackerUrl() {
|
||||||
qDebug()<<"Copy tracker URL to clipboard";
|
|
||||||
QTorrentHandle h = properties->getCurrentTorrent();
|
|
||||||
if (!h.is_valid()) {
|
|
||||||
clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
QList<QTreeWidgetItem *> selected_items = getSelectedTrackerItems();
|
||||||
if (selected_items.isEmpty()) return;
|
if (selected_items.isEmpty()) return;
|
||||||
QString urls_to_copy;
|
QStringList urls_to_copy;
|
||||||
foreach (QTreeWidgetItem *item, selected_items) {
|
foreach (QTreeWidgetItem *item, selected_items) {
|
||||||
QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString();
|
QString tracker_url = item->data(COL_URL, Qt::DisplayRole).toString();
|
||||||
qDebug()<<QString("Copy ")+tracker_url;
|
qDebug() << QString("Copy: ") + tracker_url;
|
||||||
urls_to_copy += tracker_url/*.prepend(QString(" "))*/;
|
urls_to_copy << tracker_url;
|
||||||
delete item;
|
|
||||||
}
|
}
|
||||||
QApplication::clipboard()->setText(urls_to_copy);
|
QApplication::clipboard()->setText(urls_to_copy.join("\n"));
|
||||||
qDebug()<<"Tracker URL copied clipboard!";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -358,7 +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("list-add"), tr("Copy tracker url..."));
|
QAction *copyAct = menu.addAction(IconProvider::instance()->getIcon("list-add"), 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"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user