From 1171be7919e13027c246bbda68a9db8eb9fbc235 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 16 Apr 2024 17:37:14 +0200 Subject: [PATCH] Show msg box modal when SE window not focused - thx jupester :) Fix #8198 --- src/ui/Forms/AudioToText/VoskAudioToText.cs | 4 ++-- src/ui/Forms/AudioToText/WhisperAudioToText.cs | 2 +- src/ui/Forms/SeMsgBox/MessageBox.cs | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ui/Forms/AudioToText/VoskAudioToText.cs b/src/ui/Forms/AudioToText/VoskAudioToText.cs index a62cc870b..57bd6dc0c 100644 --- a/src/ui/Forms/AudioToText/VoskAudioToText.cs +++ b/src/ui/Forms/AudioToText/VoskAudioToText.cs @@ -234,11 +234,11 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText if (errors.Length > 0) { - MessageBox.Show($"{errorCount} error(s)!{Environment.NewLine}{errors}"); + MessageBox.Show(this, $"{errorCount} error(s)!{Environment.NewLine}{errors}"); } var fileList = Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, _outputBatchFileNames); - MessageBox.Show(string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount) + fileList); + MessageBox.Show(this, string.Format(LanguageSettings.Current.AudioToText.XFilesSavedToVideoSourceFolder, listViewInputFiles.Items.Count - errorCount) + fileList); groupBoxInputFiles.Enabled = true; buttonGenerate.Enabled = true; diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 71c54cfdb..4bac683e8 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -386,7 +386,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText _languageCode = GetLanguage(comboBoxLanguages.Text); - if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model && + if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model && _languageCode != "en" && IsModelEnglishOnly(model)) { var result = MessageBox.Show("English model should only be used with English language." + Environment.NewLine + diff --git a/src/ui/Forms/SeMsgBox/MessageBox.cs b/src/ui/Forms/SeMsgBox/MessageBox.cs index c5dc26eee..8249f1016 100644 --- a/src/ui/Forms/SeMsgBox/MessageBox.cs +++ b/src/ui/Forms/SeMsgBox/MessageBox.cs @@ -28,6 +28,14 @@ namespace Nikse.SubtitleEdit.Forms.SeMsgBox } } + public static DialogResult Show(Form form, string text) + { + using (var msgBox = new MessageBoxForm(text, string.Empty, MessageBoxButtons.OK)) + { + return msgBox.ShowDialog(form); + } + } + public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) { using (var msgBox = new MessageBoxForm(text, caption, buttons))