From e698fbad14c6e405e52a6bf3855c43dde218ff71 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 12 Aug 2015 10:20:56 +0200 Subject: [PATCH] GUI: emit warning when trying to edit running jobs See #1296. --- src/mkvtoolnix-gui/jobs/tool.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mkvtoolnix-gui/jobs/tool.cpp b/src/mkvtoolnix-gui/jobs/tool.cpp index 4e0f6c59a..4f67095b4 100644 --- a/src/mkvtoolnix-gui/jobs/tool.cpp +++ b/src/mkvtoolnix-gui/jobs/tool.cpp @@ -340,14 +340,20 @@ Tool::openJobInTool(Job const &job) void Tool::onEditAndRemove() { - m_model->withSelectedJobs(ui->jobs, [this](Job &jobToEdit) { + auto emitRunningWarning = false; + + m_model->withSelectedJobs(ui->jobs, [this, &emitRunningWarning](Job &jobToEdit) { if (Job::Running == jobToEdit.status()) - return; + emitRunningWarning = true; - openJobInTool(jobToEdit); - - m_model->removeJobsIf([&jobToEdit](Job const &jobToRemove) { return jobToEdit.id() == jobToRemove.id(); }); + else { + openJobInTool(jobToEdit); + m_model->removeJobsIf([&jobToEdit](Job const &jobToRemove) { return jobToEdit.id() == jobToRemove.id(); }); + } }); + + if (emitRunningWarning) + MainWindow::get()->setStatusBarMessage(QY("Running jobs cannot be edited.")); } void