Browse Source

Merge pull request #2493 from ADTC/issue-2452

Add "Copy name" option in right-click menu of torrent list
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
33c5eccf13
  1. 17
      src/gui/transferlistwidget.cpp
  2. 1
      src/gui/transferlistwidget.h

17
src/gui/transferlistwidget.cpp

@ -424,6 +424,18 @@ void TransferListWidget::copySelectedMagnetURIs() const @@ -424,6 +424,18 @@ void TransferListWidget::copySelectedMagnetURIs() const
qApp->clipboard()->setText(magnet_uris.join("\n"));
}
void TransferListWidget::copySelectedNames() const
{
QStringList torrent_names;
const QStringList hashes = getSelectedTorrentsHashes();
foreach (const QString &hash, hashes) {
const QTorrentHandle h = BTSession->getTorrentHandle(hash);
if (h.is_valid())
torrent_names << h.name();
}
qApp->clipboard()->setText(torrent_names.join("\n"));
}
void TransferListWidget::hidePriorityColumn(bool hide)
{
qDebug("hidePriorityColumn(%d)", hide);
@ -741,6 +753,10 @@ void TransferListWidget::displayListMenu(const QPoint&) @@ -741,6 +753,10 @@ void TransferListWidget::displayListMenu(const QPoint&)
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents()));
QAction actionCopy_magnet_link(QIcon(":/icons/magnet.png"), tr("Copy magnet link"), 0);
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
QAction actionCopy_name(IconProvider::instance()->getIcon("edit-copy"), tr("Copy name"), 0);
connect(&actionCopy_name, SIGNAL(triggered()), this, SLOT(copySelectedNames()));
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
actionSuper_seeding_mode.setCheckable(true);
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
@ -873,6 +889,7 @@ void TransferListWidget::displayListMenu(const QPoint&) @@ -873,6 +889,7 @@ void TransferListWidget::displayListMenu(const QPoint&)
prioMenu->addAction(&actionBottomPriority);
}
listMenu.addSeparator();
listMenu.addAction(&actionCopy_name);
listMenu.addAction(&actionCopy_magnet_link);
// Call menu
QAction *act = 0;

1
src/gui/transferlistwidget.h

@ -71,6 +71,7 @@ public slots: @@ -71,6 +71,7 @@ public slots:
void topPrioSelectedTorrents();
void bottomPrioSelectedTorrents();
void copySelectedMagnetURIs() const;
void copySelectedNames() const;
void openSelectedTorrentsFolder() const;
void recheckSelectedTorrents();
void setDlLimitSelectedTorrents();

Loading…
Cancel
Save