diff --git a/src/mkvtoolnix-gui/jobs/model.h b/src/mkvtoolnix-gui/jobs/model.h index d710ec190..f7135ba7b 100644 --- a/src/mkvtoolnix-gui/jobs/model.h +++ b/src/mkvtoolnix-gui/jobs/model.h @@ -72,7 +72,6 @@ public: void startNextAutoJob(); void startJobImmediately(Job &job); - void saveJobs(); void loadJobs(); virtual Qt::DropActions supportedDropActions() const; @@ -102,6 +101,8 @@ public slots: void resetTotalProgress(); + void saveJobs(); + protected: QList createRow(Job const &job) const; void setRowText(QList const &items, Job const &job) const; diff --git a/src/mkvtoolnix-gui/jobs/tool.cpp b/src/mkvtoolnix-gui/jobs/tool.cpp index 741a0900d..74269c231 100644 --- a/src/mkvtoolnix-gui/jobs/tool.cpp +++ b/src/mkvtoolnix-gui/jobs/tool.cpp @@ -124,6 +124,7 @@ Tool::setupActions() { connect(ui->jobs, &QTreeView::doubleClicked, this, &Tool::onViewOutput); connect(mw, &MainWindow::preferencesChanged, this, &Tool::retranslateUi); + connect(mw, &MainWindow::aboutToClose, m_model, &Model::saveJobs); connect(MainWindow::watchCurrentJobTab(), &WatchJobs::Tab::watchCurrentJobTabCleared, m_model, &Model::resetTotalProgress); } diff --git a/src/mkvtoolnix-gui/main_window/main_window.cpp b/src/mkvtoolnix-gui/main_window/main_window.cpp index cca032b20..6da6a68e7 100644 --- a/src/mkvtoolnix-gui/main_window/main_window.cpp +++ b/src/mkvtoolnix-gui/main_window/main_window.cpp @@ -332,6 +332,8 @@ MainWindow::beforeCloseCheckRunningJobs() { void MainWindow::closeEvent(QCloseEvent *event) { + emit aboutToClose(); + auto ok = mergeTool()->closeAllTabs(); ok = ok && headerEditorTool()->closeAllTabs(); ok = ok && chapterEditorTool()->closeAllTabs(); @@ -342,10 +344,6 @@ MainWindow::closeEvent(QCloseEvent *event) { return; } - auto tool = jobTool(); - if (tool) - tool->model()->saveJobs(); - Util::saveWidgetGeometry(this); event->accept(); diff --git a/src/mkvtoolnix-gui/main_window/main_window.h b/src/mkvtoolnix-gui/main_window/main_window.h index 7f13d8e0c..e42e84ac9 100644 --- a/src/mkvtoolnix-gui/main_window/main_window.h +++ b/src/mkvtoolnix-gui/main_window/main_window.h @@ -84,6 +84,7 @@ public: signals: void windowShown(); void preferencesChanged(); + void aboutToClose(); public slots: virtual void changeToolToSender();