From 452504a5cb3cfa5fb9dca3f446b9572749ad9d0a Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Tue, 23 Apr 2024 07:13:48 +0200 Subject: [PATCH] Disable OK on tts is done --- src/ui/Forms/Tts/TextToSpeech.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 743c6d8ad..1997a100e 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -35,6 +35,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts private readonly List _engines; private readonly List _elevenLabVoices; private bool _actorsOn; + private bool _converting; public class ActorAndVoice { @@ -193,7 +194,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts } buttonGenerateTTS.Text = LanguageSettings.Current.General.Cancel; - + _converting = true; + buttonOK.Enabled = false; _waveFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(_waveFolder); @@ -253,8 +255,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } - HandleAbort(); UiUtil.OpenFolder(_waveFolder); + HandleAbort(); } private void HandleAbort() @@ -270,6 +272,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts buttonGenerateTTS.Text = "Generate text to speech"; buttonGenerateTTS.Enabled = true; _abort = false; + _converting = false; + buttonOK.Enabled = true; } private async Task GenerateParagraphAudio(Subtitle subtitle, bool showProgressBar, string overrideFileName) @@ -1387,6 +1391,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void buttonCancel_Click(object sender, EventArgs e) { + if (_converting) + { + _abort = true; + return; + } + DialogResult = DialogResult.Cancel; }