mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 14:23:35 -07:00
Static order of items in the transferlist menu.
Conflicts: src/gui/transferlistwidget.cpp
This commit is contained in:
parent
6ca7ff0e25
commit
5c9ce2952b
1 changed files with 27 additions and 32 deletions
|
@ -778,16 +778,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;
|
|
||||||
QTorrentHandle h;
|
QTorrentHandle h;
|
||||||
qDebug("Displaying menu");
|
qDebug("Displaying menu");
|
||||||
foreach (const QModelIndex &index, selectedIndexes) {
|
foreach (const QModelIndex &index, selectedIndexes) {
|
||||||
|
@ -798,7 +797,6 @@ 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()) {
|
||||||
|
@ -824,35 +822,32 @@ void TransferListWidget::displayListMenu(const QPoint&)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (h.is_paused()) {
|
if (!h.is_forced())
|
||||||
if (!has_start) {
|
needs_force = true;
|
||||||
listMenu.addAction(&actionStart);
|
else
|
||||||
has_start = true;
|
needs_start = true;
|
||||||
}
|
if (h.is_paused())
|
||||||
if (!has_force) {
|
needs_start = true;
|
||||||
listMenu.addAction(&actionForceStart);
|
else
|
||||||
has_force = true;
|
needs_pause = true;
|
||||||
}
|
if (h.has_metadata())
|
||||||
}
|
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 (h.has_metadata() && !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();
|
||||||
|
@ -880,7 +875,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