From 93235d2c7d15e031015ebbbfeefa14778fe9a56e Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 28 Dec 2012 11:21:14 +0000 Subject: WinGui: Initial work to implement x264 Preset/Tune/Profile/Level options in-gui. Still some stuff to tidy up but should be usable for now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5113 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrakeWPF/ViewModels/AdvancedViewModel.cs | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 8e3c13e37..29b4bed48 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -18,6 +18,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Parsing; using HandBrake.Interop.Model.Encoding; + using HandBrakeWPF.Commands.Interfaces; using HandBrakeWPF.Helpers; using HandBrakeWPF.Model; using HandBrakeWPF.ViewModels.Interfaces; @@ -27,6 +28,11 @@ namespace HandBrakeWPF.ViewModels /// public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel { + /// + /// The advanced encoder options command. + /// + private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand; + #region Constants and Fields /// @@ -166,8 +172,9 @@ namespace HandBrakeWPF.ViewModels /// /// Initializes a new instance of the class. /// - public AdvancedViewModel() + public AdvancedViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand) { + this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand; this.Task = new EncodeTask(); this.UpdateUIFromAdvancedOptions(); } @@ -243,6 +250,12 @@ namespace HandBrakeWPF.ViewModels this.Task.AdvancedEncoderOptions = value; this.UpdateUIFromAdvancedOptions(); this.NotifyOfPropertyChange(() => this.AdvancedOptionsString); + + // Reset the video tab if the user is using this tab. + if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions)) + { + this.advancedEncoderOptionsCommand.ExecuteClearVideo(); + } } } @@ -630,14 +643,6 @@ namespace HandBrakeWPF.ViewModels #region Public Methods - /// - /// The notify all changed. - /// - public void NotifyAllChanged() - { - this.NotifyOfPropertyChange(() => this.AdvancedOptionsString); - } - /// /// The update ui from advanced options. /// @@ -884,8 +889,6 @@ namespace HandBrakeWPF.ViewModels } } - break; - default: break; } } @@ -933,6 +936,14 @@ namespace HandBrakeWPF.ViewModels } } + /// + /// The clear. + /// + public void Clear() + { + this.AdvancedOptionsString = string.Empty; + } + #endregion #region ITabInterface @@ -1042,7 +1053,7 @@ namespace HandBrakeWPF.ViewModels int equalsIndex = existingSegment.IndexOf('='); if (equalsIndex >= 0) { - optionName = existingSegment.Substring(0, existingSegment.IndexOf("=")); + optionName = existingSegment.Substring(0, existingSegment.IndexOf("=", System.StringComparison.Ordinal)); } if (!this.uiOptions.Contains(optionName) && optionName != string.Empty) @@ -1154,6 +1165,12 @@ namespace HandBrakeWPF.ViewModels this.Task.AdvancedEncoderOptions = string.Join(":", newOptions); this.NotifyOfPropertyChange(() => this.AdvancedOptionsString); + + // Reset the video tab if the user is using this tab. + if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions)) + { + this.advancedEncoderOptionsCommand.ExecuteClearVideo(); + } } #endregion -- cgit v1.2.3