Some refact regarding names of a few subtitle formats

This commit is contained in:
niksedk 2015-03-20 17:15:12 +01:00
parent 80dada6f66
commit 9dadb14940
8 changed files with 27 additions and 18 deletions

View File

@ -730,11 +730,11 @@ namespace Nikse.SubtitleEdit.Forms
sub = vobSubOcr.SubtitleFromOcr;
}
}
if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name && _assStyle != null)
if (comboBoxSubtitleFormats.Text == AdvancedSubStationAlpha.NameOfFormat && _assStyle != null)
{
sub.Header = _assStyle;
}
else if (comboBoxSubtitleFormats.Text == new SubStationAlpha().Name && _ssaStyle != null)
else if (comboBoxSubtitleFormats.Text == SubStationAlpha.NameOfFormat && _ssaStyle != null)
{
sub.Header = _ssaStyle;
}
@ -989,7 +989,7 @@ namespace Nikse.SubtitleEdit.Forms
private void ComboBoxSubtitleFormatsSelectedIndexChanged(object sender, EventArgs e)
{
if (comboBoxSubtitleFormats.Text == new AdvancedSubStationAlpha().Name || comboBoxSubtitleFormats.Text == new SubStationAlpha().Name)
if (comboBoxSubtitleFormats.Text == AdvancedSubStationAlpha.NameOfFormat || comboBoxSubtitleFormats.Text == SubStationAlpha.NameOfFormat)
{
buttonStyles.Visible = true;
}

View File

@ -2143,7 +2143,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (format == null || format.Name == new Scenarist().Name)
if (format == null || format.Name == Scenarist.NameOfFormat)
{
try
{
@ -2165,7 +2165,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (format == null || format.Name == new SubRip().Name)
if (format == null || format.Name == SubRip.NameOfFormat)
{
if (_subtitle.Paragraphs.Count > 1)
{
@ -2212,7 +2212,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
if (format == null || format.Name == new Scenarist().Name)
if (format == null || format.Name == Scenarist.NameOfFormat)
{
try
{

View File

@ -1121,12 +1121,12 @@ namespace Nikse.SubtitleEdit.Forms.Styles
openFileDialogImport.InitialDirectory = Configuration.DataDirectory;
if (_isSubStationAlpha)
{
openFileDialogImport.Filter = new SubStationAlpha().Name + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
openFileDialogImport.Filter = SubStationAlpha.NameOfFormat + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.FileName = "my_styles.ssa";
}
else
{
openFileDialogImport.Filter = new AdvancedSubStationAlpha().Name + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
openFileDialogImport.Filter = AdvancedSubStationAlpha.NameOfFormat + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.FileName = "my_styles.ass";
}
@ -1207,12 +1207,12 @@ namespace Nikse.SubtitleEdit.Forms.Styles
saveFileDialogStyle.InitialDirectory = Configuration.DataDirectory;
if (_isSubStationAlpha)
{
saveFileDialogStyle.Filter = new SubStationAlpha().Name + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.Filter = SubStationAlpha.NameOfFormat + "|*.ssa|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.FileName = "my_styles.ssa";
}
else
{
saveFileDialogStyle.Filter = new AdvancedSubStationAlpha().Name + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.Filter = AdvancedSubStationAlpha.NameOfFormat + "|*.ass|" + Configuration.Settings.Language.General.AllFiles + "|*.*";
saveFileDialogStyle.FileName = "my_styles.ass";
}

View File

@ -218,8 +218,8 @@ namespace Nikse.SubtitleEdit.Logic
if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha))
{
if (toFormat.ToLower() != new AdvancedSubStationAlpha().Name.ToLower().Replace(" ", string.Empty) &&
toFormat.ToLower() != new SubStationAlpha().Name.ToLower().Replace(" ", string.Empty))
if (toFormat.ToLower() != AdvancedSubStationAlpha.NameOfFormat.ToLower().Replace(" ", string.Empty) &&
toFormat.ToLower() != SubStationAlpha.NameOfFormat.ToLower().Replace(" ", string.Empty))
{
foreach (SubtitleFormat sf in formats)

View File

@ -51,9 +51,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
get { return ".ass"; }
}
public const string NameOfFormat = "Advanced Sub Station Alpha";
public override string Name
{
get { return "Advanced Sub Station Alpha"; }
get { return NameOfFormat; }
}
public override bool IsTimeBased
@ -855,7 +857,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
public override void RemoveNativeFormatting(Subtitle subtitle, SubtitleFormat newFormat)
{
if (newFormat != null && newFormat.Name == new SubStationAlpha().Name)
if (newFormat != null && newFormat.Name == SubStationAlpha.NameOfFormat)
{
foreach (Paragraph p in subtitle.Paragraphs)
{

View File

@ -15,9 +15,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
get { return ".txt"; }
}
public const string NameOfFormat = "Scenarist";
public override string Name
{
get { return "Scenarist"; }
get { return NameOfFormat; }
}
public override bool IsTimeBased

View File

@ -31,9 +31,11 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
get { return ".srt"; }
}
public const string NameOfFormat = "SubRip";
public override string Name
{
get { return "SubRip"; }
get { return NameOfFormat; }
}
public override bool IsTimeBased

View File

@ -17,9 +17,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
get { return ".ssa"; }
}
public const string NameOfFormat = "Sub Station Alpha";
public override string Name
{
get { return "Sub Station Alpha"; }
get { return NameOfFormat; }
}
public override bool IsTimeBased
@ -434,7 +437,7 @@ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
public override void RemoveNativeFormatting(Subtitle subtitle, SubtitleFormat newFormat)
{
if (newFormat != null && newFormat.Name == new AdvancedSubStationAlpha().Name)
if (newFormat != null && newFormat.Name == AdvancedSubStationAlpha.NameOfFormat)
{
// do we need any conversion?
}