Fix progressbar in "Audio to text" on Ubuntu

This commit is contained in:
niksedk 2022-08-30 14:58:43 +02:00
parent 08e7e8ba67
commit f2abd0596f
2 changed files with 25 additions and 8 deletions

View File

@ -12,6 +12,7 @@ using System.Text;
using System.Windows.Forms;
using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Vosk;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Nikse.SubtitleEdit.Forms
{
@ -134,9 +135,7 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
progressBar1.Maximum = 100;
progressBar1.Value = 0;
progressBar1.Visible = true;
ShowProgressBar();
var modelFileName = Path.Combine(_voskFolder, comboBoxModels.Text);
buttonGenerate.Enabled = false;
buttonDownload.Enabled = false;
@ -161,6 +160,16 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = DialogResult.OK;
}
private void ShowProgressBar()
{
progressBar1.Maximum = 100;
progressBar1.Value = 0;
progressBar1.Visible = true;
progressBar1.BringToFront();
progressBar1.Refresh();
progressBar1.Top = labelProgress.Bottom + 3;
}
private void GenerateBatch()
{
groupBoxInputFiles.Enabled = false;
@ -172,9 +181,7 @@ namespace Nikse.SubtitleEdit.Forms
var videoFileName = lvi.Text;
listViewInputFiles.SelectedIndices.Clear();
lvi.Selected = true;
progressBar1.Maximum = 100;
progressBar1.Value = 0;
progressBar1.Visible = true;
ShowProgressBar();
var modelFileName = Path.Combine(_voskFolder, comboBoxModels.Text);
buttonGenerate.Enabled = false;
buttonDownload.Enabled = false;
@ -361,8 +368,8 @@ namespace Nikse.SubtitleEdit.Forms
_filesToDelete.Add(outWaveFile);
var process = GetFfmpegProcess(videoFileName, audioTrackNumber, outWaveFile);
process.Start();
ShowProgressBar();
progressBar1.Style = ProgressBarStyle.Marquee;
progressBar1.Visible = true;
double seconds = 0;
buttonCancel.Visible = true;
try

View File

@ -106,6 +106,16 @@ namespace Nikse.SubtitleEdit.Forms
TaskbarList.SetProgressState(_parentForm.Handle, TaskbarButtonProgressFlags.NoProgress);
}
private void ShowProgressBar()
{
progressBar1.Maximum = 100;
progressBar1.Value = 0;
progressBar1.Visible = true;
progressBar1.BringToFront();
progressBar1.Refresh();
progressBar1.Top = labelProgress.Bottom + 3;
}
private void GenerateBatch()
{
groupBoxInputFiles.Enabled = false;
@ -116,7 +126,7 @@ namespace Nikse.SubtitleEdit.Forms
ParagraphMaxChars = Configuration.Settings.General.SubtitleLineMaximumLength * 2,
};
progressBar1.Visible = true;
ShowProgressBar();
foreach (ListViewItem lvi in listViewInputFiles.Items)
{
_batchFileNumber++;