diff options
author | sr55 <[email protected]> | 2015-06-20 19:45:31 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-06-20 19:45:31 +0000 |
commit | ae9dbce961c2d87e5f52288c35fbf882de8430c7 (patch) | |
tree | c8da7e616457a9fa67505de26ad3dfffcdb8dc8f /win/CS/HandBrakeWPF/Converters | |
parent | 9192276e8bfde8ac2ce798edf677be141ad5e9b5 (diff) |
WinGui: Initial implementation of quality based encoding option. Please note, the preset version has been bumped so user presets will need to be re-created.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7306 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters')
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Audio/AudioRateTypeConverter.cs | 94 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs | 1 |
2 files changed, 95 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioRateTypeConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioRateTypeConverter.cs new file mode 100644 index 000000000..1aaba88a2 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioRateTypeConverter.cs @@ -0,0 +1,94 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioRateTypeConverter.cs" company="HandBrake Project (http://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>
+// The audio rate type converter.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Audio
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Utilities;
+
+ /// <summary>
+ /// The audio rate type converter.
+ /// </summary>
+ public class AudioRateTypeConverter : IValueConverter
+ {
+ /// <summary>
+ /// The convert.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var types = value as IEnumerable<AudioEncoderRateType>;
+ if (types != null)
+ {
+ List<string> rateTypes = new List<string>();
+ foreach (var item in types)
+ {
+ rateTypes.Add(EnumHelper<AudioEncoderRateType>.GetDisplay(item));
+ }
+
+ return rateTypes;
+ }
+
+
+ if (targetType == typeof(AudioEncoderRateType) || value.GetType() == typeof(AudioEncoderRateType))
+ {
+ return EnumHelper<AudioEncoderRateType>.GetDisplay((AudioEncoderRateType)value);
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// The convert back.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ return EnumHelper<AudioEncoderRateType>.GetValue(value.ToString());
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index 10fb8fd3c..4c5599d62 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -134,6 +134,7 @@ namespace HandBrakeWPF.Converters return EnumHelper<OutputFormat>.GetDisplay((OutputFormat)value);
}
+
return null;
}
|