GUI: job queue: optionally reset warning/error counters to 0 on exit

Implements #1437.
This commit is contained in:
Moritz Bunkus 2015-10-10 17:04:16 +02:00
parent 8045d3836d
commit 95f5c7c592
6 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2015-10-10 Moritz Bunkus <moritz@bunkus.org>
* MKVToolNix GUI: new job queue feature: added an option in the
preferences for resetting the warning and error counters of all
jobs and the global counters in the status bar to 0 when exiting
the program. Implements #1437.
* MKVToolNix GUI: current job output enhancement: the separator
lines for warnings and errors ("--- Warnings emitted by Job …
started on … ---") are only shown when warnings/errors actually

View File

@ -164,6 +164,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbGuiResetJobWarningErrorCountersOnExit">
<property name="text">
<string>Reset the warning and error counters on exit</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbGuiRemoveJobs">
<property name="text">
@ -970,6 +977,7 @@
<tabstop>cbGuiSwitchToJobOutputAfterStarting</tabstop>
<tabstop>cbGuiUseDefaultJobDescription</tabstop>
<tabstop>cbGuiShowOutputOfAllJobs</tabstop>
<tabstop>cbGuiResetJobWarningErrorCountersOnExit</tabstop>
<tabstop>cbGuiRemoveJobs</tabstop>
<tabstop>cbGuiJobRemovalPolicy</tabstop>
<tabstop>cbCEDropLastFromBlurayPlaylist</tabstop>

View File

@ -282,6 +282,8 @@ Job::saveQueueFile() {
void
Job::saveJob(Util::ConfigFile &settings) {
auto resetCounters = Util::Settings::get().m_resetJobWarningErrorCountersOnExit;
settings.setValue("uuid", m_uuid);
settings.setValue("status", static_cast<unsigned int>(m_status));
settings.setValue("description", m_description);
@ -291,8 +293,8 @@ Job::saveJob(Util::ConfigFile &settings) {
settings.setValue("fullOutput", m_fullOutput);
settings.setValue("progress", m_progress);
settings.setValue("exitCode", m_exitCode);
settings.setValue("warningsAcknowledged", m_warningsAcknowledged);
settings.setValue("errorsAcknowledged", m_errorsAcknowledged);
settings.setValue("warningsAcknowledged", resetCounters ? m_warnings.count() : m_warningsAcknowledged);
settings.setValue("errorsAcknowledged", resetCounters ? m_errors.count() : m_errorsAcknowledged);
settings.setValue("dateAdded", m_dateAdded);
settings.setValue("dateStarted", m_dateStarted);
settings.setValue("dateFinished", m_dateFinished);
@ -325,6 +327,11 @@ Job::loadJobBasis(Util::ConfigFile &settings) {
if (Running == m_status)
m_status = Aborted;
if (Util::Settings::get().m_resetJobWarningErrorCountersOnExit) {
m_warningsAcknowledged = m_warnings.count();
m_errorsAcknowledged = m_errors.count();
}
}
JobPtr

View File

@ -43,6 +43,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
ui->cbGuiUseDefaultJobDescription->setChecked(m_cfg.m_useDefaultJobDescription);
ui->cbGuiShowOutputOfAllJobs->setChecked(m_cfg.m_showOutputOfAllJobs);
ui->cbGuiSwitchToJobOutputAfterStarting->setChecked(m_cfg.m_switchToJobOutputAfterStarting);
ui->cbGuiResetJobWarningErrorCountersOnExit->setChecked(m_cfg.m_resetJobWarningErrorCountersOnExit);
setupJobRemovalPolicy();
setupCommonLanguages();
@ -120,6 +121,7 @@ PreferencesDialog::setupToolTips() {
Util::setToolTip(ui->cbGuiUseDefaultJobDescription, QY("If disabled the GUI will let you enter a description for a job when adding it to the queue."));
Util::setToolTip(ui->cbGuiShowOutputOfAllJobs, QY("If enabled the first tab in the »job output« tool will not be cleared when a new job starts."));
Util::setToolTip(ui->cbGuiSwitchToJobOutputAfterStarting, QY("If enabled the GUI will automatically switch to the job output tool whenever you start a job (e.g. by pressing »start muxing«)."));
Util::setToolTip(ui->cbGuiResetJobWarningErrorCountersOnExit, QY("If enabled the warning and error counters of all jobs and the global counters in the status bar will be reset to 0 when the program exits."));
Util::setToolTip(ui->cbGuiRemoveJobs,
Q("%1 %2")
@ -418,6 +420,7 @@ PreferencesDialog::save() {
m_cfg.m_useDefaultJobDescription = ui->cbGuiUseDefaultJobDescription->isChecked();
m_cfg.m_showOutputOfAllJobs = ui->cbGuiShowOutputOfAllJobs->isChecked();
m_cfg.m_switchToJobOutputAfterStarting = ui->cbGuiSwitchToJobOutputAfterStarting->isChecked();
m_cfg.m_resetJobWarningErrorCountersOnExit = ui->cbGuiResetJobWarningErrorCountersOnExit->isChecked();
auto idx = !ui->cbGuiRemoveJobs->isChecked() ? 0 : ui->cbGuiJobRemovalPolicy->currentIndex() + 1;
m_cfg.m_jobRemovalPolicy = static_cast<Util::Settings::JobRemovalPolicy>(idx);

View File

@ -167,6 +167,7 @@ Settings::load() {
m_useDefaultJobDescription = reg.value("useDefaultJobDescription", false).toBool();
m_showOutputOfAllJobs = reg.value("showOutputOfAllJobs", true).toBool();
m_switchToJobOutputAfterStarting = reg.value("switchToJobOutputAfterStarting", false).toBool();
m_resetJobWarningErrorCountersOnExit = reg.value("resetJobWarningErrorCountersOnExit", false).toBool();
m_jobRemovalPolicy = static_cast<JobRemovalPolicy>(reg.value("jobRemovalPolicy", static_cast<int>(JobRemovalPolicy::Never)).toInt());
m_disableAnimations = reg.value("disableAnimations", false).toBool();
@ -284,6 +285,7 @@ Settings::save()
reg.setValue("useDefaultJobDescription", m_useDefaultJobDescription);
reg.setValue("showOutputOfAllJobs", m_showOutputOfAllJobs);
reg.setValue("switchToJobOutputAfterStarting", m_switchToJobOutputAfterStarting);
reg.setValue("resetJobWarningErrorCountersOnExit", m_resetJobWarningErrorCountersOnExit);
reg.setValue("jobRemovalPolicy", static_cast<int>(m_jobRemovalPolicy));
reg.setValue("disableAnimations", m_disableAnimations);

View File

@ -82,7 +82,7 @@ public:
unsigned int m_minimumPlaylistDuration;
JobRemovalPolicy m_jobRemovalPolicy;
bool m_useDefaultJobDescription, m_showOutputOfAllJobs, m_switchToJobOutputAfterStarting;
bool m_useDefaultJobDescription, m_showOutputOfAllJobs, m_switchToJobOutputAfterStarting, m_resetJobWarningErrorCountersOnExit;
bool m_checkForUpdates;
QDateTime m_lastUpdateCheck;