mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-28 13:57:22 +00:00
GUI: job queue: show "move up/down" buttons if enabled in preferences
Implements the second half of #2060.
This commit is contained in:
parent
40af013949
commit
f212463f76
4
NEWS.md
4
NEWS.md
@ -15,7 +15,9 @@
|
|||||||
tracks will be used for setting the destination file name. Other files that
|
tracks will be used for setting the destination file name. Other files that
|
||||||
are added are ignore. Implements the rest of #2058.
|
are added are ignore. Implements the rest of #2058.
|
||||||
* MKVToolNix GUI: job queue: selected jobs can now be move up and down by
|
* 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
|
## Bug fixes
|
||||||
|
|
||||||
|
@ -35,32 +35,89 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mtx::gui::Util::BasicTreeView" name="jobs">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="contextMenuPolicy">
|
<item>
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<widget class="mtx::gui::Util::BasicTreeView" name="jobs">
|
||||||
</property>
|
<property name="contextMenuPolicy">
|
||||||
<property name="acceptDrops">
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="acceptDrops">
|
||||||
<property name="editTriggers">
|
<bool>true</bool>
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
</property>
|
||||||
</property>
|
<property name="editTriggers">
|
||||||
<property name="dragEnabled">
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="dragEnabled">
|
||||||
<property name="dragDropMode">
|
<bool>true</bool>
|
||||||
<enum>QAbstractItemView::InternalMove</enum>
|
</property>
|
||||||
</property>
|
<property name="dragDropMode">
|
||||||
<property name="defaultDropAction">
|
<enum>QAbstractItemView::InternalMove</enum>
|
||||||
<enum>Qt::MoveAction</enum>
|
</property>
|
||||||
</property>
|
<property name="defaultDropAction">
|
||||||
<property name="selectionMode">
|
<enum>Qt::MoveAction</enum>
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
</property>
|
||||||
</property>
|
<property name="selectionMode">
|
||||||
<property name="selectionBehavior">
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
</property>
|
||||||
</property>
|
<property name="selectionBehavior">
|
||||||
</widget>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="moveJobsButtons" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_1">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveJobsUp">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qt_resources.qrc">
|
||||||
|
<normaloff>:/icons/16x16/arrow-up.png</normaloff>:/icons/16x16/arrow-up.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="moveJobsDown">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../qt_resources.qrc">
|
||||||
|
<normaloff>:/icons/16x16/arrow-down.png</normaloff>:/icons/16x16/arrow-down.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_1">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -72,7 +129,9 @@
|
|||||||
<header>mkvtoolnix-gui/util/basic_tree_view.h</header>
|
<header>mkvtoolnix-gui/util/basic_tree_view.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../../qt_resources.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>onContextMenu(QPoint)</slot>
|
<slot>onContextMenu(QPoint)</slot>
|
||||||
|
@ -73,6 +73,8 @@ void
|
|||||||
Tool::setupUi() {
|
Tool::setupUi() {
|
||||||
ui->jobs->setModel(m_model);
|
ui->jobs->setModel(m_model);
|
||||||
|
|
||||||
|
setupMoveJobsButtons();
|
||||||
|
|
||||||
Util::preventScrollingWithoutFocus(this);
|
Util::preventScrollingWithoutFocus(this);
|
||||||
Util::HeaderViewManager::create(*ui->jobs, "Jobs::Jobs");
|
Util::HeaderViewManager::create(*ui->jobs, "Jobs::Jobs");
|
||||||
|
|
||||||
@ -135,18 +137,29 @@ Tool::setupActions() {
|
|||||||
connect(m_editAndRemoveAction, &QAction::triggered, this, &Tool::onEditAndRemove);
|
connect(m_editAndRemoveAction, &QAction::triggered, this, &Tool::onEditAndRemove);
|
||||||
connect(m_startImmediatelyAction, &QAction::triggered, this, &Tool::onStartImmediately);
|
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::doubleClicked, this, &Tool::onViewOutput);
|
||||||
connect(ui->jobs, &Util::BasicTreeView::customContextMenuRequested, this, &Tool::onContextMenu);
|
connect(ui->jobs, &Util::BasicTreeView::customContextMenuRequested, this, &Tool::onContextMenu);
|
||||||
connect(ui->jobs, &Util::BasicTreeView::deletePressed, this, &Tool::onRemove);
|
connect(ui->jobs, &Util::BasicTreeView::deletePressed, this, &Tool::onRemove);
|
||||||
connect(ui->jobs, &Util::BasicTreeView::ctrlDownPressed, this, [this]() { moveJobsUpOrDown(false); });
|
connect(ui->jobs, &Util::BasicTreeView::ctrlDownPressed, this, [this]() { moveJobsUpOrDown(false); });
|
||||||
connect(ui->jobs, &Util::BasicTreeView::ctrlUpPressed, this, [this]() { moveJobsUpOrDown(true); });
|
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::retranslateUi);
|
||||||
|
connect(mw, &MainWindow::preferencesChanged, this, &Tool::setupMoveJobsButtons);
|
||||||
connect(mw, &MainWindow::aboutToClose, m_model, &Model::saveJobs);
|
connect(mw, &MainWindow::aboutToClose, m_model, &Model::saveJobs);
|
||||||
|
|
||||||
connect(MainWindow::watchCurrentJobTab(), &WatchJobs::Tab::watchCurrentJobTabCleared, m_model, &Model::resetTotalProgress);
|
connect(MainWindow::watchCurrentJobTab(), &WatchJobs::Tab::watchCurrentJobTabCleared, m_model, &Model::resetTotalProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Tool::setupMoveJobsButtons() {
|
||||||
|
ui->moveJobsButtons->setVisible(Util::Settings::get().m_showMoveUpDownButtons);
|
||||||
|
enableMoveJobsButtons();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tool::onJobQueueMenu() {
|
Tool::onJobQueueMenu() {
|
||||||
auto mwUi = MainWindow::getUi();
|
auto mwUi = MainWindow::getUi();
|
||||||
@ -550,4 +563,13 @@ Tool::selectJobs(QList<Job *> const &jobs) {
|
|||||||
ui->jobs->selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
@ -66,6 +66,8 @@ public slots:
|
|||||||
void onJobQueueMenu();
|
void onJobQueueMenu();
|
||||||
void onContextMenu(QPoint pos);
|
void onContextMenu(QPoint pos);
|
||||||
void moveJobsUpOrDown(bool up);
|
void moveJobsUpOrDown(bool up);
|
||||||
|
void setupMoveJobsButtons();
|
||||||
|
void enableMoveJobsButtons();
|
||||||
|
|
||||||
void resizeColumnsToContents() const;
|
void resizeColumnsToContents() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user