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 | |
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')
5 files changed, 113 insertions, 10 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;
}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 5cbc6d1b2..87a26cade 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -140,6 +140,7 @@ <Compile Include="Controls\AlertPanel.xaml.cs">
<DependentUpon>AlertPanel.xaml</DependentUpon>
</Compile>
+ <Compile Include="Converters\Audio\AudioRateTypeConverter.cs" />
<Compile Include="Converters\Audio\AudioTrackDefaultBehaviourConverter.cs" />
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
<Compile Include="Converters\Filters\DenoisePresetConverter.cs" />
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index 87f6188b5..ec0098358 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -38,7 +38,7 @@ namespace HandBrakeWPF.Services.Presets {
#region Private Variables
- private static readonly int CurrentPresetVersion = 3;
+ private static readonly int CurrentPresetVersion = 4;
/// <summary>
/// User Preset Default Catgory Name
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index ef8a29cf9..1a7048b60 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -24,6 +24,7 @@ <Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
<Audio:AudioBehaviourConverter x:Key="audioBehaviourConverter" />
<Audio:AudioTrackDefaultBehaviourConverter x:Key="audioTrackDefaultBehaviourConverter" />
+ <Audio:AudioRateTypeConverter x:Key="audioRateTypeConverter" />
</UserControl.Resources>
<Grid>
@@ -145,7 +146,7 @@ <Image Grid.Column="0" Grid.Row="0"
Width="16"
Height="16"
- Margin="10,0,10,0"
+ Margin="8,0,8,0"
Source="Images/Movies.png" />
<!-- Settings -->
@@ -188,12 +189,18 @@ </ComboBox.ItemsSource>
</ComboBox>
- <TextBlock Grid.Column="4" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Bitrate}"
- Visibility="{Binding CannotSetBitrate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
+ <ComboBox Grid.Column="4" Height="22" Width="65" HorizontalAlignment="Stretch"
+ ItemsSource="{Binding AudioEncoderRateTypes, Converter={StaticResource audioRateTypeConverter}}"
+ SelectedItem="{Binding EncoderRateType, Converter={StaticResource audioRateTypeConverter}}"
+ Visibility="{Binding IsRateTypeVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+
+ <ComboBox Grid.Column="5" Width="55" Height="22" Margin="5,0,5,0" ItemsSource="{Binding EncoderQualityValues}"
+ SelectedItem="{Binding Quality}"
+ Visibility="{Binding IsQualityVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+
<ComboBox Grid.Column="5" Width="55" Height="22" Margin="5,0,5,0" ItemsSource="{Binding Bitrates}"
SelectedItem="{Binding Bitrate}"
- Visibility="{Binding CannotSetBitrate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
-
+ Visibility="{Binding IsBitrateVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
<!-- Row 2 -->
<TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}"
@@ -204,18 +211,18 @@ Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
-
- <ToggleButton Name="advancedOptionsToggle" VerticalAlignment="Center" Grid.Column="8" Grid.Row="0" Grid.ColumnSpan="2"
+ <ToggleButton Name="advancedOptionsToggle" VerticalAlignment="Center" Grid.Column="8" Grid.Row="0" Grid.ColumnSpan="2" Margin="5,0,0,0"
Padding="3,0" Height="22" HorizontalAlignment="Left" >
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Content" Value="Show"/>
+ <Setter Property="FontWeight" Value="Bold" />
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
- <Setter Property="Content" Value="Hide"/>
+ <Setter Property="Content" Value="˄"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
- <Setter Property="Content" Value="Show"/>
+ <Setter Property="Content" Value="˅" />
</Trigger>
</Style.Triggers>
</Style>
|