summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2014-07-05 14:37:53 +0000
committersr55 <[email protected]>2014-07-05 14:37:53 +0000
commit2412d4a92123b2f20b43987a65a4fbd645be1443 (patch)
treeefaa258ae72aa99e1473f740be87d0327fb0bccd /win/CS/HandBrakeWPF
parentd4a760ecd14a39772c0f9a5b7b35d0bc15d9a77f (diff)
WinGui: Adding support for Nlmeans to the front-end. Plist keys still tbd.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6227 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs86
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs97
-rw-r--r--win/CS/HandBrakeWPF/Views/FiltersView.xaml47
4 files changed, 219 insertions, 13 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs
new file mode 100644
index 000000000..bb0ec1b7e
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs
@@ -0,0 +1,86 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DenoisePresetConverter.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>
+// Defines the DenoisePresetConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Filters
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Windows.Data;
+
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The denoise preset converter.
+ /// </summary>
+ public class DenoisePresetConverter : IMultiValueConverter
+ {
+ /// <summary>
+ /// The convert.
+ /// </summary>
+ /// <param name="values">
+ /// The values.
+ /// </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[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (values.Any() && values.Count() == 2)
+ {
+ Denoise denoiseChoice = (Denoise)values[1];
+
+ if (denoiseChoice == Denoise.hqdn3d)
+ {
+ return new List<DenoisePreset> { DenoisePreset.Weak, DenoisePreset.Medium, DenoisePreset.Strong, DenoisePreset.Custom };
+ }
+
+ if (denoiseChoice == Denoise.NlMeans)
+ {
+ return new List<DenoisePreset> { DenoisePreset.Ultralight, DenoisePreset.Light, DenoisePreset.Medium, DenoisePreset.Strong };
+ }
+ }
+
+ return Enumerable.Empty<DenoisePreset>();
+ }
+
+ /// <summary>
+ /// The convert back. Not used
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetTypes">
+ /// The target types.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The Nothing. Not used
+ /// </returns>
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 64752b39d..dcd4a42bb 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -62,6 +62,7 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+ <UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\Release\</OutputPath>
@@ -149,6 +150,7 @@
<Compile Include="Constants.cs" />
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
+ <Compile Include="Converters\Filters\DenoisePresetConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
<Compile Include="Helpers\FileHelper.cs" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index e5d825ba4..70921b23f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -10,12 +10,12 @@
namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
+ using System.Globalization;
using Caliburn.Micro;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
@@ -145,7 +145,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return this.DeblockValue == 4 ? "Off" : this.DeblockValue.ToString();
+ return this.DeblockValue == 4 ? "Off" : this.DeblockValue.ToString(CultureInfo.InvariantCulture);
}
}
@@ -295,8 +295,13 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.SelectedDenoise);
// Show / Hide the Custom Control
- this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.Custom;
+ this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.hqdn3d && this.CurrentTask.DenoisePreset == DenoisePreset.Custom;
this.NotifyOfPropertyChange(() => this.ShowDenoiseCustom);
+
+ this.SelectedDenoisePreset = this.CurrentTask.Denoise == Denoise.hqdn3d ? DenoisePreset.Weak : DenoisePreset.Ultralight; // Default so we don't have an invalid preset.
+
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseOptions);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseTune);
}
}
@@ -378,6 +383,90 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public string DeinterlaceControlText { get; set; }
+ /// <summary>
+ /// Gets or sets the selected denoise tune.
+ /// </summary>
+ public DenoiseTune SelectedDenoiseTune
+ {
+ get
+ {
+ return this.CurrentTask.DenoiseTune;
+ }
+
+ set
+ {
+ this.CurrentTask.DenoiseTune = value;
+ this.NotifyOfPropertyChange(() => this.SelectedDenoiseTune);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected denoise preset.
+ /// </summary>
+ public DenoisePreset SelectedDenoisePreset
+ {
+ get
+ {
+ return this.CurrentTask.DenoisePreset;
+ }
+
+ set
+ {
+ this.CurrentTask.DenoisePreset = value;
+ this.NotifyOfPropertyChange(() => this.SelectedDenoisePreset);
+
+ // Show / Hide the Custom Control
+ this.ShowDenoiseCustom = this.CurrentTask.Denoise == Denoise.hqdn3d && this.CurrentTask.DenoisePreset == DenoisePreset.Custom;
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseCustom);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseOptions);
+ this.NotifyOfPropertyChange(() => this.ShowDenoiseTune);
+ }
+ }
+
+ /// <summary>
+ /// Gets the denoise presets.
+ /// </summary>
+ public IEnumerable<DenoisePreset> DenoisePresets
+ {
+ get
+ {
+ return EnumHelper<DenoisePreset>.GetEnumList();
+ }
+ }
+
+ /// <summary>
+ /// Gets the denoise tunes.
+ /// </summary>
+ public IEnumerable<DenoiseTune> DenoiseTunes
+ {
+ get
+ {
+ return EnumHelper<DenoiseTune>.GetEnumList();
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether show denoise options.
+ /// </summary>
+ public bool ShowDenoiseOptions
+ {
+ get
+ {
+ return this.SelectedDenoise != Denoise.Off;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether show denoise tune.
+ /// </summary>
+ public bool ShowDenoiseTune
+ {
+ get
+ {
+ return this.SelectedDenoise == Denoise.NlMeans;
+ }
+ }
+
#endregion
#region Implemented Interfaces
@@ -406,6 +495,8 @@ namespace HandBrakeWPF.ViewModels
this.SelectedDetelecine = preset.Task.Detelecine;
this.Grayscale = preset.Task.Grayscale;
this.DeblockValue = preset.Task.Deblock == 0 ? 4 : preset.Task.Deblock;
+ this.SelectedDenoisePreset = preset.Task.DenoisePreset;
+ this.SelectedDenoiseTune = preset.Task.DenoiseTune;
// Custom Values
this.CustomDecomb = preset.Task.CustomDecomb;
diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
index ed5993def..70488d5da 100644
--- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml
+++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
@@ -3,11 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" mc:Ignorable="d" >
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
+ xmlns:filters="clr-namespace:HandBrakeWPF.Converters.Filters"
+ mc:Ignorable="d" >
<UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:EnumComboConverter x:Key="boolComboConverter" />
<Converters:InverseBooleanConverter x:Key="inverseBooleanConverter" />
+ <filters:DenoisePresetConverter x:Key="DenoisePresetConverter" />
</UserControl.Resources>
<Grid>
@@ -45,7 +48,7 @@
<ComboBox Width="120" Grid.Row="0" ItemsSource="{Binding DetelecineOptions, Converter={StaticResource boolComboConverter}}"
SelectedItem="{Binding SelectedDetelecine, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10"
HorizontalAlignment="Left"/>
- <TextBox Width="120" Grid.Row="0" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDetelecine}"
+ <TextBox Width="120" Grid.Row="0" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDetelecine}" HorizontalAlignment="Left"
Visibility="{Binding ShowDetelecineCustom, Converter={StaticResource boolToVisConverter}}"/>
<TextBlock Text="{Binding DeinterlaceControlText}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" VerticalAlignment="Top"/>
@@ -53,7 +56,7 @@
<StackPanel Orientation="Horizontal">
<RadioButton GroupName="Interlace" Content="Deinterlace" IsChecked="{Binding IsDeinterlaceMode}" />
<RadioButton GroupName="Interlace" Content="Decomb" Margin="10,0,0,0" IsChecked="{Binding IsDeinterlaceMode, Converter={StaticResource inverseBooleanConverter}}" />
- </StackPanel>
+ </StackPanel>
<ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left"
SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}" Margin="0,0,0,10"
@@ -64,18 +67,42 @@
Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" />
</StackPanel>
- <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDecomb}" VerticalAlignment="Top"
+ <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDecomb}" VerticalAlignment="Top" HorizontalAlignment="Left"
Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" />
- <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDeinterlace}" VerticalAlignment="Top"
+ <TextBox Width="120" Grid.Row="1" Grid.Column="2" Text="{Binding CustomDeinterlace}" VerticalAlignment="Top" HorizontalAlignment="Left"
Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" />
<TextBlock Text="Denoise:" Grid.Row="3" Grid.Column="0" Margin="0,0,0,10"/>
<ComboBox Width="120" Grid.Row="3" ItemsSource="{Binding DenoiseOptions, Converter={StaticResource boolComboConverter}}"
- SelectedItem="{Binding SelectedDenoise, Converter={StaticResource boolComboConverter}}" Grid.Column="1" Margin="0,0,0,10"
- HorizontalAlignment="Left"/>
- <TextBox Width="120" Grid.Row="3" Grid.Column="2" Margin="0,0,0,10" Text="{Binding CustomDenoise}"
- Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}" />
+ SelectedItem="{Binding SelectedDenoise, Converter={StaticResource boolComboConverter}}" Grid.Column="1"
+ HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,10" />
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Row="3" Grid.Column="2" Margin="0,0,0,10"
+ Visibility="{Binding ShowDenoiseOptions, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Preset: " Margin="5,0,5,0" />
+ <ComboBox SelectedItem="{Binding SelectedDenoisePreset}"
+ MinWidth="100" HorizontalAlignment="Center" VerticalAlignment="Center">
+ <ComboBox.ItemsSource>
+ <MultiBinding Converter="{StaticResource DenoisePresetConverter}">
+ <Binding Path="DenoisePresets" />
+ <Binding Path="SelectedDenoise" />
+ </MultiBinding>
+ </ComboBox.ItemsSource>
+ </ComboBox>
+
+ <StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseTune, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Tune: " Margin="5,0,5,0" />
+ <ComboBox ItemsSource="{Binding DenoiseTunes}" SelectedItem="{Binding SelectedDenoiseTune}" MinWidth="100"
+ Visibility="{Binding ShowDenoiseTunes, Converter={StaticResource boolToVisConverter}}" VerticalAlignment="Center" />
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}">
+ <TextBlock Text="Custom: " Margin="5,0,5,0" />
+ <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise}" VerticalAlignment="Center" />
+ </StackPanel>
+
+ </StackPanel>
<TextBlock Text="Deblock:" Grid.Row="4" Grid.Column="0" Margin="0,0,0,10"/>
<Slider Width="120" Value="{Binding DeblockValue}" TickPlacement="BottomRight" Minimum="4" Maximum="15" Grid.Row="4" Grid.Column="1" Margin="0,0,0,10"
@@ -86,6 +113,6 @@
</Grid>
</StackPanel>
-
+
</Grid>
</UserControl>