GUI: jobs: resetting total progress must clear number completed jobs

Otherwise the total progress will jump back to 100% whenever the
progress is updated (e.g. when a job is removed).
This commit is contained in:
Moritz Bunkus 2015-08-30 08:50:20 +02:00
parent d2af08f770
commit 7ff6175a95
3 changed files with 16 additions and 0 deletions

View File

@ -425,6 +425,18 @@ Model::stop() {
emit queueStatusChanged(QueueStatus::Stopped);
}
void
Model::resetTotalProgress() {
QMutexLocker locked{&m_mutex};
if (isRunning() || !m_queueNumDone)
return;
m_queueNumDone = 0;
emit progressChanged(0, 0);
}
void
Model::updateProgress() {
QMutexLocker locked{&m_mutex};

View File

@ -100,6 +100,8 @@ public slots:
void acknowledgeAllErrors();
void acknowledgeSelectedErrors(QAbstractItemView *view);
void resetTotalProgress();
protected:
QList<QStandardItem *> createRow(Job const &job) const;
void setRowText(QList<QStandardItem *> const &items, Job const &job) const;

View File

@ -124,6 +124,8 @@ Tool::setupActions() {
connect(ui->jobs, &QTreeView::doubleClicked, this, &Tool::onViewOutput);
connect(mw, &MainWindow::preferencesChanged, this, &Tool::retranslateUi);
connect(MainWindow::watchCurrentJobTab(), &WatchJobs::Tab::watchCurrentJobTabCleared, m_model, &Model::resetTotalProgress);
}
void