summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-12-03 20:42:25 +0000
committersr55 <[email protected]>2011-12-03 20:42:25 +0000
commitc1f270b152db7a124b4664277c22996115836f81 (patch)
treec97d367985eba2263a0a33ae021d584bcada02a8 /win/CS/HandBrakeWPF
parentd23ce1929a4711f9153a27f39ac30f07a1b66acd (diff)
WinGui: (WPF) Further work hooking up the new main window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4372 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs10
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml8
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml.cs13
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml6
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml.cs35
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml6
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml.cs27
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml10
-rw-r--r--win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml.cs53
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml10
11 files changed, 134 insertions, 48 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 3869f479d..4772fd13f 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -266,6 +266,10 @@
<Project>{087A2BA8-BAC2-4577-A46F-07FF9D420016}</Project>
<Name>HandBrake.ApplicationServices</Name>
</ProjectReference>
+ <ProjectReference Include="..\HandBrake.Interop\HandBrakeInterop\HandBrakeInterop.csproj">
+ <Project>{F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}</Project>
+ <Name>HandBrakeInterop</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Factories\" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 6401f4c3a..e939c5d52 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -588,9 +588,15 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void BrowseDestination()
{
- VistaSaveFileDialog dialog = new VistaSaveFileDialog { Filter = "MP4 File (*.mp4)|Mkv File(*.mkv)" };
+ VistaSaveFileDialog dialog = new VistaSaveFileDialog
+ {
+ Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",
+ AddExtension = true,
+ OverwritePrompt = true,
+ DefaultExt = ".mp4"
+ };
dialog.ShowDialog();
- dialog.AddExtension = true;
+
this.CurrentTask.Destination = dialog.FileName;
this.NotifyOfPropertyChange("CurrentTask");
}
diff --git a/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml b/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml
index 78c784a37..0eeaff7e8 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml
+++ b/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml
@@ -4,7 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
+ d:DesignHeight="300" d:DesignWidth="300"
+ x:Name="advancedView">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -14,9 +15,8 @@
<TextBlock Text="Advanced" FontWeight="Bold" Margin="10,5,0,0" Grid.Row="0" ></TextBlock>
- <TextBox Grid.Row="2" Margin="10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
-
- </TextBox>
+ <TextBox Grid.Row="2" Margin="10" Text="{Binding Query, RelativeSource={RelativeSource AncestorType=UserControl}}"
+ VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
</Grid>
</UserControl>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml.cs b/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml.cs
index fa9a38d72..f00d972bb 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/Controls/AdvancedView.xaml.cs
@@ -28,15 +28,22 @@ namespace HandBrakeWPF.Views.Controls
/// <summary>
/// The "Query" Dependancy Property
/// </summary>
- public static readonly DependencyProperty QueryProperty = DependencyProperty.Register("Query", typeof(string), typeof(AdvancedView), new PropertyMetadata(null));
+ public static readonly DependencyProperty QueryProperty = DependencyProperty.Register("Query", typeof(string), typeof(AdvancedView));
/// <summary>
/// Gets or sets State.
/// </summary>
public string Query
{
- get { return (string)this.GetValue(QueryProperty); }
- set { this.SetValue(QueryProperty, value); }
+ get
+ {
+ return (string)this.GetValue(QueryProperty);
+ }
+
+ set
+ {
+ this.SetValue(QueryProperty, value);
+ }
}
}
}
diff --git a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml
index 5fafa01af..512a1b91d 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml
+++ b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml
@@ -18,11 +18,11 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <Button Content="Add Track" Grid.Column="0" Width="75" Margin="0,0,10,0" />
- <Button Content="Remove" Grid.Column="1" Width="75" />
+ <Button Content="Add Track" Click="Add" Grid.Column="0" Width="75" Margin="0,0,10,0" />
+ <Button Content="Remove" Click="Remove" Grid.Column="1" Width="75" />
</Grid>
- <DataGrid Grid.Row="2" Margin="10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <DataGrid Grid.Row="2" Margin="10" ItemsSource="{Binding AudioTracks, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</DataGrid>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml.cs b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml.cs
index 74fe9e057..417a1226c 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/Controls/AudioView.xaml.cs
@@ -10,7 +10,7 @@
namespace HandBrakeWPF.Views.Controls
{
using System;
- using System.ComponentModel;
+ using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
@@ -27,38 +27,49 @@ namespace HandBrakeWPF.Views.Controls
public AudioView()
{
InitializeComponent();
- this.AudioTracks = new BindingList<AudioTrack>();
}
/// <summary>
/// The "Query" Dependancy Property
/// </summary>
- public static readonly DependencyProperty QueryProperty = DependencyProperty.Register("AudioTracks", typeof(BindingList<AudioTrack>), typeof(AudioView), new PropertyMetadata(null));
-
+ public static readonly DependencyProperty AudioTracksProperty = DependencyProperty.Register("AudioTracks", typeof(ObservableCollection<AudioTrack>), typeof(AudioView));
/// <summary>
/// Gets or sets State.
/// </summary>
- public BindingList<AudioTrack> AudioTracks
+ public ObservableCollection<AudioTrack> AudioTracks
{
- get { return (BindingList<AudioTrack>)this.GetValue(QueryProperty); }
- set { this.SetValue(QueryProperty, value); }
+ get { return (ObservableCollection<AudioTrack>)this.GetValue(AudioTracksProperty); }
+ set { this.SetValue(AudioTracksProperty, value); }
}
+
/// <summary>
- /// Add an audio track.
+ /// Add a new Track
/// </summary>
- public void Add()
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public void Add(object sender, RoutedEventArgs e)
{
this.AudioTracks.Add(new AudioTrack());
}
/// <summary>
- /// Remove an Audio Track
+ /// Remove a Track
/// </summary>
- public void Remove()
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public void Remove(object sender, RoutedEventArgs e)
{
- throw new NotImplementedException("Not Done Yet!");
+ throw new NotImplementedException();
}
}
}
diff --git a/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml b/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml
index 7e787cf82..5a749a568 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml
+++ b/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml
@@ -20,12 +20,12 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <CheckBox Content="Create chapter markers" Grid.Column="0" VerticalAlignment="Center" />
+ <CheckBox Content="Create chapter markers" IsChecked="{Binding IncludeChapterMarkers, RelativeSource={RelativeSource AncestorType=UserControl}}" Grid.Column="0" VerticalAlignment="Center" />
<Button Content="Import" Grid.Column="2" Width="75" Margin="0,0,10,0" />
<Button Content="Export" Grid.Column="3" Width="75" />
</Grid>
-
- <DataGrid Grid.Row="2" Margin="10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+
+ <DataGrid Grid.Row="2" Margin="10" ItemsSource="{Binding Chapters, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</DataGrid>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml.cs b/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml.cs
index 4ad791fb1..a9ef20d95 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/Controls/ChaptersView.xaml.cs
@@ -11,10 +11,11 @@ namespace HandBrakeWPF.Views.Controls
{
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
- using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Model.Encoding;
/// <summary>
/// Interaction logic for ChaptersView.xaml
@@ -30,17 +31,31 @@ namespace HandBrakeWPF.Views.Controls
}
/// <summary>
- /// The "Query" Dependancy Property
+ /// The "Chapters" Dependancy Property
/// </summary>
- public static readonly DependencyProperty QueryProperty = DependencyProperty.Register("Chapters", typeof(IList<Chapter>), typeof(ChaptersView), new PropertyMetadata(null));
+ public static readonly DependencyProperty ChaptersProperty = DependencyProperty.Register("Chapters", typeof(ObservableCollection<ChapterMarker>), typeof(ChaptersView));
+
+ /// <summary>
+ /// The "EnableChapterMarkers" Dependancy Property
+ /// </summary>
+ public static readonly DependencyProperty IncludeChaptersProperty = DependencyProperty.Register("IncludeChapterMarkers", typeof(bool), typeof(ChaptersView));
/// <summary>
/// Gets or sets State.
/// </summary>
- public IList<Chapter> Query
+ public IList<ChapterMarker> Chapters
+ {
+ get { return (ObservableCollection<ChapterMarker>)this.GetValue(ChaptersProperty); }
+ set { this.SetValue(ChaptersProperty, value); }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether chapter markers are enabled.
+ /// </summary>
+ public bool IncludeChapterMarkers
{
- get { return (IList<Chapter>)this.GetValue(QueryProperty); }
- set { this.SetValue(QueryProperty, value); }
+ get { return (bool)this.GetValue(IncludeChaptersProperty); }
+ set { this.SetValue(IncludeChaptersProperty, value); }
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml
index a8acf0e5d..8ae5e48d1 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml
+++ b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
@@ -19,12 +19,12 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <Button Content="Add" Grid.Column="0" Width="75" Margin="0,0,10,0" />
- <Button Content="Remove" Grid.Column="1" Width="75" Margin="0,0,10,0" />
- <Button Content="Import SRT" Grid.Column="2" Width="75" />
+ <Button Content="Add" Name="AddTrack" Click="Add" Grid.Column="0" Width="75" Margin="0,0,10,0" />
+ <Button Content="Remove" Name="RemoveTrack" Click="Remove" Grid.Column="1" Width="75" Margin="0,0,10,0" />
+ <Button Content="Import SRT" Click="ImportSrt" Grid.Column="2" Width="75" />
</Grid>
- <DataGrid Grid.Row="2" Margin="10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <DataGrid Grid.Row="2" Margin="10" ItemsSource="{Binding SubtitleTracks, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</DataGrid>
diff --git a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml.cs b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml.cs
index ddf717a58..44922c1a6 100644
--- a/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/Controls/SubtitlesView.xaml.cs
@@ -9,7 +9,8 @@
namespace HandBrakeWPF.Views.Controls
{
- using System.ComponentModel;
+ using System;
+ using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
@@ -31,15 +32,57 @@ namespace HandBrakeWPF.Views.Controls
/// <summary>
/// The "Query" Dependancy Property
/// </summary>
- public static readonly DependencyProperty QueryProperty = DependencyProperty.Register("SubtitleTracks", typeof(BindingList<SubtitleTrack>), typeof(SubtitlesView), new PropertyMetadata(null));
+ public static readonly DependencyProperty SubtitleTracksProperty = DependencyProperty.Register("SubtitleTracks", typeof(ObservableCollection<SubtitleTrack>), typeof(SubtitlesView));
/// <summary>
/// Gets or sets State.
/// </summary>
- public BindingList<SubtitleTrack> AudioTracks
+ public ObservableCollection<SubtitleTrack> SubtitleTracks
{
- get { return (BindingList<SubtitleTrack>)this.GetValue(QueryProperty); }
- set { this.SetValue(QueryProperty, value); }
+ get { return (ObservableCollection<SubtitleTrack>)this.GetValue(SubtitleTracksProperty); }
+ set { this.SetValue(SubtitleTracksProperty, value); }
+ }
+
+ /// <summary>
+ /// Add a new Track
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public void Add(object sender, RoutedEventArgs e)
+ {
+ this.SubtitleTracks.Add(new SubtitleTrack());
+ }
+
+ /// <summary>
+ /// Remove a Track
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public void Remove(object sender, RoutedEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Import an SRT File.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public void ImportSrt(object sender, RoutedEventArgs e)
+ {
+ throw new NotImplementedException();
}
}
}
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 07f880ae5..a6649a268 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -287,16 +287,16 @@
</Grid>
</TabItem>
<TabItem Header="Audio" Name="audioTab">
- <Controls:AudioView></Controls:AudioView>
+ <Controls:AudioView AudioTracks="{Binding CurrentTask.AudioTracks, Mode=TwoWay}"></Controls:AudioView>
</TabItem>
<TabItem Header="Subtitles" Name="subtitlesTab">
- <Controls:SubtitlesView></Controls:SubtitlesView>
+ <Controls:SubtitlesView SubtitleTracks="{Binding CurrentTask.SubtitleTracks, Mode=TwoWay}"></Controls:SubtitlesView>
</TabItem>
<TabItem Header="Chapters" Name="chaptersTab">
- <Controls:ChaptersView></Controls:ChaptersView>
+ <Controls:ChaptersView IncludeChapterMarkers="{Binding CurrentTask.IncludeChapterMarkers, Mode=TwoWay}" Chapters="{Binding CurrentTask.ChapterNames, Mode=TwoWay}"></Controls:ChaptersView>
</TabItem>
<TabItem Header="Advanced" Name="advancedTab">
- <Controls:AdvancedView></Controls:AdvancedView>
+ <Controls:AdvancedView Query="{Binding CurrentTask.AdvancedEncoderOptions, Mode=TwoWay}"></Controls:AdvancedView>
</TabItem>
</TabControl>
@@ -322,7 +322,7 @@
</StackPanel>
<!-- Status Bar -->
- <StatusBar Grid.Row="6" Height="30" Grid.ColumnSpan="2" VerticalAlignment="Bottom">
+ <StatusBar Grid.Row="6" Height="28" Grid.ColumnSpan="2" VerticalAlignment="Bottom">
<Label Content="{Binding Path=ProgramStatusLabel}" FontSize="10" VerticalAlignment="Center" />
</StatusBar>