// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Subtitle Information // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Model.Encoding { using System; using System.Windows.Forms; using HandBrake.ApplicationServices.Parsing; /// /// Subtitle Information /// public class SubtitleTrack : ModelBase { #region Constants and Fields /// /// The source track. /// private Subtitle sourceTrack; #endregion /// /// Initializes a new instance of the class. /// public SubtitleTrack() { } /// /// Initializes a new instance of the class. /// Copy Constructor /// /// /// The subtitle. /// public SubtitleTrack(SubtitleTrack subtitle) { this.Burned = subtitle.Burned; this.Default = subtitle.Default; this.Forced = subtitle.Forced; this.sourceTrack = subtitle.SourceTrack; this.SrtCharCode = subtitle.SrtCharCode; this.SrtFileName = subtitle.SrtFileName; this.SrtLang = subtitle.SrtLang; this.SrtOffset = subtitle.SrtOffset; this.SrtPath = subtitle.SrtPath; this.SubtitleType = subtitle.SubtitleType; this.SourceTrack = subtitle.SourceTrack; } #region Public Properties /// /// Gets or sets a value indicating whether Burned. /// public bool Burned { get; set; } /// /// Gets or sets a value indicating whether Default. /// public bool Default { get; set; } /// /// Gets or sets a value indicating whether Forced. /// public bool Forced { get; set; } /// /// Gets a value indicating whether this is an SRT subtitle. /// public bool IsSrtSubtitle { get { return this.SrtFileName != "-" && this.SrtFileName != null; } } /// /// Gets or sets Track. /// [Obsolete("Use SourceTrack Instead")] public string Track { get; set; } /// /// Gets or sets SourceTrack. /// public Subtitle SourceTrack { get { return this.sourceTrack; } set { this.sourceTrack = value; this.OnPropertyChanged("SourceTrack"); if (this.sourceTrack != null) { this.Track = this.sourceTrack.ToString(); } } } /// /// Gets or sets the SRT Character Code /// public string SrtCharCode { get; set; } /// /// Gets or sets the SRT Filename /// public string SrtFileName { get; set; } /// /// Gets or sets the SRT Language /// public string SrtLang { get; set; } /// /// Gets or sets the SRT Offset /// public int SrtOffset { get; set; } /// /// Gets or sets the Path to the SRT file /// public string SrtPath { get; set; } /// /// Gets or sets the type of the subtitle /// public SubtitleType SubtitleType { get; set; } /// /// Gets A ListViewItem Containing information about this subitlte /// [Obsolete("Used only for the old forms gui. Will be removed.")] public ListViewItem ListView { get { var listTrack = new ListViewItem(this.Track); listTrack.SubItems.Add(this.Forced ? "Yes" : "No"); listTrack.SubItems.Add(this.Burned ? "Yes" : "No"); listTrack.SubItems.Add(this.Default ? "Yes" : "No"); listTrack.SubItems.Add(this.SrtLang); listTrack.SubItems.Add(this.SrtCharCode); listTrack.SubItems.Add(this.SrtOffset.ToString()); return listTrack; } } #endregion } }