diff options
author | sr55 <[email protected]> | 2019-06-06 15:35:02 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-06-06 15:35:02 +0100 |
commit | 20aa33df6fa9e9ea488fb495424a088f584032a8 (patch) | |
tree | 78310f5b331a7f4cd3bbe4706f2693d136da82f4 /win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs | |
parent | 9532ed2edfa915fd023e481d87b546562a7c80a1 (diff) |
WinGui: Don't show encoder options when Fallback = None and a passthru encoder is selected on the Audio Defaults screen. Also add the ? as the MacGui has. #2135
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs new file mode 100644 index 000000000..c22a22319 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioControlVisibilityConverter.cs @@ -0,0 +1,53 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="AudioControlVisibilityConverter.cs" company="HandBrake Project (https://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters.Audio +{ + using System; + using System.Globalization; + using System.Windows; + using System.Windows.Data; + + using HandBrakeWPF.Services.Encode.Model.Models; + + public class AudioControlVisibilityConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values.Length == 3) + { + bool isVisibile = (bool)values[0]; + bool isPassthru = (bool)values[1]; + AudioEncoder fallbackEncoder = AudioEncoder.ffaac; + + if (values[2] != null && values[2].GetType() == typeof(AudioEncoder)) + { + fallbackEncoder = (AudioEncoder)values[2]; + } + + if (!isVisibile) + { + return Visibility.Collapsed; + } + + if (fallbackEncoder == AudioEncoder.None && isPassthru) + { + return Visibility.Collapsed; + } + } + + return Visibility.Visible; + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +}
\ No newline at end of file |