From aeeb707ac428a474a4e96886873299fefa372d21 Mon Sep 17 00:00:00 2001 From: gashtal Date: Mon, 19 Feb 2024 16:07:04 -0800 Subject: [PATCH 1/2] Clear queue only on application close, and only if user chooses to do so Ensures that existing jobs in the queue are not lost if the application is not closed cleanly for any reason --- src/win_main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/win_main.cpp b/src/win_main.cpp index f3eb5a8..afd5e03 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -1120,7 +1120,6 @@ void MainWindow::init(void) if(m_jobList->loadQueuedJobs(m_sysinfo.data()) > 0) { m_label[0]->setVisible(m_jobList->rowCount(QModelIndex()) == 0); - m_jobList->clearQueuedJobs(); } } @@ -1414,6 +1413,10 @@ void MainWindow::closeEvent(QCloseEvent *e) } m_jobList->saveQueuedJobs(); } + else + { + m_jobList->clearQueuedJobs(); + } } else { From 0b56e92279c528317bc5acf4988b70dd43127e3f Mon Sep 17 00:00:00 2001 From: gashtal Date: Mon, 19 Feb 2024 17:16:50 -0800 Subject: [PATCH 2/2] Update queue file whenever a job is added or removed Ensures jobs added or removed during the current session get immediately saved in queue.ini and won't be lost if the application is not closed cleanly --- src/win_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/win_main.cpp b/src/win_main.cpp index afd5e03..bdb285a 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -479,6 +479,7 @@ void MainWindow::deleteButtonPressed(void) ENSURE_APP_IS_READY(); m_jobList->deleteJob(ui->jobsView->currentIndex()); + m_jobList->saveQueuedJobs(); m_label[0]->setVisible(m_jobList->rowCount(QModelIndex()) == 0); } @@ -1596,6 +1597,7 @@ bool MainWindow::appendJob(const QString &sourceFileName, const QString &outputF bool okay = false; EncodeThread *thrd = new EncodeThread(sourceFileName, outputFileName, options, m_sysinfo.data(), m_preferences.data()); QModelIndex newIndex = m_jobList->insertJob(thrd); + m_jobList->saveQueuedJobs(); if(newIndex.isValid()) {