|
|
@ -282,6 +282,13 @@ void TransferListWidget::startSelectedTorrents() |
|
|
|
BTSession->resumeTorrent(hash); |
|
|
|
BTSession->resumeTorrent(hash); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TransferListWidget::forceStartSelectedTorrents() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const QStringList hashes = getSelectedTorrentsHashes(); |
|
|
|
|
|
|
|
foreach (const QString &hash, hashes) |
|
|
|
|
|
|
|
BTSession->resumeTorrent(hash, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TransferListWidget::startVisibleTorrents() |
|
|
|
void TransferListWidget::startVisibleTorrents() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QStringList hashes; |
|
|
|
QStringList hashes; |
|
|
@ -725,6 +732,8 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
// Create actions
|
|
|
|
// Create actions
|
|
|
|
QAction actionStart(IconProvider::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), 0); |
|
|
|
QAction actionStart(IconProvider::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), 0); |
|
|
|
connect(&actionStart, SIGNAL(triggered()), this, SLOT(startSelectedTorrents())); |
|
|
|
connect(&actionStart, SIGNAL(triggered()), this, SLOT(startSelectedTorrents())); |
|
|
|
|
|
|
|
QAction actionForceStart(tr("Force Resume", "Force Resume/start the torrent"), 0); |
|
|
|
|
|
|
|
connect(&actionForceStart, SIGNAL(triggered()), this, SLOT(forceStartSelectedTorrents())); |
|
|
|
QAction actionPause(IconProvider::instance()->getIcon("media-playback-pause"), tr("Pause", "Pause the torrent"), 0); |
|
|
|
QAction actionPause(IconProvider::instance()->getIcon("media-playback-pause"), tr("Pause", "Pause the torrent"), 0); |
|
|
|
connect(&actionPause, SIGNAL(triggered()), this, SLOT(pauseSelectedTorrents())); |
|
|
|
connect(&actionPause, SIGNAL(triggered()), this, SLOT(pauseSelectedTorrents())); |
|
|
|
QAction actionDelete(IconProvider::instance()->getIcon("edit-delete"), tr("Delete", "Delete the torrent"), 0); |
|
|
|
QAction actionDelete(IconProvider::instance()->getIcon("edit-delete"), tr("Delete", "Delete the torrent"), 0); |
|
|
@ -753,10 +762,8 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents())); |
|
|
|
connect(&actionForce_recheck, SIGNAL(triggered()), this, SLOT(recheckSelectedTorrents())); |
|
|
|
QAction actionCopy_magnet_link(QIcon(":/icons/magnet.png"), tr("Copy magnet link"), 0); |
|
|
|
QAction actionCopy_magnet_link(QIcon(":/icons/magnet.png"), tr("Copy magnet link"), 0); |
|
|
|
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs())); |
|
|
|
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs())); |
|
|
|
|
|
|
|
|
|
|
|
QAction actionCopy_name(IconProvider::instance()->getIcon("edit-copy"), tr("Copy name"), 0); |
|
|
|
QAction actionCopy_name(IconProvider::instance()->getIcon("edit-copy"), tr("Copy name"), 0); |
|
|
|
connect(&actionCopy_name, SIGNAL(triggered()), this, SLOT(copySelectedNames())); |
|
|
|
connect(&actionCopy_name, SIGNAL(triggered()), this, SLOT(copySelectedNames())); |
|
|
|
|
|
|
|
|
|
|
|
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0); |
|
|
|
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0); |
|
|
|
actionSuper_seeding_mode.setCheckable(true); |
|
|
|
actionSuper_seeding_mode.setCheckable(true); |
|
|
|
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding())); |
|
|
|
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding())); |
|
|
@ -771,13 +778,14 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
// End of actions
|
|
|
|
// End of actions
|
|
|
|
QMenu listMenu(this); |
|
|
|
QMenu listMenu(this); |
|
|
|
// Enable/disable pause/start action given the DL state
|
|
|
|
// Enable/disable pause/start action given the DL state
|
|
|
|
bool has_pause = false, has_start = false, has_preview = false; |
|
|
|
bool has_pause = false, has_start = false, has_force = false, has_preview = false; |
|
|
|
bool all_same_super_seeding = true; |
|
|
|
bool all_same_super_seeding = true; |
|
|
|
bool super_seeding_mode = false; |
|
|
|
bool super_seeding_mode = false; |
|
|
|
bool all_same_sequential_download_mode = true, all_same_prio_firstlast = true; |
|
|
|
bool all_same_sequential_download_mode = true, all_same_prio_firstlast = true; |
|
|
|
bool sequential_download_mode = false, prioritize_first_last = false; |
|
|
|
bool sequential_download_mode = false, prioritize_first_last = false; |
|
|
|
bool one_has_metadata = false, one_not_seed = false; |
|
|
|
bool one_has_metadata = false, one_not_seed = false; |
|
|
|
bool first = true; |
|
|
|
bool first = true; |
|
|
|
|
|
|
|
bool forced = false; |
|
|
|
QTorrentHandle h; |
|
|
|
QTorrentHandle h; |
|
|
|
qDebug("Displaying menu"); |
|
|
|
qDebug("Displaying menu"); |
|
|
|
foreach (const QModelIndex &index, selectedIndexes) { |
|
|
|
foreach (const QModelIndex &index, selectedIndexes) { |
|
|
@ -788,6 +796,7 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
if (!h.is_valid()) continue; |
|
|
|
if (!h.is_valid()) continue; |
|
|
|
if (h.has_metadata()) |
|
|
|
if (h.has_metadata()) |
|
|
|
one_has_metadata = true; |
|
|
|
one_has_metadata = true; |
|
|
|
|
|
|
|
forced = h.is_forced(); |
|
|
|
if (!h.is_seed()) { |
|
|
|
if (!h.is_seed()) { |
|
|
|
one_not_seed = true; |
|
|
|
one_not_seed = true; |
|
|
|
if (h.has_metadata()) { |
|
|
|
if (h.has_metadata()) { |
|
|
@ -818,8 +827,26 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
listMenu.addAction(&actionStart); |
|
|
|
listMenu.addAction(&actionStart); |
|
|
|
has_start = true; |
|
|
|
has_start = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!has_force) { |
|
|
|
|
|
|
|
listMenu.addAction(&actionForceStart); |
|
|
|
|
|
|
|
has_force = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!forced) { |
|
|
|
|
|
|
|
if (!has_force) { |
|
|
|
|
|
|
|
listMenu.addAction(&actionForceStart); |
|
|
|
|
|
|
|
has_force = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
|
|
|
|
if (!has_start) { |
|
|
|
|
|
|
|
listMenu.addAction(&actionStart); |
|
|
|
|
|
|
|
has_start = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!has_pause) { |
|
|
|
if (!has_pause) { |
|
|
|
listMenu.addAction(&actionPause); |
|
|
|
listMenu.addAction(&actionPause); |
|
|
|
has_pause = true; |
|
|
|
has_pause = true; |
|
|
@ -828,7 +855,7 @@ void TransferListWidget::displayListMenu(const QPoint&) |
|
|
|
if (h.has_metadata() && BTSession->isFilePreviewPossible(hash) && !has_preview) |
|
|
|
if (h.has_metadata() && BTSession->isFilePreviewPossible(hash) && !has_preview) |
|
|
|
has_preview = true; |
|
|
|
has_preview = true; |
|
|
|
first = false; |
|
|
|
first = false; |
|
|
|
if (has_pause && has_start && has_preview && one_not_seed) break; |
|
|
|
if (has_pause && has_start && has_force && has_preview && one_not_seed) break; |
|
|
|
} |
|
|
|
} |
|
|
|
listMenu.addSeparator(); |
|
|
|
listMenu.addSeparator(); |
|
|
|
listMenu.addAction(&actionDelete); |
|
|
|
listMenu.addAction(&actionDelete); |
|
|
|