mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
- Added "Copy magnet link" entry to right click menu now that we support magnet URIs
This commit is contained in:
parent
e429126934
commit
c8e8306e0a
10 changed files with 239 additions and 195 deletions
24
src/GUI.cpp
24
src/GUI.cpp
|
@ -34,6 +34,7 @@
|
|||
#include <QDesktopServices>
|
||||
#include <QStatusBar>
|
||||
#include <QFrame>
|
||||
#include <QClipboard>
|
||||
#ifdef QT_4_4
|
||||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
|
@ -597,6 +598,28 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::copyMagnetURI() const {
|
||||
QStringList hashes;
|
||||
switch(tabs->currentIndex()){
|
||||
case 0:
|
||||
hashes = downloadingTorrentTab->getSelectedTorrents();
|
||||
break;
|
||||
case 1:
|
||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
QStringList magnet_uris;
|
||||
foreach(QString hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(h.is_valid()) {
|
||||
magnet_uris << misc::toQString(make_magnet_uri(h.get_torrent_info()));
|
||||
}
|
||||
}
|
||||
qApp->clipboard()->setText(magnet_uris.join("\n"));
|
||||
}
|
||||
|
||||
void GUI::goBuyPage() const {
|
||||
QStringList hashes;
|
||||
|
@ -1351,6 +1374,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||
} else {
|
||||
hashes = finishedTorrentTab->getSelectedTorrents();
|
||||
}
|
||||
qDebug("nb hashes: %d", hashes.size());
|
||||
foreach(const QString &hash, hashes) {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||
if(!h.is_paused()){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue