diff --git a/NEWS.md b/NEWS.md
index 5307cb2bc..313b513bc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -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
diff --git a/src/mkvtoolnix-gui/forms/main_window/prefs_run_program_widget.ui b/src/mkvtoolnix-gui/forms/main_window/prefs_run_program_widget.ui
index 5d111d391..82b8bf565 100644
--- a/src/mkvtoolnix-gui/forms/main_window/prefs_run_program_widget.ui
+++ b/src/mkvtoolnix-gui/forms/main_window/prefs_run_program_widget.ui
@@ -31,7 +31,14 @@
-
- After a job completes &successfully or with warnings
+ After a job completes &successfully
+
+
+
+ -
+
+
+ After a job exits with &warnings
@@ -316,6 +323,7 @@ p, li { white-space: pre-wrap; }
leName
cbType
cbAfterJobSuccessful
+ cbAfterJobWarnings
cbAfterJobError
cbAfterJobQueueStopped
pbExecuteNow
@@ -325,6 +333,7 @@ p, li { white-space: pre-wrap; }
tbUsageNotes
leAudioFile
pbBrowseAudioFile
+ sbVolume
diff --git a/src/mkvtoolnix-gui/jobs/job.cpp b/src/mkvtoolnix-gui/jobs/job.cpp
index 2ba99c5c7..8cf84f6cd 100644
--- a/src/mkvtoolnix-gui/jobs/job.cpp
+++ b/src/mkvtoolnix-gui/jobs/job.cpp
@@ -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);
diff --git a/src/mkvtoolnix-gui/main_window/prefs_run_program_widget.cpp b/src/mkvtoolnix-gui/main_window/prefs_run_program_widget.cpp
index a636c3489..d9700e7ef 100644
--- a/src/mkvtoolnix-gui/main_window/prefs_run_program_widget.cpp
+++ b/src/mkvtoolnix-gui/main_window/prefs_run_program_widget.cpp
@@ -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);
diff --git a/src/mkvtoolnix-gui/util/settings.cpp b/src/mkvtoolnix-gui/util/settings.cpp
index 99c8ce3cf..3997d5222 100644
--- a/src/mkvtoolnix-gui/util/settings.cpp
+++ b/src/mkvtoolnix-gui/util/settings.cpp
@@ -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
diff --git a/src/mkvtoolnix-gui/util/settings.h b/src/mkvtoolnix-gui/util/settings.h
index 07a883a18..7dd085a72 100644
--- a/src/mkvtoolnix-gui/util/settings.h
+++ b/src/mkvtoolnix-gui/util/settings.h
@@ -40,6 +40,7 @@ public:
RunAfterJobQueueFinishes = 0x01,
RunAfterJobCompletesSuccessfully = 0x02,
RunAfterJobCompletesWithErrors = 0x04,
+ RunAfterJobCompletesWithWarnings = 0x08,
};
Q_DECLARE_FLAGS(RunProgramForEvents, RunProgramForEvent)