mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-28 15:34:16 +00:00
- Fix other possible crashes with MAGNET URIs
- Fix "download first last piece first" feature for torrents containing more than one file
This commit is contained in:
parent
497cb07852
commit
df5f5a943b
@ -602,7 +602,7 @@ void TransferListWidget::copySelectedMagnetURIs() const {
|
|||||||
QStringList magnet_uris;
|
QStringList magnet_uris;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(const QModelIndex &index, selectedIndexes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(proxyModel->mapToSource(index).row()));
|
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(proxyModel->mapToSource(index).row()));
|
||||||
if(h.is_valid())
|
if(h.is_valid() && h.has_metadata())
|
||||||
magnet_uris << misc::toQString(make_magnet_uri(h.get_torrent_info()));
|
magnet_uris << misc::toQString(make_magnet_uri(h.get_torrent_info()));
|
||||||
}
|
}
|
||||||
qApp->clipboard()->setText(magnet_uris.join("\n"));
|
qApp->clipboard()->setText(magnet_uris.join("\n"));
|
||||||
@ -632,7 +632,7 @@ void TransferListWidget::previewSelectedTorrents() {
|
|||||||
QStringList pathsList;
|
QStringList pathsList;
|
||||||
foreach(const QModelIndex &index, selectedIndexes) {
|
foreach(const QModelIndex &index, selectedIndexes) {
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(proxyModel->mapToSource(index).row()));
|
QTorrentHandle h = BTSession->getTorrentHandle(getHashFromRow(proxyModel->mapToSource(index).row()));
|
||||||
if(h.is_valid()) {
|
if(h.is_valid() && h.has_metadata()) {
|
||||||
new previewSelect(this, h);
|
new previewSelect(this, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -783,7 +783,7 @@ void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
|
|||||||
// Get the file hash
|
// Get the file hash
|
||||||
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
if(h.is_valid()) {
|
if(h.is_valid() && h.has_metadata()) {
|
||||||
h.super_seeding(!h.super_seeding());
|
h.super_seeding(!h.super_seeding());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -796,7 +796,7 @@ void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
|
|||||||
// Get the file hash
|
// Get the file hash
|
||||||
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
if(h.is_valid()) {
|
if(h.is_valid() && h.has_metadata()) {
|
||||||
h.set_sequential_download(!h.is_sequential_download());
|
h.set_sequential_download(!h.is_sequential_download());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -808,7 +808,7 @@ void TransferListWidget::toggleSelectedFirstLastPiecePrio() {
|
|||||||
// Get the file hash
|
// Get the file hash
|
||||||
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
|
||||||
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
QTorrentHandle h = BTSession->getTorrentHandle(hash);
|
||||||
if(h.is_valid() && h.num_files() == 1) {
|
if(h.is_valid() && h.has_metadata()) {
|
||||||
h.prioritize_first_last_piece(!h.first_last_piece_first());
|
h.prioritize_first_last_piece(!h.first_last_piece_first());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -871,21 +871,23 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
one_has_metadata = true;
|
one_has_metadata = true;
|
||||||
if(!h.is_seed()) {
|
if(!h.is_seed()) {
|
||||||
one_not_seed = true;
|
one_not_seed = true;
|
||||||
if(first) {
|
if(h.has_metadata()) {
|
||||||
sequential_download_mode = h.is_sequential_download();
|
if(first) {
|
||||||
prioritize_first_last = h.first_last_piece_first();
|
sequential_download_mode = h.is_sequential_download();
|
||||||
} else {
|
prioritize_first_last = h.first_last_piece_first();
|
||||||
if(sequential_download_mode != h.is_sequential_download()) {
|
} else {
|
||||||
all_same_sequential_download_mode = false;
|
if(sequential_download_mode != h.is_sequential_download()) {
|
||||||
}
|
all_same_sequential_download_mode = false;
|
||||||
if(prioritize_first_last != h.first_last_piece_first()) {
|
}
|
||||||
all_same_prio_firstlast = false;
|
if(prioritize_first_last != h.first_last_piece_first()) {
|
||||||
|
all_same_prio_firstlast = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef LIBTORRENT_0_15
|
#ifdef LIBTORRENT_0_15
|
||||||
else {
|
else {
|
||||||
if(!one_not_seed && all_same_super_seeding) {
|
if(!one_not_seed && all_same_super_seeding && h.has_metadata()) {
|
||||||
if(first) {
|
if(first) {
|
||||||
super_seeding_mode = h.super_seeding();
|
super_seeding_mode = h.super_seeding();
|
||||||
} else {
|
} else {
|
||||||
@ -920,7 +922,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
listMenu.addAction(&actionSet_download_limit);
|
listMenu.addAction(&actionSet_download_limit);
|
||||||
listMenu.addAction(&actionSet_upload_limit);
|
listMenu.addAction(&actionSet_upload_limit);
|
||||||
#ifdef LIBTORRENT_0_15
|
#ifdef LIBTORRENT_0_15
|
||||||
if(!one_not_seed && all_same_super_seeding) {
|
if(!one_not_seed && all_same_super_seeding && one_has_metadata) {
|
||||||
QIcon ico;
|
QIcon ico;
|
||||||
if(super_seeding_mode) {
|
if(super_seeding_mode) {
|
||||||
ico = QIcon(":/Icons/oxygen/button_ok.png");
|
ico = QIcon(":/Icons/oxygen/button_ok.png");
|
||||||
@ -937,7 +939,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
listMenu.addAction(&actionPreview_file);
|
listMenu.addAction(&actionPreview_file);
|
||||||
added_preview_action = true;
|
added_preview_action = true;
|
||||||
}
|
}
|
||||||
if(one_not_seed) {
|
if(one_not_seed && one_has_metadata) {
|
||||||
if(all_same_sequential_download_mode) {
|
if(all_same_sequential_download_mode) {
|
||||||
QIcon ico;
|
QIcon ico;
|
||||||
if(sequential_download_mode) {
|
if(sequential_download_mode) {
|
||||||
@ -974,7 +976,8 @@ void TransferListWidget::displayListMenu(const QPoint&) {
|
|||||||
listMenu.addAction(&actionDecreasePriority);
|
listMenu.addAction(&actionDecreasePriority);
|
||||||
}
|
}
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
listMenu.addAction(&actionCopy_magnet_link);
|
if(one_has_metadata)
|
||||||
|
listMenu.addAction(&actionCopy_magnet_link);
|
||||||
listMenu.addAction(&actionBuy_it);
|
listMenu.addAction(&actionBuy_it);
|
||||||
// Call menu
|
// Call menu
|
||||||
listMenu.exec(QCursor::pos());
|
listMenu.exec(QCursor::pos());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user