mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 01:33:07 -07:00
Static order of items in the transferlist menu.
This commit is contained in:
parent
f21cafb605
commit
6668018b45
1 changed files with 27 additions and 32 deletions
|
@ -665,16 +665,15 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
||||||
actionFirstLastPiece_prio.setCheckable(true);
|
actionFirstLastPiece_prio.setCheckable(true);
|
||||||
connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio()));
|
connect(&actionFirstLastPiece_prio, SIGNAL(triggered()), this, SLOT(toggleSelectedFirstLastPiecePrio()));
|
||||||
// End of actions
|
// End of actions
|
||||||
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_force = false, has_preview = false;
|
bool needs_pause = false, needs_start = false, needs_force = false, needs_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;
|
|
||||||
|
|
||||||
BitTorrent::TorrentHandle *torrent;
|
BitTorrent::TorrentHandle *torrent;
|
||||||
qDebug("Displaying menu");
|
qDebug("Displaying menu");
|
||||||
|
@ -686,7 +685,6 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
||||||
|
|
||||||
if (torrent->hasMetadata())
|
if (torrent->hasMetadata())
|
||||||
one_has_metadata = true;
|
one_has_metadata = true;
|
||||||
forced = torrent->isForced();
|
|
||||||
if (!torrent->isSeed()) {
|
if (!torrent->isSeed()) {
|
||||||
one_not_seed = true;
|
one_not_seed = true;
|
||||||
if (torrent->hasMetadata()) {
|
if (torrent->hasMetadata()) {
|
||||||
|
@ -712,35 +710,32 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (torrent->isPaused()) {
|
if (!torrent->isForced())
|
||||||
if (!has_start) {
|
needs_force = true;
|
||||||
listMenu.addAction(&actionStart);
|
else
|
||||||
has_start = true;
|
needs_start = true;
|
||||||
}
|
if (torrent->isPaused())
|
||||||
if (!has_force) {
|
needs_start = true;
|
||||||
listMenu.addAction(&actionForceStart);
|
else
|
||||||
has_force = true;
|
needs_pause = true;
|
||||||
}
|
if (torrent->hasMetadata())
|
||||||
}
|
needs_preview = true;
|
||||||
else {
|
|
||||||
if (forced && !has_start) {
|
|
||||||
listMenu.addAction(&actionStart);
|
|
||||||
has_start = true;
|
|
||||||
}
|
|
||||||
if (!has_pause) {
|
|
||||||
listMenu.addAction(&actionPause);
|
|
||||||
has_pause = true;
|
|
||||||
}
|
|
||||||
if (!forced && !has_force) {
|
|
||||||
listMenu.addAction(&actionForceStart);
|
|
||||||
has_force = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (torrent->hasMetadata() && !has_preview)
|
|
||||||
has_preview = true;
|
|
||||||
first = false;
|
first = false;
|
||||||
if (has_pause && has_start && has_force && has_preview && one_not_seed) break;
|
|
||||||
|
if (one_has_metadata && one_not_seed && !all_same_sequential_download_mode
|
||||||
|
&& !all_same_prio_firstlast && !all_same_super_seeding && needs_start
|
||||||
|
&& needs_force && needs_pause && needs_preview) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
QMenu listMenu(this);
|
||||||
|
if (needs_start)
|
||||||
|
listMenu.addAction(&actionStart);
|
||||||
|
if (needs_pause)
|
||||||
|
listMenu.addAction(&actionPause);
|
||||||
|
if (needs_force)
|
||||||
|
listMenu.addAction(&actionForceStart);
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
listMenu.addAction(&actionDelete);
|
listMenu.addAction(&actionDelete);
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
|
@ -768,7 +763,7 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
||||||
}
|
}
|
||||||
listMenu.addSeparator();
|
listMenu.addSeparator();
|
||||||
bool added_preview_action = false;
|
bool added_preview_action = false;
|
||||||
if (has_preview) {
|
if (needs_preview) {
|
||||||
listMenu.addAction(&actionPreview_file);
|
listMenu.addAction(&actionPreview_file);
|
||||||
added_preview_action = true;
|
added_preview_action = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue