diff options
author | sr55 <[email protected]> | 2012-05-12 22:00:52 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-05-12 22:00:52 +0000 |
commit | d70eae0c6909bca688d1ed5091673b525cc2dc06 (patch) | |
tree | cfab419dac689afd2d041796ac9ca5a4c1e1a394 /win/CS/HandBrakeWPF | |
parent | b3723d62f9a7cba1162dd56598e6be7a53083786 (diff) |
WinGui: Make the new WPF UI default. (the old UI exe is still included in the build. Handbrake_old.exe)
Also includes bug fixes to the audio and subtitles panels.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4667 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs | 96 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Installer/Installer.nsi | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Installer/Installer64.nsi | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 6 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/AudioView.xaml | 26 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 9 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 13 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/releasenotes.html | 29 |
12 files changed, 173 insertions, 24 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs new file mode 100644 index 000000000..cc1915e4b --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs @@ -0,0 +1,96 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioBitrateConverter.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>
+// A Converter to provide the available audio bitrate options.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Audio
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+ using System.Collections.Generic;
+ using System.Linq;
+ using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// A Converter to provide the available audio bitrate options.
+ /// </summary>
+ public class AudioBitrateConverter : IValueConverter
+ {
+ /// <summary>
+ /// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.
+ /// </summary>
+ /// <returns>
+ /// A converted value.If the method returns null, the valid null value is used.A return value of <see cref="T:System.Windows.DependencyProperty"/>.<see cref="F:System.Windows.DependencyProperty.UnsetValue"/> indicates that the converter did not produce a value, and that the binding will use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"/> if it is available, or else will use the default value.A return value of <see cref="T:System.Windows.Data.Binding"/>.<see cref="F:System.Windows.Data.Binding.DoNothing"/> indicates that the binding does not transfer the value or use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"/> or the default value.
+ /// </returns>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The type of the binding target property.
+ /// </param>
+ /// <param name="parameter">
+ /// The converter parameter to use.
+ /// </param>
+ /// <param name="culture">
+ /// The culture to use in the converter.
+ /// </param>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ // Base set of bitrates available.
+ List<int> bitrates = new List<int> { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 640, 768 };
+
+ int max = 160;
+ AudioTrack track = value as AudioTrack;
+ if (track != null)
+ {
+ switch (track.Encoder)
+ {
+ case AudioEncoder.Faac:
+ case AudioEncoder.ffaac:
+ max = track.MixDown == Mixdown.SixChannelDiscrete ? 768 : 320;
+ break;
+ case AudioEncoder.Lame:
+ max = 320;
+ break;
+ case AudioEncoder.Vorbis:
+ max = 384;
+ break;
+ case AudioEncoder.Ac3:
+ max = 640;
+ break;
+ case AudioEncoder.Ac3Passthrough:
+ case AudioEncoder.DtsPassthrough:
+ case AudioEncoder.DtsHDPassthrough:
+ case AudioEncoder.AacPassthru:
+ case AudioEncoder.Mp3Passthru:
+ case AudioEncoder.Passthrough:
+ case AudioEncoder.ffflac:
+ max = 768; // Since we don't care, just set it to the max.
+ break;
+ default:
+ max = 768;
+ break;
+ }
+
+ // Bring the bitrate down in-line with the max.
+ if (track.Bitrate > max)
+ {
+ track.Bitrate = max;
+ }
+ }
+
+ return bitrates.Where(bitrate => bitrate <= max);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 77665c7f8..3ed921e6c 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -9,7 +9,7 @@ <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HandBrakeWPF</RootNamespace>
- <AssemblyName>HandBrake</AssemblyName>
+ <AssemblyName>Handbrake</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -110,6 +110,7 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
+ <Compile Include="Converters\Audio\AudioBitrateConverter.cs" />
<Compile Include="Converters\BooleanToHiddenVisibilityConverter.cs" />
<Compile Include="ViewModels\Interfaces\ITitleSpecificViewModel.cs" />
<Compile Include="ViewModels\TitleSpecificViewModel.cs" />
@@ -325,6 +326,10 @@ <Content Include="defaultsettings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="releasenotes.html">
+ <SubType>Designer</SubType>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Resource Include="Views\Images\Refresh.ico" />
<Resource Include="Views\Images\WarningSmall.png" />
<Resource Include="Views\Images\Complete.png" />
diff --git a/win/CS/HandBrakeWPF/Installer/Installer.nsi b/win/CS/HandBrakeWPF/Installer/Installer.nsi index c19c0e2ab..0bf909b58 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer.nsi @@ -132,6 +132,7 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
+ File ".html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/Installer64.nsi b/win/CS/HandBrakeWPF/Installer/Installer64.nsi index 9e6ff4872..ca7f4db83 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer64.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer64.nsi @@ -133,6 +133,7 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
+ File ".html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl index 07b9d6240..19429202d 100644 --- a/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl +++ b/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl @@ -132,6 +132,7 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
+ File "*.html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl index 15c35d248..b6e874051 100644 --- a/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl +++ b/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl @@ -132,6 +132,7 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
+ File ".html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 55b53ffa1..7b3fede44 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1154,9 +1154,11 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Show Release Notes
/// </summary>
- public void ReleaseNotes()
+ public void ShowReleaseNotes()
{
- Process.Start("https://forum.handbrake.fr/viewtopic.php?f=11&t=23843");
+ string path =
+ Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
+ Process.Start(path + "\\releasenotes.html");
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index a67bc293e..b4d8d65ab 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -7,6 +7,8 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
+using System.IO;
+
namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
@@ -156,11 +158,12 @@ namespace HandBrakeWPF.ViewModels {
SubtitleTrack track = new SubtitleTrack
{
- SrtFileName = srtFile,
+ SrtFileName = Path.GetFileNameWithoutExtension(srtFile),
SrtOffset = 0,
SrtCharCode = "UTF-8",
SrtLang = "English",
- SubtitleType = SubtitleType.SRT
+ SubtitleType = SubtitleType.SRT,
+ SrtPath = srtFile
};
this.Task.SubtitleTracks.Add(track);
}
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index c8d3ba88e..ea112a750 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -7,12 +7,14 @@ xmlns:cal="http://www.caliburnproject.org"
xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
xmlns:Conveters="clr-namespace:HandBrakeWPF.Converters"
- xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" mc:Ignorable="d">
-
+ xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
+ xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio" mc:Ignorable="d">
+
<UserControl.Resources>
<Conveters:EnumComboConverter x:Key="enumComboConverter" />
<Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />
+ <Audio:AudioBitrateConverter x:Key="audioBitrateConverter" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -86,31 +88,31 @@ <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
-
+
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
-
+
<!-- Row 1-->
<TextBlock Text="Source" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Height="22"
ItemsSource="{Binding DataContext.SourceTracks, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding ScannedTrack}"/>
-
+
<TextBlock Text="Codec" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
<ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
ItemsSource="{Binding DataContext.AudioEncoders, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding Encoder, Converter={StaticResource enumComboConverter}}"/>
-
+
<TextBlock Text="Bitrate" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Width="70" Grid.Column="5" Margin="5,0,5,0" Height="22"
- ItemsSource="{Binding DataContext.AudioBitrates, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
- SelectedItem="{Binding Bitrate}" IsEnabled="{Binding}"
+ SelectedItem="{Binding Bitrate}"
+ ItemsSource="{Binding TrackReference, Converter={StaticResource audioBitrateConverter}}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
-
+
<TextBlock Text="Samplerate" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<ComboBox Width="70" Grid.Column="7" Margin="5,0,5,0" Height="22"
@@ -125,19 +127,19 @@ ItemsSource="{Binding DataContext.AudioMixdowns, Converter={StaticResource enumComboConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
SelectedItem="{Binding MixDown, Converter={StaticResource enumComboConverter}}"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
-
+
<TextBlock Text="DRC" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<NumericUpDown:NumericUpDown Name="drcNumericCtl" Width="45" Value="{Binding DRC, Mode=TwoWay}" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Margin="5,0,5,0"
Minimum="0" Maximum="4" DecimalPlace="1" LargeChange="0.1" SmallChange="0.1"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}" />
-
+
<TextBlock Text="Gain" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
<NumericUpDown:NumericUpDown Name="gainNumericCtl" Width="45" Value="{Binding Gain, Mode=TwoWay}" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0"
Minimum="-20" Maximum="20" DecimalPlace="0" SmallChange="1" LargeChange="1"
Visibility="{Binding IsPassthru, Converter={StaticResource boolToHiddenVisConverter}, ConverterParameter=true}"/>
-
+
</Grid>
<!-- Delete -->
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 2161ac590..6d8e57b98 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -332,11 +332,10 @@ <StatusBar Padding="0" Margin="0" Grid.Row="6" Height="32" Grid.ColumnSpan="2" VerticalAlignment="Bottom" >
<Label Content="{Binding Path=StatusLabel}" FontSize="11" Padding="0,0,0,5" VerticalAlignment="Center" />
- <TextBlock VerticalAlignment="Top" HorizontalAlignment="Right" Padding="0,0,0,5" FontSize="11" FontWeight="Bold">
- <Hyperlink NavigateUri="http://forum.handbrake.fr/viewtopic.php?f=11&t=23843" RequestNavigate="Hyperlink_RequestNavigate">
- BETA WPF UI Release Notes
- </Hyperlink>
- </TextBlock>
+ <Button Content="BETA WPF UI RELEASE NOTES" Micro:Message.Attach="[Event Click] = [Action ShowReleaseNotes]"
+ FontWeight="Bold" Foreground="Blue" Padding="0,0,0,5" FontSize="11"
+ />
+
</StatusBar>
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 0611bba0b..99097a0b0 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -5,7 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation"
- xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" mc:Ignorable="d">
+ xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
+ xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" mc:Ignorable="d">
+ <UserControl.Resources>
+ <Converters:BooleanToVisibilityConverter x:Key="booleanToVisConverter" />
+ </UserControl.Resources>
+
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -75,7 +80,11 @@ <TextBlock Text="Source" FontWeight="Bold" Grid.Column="0" VerticalAlignment="Center" />
<ComboBox Width="120" ItemsSource="{Binding DataContext.SourceTracks, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
- SelectedItem="{Binding SourceTrack}" Grid.Column="1" Margin="5,0,5,0" Height="22" />
+ SelectedItem="{Binding SourceTrack}" Grid.Column="1" Margin="5,0,5,0" Height="22"
+ Visibility="{Binding IsSrtSubtitle, Converter={StaticResource booleanToVisConverter}, ConverterParameter=true}"/>
+ <TextBlock Text="{Binding SrtFileName}" Grid.Column="1" VerticalAlignment="Center"
+ Visibility="{Binding IsSrtSubtitle, Converter={StaticResource booleanToVisConverter}, ConverterParameter=false}" />
+
<TextBlock Text="Forced Only" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
<CheckBox Grid.Column="3" IsChecked="{Binding Forced}" VerticalAlignment="Center" Margin="5,0,5,0"/>
<TextBlock Text="Burn In" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center" />
diff --git a/win/CS/HandBrakeWPF/releasenotes.html b/win/CS/HandBrakeWPF/releasenotes.html new file mode 100644 index 000000000..0d8beced5 --- /dev/null +++ b/win/CS/HandBrakeWPF/releasenotes.html @@ -0,0 +1,29 @@ +<html>
+
+ <h3>HandBrake WPF Relase Notes</h3>
+
+
+ <font color="#FF0000">
+ <b>!!! Warning !!!</b>
+ </font><br /><br />
+
+ This build is only recommended for Advanced Users!!! <br /><br />
+
+
+ <b> Whats Changed?</b><br /><br />
+
+ The Windows User Interface for HandBrake is currently being ported to WPF from the older WinForms technology. <br />
+ While there are minor improvements in the new UI, it reamins largely the same as the old forms UI at this stage. <br /><br />
+
+ <b> How do I continue using the old winforms GUI?</b><br /><br />
+ Until the WPF UI stabilizes, the build will include a copy of the old winforms based UI. <br />
+ In the directory which you installed HandBrake, there is a file called HandBrake_old.exe which is the old forms UI. <br />
+ You can simply swap the exe file names over if you wish to continue running the old one.<br /><br />
+
+
+
+ <b>Bug Reports and Comments</b><br /><br />
+
+ Please keep any bug reports to <a href="https://forum.handbrake.fr/viewtopic.php?f=11&t=23843" target="_blank">this thread.</a>
+
+</html>
\ No newline at end of file |