GIU: job actions: split "when successful or with warnings" into separate options

Implements #2798.
This commit is contained in:
Moritz Bunkus 2020-04-25 10:34:38 +02:00
parent 78d525a774
commit f31d039032
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
6 changed files with 34 additions and 2 deletions

View File

@ -4,6 +4,9 @@
* mkvmerge: for audio-only files mkvmerge will now write a cue entry every
500ms instead of every 2s.
* MKVToolNix GUI: job actions: split up the option "execute when the job
finishes successfully or with warnings" into two separate options: "…when
finishes successfully" and "…when exits with warnings". Implements #2798.
## Bug fixes

View File

@ -31,7 +31,14 @@
<item>
<widget class="QCheckBox" name="cbAfterJobSuccessful">
<property name="text">
<string>After a job completes &amp;successfully or with warnings</string>
<string>After a job completes &amp;successfully</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbAfterJobWarnings">
<property name="text">
<string>After a job exits with &amp;warnings</string>
</property>
</widget>
</item>
@ -316,6 +323,7 @@ p, li { white-space: pre-wrap; }
<tabstop>leName</tabstop>
<tabstop>cbType</tabstop>
<tabstop>cbAfterJobSuccessful</tabstop>
<tabstop>cbAfterJobWarnings</tabstop>
<tabstop>cbAfterJobError</tabstop>
<tabstop>cbAfterJobQueueStopped</tabstop>
<tabstop>pbExecuteNow</tabstop>
@ -325,6 +333,7 @@ p, li { white-space: pre-wrap; }
<tabstop>tbUsageNotes</tabstop>
<tabstop>leAudioFile</tabstop>
<tabstop>pbBrowseAudioFile</tabstop>
<tabstop>sbVolume</tabstop>
</tabstops>
<resources>
<include location="../../qt_resources.qrc"/>

View File

@ -468,7 +468,9 @@ Job::runProgramsAfterCompletion() {
if (!mtx::included_in(p->status, DoneOk, DoneWarnings, Failed))
return;
auto event = p->status == Failed ? Util::Settings::RunAfterJobCompletesWithErrors : Util::Settings::RunAfterJobCompletesSuccessfully;
auto event = p->status == Failed ? Util::Settings::RunAfterJobCompletesWithErrors
: p->status == DoneWarnings ? Util::Settings::RunAfterJobCompletesWithWarnings
: Util::Settings::RunAfterJobCompletesSuccessfully;
App::programRunner().run(event, [this](ProgramRunner::VariableMap &variables) {
runProgramSetupVariables(variables);

View File

@ -71,6 +71,7 @@ PrefsRunProgramWidget::setupUi(Util::Settings::RunProgramConfig const &cfg) {
p->flagsByCheckbox[p->ui->cbAfterJobQueueStopped] = Util::Settings::RunAfterJobQueueFinishes;
p->flagsByCheckbox[p->ui->cbAfterJobSuccessful] = Util::Settings::RunAfterJobCompletesSuccessfully;
p->flagsByCheckbox[p->ui->cbAfterJobWarnings] = Util::Settings::RunAfterJobCompletesWithWarnings;
p->flagsByCheckbox[p->ui->cbAfterJobError] = Util::Settings::RunAfterJobCompletesWithErrors;
p->ui->cbConfigurationActive->setChecked(cfg.m_active);

View File

@ -270,6 +270,22 @@ Settings::convertOldSettings() {
reg->setValue(s_valMergePredefinedSubtitleTrackNames, value.toStringList());
}
reg->endGroup();
// Update program runner event types: v46 splits "run if job
// successful or with warnings" into two separate events.
if (writtenByVersion <= version_number_t{"45.0.0.26"}) {
reg->beginGroup(s_grpRunProgramConfigurations);
for (auto const &group : reg->childGroups()) {
reg->beginGroup(group);
auto forEvents = reg->value(s_valForEvents).toInt();
if (forEvents & 2)
reg->setValue(s_valForEvents, forEvents | 8);
reg->endGroup();
}
reg->endGroup(); // runProgramConfigurations
}
}
void

View File

@ -40,6 +40,7 @@ public:
RunAfterJobQueueFinishes = 0x01,
RunAfterJobCompletesSuccessfully = 0x02,
RunAfterJobCompletesWithErrors = 0x04,
RunAfterJobCompletesWithWarnings = 0x08,
};
Q_DECLARE_FLAGS(RunProgramForEvents, RunProgramForEvent)