// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // A class to track the behaviours of audio track selection // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Model.Subtitle { using System.ComponentModel; using Caliburn.Micro; /// /// A class to track the behaviours of audio track selection /// public class SubtitleBehaviours : PropertyChangedBase { /// /// The selected behaviour. /// private SubtitleBehaviourModes selectedBehaviour; /// /// The selected langauges. /// private BindingList selectedLangauges; /// /// The add foreign audio scan track. /// private bool addForeignAudioScanTrack; /// /// The add closed captions. /// private bool addClosedCaptions; /// /// Initializes a new instance of the class. /// public SubtitleBehaviours() { this.SelectedBehaviour = SubtitleBehaviourModes.None; this.SelectedLangauges = new BindingList(); } /// /// Initializes a new instance of the class. /// /// /// The behaviours. /// public SubtitleBehaviours(SubtitleBehaviours behaviours) { this.SelectedBehaviour = behaviours.selectedBehaviour; this.SelectedLangauges = new BindingList(behaviours.SelectedLangauges); } /// /// Gets or sets the selected behaviour. /// public SubtitleBehaviourModes SelectedBehaviour { get { return this.selectedBehaviour; } set { if (value == this.selectedBehaviour) { return; } this.selectedBehaviour = value; this.NotifyOfPropertyChange(() => this.SelectedBehaviour); } } /// /// Gets or sets the selected langages. /// public BindingList SelectedLangauges { get { return this.selectedLangauges; } set { if (Equals(value, this.selectedLangauges)) { return; } this.selectedLangauges = value; this.NotifyOfPropertyChange(() => this.SelectedLangauges); } } /// /// Gets or sets a value indicating whether add foreign audio scan track. /// public bool AddForeignAudioScanTrack { get { return this.addForeignAudioScanTrack; } set { if (value.Equals(this.addForeignAudioScanTrack)) { return; } this.addForeignAudioScanTrack = value; this.NotifyOfPropertyChange(() => this.AddForeignAudioScanTrack); } } /// /// Gets or sets a value indicating whether add closed captions. /// public bool AddClosedCaptions { get { return this.addClosedCaptions; } set { if (value.Equals(this.addClosedCaptions)) { return; } this.addClosedCaptions = value; this.NotifyOfPropertyChange(() => this.AddClosedCaptions); } } /// /// Clone this object /// /// /// The . /// public SubtitleBehaviours Clone() { SubtitleBehaviours cloned = new SubtitleBehaviours { SelectedBehaviour = this.selectedBehaviour, SelectedLangauges = new BindingList(), AddClosedCaptions = this.addClosedCaptions, AddForeignAudioScanTrack = this.addForeignAudioScanTrack, }; foreach (var item in this.SelectedLangauges) { cloned.SelectedLangauges.Add(item); } return cloned; } } }