From 115b5b485f3f00f13316c82ae448b757db8857e9 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 7 Dec 2019 09:28:08 +0100 Subject: [PATCH] Work on batch convert --- src/Forms/BatchConvert.cs | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Forms/BatchConvert.cs b/src/Forms/BatchConvert.cs index 69797cffa..3275cfe8d 100644 --- a/src/Forms/BatchConvert.cs +++ b/src/Forms/BatchConvert.cs @@ -679,6 +679,7 @@ namespace Nikse.SubtitleEdit.Forms } UpdateRtlSettings(); + UpdateActionEnabledCache(); if (listViewInputFiles.Items.Count == 0) { MessageBox.Show(Configuration.Settings.Language.BatchConvert.NothingToConvert); @@ -1141,8 +1142,25 @@ namespace Nikse.SubtitleEdit.Forms _bdLookup = new Dictionary>(); } + private Dictionary _actionEnabledCache; + + private void UpdateActionEnabledCache() + { + _actionEnabledCache = new Dictionary(); + foreach (ListViewItem item in listViewConvertOptions.Items) + { + var fixItem = item.Tag as FixActionItem; + _actionEnabledCache.Add(fixItem.Action, item.Checked); + } + } + private bool IsActionEnabled(CommandLineConverter.BatchAction action) { + if (_actionEnabledCache != null) + { + return _actionEnabledCache[action]; + } + foreach (ListViewItem item in listViewConvertOptions.Items) { var fixItem = item.Tag as FixActionItem; @@ -1918,6 +1936,7 @@ namespace Nikse.SubtitleEdit.Forms { ".png", ".jpg", + ".jpeg", ".tif", ".tiff", ".gif", @@ -1956,7 +1975,11 @@ namespace Nikse.SubtitleEdit.Forms { labelStatus.Refresh(); var fi = new FileInfo(fileName); - if (ext == ".sub" && FileUtil.IsVobSub(fileName)) + if (comboBoxFilter.SelectedIndex == 4 && textBoxFilter.Text.Length > 0 && !fileName.Contains(textBoxFilter.Text, StringComparison.OrdinalIgnoreCase)) + { + // skip + } + else if (ext == ".sub" && FileUtil.IsVobSub(fileName)) { AddFromSearch(fileName, fi, "VobSub"); } @@ -1976,10 +1999,6 @@ namespace Nikse.SubtitleEdit.Forms { // skip for now } - else if (comboBoxFilter.SelectedIndex == 4 && textBoxFilter.Text.Length > 0 && !fileName.Contains(textBoxFilter.Text, StringComparison.OrdinalIgnoreCase)) - { - // skip - } else { if (fi.Length < ConvertMaxFileSize)