// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The Advanced View Model // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.ViewModels { using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Parsing; using HandBrake.Interop.Model.Encoding; using HandBrakeWPF.ViewModels.Interfaces; /// /// The Advanced View Model /// public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel { #region Constants and Fields /// /// Backing field for displaying x264 options /// private bool? displayX264Options; /// /// The show x 264 panel. /// private bool showX264Panel; #endregion #region Properties /// /// Gets or sets the x 264 view model. /// public IX264ViewModel X264ViewModel { get; set; } /// /// Gets or sets the encoder options view model. /// public IEncoderOptionsViewModel EncoderOptionsViewModel { get; set; } /// /// Gets or sets a value indicating whether show x 264 panel. /// public bool ShowX264Panel { get { return this.showX264Panel; } set { this.showX264Panel = value; this.NotifyOfPropertyChange(() => this.ShowX264Panel); } } /// /// Gets or sets a value indicating whether DisplayX264Options. /// public bool? ShowSimplePanel { get { return this.displayX264Options; } set { this.displayX264Options = value; this.NotifyOfPropertyChange(() => this.ShowSimplePanel); } } #endregion #region Implemented Interfaces /// /// The set encoder. /// /// /// The encoder. /// public void SetEncoder(VideoEncoder encoder) { this.EncoderOptionsViewModel.SetEncoder(encoder); this.X264ViewModel.SetEncoder(encoder); if (encoder == VideoEncoder.X264) { this.ShowX264Panel = true; this.ShowSimplePanel = false; } else { this.ShowX264Panel = false; this.ShowSimplePanel = true; } } /// /// The clear. /// public void Clear() { this.EncoderOptionsViewModel.Clear(); this.X264ViewModel.Clear(); } /// /// Setup this tab for the specified preset. /// /// /// The preset. /// /// /// The task. /// public void SetPreset(Preset preset, EncodeTask task) { this.EncoderOptionsViewModel.SetPreset(preset, task); this.X264ViewModel.SetPreset(preset, task); } /// /// Update all the UI controls based on the encode task passed in. /// /// /// The task. /// public void UpdateTask(EncodeTask task) { this.EncoderOptionsViewModel.UpdateTask(task); this.X264ViewModel.UpdateTask(task); this.SetEncoder(task.VideoEncoder); } /// /// Setup this window for a new source /// /// /// The title. /// /// /// The preset. /// /// /// The task. /// public void SetSource(Title title, Preset preset, EncodeTask task) { this.EncoderOptionsViewModel.SetSource(title, preset, task); this.X264ViewModel.SetSource(title, preset, task); } #endregion } }