Merge pull request #2414 from ivandrofly/fce-patch-2

[fixcommonerrors] - add reset default button.
This commit is contained in:
Nikolaj Olsson 2017-05-31 18:13:48 +02:00 committed by GitHub
commit 83dfdfdc18
7 changed files with 33 additions and 1 deletions

View File

@ -636,6 +636,7 @@ Note: Do check free disk space.</WaveFileMalformed>
<FixOcrErrorExample>D0n't -&gt; Don't</FixOcrErrorExample>
<FixSpaceBetweenNumbersExample>1 100 -&gt; 1100</FixSpaceBetweenNumbersExample>
<FixDialogsOneLineExample>Hi John! - Hi Ida! -&gt; Hi John!&lt;br /&gt;- Hi Ida!</FixDialogsOneLineExample>
<SelectDefault>Select default</SelectDefault>
</FixCommonErrors>
<GetDictionaries>
<Title>Need dictionaries?</Title>

View File

@ -822,6 +822,7 @@ namespace Nikse.SubtitleEdit.Core
FixOcrErrorExample = "D0n't -> Don't",
FixSpaceBetweenNumbersExample = "1 100 -> 1100",
FixDialogsOneLineExample = "Hi John! - Hi Ida! -> Hi John!<br />- Hi Ida!",
SelectDefault = "Select default",
};
GetDictionaries = new LanguageStructure.GetDictionaries

View File

@ -1687,6 +1687,9 @@ namespace Nikse.SubtitleEdit.Core
case "FixCommonErrors/FixDialogsOneLineExample":
language.FixCommonErrors.FixDialogsOneLineExample = reader.Value;
break;
case "FixCommonErrors/SelectDefault":
language.FixCommonErrors.SelectDefault = reader.Value;
break;
case "GetDictionaries/Title":
language.GetDictionaries.Title = reader.Value;
break;

View File

@ -698,6 +698,7 @@
public string FixOcrErrorExample { get; set; }
public string FixSpaceBetweenNumbersExample { get; set; }
public string FixDialogsOneLineExample { get; set; }
public string SelectDefault { get; set; }
}
public class GetDictionaries

View File

@ -476,6 +476,11 @@ namespace Nikse.SubtitleEdit.Core
public bool FixMusicNotationTicked { get; set; }
public FixCommonErrorsSettings()
{
LoadDeafultConfigs();
}
public void LoadDeafultConfigs()
{
EmptyLinesTicked = true;
OverlappingDisplayTimeTicked = true;
@ -502,6 +507,7 @@ namespace Nikse.SubtitleEdit.Core
FixMissingOpenBracketTicked = true;
FixMusicNotationTicked = true;
}
}
public class GeneralSettings

View File

@ -36,6 +36,7 @@ namespace Nikse.SubtitleEdit.Forms
this.labelStatus = new System.Windows.Forms.Label();
this.buttonBack = new System.Windows.Forms.Button();
this.groupBoxStep1 = new System.Windows.Forms.GroupBox();
this.buttonResetDefault = new System.Windows.Forms.Button();
this.comboBoxLanguage = new System.Windows.Forms.ComboBox();
this.labelLanguage = new System.Windows.Forms.Label();
this.buttonInverseSelection = new System.Windows.Forms.Button();
@ -146,6 +147,7 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxStep1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxStep1.Controls.Add(this.buttonResetDefault);
this.groupBoxStep1.Controls.Add(this.comboBoxLanguage);
this.groupBoxStep1.Controls.Add(this.labelLanguage);
this.groupBoxStep1.Controls.Add(this.buttonInverseSelection);
@ -158,6 +160,17 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxStep1.TabStop = false;
this.groupBoxStep1.Text = "Step 1/2 - Choose which errors to fix";
//
// buttonResetDefault
//
this.buttonResetDefault.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonResetDefault.Location = new System.Drawing.Point(193, 514);
this.buttonResetDefault.Name = "buttonResetDefault";
this.buttonResetDefault.Size = new System.Drawing.Size(100, 21);
this.buttonResetDefault.TabIndex = 12;
this.buttonResetDefault.Text = "Select default";
this.buttonResetDefault.UseVisualStyleBackColor = true;
this.buttonResetDefault.Click += new System.EventHandler(this.buttonResetDefault_Click);
//
// comboBoxLanguage
//
this.comboBoxLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -750,5 +763,6 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonSplitLine;
private System.Windows.Forms.ComboBox comboBoxLanguage;
private System.Windows.Forms.Label labelLanguage;
private System.Windows.Forms.Button buttonResetDefault;
}
}

View File

@ -439,6 +439,7 @@ namespace Nikse.SubtitleEdit.Forms
labelLanguage.Text = Configuration.Settings.Language.ChooseLanguage.Language;
toolStripMenuItemDelete.Text = Configuration.Settings.Language.Main.Menu.ContextMenu.Delete;
mergeSelectedLinesToolStripMenuItem.Text = Configuration.Settings.Language.Main.Menu.ContextMenu.MergeSelectedLines;
buttonResetDefault.Text = _language.SelectDefault;
splitContainerStep2.Panel1MinSize = 110;
splitContainerStep2.Panel2MinSize = 160;
@ -530,7 +531,7 @@ namespace Nikse.SubtitleEdit.Forms
{
if (_nameList == null)
{
string languageTwoLetterCode = LanguageAutoDetect.AutoDetectGoogleLanguage(Subtitle);
string languageTwoLetterCode = LanguageAutoDetect.AutoDetectGoogleLanguage(Subtitle);
// Will contains both one word names and multi names
var namesList = new NameList(Configuration.DictionariesDirectory, languageTwoLetterCode, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
_nameList = namesList.GetNames();
@ -1608,5 +1609,10 @@ namespace Nikse.SubtitleEdit.Forms
SaveConfiguration();
}
private void buttonResetDefault_Click(object sender, EventArgs e)
{
Configuration.Settings.CommonErrors.LoadDeafultConfigs();
AddFixActions(CultureInfo.GetCultureInfo(_autoDetectGoogleLanguage).ThreeLetterISOLanguageName);
}
}
}