diff --git a/NEWS.md b/NEWS.md
index 68a7fdcec..0461e9974 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -15,7 +15,9 @@
tracks will be used for setting the destination file name. Other files that
are added are ignore. Implements the rest of #2058.
* MKVToolNix GUI: job queue: selected jobs can now be move up and down by
- pressing the `Ctrl+Up` and `Ctrl+Down` keys. Implements part of #2060.
+ pressing the `Ctrl+Up` and `Ctrl+Down` keys. Additionally, push buttons to
+ move them up & down are shown if the corresponding option is enabled in the
+ preferences. Implements #2060.
## Bug fixes
diff --git a/src/mkvtoolnix-gui/forms/jobs/tool.ui b/src/mkvtoolnix-gui/forms/jobs/tool.ui
index febc5e093..e1781b1f2 100644
--- a/src/mkvtoolnix-gui/forms/jobs/tool.ui
+++ b/src/mkvtoolnix-gui/forms/jobs/tool.ui
@@ -35,32 +35,89 @@
-
-
-
- Qt::CustomContextMenu
-
-
- true
-
-
- QAbstractItemView::NoEditTriggers
-
-
- true
-
-
- QAbstractItemView::InternalMove
-
-
- Qt::MoveAction
-
-
- QAbstractItemView::ExtendedSelection
-
-
- QAbstractItemView::SelectRows
-
-
+
+
-
+
+
+ Qt::CustomContextMenu
+
+
+ true
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ true
+
+
+ QAbstractItemView::InternalMove
+
+
+ Qt::MoveAction
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+ QAbstractItemView::SelectRows
+
+
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+ :/icons/16x16/arrow-up.png:/icons/16x16/arrow-up.png
+
+
+
+ -
+
+
+
+
+
+
+ :/icons/16x16/arrow-down.png:/icons/16x16/arrow-down.png
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
@@ -72,7 +129,9 @@
mkvtoolnix-gui/util/basic_tree_view.h
-
+
+
+
onContextMenu(QPoint)
diff --git a/src/mkvtoolnix-gui/jobs/tool.cpp b/src/mkvtoolnix-gui/jobs/tool.cpp
index 735896c6b..6a3e4baf1 100644
--- a/src/mkvtoolnix-gui/jobs/tool.cpp
+++ b/src/mkvtoolnix-gui/jobs/tool.cpp
@@ -73,6 +73,8 @@ void
Tool::setupUi() {
ui->jobs->setModel(m_model);
+ setupMoveJobsButtons();
+
Util::preventScrollingWithoutFocus(this);
Util::HeaderViewManager::create(*ui->jobs, "Jobs::Jobs");
@@ -135,18 +137,29 @@ Tool::setupActions() {
connect(m_editAndRemoveAction, &QAction::triggered, this, &Tool::onEditAndRemove);
connect(m_startImmediatelyAction, &QAction::triggered, this, &Tool::onStartImmediately);
+ connect(ui->jobs->selectionModel(), &QItemSelectionModel::selectionChanged, this, &Tool::enableMoveJobsButtons);
connect(ui->jobs, &Util::BasicTreeView::doubleClicked, this, &Tool::onViewOutput);
connect(ui->jobs, &Util::BasicTreeView::customContextMenuRequested, this, &Tool::onContextMenu);
connect(ui->jobs, &Util::BasicTreeView::deletePressed, this, &Tool::onRemove);
connect(ui->jobs, &Util::BasicTreeView::ctrlDownPressed, this, [this]() { moveJobsUpOrDown(false); });
connect(ui->jobs, &Util::BasicTreeView::ctrlUpPressed, this, [this]() { moveJobsUpOrDown(true); });
+ connect(ui->moveJobsDown, &QPushButton::clicked, this, [this]() { moveJobsUpOrDown(false); });
+ connect(ui->moveJobsUp, &QPushButton::clicked, this, [this]() { moveJobsUpOrDown(true); });
+
connect(mw, &MainWindow::preferencesChanged, this, &Tool::retranslateUi);
+ connect(mw, &MainWindow::preferencesChanged, this, &Tool::setupMoveJobsButtons);
connect(mw, &MainWindow::aboutToClose, m_model, &Model::saveJobs);
connect(MainWindow::watchCurrentJobTab(), &WatchJobs::Tab::watchCurrentJobTabCleared, m_model, &Model::resetTotalProgress);
}
+void
+Tool::setupMoveJobsButtons() {
+ ui->moveJobsButtons->setVisible(Util::Settings::get().m_showMoveUpDownButtons);
+ enableMoveJobsButtons();
+}
+
void
Tool::onJobQueueMenu() {
auto mwUi = MainWindow::getUi();
@@ -550,4 +563,13 @@ Tool::selectJobs(QList const &jobs) {
ui->jobs->selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);
}
+void
+Tool::enableMoveJobsButtons() {
+ auto hasSelected = false;
+ m_model->withSelectedJobsAsList(ui->jobs, [&hasSelected](auto const &selectedJobs) { hasSelected = !selectedJobs.isEmpty(); });
+
+ ui->moveJobsUp->setEnabled(hasSelected);
+ ui->moveJobsDown->setEnabled(hasSelected);
+}
+
}}}
diff --git a/src/mkvtoolnix-gui/jobs/tool.h b/src/mkvtoolnix-gui/jobs/tool.h
index 0be8ea3f7..5687ec806 100644
--- a/src/mkvtoolnix-gui/jobs/tool.h
+++ b/src/mkvtoolnix-gui/jobs/tool.h
@@ -66,6 +66,8 @@ public slots:
void onJobQueueMenu();
void onContextMenu(QPoint pos);
void moveJobsUpOrDown(bool up);
+ void setupMoveJobsButtons();
+ void enableMoveJobsButtons();
void resizeColumnsToContents() const;