GUI: prevent removal of running jobs

Fixes #1220.
This commit is contained in:
Moritz Bunkus 2015-06-01 21:53:01 +02:00
parent 531ef2d26a
commit c826183ed5
2 changed files with 29 additions and 3 deletions

View File

@ -1,5 +1,8 @@
2015-06-01 Moritz Bunkus <moritz@bunkus.org>
* MKVToolNix GUI: bug fix: running jobs cannot be removed from the
job queue anymore. Fixes #1220.
* MKVToolNix GUI: bug fix: when starting the GUI old jobs from the
queue were silently discarded if they included additional parts
(e.g. VOBs).

View File

@ -125,11 +125,23 @@ Tool::onStart() {
void
Tool::onRemove() {
auto idsToRemove = QMap<uint64_t, bool>{};
auto idsToRemove = QMap<uint64_t, bool>{};
auto emitRunningWarning = false;
m_model->withSelectedJobs(ui->jobs, [&idsToRemove](Job &job) { idsToRemove[job.m_id] = true; });
m_model->removeJobsIf([&](Job const &job) { return idsToRemove[job.m_id]; });
m_model->removeJobsIf([&idsToRemove, &emitRunningWarning](Job const &job) -> bool {
if (!idsToRemove[job.m_id])
return false;
if (Job::Running != job.m_status)
return true;
emitRunningWarning = true;
return false;
});
if (emitRunningWarning)
MainWindow::get()->setStatusBarMessage(QY("Running jobs cannot be removed."));
}
void
@ -149,7 +161,18 @@ Tool::onRemoveDoneOk() {
void
Tool::onRemoveAll() {
m_model->removeJobsIf([this](Job const &) { return true; });
auto emitRunningWarning = false;
m_model->removeJobsIf([&emitRunningWarning](Job const &job) -> bool {
if (Job::Running != job.m_status)
return true;
emitRunningWarning = true;
return false;
});
if (emitRunningWarning)
MainWindow::get()->setStatusBarMessage(QY("Running jobs cannot be removed."));
}
void