|
|
@ -487,7 +487,33 @@ void TransferListWidget::copySelectedNames() const |
|
|
|
qApp->clipboard()->setText(torrentNames.join('\n')); |
|
|
|
qApp->clipboard()->setText(torrentNames.join('\n')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TransferListWidget::copySelectedHashes() const |
|
|
|
void TransferListWidget::copySelectedInfohashes(const CopyInfohashPolicy policy) const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const auto selectedTorrents = getSelectedTorrents(); |
|
|
|
|
|
|
|
QStringList infoHashes; |
|
|
|
|
|
|
|
infoHashes.reserve(selectedTorrents.size()); |
|
|
|
|
|
|
|
switch (policy) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case CopyInfohashPolicy::Version1: |
|
|
|
|
|
|
|
for (const BitTorrent::Torrent *torrent : selectedTorrents) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (const auto infoHash = torrent->infoHash().v1(); infoHash.isValid()) |
|
|
|
|
|
|
|
infoHashes << infoHash.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case CopyInfohashPolicy::Version2: |
|
|
|
|
|
|
|
for (const BitTorrent::Torrent *torrent : selectedTorrents) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (const auto infoHash = torrent->infoHash().v2(); infoHash.isValid()) |
|
|
|
|
|
|
|
infoHashes << infoHash.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qApp->clipboard()->setText(infoHashes.join('\n')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TransferListWidget::copySelectedIDs() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList torrentIDs; |
|
|
|
QStringList torrentIDs; |
|
|
|
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents())) |
|
|
|
for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents())) |
|
|
@ -827,10 +853,14 @@ void TransferListWidget::displayListMenu(const QPoint &) |
|
|
|
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents); |
|
|
|
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents); |
|
|
|
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon("kt-magnet"), tr("Magnet link"), listMenu); |
|
|
|
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon("kt-magnet"), tr("Magnet link"), listMenu); |
|
|
|
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs); |
|
|
|
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs); |
|
|
|
|
|
|
|
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Torrent ID"), listMenu); |
|
|
|
|
|
|
|
connect(actionCopyID, &QAction::triggered, this, &TransferListWidget::copySelectedIDs); |
|
|
|
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"), listMenu); |
|
|
|
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"), listMenu); |
|
|
|
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames); |
|
|
|
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames); |
|
|
|
auto *actionCopyHash = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Hash"), listMenu); |
|
|
|
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Info hash v1"), listMenu); |
|
|
|
connect(actionCopyHash, &QAction::triggered, this, &TransferListWidget::copySelectedHashes); |
|
|
|
connect(actionCopyHash1, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version1); }); |
|
|
|
|
|
|
|
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Info hash v2"), listMenu); |
|
|
|
|
|
|
|
connect(actionCopyHash2, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version2); }); |
|
|
|
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu); |
|
|
|
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu); |
|
|
|
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding); |
|
|
|
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding); |
|
|
|
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."), listMenu); |
|
|
|
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."), listMenu); |
|
|
@ -860,6 +890,7 @@ void TransferListWidget::displayListMenu(const QPoint &) |
|
|
|
bool first = true; |
|
|
|
bool first = true; |
|
|
|
TagSet tagsInAny; |
|
|
|
TagSet tagsInAny; |
|
|
|
TagSet tagsInAll; |
|
|
|
TagSet tagsInAll; |
|
|
|
|
|
|
|
bool hasInfohashV1 = false, hasInfohashV2 = false; |
|
|
|
|
|
|
|
|
|
|
|
for (const QModelIndex &index : selectedIndexes) |
|
|
|
for (const QModelIndex &index : selectedIndexes) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -939,11 +970,17 @@ void TransferListWidget::displayListMenu(const QPoint &) |
|
|
|
if (torrent->hasMetadata()) |
|
|
|
if (torrent->hasMetadata()) |
|
|
|
needsPreview = true; |
|
|
|
needsPreview = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!hasInfohashV1 && torrent->infoHash().v1().isValid()) |
|
|
|
|
|
|
|
hasInfohashV1 = true; |
|
|
|
|
|
|
|
if (!hasInfohashV2 && torrent->infoHash().v2().isValid()) |
|
|
|
|
|
|
|
hasInfohashV2 = true; |
|
|
|
|
|
|
|
|
|
|
|
first = false; |
|
|
|
first = false; |
|
|
|
|
|
|
|
|
|
|
|
if (oneHasMetadata && oneNotSeed && !allSameSequentialDownloadMode |
|
|
|
if (oneHasMetadata && oneNotSeed && !allSameSequentialDownloadMode |
|
|
|
&& !allSamePrioFirstlast && !allSameSuperSeeding && !allSameCategory |
|
|
|
&& !allSamePrioFirstlast && !allSameSuperSeeding && !allSameCategory |
|
|
|
&& needsStart && needsForce && needsPause && needsPreview && !allSameAutoTMM) |
|
|
|
&& needsStart && needsForce && needsPause && needsPreview && !allSameAutoTMM |
|
|
|
|
|
|
|
&& hasInfohashV1 && hasInfohashV2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -1084,8 +1121,12 @@ void TransferListWidget::displayListMenu(const QPoint &) |
|
|
|
QMenu *copySubMenu = listMenu->addMenu( |
|
|
|
QMenu *copySubMenu = listMenu->addMenu( |
|
|
|
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy")); |
|
|
|
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy")); |
|
|
|
copySubMenu->addAction(actionCopyName); |
|
|
|
copySubMenu->addAction(actionCopyName); |
|
|
|
copySubMenu->addAction(actionCopyHash); |
|
|
|
copySubMenu->addAction(actionCopyHash1); |
|
|
|
|
|
|
|
actionCopyHash1->setEnabled(hasInfohashV1); |
|
|
|
|
|
|
|
copySubMenu->addAction(actionCopyHash2); |
|
|
|
|
|
|
|
actionCopyHash2->setEnabled(hasInfohashV2); |
|
|
|
copySubMenu->addAction(actionCopyMagnetLink); |
|
|
|
copySubMenu->addAction(actionCopyMagnetLink); |
|
|
|
|
|
|
|
copySubMenu->addAction(actionCopyID); |
|
|
|
|
|
|
|
|
|
|
|
listMenu->popup(QCursor::pos()); |
|
|
|
listMenu->popup(QCursor::pos()); |
|
|
|
} |
|
|
|
} |
|
|
|