Add copy options to webui context menu (addresses #6815) (#7036)

* Add copy options to webui context menu
Add Copy Hash to gui (closes #6964)

* Use switch statement

* Use camel case, switch from signal to qaction.

* Rename variable

* Change variable name
This commit is contained in:
Tom Piccirello 2017-08-06 04:35:12 -04:00 committed by Mike Tzou
parent 08aa827366
commit 145641ac41
8 changed files with 90 additions and 0 deletions

View file

@ -527,6 +527,15 @@ void TransferListWidget::copySelectedNames() const
qApp->clipboard()->setText(torrent_names.join("\n"));
}
void TransferListWidget::copySelectedHashes() const
{
QStringList torrentHashes;
foreach (BitTorrent::TorrentHandle *const torrent, getSelectedTorrents())
torrentHashes << torrent->hash();
qApp->clipboard()->setText(torrentHashes.join('\n'));
}
void TransferListWidget::hidePriorityColumn(bool hide)
{
qDebug("hidePriorityColumn(%d)", hide);
@ -870,6 +879,8 @@ void TransferListWidget::displayListMenu(const QPoint&)
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
QAction actionCopy_name(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy name"), 0);
connect(&actionCopy_name, SIGNAL(triggered()), this, SLOT(copySelectedNames()));
QAction actionCopyHash(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy hash"), 0);
connect(&actionCopyHash, &QAction::triggered, this, &TransferListWidget::copySelectedHashes);
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
actionSuper_seeding_mode.setCheckable(true);
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
@ -1081,6 +1092,7 @@ void TransferListWidget::displayListMenu(const QPoint&)
listMenu.addSeparator();
listMenu.addAction(&actionCopy_name);
listMenu.addAction(&actionCopy_magnet_link);
listMenu.addAction(&actionCopyHash);
// Call menu
QAction *act = 0;
act = listMenu.exec(QCursor::pos());