GUI: use signal for saving state before quitting

This commit is contained in:
Moritz Bunkus 2015-08-30 15:36:16 +02:00
parent f8c6f3f733
commit 73cd3dd911
4 changed files with 6 additions and 5 deletions

View File

@ -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<QStandardItem *> createRow(Job const &job) const;
void setRowText(QList<QStandardItem *> const &items, Job const &job) const;

View File

@ -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);
}

View File

@ -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();

View File

@ -84,6 +84,7 @@ public:
signals:
void windowShown();
void preferencesChanged();
void aboutToClose();
public slots:
virtual void changeToolToSender();