mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-30 14:58:50 +00:00
GUI: show number of running jobs in the status bar
This commit is contained in:
parent
95b88d6dee
commit
ee8dae5da5
@ -55,7 +55,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">0 automatic, 0 manual</string>
|
<string notr="true">0 automatic, 0 manual, 0 running</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -445,21 +445,14 @@ void
|
|||||||
Model::updateJobStats() {
|
Model::updateJobStats() {
|
||||||
QMutexLocker locked{&m_mutex};
|
QMutexLocker locked{&m_mutex};
|
||||||
|
|
||||||
auto numPendingAuto = 0;
|
auto numJobs = std::map<Job::Status, int>{ { Job::PendingAuto, 0 }, { Job::PendingManual, 0 }, { Job::Running, 0 }, { Job::Disabled, 0 } };
|
||||||
auto numPendingManual = 0;
|
|
||||||
auto numOther = 0;
|
|
||||||
|
|
||||||
for (auto const &job : m_jobsById)
|
for (auto const &job : m_jobsById) {
|
||||||
if (mtx::included_in(job->status(), Job::PendingAuto, Job::Running))
|
auto idx = mtx::included_in(job->status(), Job::PendingAuto, Job::PendingManual, Job::Running) ? job->status() : Job::Disabled;
|
||||||
++numPendingAuto;
|
++numJobs[idx];
|
||||||
|
}
|
||||||
|
|
||||||
else if (Job::PendingManual == job->status())
|
emit jobStatsChanged(numJobs[ Job::PendingAuto ], numJobs[ Job::PendingManual ], numJobs[ Job::Running ], numJobs[ Job::Disabled ]);
|
||||||
++numPendingManual;
|
|
||||||
|
|
||||||
else
|
|
||||||
++numOther;
|
|
||||||
|
|
||||||
emit jobStatsChanged(numPendingAuto, numPendingManual, numOther);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void progressChanged(int progress, int totalProgress);
|
void progressChanged(int progress, int totalProgress);
|
||||||
void jobStatsChanged(int numPendingAutomatic, int numPendingManual, int numOther);
|
void jobStatsChanged(int numPendingAutomatic, int numPendingManual, int numRunning, int numOther);
|
||||||
void numUnacknowledgedWarningsOrErrorsChanged(int numWarnings, int numErrors);
|
void numUnacknowledgedWarningsOrErrorsChanged(int numWarnings, int numErrors);
|
||||||
|
|
||||||
void queueStatusChanged(QueueStatus status);
|
void queueStatusChanged(QueueStatus status);
|
||||||
|
@ -48,9 +48,11 @@ StatusBarProgressWidget::setProgress(int progress,
|
|||||||
void
|
void
|
||||||
StatusBarProgressWidget::setJobStats(int numPendingAuto,
|
StatusBarProgressWidget::setJobStats(int numPendingAuto,
|
||||||
int numPendingManual,
|
int numPendingManual,
|
||||||
|
int numRunning,
|
||||||
int) {
|
int) {
|
||||||
m_numPendingAuto = numPendingAuto;
|
m_numPendingAuto = numPendingAuto;
|
||||||
m_numPendingManual = numPendingManual;
|
m_numPendingManual = numPendingManual;
|
||||||
|
m_numRunning = numRunning;
|
||||||
|
|
||||||
setLabelTexts();
|
setLabelTexts();
|
||||||
}
|
}
|
||||||
@ -84,7 +86,7 @@ StatusBarProgressWidget::retranslateUi() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
StatusBarProgressWidget::setLabelTexts() {
|
StatusBarProgressWidget::setLabelTexts() {
|
||||||
ui->numJobsLabel->setText(QY("%1 automatic, %2 manual").arg(m_numPendingAuto).arg(m_numPendingManual));
|
ui->numJobsLabel->setText(QY("%1 automatic, %2 manual, %3 running").arg(m_numPendingAuto).arg(m_numPendingManual).arg(m_numRunning));
|
||||||
ui->warningsLabel->setText(QNY("%1 warning", "%1 warnings", m_numWarnings).arg(m_numWarnings));
|
ui->warningsLabel->setText(QNY("%1 warning", "%1 warnings", m_numWarnings).arg(m_numWarnings));
|
||||||
ui->errorsLabel ->setText(QNY("%1 error", "%1 errors", m_numErrors) .arg(m_numErrors));
|
ui->errorsLabel ->setText(QNY("%1 error", "%1 errors", m_numErrors) .arg(m_numErrors));
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class StatusBarProgressWidget : public QWidget {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<Ui::StatusBarProgressWidget> ui;
|
std::unique_ptr<Ui::StatusBarProgressWidget> ui;
|
||||||
int m_numPendingAuto{}, m_numPendingManual{}, m_numWarnings{}, m_numErrors{}, m_timerStep{};
|
int m_numPendingAuto{}, m_numPendingManual{}, m_numRunning{}, m_numWarnings{}, m_numErrors{}, m_timerStep{};
|
||||||
QTimer m_timer;
|
QTimer m_timer;
|
||||||
QList<QPixmap> m_pixmaps;
|
QList<QPixmap> m_pixmaps;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setProgress(int progress, int totalProgress);
|
void setProgress(int progress, int totalProgress);
|
||||||
void setJobStats(int numPendingAutomatic, int numPendingManual, int numOther);
|
void setJobStats(int numPendingAutomatic, int numPendingManual, int numRunning, int numOther);
|
||||||
void setNumUnacknowledgedWarningsOrErrors(int numWarnings, int numErrors);
|
void setNumUnacknowledgedWarningsOrErrors(int numWarnings, int numErrors);
|
||||||
void updateWarningsAndErrorsIcons();
|
void updateWarningsAndErrorsIcons();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user