From 530f47597ef140e80f450da085ff058fa74408e3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Tue, 27 Aug 2013 17:53:01 +0000 Subject: [PATCH] WinGui: Show a radio button on the filters tab to select between Deinterlace and Decomb mode similar to the Mac/Linux UI's git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5754 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Converters/InverseBooleanConverter.cs | 10 ++-- .../ViewModels/FiltersViewModel.cs | 40 ++++++++++++++ win/CS/HandBrakeWPF/Views/FiltersView.xaml | 52 +++++++++++++------ 3 files changed, 82 insertions(+), 20 deletions(-) diff --git a/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs b/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs index 8cd29431f..b935953eb 100644 --- a/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs @@ -16,7 +16,7 @@ namespace HandBrakeWPF.Converters /// /// The inverse boolean converter. /// - [ValueConversion(typeof(bool), typeof(bool))] + [ValueConversion(typeof(bool?), typeof(bool))] public class InverseBooleanConverter : IValueConverter { /// @@ -39,12 +39,14 @@ namespace HandBrakeWPF.Converters /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (targetType != typeof(bool)) + if (targetType != typeof(bool?) && targetType != typeof(bool)) { throw new InvalidOperationException("The target must be a boolean"); } - return !(bool)value; + bool result; + bool.TryParse(value.ToString(), out result); + return !result; } /// @@ -67,7 +69,7 @@ namespace HandBrakeWPF.Converters /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - throw new NotSupportedException(); + return null; } } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index fe9c4fabf..e8abd4b57 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -26,6 +26,8 @@ namespace HandBrakeWPF.ViewModels /// public class FiltersViewModel : ViewModelBase, IFiltersViewModel { + private bool isDeinterlaceMode; + #region Constructors and Destructors /// @@ -41,6 +43,7 @@ namespace HandBrakeWPF.ViewModels { this.CurrentTask = new EncodeTask(); this.DeblockValue = 4; // OFF + this.IsDeinterlaceMode = true; } #endregion @@ -324,6 +327,43 @@ namespace HandBrakeWPF.ViewModels /// public bool ShowDetelecineCustom { get; set; } + /// + /// Gets or sets a value indicating whether is deinterlace mode. + /// + public bool IsDeinterlaceMode + { + get + { + return this.isDeinterlaceMode; + } + set + { + if (!object.Equals(this.isDeinterlaceMode, value)) + { + this.isDeinterlaceMode = value; + this.NotifyOfPropertyChange(() => this.IsDeinterlaceMode); + + this.DeinterlaceControlText = value ? "Deinterlace:" : "Decomb:"; + + if (value) + { + this.SelectedDecomb = Decomb.Off; + } + else + { + this.SelectedDeInterlace = Deinterlace.Off; + } + + this.NotifyOfPropertyChange(() => this.DeinterlaceControlText); + } + } + } + + /// + /// Gets or sets the deinterlace control text. + /// + public string DeinterlaceControlText { get; set; } + #endregion #region Implemented Interfaces diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml index 9c46aeabd..ed5993def 100644 --- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml +++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml @@ -7,17 +7,24 @@ + - + + + + + + + - + @@ -29,43 +36,56 @@ - - + + + SelectedItem="{Binding SelectedDetelecine, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10" + HorizontalAlignment="Left"/> - - - + + + + + + + + + + + + - - - + SelectedItem="{Binding SelectedDenoise, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10" + HorizontalAlignment="Left"/> - + - + -- 2.40.0