summaryrefslogtreecommitdiffstats
path: root/win/CS
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
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')
-rw-r--r--win/CS/Controls/AudioPanel.cs2
-rw-r--r--win/CS/Functions/QueryGenerator.cs11
-rw-r--r--win/CS/HandBrake.ApplicationServices/Functions/InteropModelCreator.cs3
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/ChapterMarker.cs45
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs3
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs3
-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
20 files changed, 208 insertions, 64 deletions
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs
index f50340f80..0f46ed1c1 100644
--- a/win/CS/Controls/AudioPanel.cs
+++ b/win/CS/Controls/AudioPanel.cs
@@ -155,7 +155,7 @@ namespace Handbrake.Controls
/// Load an arraylist of AudioTrack items into the list.
/// </summary>
/// <param name="tracks">List of audio tracks</param>
- public void LoadTracks(List<AudioTrack> tracks)
+ public void LoadTracks(ObservableCollection<AudioTrack> tracks)
{
ClearAudioList();
diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs
index b085626a9..85640c3bd 100644
--- a/win/CS/Functions/QueryGenerator.cs
+++ b/win/CS/Functions/QueryGenerator.cs
@@ -7,6 +7,7 @@ namespace Handbrake.Functions
{
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -707,17 +708,19 @@ namespace Handbrake.Functions
}
// Audio
- task.AudioTracks = new List<AudioTrack>(frmMain.AudioSettings.AudioTracks);
+ task.AudioTracks = new ObservableCollection<AudioTrack>(frmMain.AudioSettings.AudioTracks);
// Subtitles
- task.SubtitleTracks = new List<SubtitleTrack>(frmMain.Subtitles.SubtitlesList);
+ task.SubtitleTracks = new ObservableCollection<SubtitleTrack>(frmMain.Subtitles.SubtitlesList);
// Chapters
task.IncludeChapterMarkers = frmMain.Check_ChapterMarkers.Checked;
- task.ChapterNames = new List<string>();
+ task.ChapterNames = new ObservableCollection<ChapterMarker>();
foreach (DataGridViewRow row in frmMain.data_chpt.Rows)
{
- task.ChapterNames.Add(row.Cells[1].Value.ToString());
+ int number;
+ int.TryParse(row.Cells[0].Value.ToString(), out number);
+ task.ChapterNames.Add(new ChapterMarker(number, row.Cells[1].Value.ToString()));
}
// Advanced Options
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Functions/InteropModelCreator.cs
index 47d68feab..ec42f9e4f 100644
--- a/win/CS/HandBrake.ApplicationServices/Functions/InteropModelCreator.cs
+++ b/win/CS/HandBrake.ApplicationServices/Functions/InteropModelCreator.cs
@@ -7,6 +7,7 @@ namespace HandBrake.ApplicationServices.Functions
{
using System;
using System.Collections.Generic;
+ using System.Linq;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
@@ -154,7 +155,7 @@ namespace HandBrake.ApplicationServices.Functions
job.FramesStart = work.StartPoint;
}
- job.CustomChapterNames = work.ChapterNames;
+ job.CustomChapterNames = work.ChapterNames.Select(item => item.ChapterName).ToList();
job.UseDefaultChapterNames = work.IncludeChapterMarkers;
job.OutputPath = work.Destination;
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index dfff55b08..a4b34ba80 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -103,6 +103,7 @@
<Compile Include="Functions\Win7.cs" />
<Compile Include="Model\DriveInformation.cs" />
<Compile Include="Model\Encoding\AudioTrack.cs" />
+ <Compile Include="Model\Encoding\ChapterMarker.cs" />
<Compile Include="Model\Encoding\FramerateMode.cs" />
<Compile Include="Model\Encoding\PointToPointMode.cs" />
<Compile Include="Model\EncodeTask.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
index 593bd9e48..a51a7d43a 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
@@ -6,8 +6,10 @@
namespace HandBrake.ApplicationServices.Model
{
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.Model.Encoding.x264;
@@ -25,6 +27,9 @@ namespace HandBrake.ApplicationServices.Model
public EncodeTask()
{
this.Cropping = new Cropping();
+ this.AudioTracks = new ObservableCollection<AudioTrack>();
+ this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
+ this.ChapterNames = new ObservableCollection<ChapterMarker>();
}
#region Source
@@ -257,7 +262,7 @@ namespace HandBrake.ApplicationServices.Model
/// <summary>
/// Gets or sets AudioEncodings.
/// </summary>
- public List<AudioTrack> AudioTracks { get; set; }
+ public ObservableCollection<AudioTrack> AudioTracks { get; set; }
#endregion
#region Subtitles
@@ -265,7 +270,7 @@ namespace HandBrake.ApplicationServices.Model
/// <summary>
/// Gets or sets SubtitleTracks.
/// </summary>
- public List<SubtitleTrack> SubtitleTracks { get; set; }
+ public ObservableCollection<SubtitleTrack> SubtitleTracks { get; set; }
#endregion
#region Chapters
@@ -281,9 +286,9 @@ namespace HandBrake.ApplicationServices.Model
public string ChapterMarkersFilePath { get; set; }
/// <summary>
- /// Chapter Names
+ /// Gets or sets ChapterNames.
/// </summary>
- public List<string> ChapterNames { get; set; }
+ public ObservableCollection<ChapterMarker> ChapterNames { get; set; }
#endregion
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/ChapterMarker.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/ChapterMarker.cs
new file mode 100644
index 000000000..8fb1a5920
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/ChapterMarker.cs
@@ -0,0 +1,45 @@
+/* ChapterMarker.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices.Model.Encoding
+{
+ /// <summary>
+ /// A Movie Chapter
+ /// </summary>
+ public class ChapterMarker
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChapterMarker"/> class.
+ /// </summary>
+ public ChapterMarker()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChapterMarker"/> class.
+ /// </summary>
+ /// <param name="number">
+ /// The number.
+ /// </param>
+ /// <param name="Name">
+ /// The name.
+ /// </param>
+ public ChapterMarker(int number, string Name)
+ {
+ this.ChapterName = Name;
+ this.ChapterNumber = number;
+ }
+
+ /// <summary>
+ /// Gets or sets The number of this Chapter, in regards to it's parent Title
+ /// </summary>
+ public int ChapterNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets ChapterName.
+ /// </summary>
+ public string ChapterName { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 645a64cb6..19a98c3f5 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -7,6 +7,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.IO;
using System.Text;
using System.Windows.Forms;
@@ -42,7 +43,7 @@ namespace HandBrake.ApplicationServices.Utilities
#region Get a List of Audio Track Objects
XmlNode audioListDict = root.ChildNodes[2].ChildNodes[0].FirstChild.ChildNodes[1];
- List<AudioTrack> audioTracks = new List<AudioTrack>();
+ ObservableCollection<AudioTrack> audioTracks = new ObservableCollection<AudioTrack>();
for (int i = 0; i < audioListDict.ChildNodes.Count; i++)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index 36e7f0525..5cf5d7712 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -7,6 +7,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
@@ -463,7 +464,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
string query = string.Empty;
- List<AudioTrack> audioTracks = task.AudioTracks;
+ ObservableCollection<AudioTrack> audioTracks = task.AudioTracks;
List<int> tracks = new List<int>();
List<AudioEncoder> codecs = new List<AudioEncoder>();
@@ -807,14 +808,14 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="chapters">The List of chapters</param>
/// <param name="filePathName">Path to save the csv file</param>
/// <returns>True if successful </returns>
- private static bool ChapterCsvSave(IEnumerable<string> chapters, string filePathName)
+ private static bool ChapterCsvSave(IEnumerable<ChapterMarker> chapters, string filePathName)
{
string csv = string.Empty;
int counter = 0;
- foreach (string name in chapters)
+ foreach (ChapterMarker name in chapters)
{
- csv += counter + "," + name.Replace(",", "\\,") + Environment.NewLine;
+ csv += counter + "," + name.ChapterName.Replace(",", "\\,") + Environment.NewLine;
counter++;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
index 806a40f62..9a8498e95 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs
@@ -7,6 +7,7 @@ namespace HandBrake.ApplicationServices.Utilities
{
using System;
using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.Globalization;
using System.Text.RegularExpressions;
@@ -361,7 +362,7 @@ namespace HandBrake.ApplicationServices.Utilities
trackGainValues = gainValues.ToString().Replace("--gain=", string.Empty).Split(',');
// Create new Audio Track Classes and store them in the ArrayList
- List<AudioTrack> allAudioTrackInfo = new List<AudioTrack>();
+ ObservableCollection<AudioTrack> allAudioTrackInfo = new ObservableCollection<AudioTrack>();
for (int x = 0; x < encoderCount; x++)
{
AudioTrack track = new AudioTrack();
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>