Work on batch convert

This commit is contained in:
niksedk 2019-12-05 12:13:50 +01:00
parent b0323847e2
commit a760d8baee
3 changed files with 136 additions and 2 deletions

View File

@ -33,6 +33,9 @@
this.buttonConvert = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxConvertOptions = new System.Windows.Forms.GroupBox();
this.listViewConvertOptions = new System.Windows.Forms.ListView();
this.ActionCheckBox = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Action = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.buttonFixRtlSettings = new System.Windows.Forms.Button();
this.checkBoxFixRtl = new System.Windows.Forms.CheckBox();
this.buttonBridgeGapsSettings = new System.Windows.Forms.Button();
@ -136,6 +139,7 @@
//
this.groupBoxConvertOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxConvertOptions.Controls.Add(this.listViewConvertOptions);
this.groupBoxConvertOptions.Controls.Add(this.buttonFixRtlSettings);
this.groupBoxConvertOptions.Controls.Add(this.checkBoxFixRtl);
this.groupBoxConvertOptions.Controls.Add(this.buttonBridgeGapsSettings);
@ -161,6 +165,31 @@
this.groupBoxConvertOptions.TabStop = false;
this.groupBoxConvertOptions.Text = "Convert options";
//
// listViewConvertOptions
//
this.listViewConvertOptions.CheckBoxes = true;
this.listViewConvertOptions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.ActionCheckBox,
this.Action});
this.listViewConvertOptions.FullRowSelect = true;
this.listViewConvertOptions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listViewConvertOptions.HideSelection = false;
this.listViewConvertOptions.Location = new System.Drawing.Point(6, 17);
this.listViewConvertOptions.MultiSelect = false;
this.listViewConvertOptions.Name = "listViewConvertOptions";
this.listViewConvertOptions.Size = new System.Drawing.Size(281, 252);
this.listViewConvertOptions.TabIndex = 301;
this.listViewConvertOptions.UseCompatibleStateImageBehavior = false;
this.listViewConvertOptions.View = System.Windows.Forms.View.Details;
//
// ActionCheckBox
//
this.ActionCheckBox.Width = 30;
//
// Action
//
this.Action.Width = 400;
//
// buttonFixRtlSettings
//
this.buttonFixRtlSettings.ImeMode = System.Windows.Forms.ImeMode.NoControl;
@ -965,5 +994,8 @@
private System.Windows.Forms.Button buttonChooseFolder;
private System.Windows.Forms.TextBox textBoxOutputFolder;
private System.Windows.Forms.RadioButton radioButtonSaveInSourceFolder;
private System.Windows.Forms.ListView listViewConvertOptions;
private System.Windows.Forms.ColumnHeader ActionCheckBox;
private System.Windows.Forms.ColumnHeader Action;
}
}

View File

@ -262,6 +262,102 @@ namespace Nikse.SubtitleEdit.Forms
_bridgeGaps = new DurationsBridgeGaps(null);
_bridgeGaps.InitializeSettingsOnly();
buttonTransportStreamSettings.Visible = false;
var fixItems = new List<FixActionItem>
{
new FixActionItem
{
Text = "Remove formatting",
Checked = false,
Action = CommandLineConverter.BatchAction.RemoveFormatting
},
new FixActionItem
{
Text = "Redo casing",
Checked = false,
Action = CommandLineConverter.BatchAction.ReDoCasing
},
new FixActionItem
{
Text = "Remove text for HI",
Checked = false,
Action = CommandLineConverter.BatchAction.RemoveTextForHI
},
new FixActionItem
{
Text = "Bridge gaps",
Checked = false,
Action = CommandLineConverter.BatchAction.BridgeGaps
},
new FixActionItem
{
Text = "Fix common errors",
Checked = false,
Action = CommandLineConverter.BatchAction.FixCommonErrors
},
new FixActionItem
{
Text = "Multiple replace",
Checked = false,
Action = CommandLineConverter.BatchAction.MultipleReplace
},
new FixActionItem
{
Text = "Fix RTL",
Checked = false,
Action = CommandLineConverter.BatchAction.FixRtl
},
new FixActionItem
{
Text = "Split long lines",
Checked = false,
Action = CommandLineConverter.BatchAction.SplitLongLines
},
new FixActionItem
{
Text = "Auto balance lines",
Checked = false,
Action = CommandLineConverter.BatchAction.BalanceLines
},
new FixActionItem
{
Text = "Set min. milliseconds between subtitles",
Checked = false,
Action = CommandLineConverter.BatchAction.SetMinGap
},
new FixActionItem
{
Text = "Merge short lines",
Checked = false,
Action = CommandLineConverter.BatchAction.MergeShortLines
},
new FixActionItem
{
Text = "Merge lines with same text",
Checked = false,
Action = CommandLineConverter.BatchAction.MergeSameTexts
},
new FixActionItem
{
Text = "Merge lines with same time codes",
Checked = false,
Action = CommandLineConverter.BatchAction.MergeSameTimeCodes
},
};
foreach (var fixItem in fixItems)
{
var listViewItem = new ListViewItem { Tag = fixItem.Action };
listViewItem.SubItems.Add(fixItem.Text);
listViewItem.Checked = fixItem.Checked;
listViewConvertOptions.Items.Add(listViewItem);
}
}
public class FixActionItem
{
public string Text { get; set; }
public bool Checked { get; set; }
public CommandLineConverter.BatchAction Action { get; set; }
}

View File

@ -27,7 +27,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
public delegate void BatchConvertProgress(string progress);
internal enum BatchAction
public enum BatchAction
{
FixCommonErrors,
MergeShortLines,
@ -36,7 +36,13 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
RemoveTextForHI,
RemoveFormatting,
ReDoCasing,
ReverseRtlStartEnd
ReverseRtlStartEnd,
BridgeGaps,
MultipleReplace,
FixRtl,
SplitLongLines,
BalanceLines,
SetMinGap
}
internal static void ConvertOrReturn(string productIdentifier, string[] commandLineArguments)