From 8b09ede89942b630a0fbdee77d914059d590c379 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 3 Aug 2019 20:58:06 +0100 Subject: WinGui: Improvements to dropdown visibility behaviour on the Audio Defaults. #2135 --- .../Audio/AudioControlVisibilityConverter.cs | 22 +++++++++++- win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml | 42 +++++++++++++++++++--- 2 files changed, 59 insertions(+), 5 deletions(-) (limited to 'win/CS/HandBrakeWPF') diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs index 808fc9a2c..31e40dd6b 100644 --- a/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs @@ -20,14 +20,34 @@ namespace HandBrakeWPF.Converters.Audio { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - if (values.Length == 1) + if (values.Length == 3) { bool isVisibile = (bool)values[0]; + bool isPassthru = (bool)values[1]; + AudioEncoder fallbackEncoder = (AudioEncoder)values[2]; if (!isVisibile) { return Visibility.Collapsed; } + + // When the Fallback Encoder is "None" and we have a passthru encoder selected on the track, we don't have any encoder options to override so don't show them. + if (isPassthru && fallbackEncoder == AudioEncoder.None) + { + return Visibility.Collapsed; + } + } + + if (values.Length == 2) + { + bool isPassthru = (bool)values[0]; + AudioEncoder fallbackEncoder = (AudioEncoder)values[1]; + + // When the Fallback Encoder is "None" and we have a passthru encoder selected on the track, we don't have any encoder options to override so don't show them. + if (isPassthru && fallbackEncoder == AudioEncoder.None) + { + return Visibility.Collapsed; + } } return Visibility.Visible; diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml index 17343f85b..146049549 100644 --- a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml @@ -277,6 +277,8 @@ + + @@ -286,6 +288,8 @@ + + @@ -295,26 +299,56 @@ + + + DisplayMemberPath="DisplayName" > + + + + + + + + SelectedItem="{Binding SampleRateDisplayValue}" > + + + + + + + + ShowIncrementButtons="True" AllowEmpty="False"> + + + + + + + + ShowIncrementButtons="True" AllowEmpty="False" > + + + + + + + -- cgit v1.2.3