diff options
Diffstat (limited to 'win')
25 files changed, 761 insertions, 204 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs index 8147f527f..0308069f9 100644 --- a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs +++ b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs @@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Functions using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
+ using System.Linq;
using System.Reflection;
/// <summary>
@@ -72,6 +73,17 @@ namespace HandBrake.ApplicationServices.Functions }
/// <summary>
+ /// Return a list of all the enum values.
+ /// </summary>
+ /// <returns>
+ /// An Enum Oject List
+ /// </returns>
+ public static IEnumerable<T> GetEnumList()
+ {
+ return Enum.GetValues(typeof(T)).Cast<T>().ToList();
+ }
+
+ /// <summary>
/// Get a list of string names for each enum value.
/// </summary>
/// <param name="enumType">
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index 2cb6ab738..ff6f8cd4b 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -150,6 +150,7 @@ <Compile Include="Services\UserSettingService.cs" />
<Compile Include="ASUserSettingConstants.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
+ <Compile Include="Utilities\CharCodesUtilities.cs" />
<Compile Include="Utilities\GeneralUtilities.cs" />
<Compile Include="Utilities\LanguageUtilities.cs" />
<Compile Include="Utilities\PlistUtility.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs index 9a92eab80..3ef786629 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs @@ -1,7 +1,11 @@ -/* AudioTrack.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. */
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioTrack.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>
+// An Audio Track for the Audio Panel
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.ApplicationServices.Model.Encoding
{
@@ -17,27 +21,56 @@ namespace HandBrake.ApplicationServices.Model.Encoding /// </summary>
public class AudioTrack : ModelBase
{
- #region Private Variables
+ #region Constants and Fields
+
/// <summary>
- /// The gain value
+ /// The bitrate.
/// </summary>
- private int gain;
+ private int bitrate;
/// <summary>
- /// The DRC Value
+ /// The DRC Value
/// </summary>
private double drc;
/// <summary>
- /// The Scanned Audio Track
+ /// The encoder.
+ /// </summary>
+ private AudioEncoder encoder;
+
+ /// <summary>
+ /// The gain value
+ /// </summary>
+ private int gain;
+
+ /// <summary>
+ /// The mix down.
+ /// </summary>
+ private Mixdown mixDown;
+
+ /// <summary>
+ /// The sample rate.
+ /// </summary>
+ private double sampleRate;
+
+ /// <summary>
+ /// The Scanned Audio Track
/// </summary>
[NonSerialized]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private Audio scannedTrack;
+
+ /// <summary>
+ /// The track name.
+ /// </summary>
+ private string trackName;
+
#endregion
+ #region Constructors and Destructors
+
/// <summary>
- /// Initializes a new instance of the <see cref="AudioTrack"/> class.
+ /// Initializes a new instance of the <see cref = "AudioTrack" /> class.
/// </summary>
public AudioTrack()
{
@@ -50,166 +83,231 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.ScannedTrack = new Audio();
}
+ #endregion
+
+ #region Public Properties
+
/// <summary>
- /// Gets the Audio Track Name
+ /// Gets AudioEncoderDisplayValue.
/// </summary>
- public int? Track
+ public string AudioEncoderDisplayValue
{
get
{
- if (this.ScannedTrack != null)
+ return EnumHelper<AudioEncoder>.GetDisplay(this.Encoder);
+ }
+ }
+
+ /// <summary>
+ /// Gets AudioMixdownDisplayValue.
+ /// </summary>
+ public string AudioMixdownDisplayValue
+ {
+ get
+ {
+ return EnumHelper<Mixdown>.GetDisplay(this.MixDown);
+ }
+ }
+
+ /// <summary>
+ /// Gets the The UI display value for bit rate
+ /// </summary>
+ public string BitRateDisplayValue
+ {
+ get
+ {
+ if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough
+ || this.Encoder == AudioEncoder.DtsHDPassthrough)
{
- return this.ScannedTrack.TrackNumber;
+ return "Auto";
}
- return null;
+ return this.Bitrate.ToString();
}
}
/// <summary>
- /// Gets or sets the Scanned Audio Tracks
+ /// Gets or sets Audio Bitrate
/// </summary>
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Audio ScannedTrack
+ public int Bitrate
{
get
{
- return this.scannedTrack;
+ return this.bitrate;
}
set
{
- this.scannedTrack = value;
- this.OnPropertyChanged("ScannedTrack");
- this.OnPropertyChanged("TrackDisplay");
+ this.bitrate = value;
+ this.OnPropertyChanged("Bitrate");
}
}
/// <summary>
- /// Gets the Display Value for this model.
+ /// Gets or sets Dynamic Range Compression
/// </summary>
- public string TrackDisplay
+ public double DRC
{
get
{
- return this.ScannedTrack == null ? string.Empty : this.ScannedTrack.ToString();
+ return this.drc;
+ }
+
+ set
+ {
+ if (!object.Equals(value, this.drc))
+ {
+ this.drc = value;
+ this.OnPropertyChanged("DRC");
+ }
}
}
/// <summary>
- /// Gets the The UI display value for sample rate
+ /// Gets or sets Audio Encoder
/// </summary>
- public string SampleRateDisplayValue
+ public AudioEncoder Encoder
{
get
{
- return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
+ return this.encoder;
+ }
+
+ set
+ {
+ this.encoder = value;
+ this.OnPropertyChanged("Encoder");
}
}
/// <summary>
- /// Gets the The UI display value for bit rate
+ /// Gets or sets the Gain for the audio track
/// </summary>
- public string BitRateDisplayValue
+ public int Gain
{
get
{
- if (this.Encoder == AudioEncoder.Ac3Passthrough || this.Encoder == AudioEncoder.DtsPassthrough ||
- this.Encoder == AudioEncoder.DtsHDPassthrough)
+ return this.gain;
+ }
+
+ set
+ {
+ if (!object.Equals(value, this.gain))
{
- return "Auto";
+ this.gain = value;
+ this.OnPropertyChanged("Gain");
}
-
- return this.Bitrate.ToString();
}
}
/// <summary>
- /// Gets AudioEncoderDisplayValue.
+ /// Gets or sets Audio Mixdown
/// </summary>
- public string AudioEncoderDisplayValue
+ public Mixdown MixDown
{
get
{
- return EnumHelper<AudioEncoder>.GetDisplay(this.Encoder);
+ return this.mixDown;
+ }
+
+ set
+ {
+ this.mixDown = value;
+ this.OnPropertyChanged("MixDown");
}
}
/// <summary>
- /// Gets AudioMixdownDisplayValue.
+ /// Gets or sets Audio SampleRate
/// </summary>
- public string AudioMixdownDisplayValue
+ public double SampleRate
{
get
{
- return EnumHelper<Mixdown>.GetDisplay(this.MixDown);
+ return this.sampleRate;
}
- }
+ set
+ {
+ this.sampleRate = value;
+ this.OnPropertyChanged("SampleRate");
+ }
+ }
/// <summary>
- /// Gets or sets Audio Mixdown
+ /// Gets the The UI display value for sample rate
/// </summary>
- public Mixdown MixDown { get; set; }
+ public string SampleRateDisplayValue
+ {
+ get
+ {
+ return this.SampleRate == 0 ? "Auto" : this.SampleRate.ToString();
+ }
+ }
/// <summary>
- /// Gets or sets Audio Encoder
+ /// Gets or sets the Scanned Audio Tracks
/// </summary>
- public AudioEncoder Encoder { get; set; }
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ public Audio ScannedTrack
+ {
+ get
+ {
+ return this.scannedTrack;
+ }
- /// <summary>
- /// Gets or sets Audio Bitrate
- /// </summary>
- public int Bitrate { get; set; }
+ set
+ {
+ this.scannedTrack = value;
+ this.OnPropertyChanged("ScannedTrack");
+ this.OnPropertyChanged("TrackDisplay");
+ }
+ }
/// <summary>
- /// Gets or sets Audio SampleRate
+ /// Gets the Audio Track Name
/// </summary>
- public double SampleRate { get; set; }
+ public int? Track
+ {
+ get
+ {
+ if (this.ScannedTrack != null)
+ {
+ return this.ScannedTrack.TrackNumber;
+ }
- /// <summary>
- /// Gets or sets TrackName.
- /// </summary>
- public string TrackName { get; set; }
+ return null;
+ }
+ }
/// <summary>
- /// Gets or sets Dynamic Range Compression
+ /// Gets the Display Value for this model.
/// </summary>
- public double DRC
+ public string TrackDisplay
{
get
{
- return this.drc;
- }
-
- set
- {
- if (!object.Equals(value, this.drc))
- {
- this.drc = value;
- this.OnPropertyChanged("DRC");
- }
+ return this.ScannedTrack == null ? string.Empty : this.ScannedTrack.ToString();
}
}
/// <summary>
- /// Gets or sets the Gain for the audio track
+ /// Gets or sets TrackName.
/// </summary>
- public int Gain
+ public string TrackName
{
get
{
- return this.gain;
+ return this.trackName;
}
set
{
- if (!object.Equals(value, this.gain))
- {
- this.gain = value;
- this.OnPropertyChanged("Gain");
- }
+ this.trackName = value;
+ this.OnPropertyChanged("TrackName");
}
}
+
+ #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs index f69abed7d..fa7dfd10e 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs @@ -1,82 +1,123 @@ -/* SubtitleTrack.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. */
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleTrack.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>
+// Subtitle Information
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
namespace HandBrake.ApplicationServices.Model.Encoding
{
+ using System;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// Subtitle Information
/// </summary>
- public class SubtitleTrack
+ public class SubtitleTrack : ModelBase
{
- /// <summary>
- /// Gets or sets Track.
- /// </summary>
- public string Track { get; set; }
+ #region Constants and Fields
/// <summary>
- /// Gets or sets a value indicating whether Forced.
+ /// The source track.
/// </summary>
- public bool Forced { get; set; }
+ private Subtitle sourceTrack;
+
+ #endregion
+
+ #region Public Properties
/// <summary>
- /// Gets or sets a value indicating whether Burned.
+ /// Gets or sets a value indicating whether Burned.
/// </summary>
public bool Burned { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether Default.
+ /// Gets or sets a value indicating whether Default.
/// </summary>
public bool Default { get; set; }
- #region SRT Specific Options
+ /// <summary>
+ /// Gets or sets a value indicating whether Forced.
+ /// </summary>
+ public bool Forced { get; set; }
/// <summary>
- /// Gets or sets the SRT Language
+ /// Gets a value indicating whether this is an SRT subtitle.
/// </summary>
- public string SrtLang { get; set; }
+ public bool IsSrtSubtitle
+ {
+ get
+ {
+ return this.SrtFileName != "-";
+ }
+ }
/// <summary>
- /// Gets or sets the SRT Character Code
+ /// Gets or sets Track.
/// </summary>
- public string SrtCharCode { get; set; }
+ [Obsolete("Use SourceTrack Instead")]
+ public string Track { get; set; }
+
/// <summary>
- /// Gets or sets the SRT Offset
+ /// Gets or sets SourceTrack.
/// </summary>
- public int SrtOffset { get; set; }
+ public Subtitle SourceTrack
+ {
+ get
+ {
+ return this.sourceTrack;
+ }
+
+ set
+ {
+ this.sourceTrack = value;
+ this.OnPropertyChanged("SourceTrack");
+ if (this.sourceTrack != null)
+ {
+ this.Track = this.sourceTrack.ToString();
+ }
+ }
+ }
/// <summary>
- /// Gets or sets the Path to the SRT file
+ /// Gets or sets the SRT Character Code
/// </summary>
- public string SrtPath { get; set; }
+ public string SrtCharCode { get; set; }
/// <summary>
- /// Gets or sets the SRT Filename
+ /// Gets or sets the SRT Filename
/// </summary>
public string SrtFileName { get; set; }
/// <summary>
- /// Gets a value indicating whether this is an SRT subtitle.
+ /// Gets or sets the SRT Language
/// </summary>
- public bool IsSrtSubtitle
- {
- get { return this.SrtFileName != "-"; }
- }
+ public string SrtLang { get; set; }
- #endregion
+ /// <summary>
+ /// Gets or sets the SRT Offset
+ /// </summary>
+ public int SrtOffset { get; set; }
/// <summary>
- /// Gets or sets the type of the subtitle
+ /// Gets or sets the Path to the SRT file
+ /// </summary>
+ public string SrtPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type of the subtitle
/// </summary>
public SubtitleType SubtitleType { get; set; }
/// <summary>
- /// Gets A ListViewItem Containing information about this subitlte
+ /// Gets A ListViewItem Containing information about this subitlte
/// </summary>
+ [Obsolete("Used only for the old forms gui. Will be removed.")]
public ListViewItem ListView
{
get
@@ -91,5 +132,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding return listTrack;
}
}
+
+ #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs new file mode 100644 index 000000000..9c9801015 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Utilities/CharCodesUtilities.cs @@ -0,0 +1,59 @@ +/* AppcastReader.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.Utilities
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Char Codes
+ /// </summary>
+ public class CharCodesUtilities
+ {
+ /// <summary>
+ /// Get a command subset of character codes.
+ /// </summary>
+ /// <returns>
+ /// A String List of Character codes.
+ /// </returns>
+ public static List<string> GetCharacterCodes()
+ {
+ return new List<string>
+ {
+ "ANSI_X3.4-1968",
+ "ANSI_X3.4-1986",
+ "ANSI_X3.4",
+ "ANSI_X3.110-1983",
+ "ANSI_X3.110",
+ "ASCII",
+ "ECMA-114",
+ "ECMA-118",
+ "ECMA-128",
+ "ECMA-CYRILLIC",
+ "IEC_P27-1",
+ "ISO-8859-1",
+ "ISO-8859-2",
+ "ISO-8859-3",
+ "ISO-8859-4",
+ "ISO-8859-5",
+ "ISO-8859-6",
+ "ISO-8859-7",
+ "ISO-8859-8",
+ "ISO-8859-9",
+ "ISO-8859-9E",
+ "ISO-8859-10",
+ "ISO-8859-11",
+ "ISO-8859-13",
+ "ISO-8859-14",
+ "ISO-8859-15",
+ "ISO-8859-16",
+ "UTF-7",
+ "UTF-8",
+ "UTF-16",
+ "UTF-32"
+ };
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs index d879afd27..ff56be2dc 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/LanguageUtilities.cs @@ -3,10 +3,13 @@ Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
-using System.Collections.Generic;
-
namespace HandBrake.ApplicationServices.Utilities
{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Language Utilities
+ /// </summary>
public class LanguageUtilities
{
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Converters/AudioEnumConverter.cs b/win/CS/HandBrakeWPF/Converters/AudioEnumConverter.cs new file mode 100644 index 000000000..b53637bca --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/AudioEnumConverter.cs @@ -0,0 +1,83 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="BooleanToVisibilityConverter.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 BooleanToVisibilityConverter type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters
+{
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Windows.Data;
+ using System;
+
+ using HandBrake.ApplicationServices.Functions;
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// Boolean to Visibility Converter
+ /// </summary>
+ public sealed class AudioEnumConverter : IValueConverter
+ {
+ /// <summary>
+ /// Convert an Enum to it's display value (attribute)
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter. (A boolean which inverts the output)
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// Visibility property
+ /// </returns>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is Mixdown)
+ {
+ return EnumHelper<Mixdown>.GetEnumDisplayValues(value.GetType());
+ }
+ else if (value is AudioEncoder)
+ {
+ return EnumHelper<AudioEncoder>.GetEnumDisplayValues(value.GetType());
+ }
+
+ return new List<string>();
+ }
+
+ /// <summary>
+ /// Convert Back for the IValueConverter Interface. Not used!
+ /// </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>
+ /// Nothing
+ /// </returns>
+ /// <exception cref="NotImplementedException">
+ /// This method is not used!
+ /// </exception>
+ 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 86bb02532..06abbad46 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -83,6 +83,7 @@ </ApplicationDefinition>
<Compile Include="Converters\BooleanConverter.cs" />
<Compile Include="Converters\BooleanToVisibilityConverter.cs" />
+ <Compile Include="Converters\AudioEnumConverter.cs" />
<Compile Include="Helpers\AutoNameHelper.cs" />
<Compile Include="Helpers\ListBoxHelper.cs" />
<Compile Include="Services\ErrorService.cs" />
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index a11f2a8e8..60a82d94e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding.x264;
@@ -137,12 +138,18 @@ namespace HandBrakeWPF.ViewModels #region Public Methods
/// <summary>
- /// Set the selected preset
+ /// Setup this window for a new source
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- public void SetPreset(Preset preset)
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
this.Query = preset.Task.AdvancedEncoderOptions;
this.X264Preset = preset.Task.x264Preset;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index e20e3ae95..b27c14583 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -9,14 +9,19 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
+ using System.Linq;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -38,6 +43,10 @@ namespace HandBrakeWPF.ViewModels public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
this.AudioTracks = new ObservableCollection<AudioTrack>();
+ this.SampleRates = new ObservableCollection<string> { "Auto", "48", "44.1", "32", "24", "22.05" };
+ this.AudioBitrates = this.GetAppropiateBitrates(AudioEncoder.ffaac, Mixdown.DolbyProLogicII);
+ this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList();
+ this.AudioMixdowns = EnumHelper<Mixdown>.GetEnumList();
}
/// <summary>
@@ -46,28 +55,88 @@ namespace HandBrakeWPF.ViewModels public ObservableCollection<AudioTrack> AudioTracks { get; set; }
/// <summary>
+ /// Gets or sets SourceTracks.
+ /// </summary>
+ public IEnumerable<Audio> SourceTracks { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioEncoders.
+ /// </summary>
+ public IEnumerable<AudioEncoder> AudioEncoders { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioMixdowns.
+ /// </summary>
+ public IEnumerable<Mixdown> AudioMixdowns { get; set; }
+
+ /// <summary>
+ /// Gets or sets SampleRates.
+ /// </summary>
+ public IEnumerable<string> SampleRates { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioBitrates.
+ /// </summary>
+ public IEnumerable<int> AudioBitrates { get; set; }
+
+ /// <summary>
/// Add an Audio Track
/// </summary>
public void Add()
{
- this.AudioTracks.Add(new AudioTrack());
+ if (SourceTracks != null)
+ {
+ Audio track = this.SourceTracks.FirstOrDefault();
+ if (track != null)
+ {
+ this.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
+ }
+ }
}
/// <summary>
/// Remove the Selected Track
/// </summary>
- public void Remove()
+ /// <param name="track">
+ /// The track.
+ /// </param>
+ public void Remove(AudioTrack track)
{
+ this.AudioTracks.Remove(track);
}
/// <summary>
- /// Set the selected preset.
+ /// Set the Source Title
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- public void SetPreset(Preset preset)
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
+ {
+ this.SourceTracks = title.AudioTracks;
+ }
+
+ /// <summary>
+ /// Get Appropiate Bitrates for the selected encoder and mixdown.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ /// <param name="mixdown">
+ /// The mixdown.
+ /// </param>
+ /// <returns>
+ /// A List of valid audio bitrates
+ /// </returns>
+ private IEnumerable<int> GetAppropiateBitrates(AudioEncoder encoder, Mixdown mixdown)
{
+ return new ObservableCollection<int> { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160 };
}
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index 262d6585d..c36a7bcef 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -103,7 +103,9 @@ namespace HandBrakeWPF.ViewModels {
var saveFileDialog = new VistaSaveFileDialog
{
- Filter = "Csv File|*.csv", DefaultExt = "csv", CheckPathExists = true
+ Filter = "Csv File|*.csv",
+ DefaultExt = "csv",
+ CheckPathExists = true
};
saveFileDialog.ShowDialog();
if (!string.IsNullOrEmpty(saveFileDialog.FileName))
@@ -142,8 +144,8 @@ namespace HandBrakeWPF.ViewModels catch (Exception exc)
{
throw new GeneralApplicationException(
- "Unable to save Chapter Makrers file! ",
- "Chapter marker names will NOT be saved in your encode.",
+ "Unable to save Chapter Makrers file! ",
+ "Chapter marker names will NOT be saved in your encode.",
exc);
}
}
@@ -197,18 +199,21 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// The set preset.
+ /// Setup this window for a new source
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- /// <param name="currentTitle">
- /// The current Title.
+ /// <param name="task">
+ /// The task.
/// </param>
- public void Setup(Preset preset, Title currentTitle)
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
- this.SetSourceChapters(currentTitle.Chapters);
+ this.SetSourceChapters(title.Chapters);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 2b4c9a08c..6dd4292e7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -16,6 +16,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
@@ -358,12 +359,18 @@ namespace HandBrakeWPF.ViewModels #endregion
/// <summary>
- /// Setup a selected preset.
+ /// Setup this window for a new source
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
- /// The Current Preset.
+ /// The preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
/// </param>
- public void SetPreset(Preset preset)
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
if (preset != null)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs index 199c10ff9..dc43ac831 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
/// <summary>
/// The Advanced View Model Interface
@@ -19,9 +20,15 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <summary>
/// Set the selected preset
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- void SetPreset(Preset preset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title title, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs index d29242625..2d38ab31c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
/// <summary>
/// The Audio View Model Interface
@@ -17,11 +18,17 @@ namespace HandBrakeWPF.ViewModels.Interfaces public interface IAudioViewModel
{
/// <summary>
- /// Set the selected preset
+ /// Set the Source Title
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- void SetPreset(Preset preset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title title, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs index 494e1aaa6..42820006a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs @@ -20,12 +20,15 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <summary>
/// Set the selected preset
/// </summary>
+ /// <param name="currentTitle">
+ /// The current Title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- /// <param name="currentTitle">
- /// The current Title.
+ /// <param name="task">
+ /// The task.
/// </param>
- void Setup(Preset preset, Title currentTitle);
+ void SetSource(Title currentTitle, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs index 3390b328b..cf7d00474 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
/// <summary>
/// The Filters View Model Interface
@@ -19,9 +20,15 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <summary>
/// Setup a selected preset.
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The Current Preset.
/// </param>
- void SetPreset(Preset preset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title title, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs index ef816de5f..293dc728a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs @@ -23,12 +23,12 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <param name="selectedTitle">
/// The selected title.
/// </param>
- /// <param name="currentTask">
- /// The current task.
- /// </param>
/// <param name="currentPreset">
/// The Current preset
/// </param>
- void Setup(Title selectedTitle, EncodeTask currentTask, Preset currentPreset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs index d0ff210b2..e45aec710 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
/// <summary>
/// The Subtiles View Model Interface
@@ -19,9 +20,15 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <summary>
/// Set the selected preset
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- void SetPreset(Preset preset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title title, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs index 4a6c01c43..229051812 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
/// <summary>
/// The Video View Model Interface
@@ -19,9 +20,15 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <summary>
/// Set the selected preset
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- void SetPreset(Preset preset);
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void SetSource(Title title, Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 8899ece9d..9bb31ee5a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -159,6 +159,7 @@ namespace HandBrakeWPF.ViewModels this.WindowTitle = "HandBrake WPF Test Application";
this.CurrentTask = new EncodeTask();
this.ScannedSource = new Source();
+ this.SelectedPreset = this.presetService.DefaultPreset;
// Setup Events
this.scanService.ScanStared += this.ScanStared;
@@ -1022,13 +1023,13 @@ namespace HandBrakeWPF.ViewModels private void SetupTabs()
{
// Setup the Tabs
- this.PictureSettingsViewModel.Setup(this.SelectedTitle, this.CurrentTask, this.SelectedPreset);
- this.VideoViewModel.SetPreset(this.SelectedPreset);
- this.FiltersViewModel.SetPreset(this.SelectedPreset);
- this.AudioViewModel.SetPreset(this.SelectedPreset);
- this.SubtitleViewModel.SetPreset(this.SelectedPreset);
- this.ChaptersViewModel.Setup(this.SelectedPreset, this.SelectedTitle);
- this.AdvancedViewModel.SetPreset(this.SelectedPreset);
+ this.PictureSettingsViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.VideoViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.FiltersViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.AudioViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.SubtitleViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.ChaptersViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
+ this.AdvancedViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask);
}
#endregion
@@ -1059,18 +1060,23 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void ScanCompleted(object sender, HandBrake.ApplicationServices.EventArgs.ScanCompletedEventArgs e)
{
- if (e.Successful)
- {
- this.scanService.SouceData.CopyTo(this.ScannedSource);
- this.NotifyOfPropertyChange("ScannedSource");
- this.NotifyOfPropertyChange("ScannedSource.Titles");
- this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault();
- this.JobContextService.CurrentSource = this.ScannedSource;
- this.JobContextService.CurrentTask = this.CurrentTask;
- this.SetupTabs();
- }
+ Caliburn.Micro.Execute.OnUIThread(() =>
+ {
+ if (e.Successful)
+ {
+ this.scanService.SouceData.CopyTo(this.ScannedSource);
+ this.NotifyOfPropertyChange("ScannedSource");
+ this.NotifyOfPropertyChange("ScannedSource.Titles");
+ this.SelectedTitle = this.ScannedSource.Titles.Where(t => t.MainTitle).FirstOrDefault();
+ this.JobContextService.CurrentSource = this.ScannedSource;
+ this.JobContextService.CurrentTask = this.CurrentTask;
+ this.SetupTabs();
+ }
+
+ this.SourceLabel = "Scan Completed";
+
+ });
- this.SourceLabel = "Scan Completed";
// TODO Re-enable GUI.
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index f7ca69f6c..4a1a76cd6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -393,21 +393,20 @@ namespace HandBrakeWPF.ViewModels #region Public Methods
/// <summary>
- /// Setup the window after a scan.
+ /// Setup this window for a new source
/// </summary>
- /// <param name="selectedTitle">
- /// The selected title.
+ /// <param name="title">
+ /// The title.
/// </param>
- /// <param name="currentTask">
- /// The current task.
+ /// <param name="preset">
+ /// The preset.
/// </param>
- /// <param name="currentPreset">
- /// The Current preset
+ /// <param name="task">
+ /// The task.
/// </param>
- public void Setup(Title selectedTitle, EncodeTask currentTask, Preset currentPreset)
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
}
-
#endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 81a9c07db..4b0a0af9b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -9,18 +9,22 @@ namespace HandBrakeWPF.ViewModels
{
- using System;
+ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
+ using System.Linq;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
- using HandBrake.ApplicationServices.Model;
+ using Ookii.Dialogs.Wpf;
/// <summary>
/// The Subtitles View Model
@@ -28,6 +32,22 @@ namespace HandBrakeWPF.ViewModels [Export(typeof(ISubtitlesViewModel))]
public class SubtitlesViewModel : ViewModelBase, ISubtitlesViewModel
{
+ #region Constants and Fields
+
+ /// <summary>
+ /// The subtitle tracks.
+ /// </summary>
+ private ObservableCollection<SubtitleTrack> subtitleTracks;
+
+ /// <summary>
+ /// Backing field for the source subtitle tracks.
+ /// </summary>
+ private IEnumerable<Subtitle> sourceTracks;
+
+ #endregion
+
+ #region Constructors and Destructors
+
/// <summary>
/// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.SubtitlesViewModel"/> class.
/// </summary>
@@ -40,45 +60,135 @@ namespace HandBrakeWPF.ViewModels public SubtitlesViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
+
+ Langauges = LanguageUtilities.MapLanguages().Keys;
+ CharacterCodes = CharCodesUtilities.GetCharacterCodes();
}
+ #endregion
+
+ #region Public Properties
+
/// <summary>
- /// Gets or sets State.
+ /// Gets or sets State.
/// </summary>
- public ObservableCollection<SubtitleTrack> SubtitleTracks { get; set; }
+ public ObservableCollection<SubtitleTrack> SubtitleTracks
+ {
+ get
+ {
+ return this.subtitleTracks;
+ }
+
+ set
+ {
+ this.subtitleTracks = value;
+ this.NotifyOfPropertyChange(() => this.SubtitleTracks);
+ }
+ }
/// <summary>
- /// Set the currently selected preset.
+ /// Gets or sets Langauges.
/// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- public void SetPreset(Preset preset)
- {
+ public IEnumerable<string> Langauges { get; set; }
+
+ /// <summary>
+ /// Gets or sets CharacterCodes.
+ /// </summary>
+ public IEnumerable<string> CharacterCodes { get; set; }
+
+
+ /// <summary>
+ /// Gets or sets SourceTracks.
+ /// </summary>
+ public IEnumerable<Subtitle> SourceTracks
+ {
+ get
+ {
+ return this.sourceTracks;
+ }
+ set
+ {
+ this.sourceTracks = value;
+ this.NotifyOfPropertyChange(() => SourceTracks);
+ }
}
+ #endregion
+
+ #region Public Methods
+
/// <summary>
/// Add a new Track
/// </summary>
public void Add()
{
- this.SubtitleTracks.Add(new SubtitleTrack());
+ if (this.SourceTracks != null)
+ {
+ Subtitle source = this.SourceTracks.FirstOrDefault();
+ if (source != null)
+ {
+ SubtitleTrack track = new SubtitleTrack
+ {
+ SubtitleType = SubtitleType.VobSub
+ };
+
+ this.SubtitleTracks.Add(track);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Import an SRT File.
+ /// </summary>
+ public void Import()
+ {
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "SRT files (*.srt)|*.srt", CheckFileExists = true, Multiselect = true };
+
+ dialog.ShowDialog();
+
+ foreach (var srtFile in dialog.FileNames)
+ {
+ SubtitleTrack track = new SubtitleTrack
+ {
+ SrtFileName = srtFile,
+ SrtOffset = 0,
+ SrtCharCode = "UTF-8",
+ SrtLang = "English",
+ SubtitleType = SubtitleType.SRT
+ };
+ this.SubtitleTracks.Add(track);
+ }
}
/// <summary>
/// Remove a Track
/// </summary>
- public void Remove()
+ /// <param name="track">
+ /// The track.
+ /// </param>
+ public void Remove(SubtitleTrack track)
{
- throw new NotImplementedException();
+ this.SubtitleTracks.Remove(track);
}
/// <summary>
- /// Import an SRT File.
+ /// Setup this window for a new source
/// </summary>
- public void Import()
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
- throw new NotImplementedException();
+ this.SourceTracks = title.Subtitles;
+ this.SubtitleTracks = task.SubtitleTracks;
}
+
+ #endregion
}
-}
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 0368c781c..842e109d1 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -16,6 +16,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
@@ -389,12 +390,18 @@ namespace HandBrakeWPF.ViewModels #region Public Methods
/// <summary>
- /// Set the currently selected preset.
+ /// Setup this window for a new source
/// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <param name="preset">
/// The preset.
/// </param>
- public void SetPreset(Preset preset)
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void SetSource(Title title, Preset preset, EncodeTask task)
{
}
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index 84616338b..89093d2e2 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -22,7 +22,6 @@ <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Content="Add Track" cal:Message.Attach="[Event Click] = [Action Add]" Grid.Column="0" Width="75" Margin="0,0,10,0" />
- <Button Content="Remove" cal:Message.Attach="[Event Click] = [Action Remove]" Grid.Column="1" Width="75" />
</Grid>
<ListBox Grid.Row="2" ItemsSource="{Binding AudioTracks}"
@@ -70,21 +69,31 @@ <!-- 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" />
+ <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" />
+ <ComboBox Width="100" Grid.Column="3" Margin="5,0,5,0" Height="22"
+ ItemsSource="{Binding DataContext.AudioEncoders, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
+ SelectedItem="{Binding Encoder}"/>
<TextBlock Text="Bitrate" FontWeight="Bold" Grid.Column="4" VerticalAlignment="Center" />
- <ComboBox Width="70" Grid.Column="5" Margin="5,0,5,0" Height="22" />
+ <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}"/>
<TextBlock Text="Samplerate" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center" />
- <ComboBox Width="70" Grid.Column="7" Margin="5,0,5,0" Height="22" />
+ <ComboBox Width="70" Grid.Column="7" Margin="5,0,5,0" Height="22"
+ ItemsSource="{Binding DataContext.SampleRates, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
+ SelectedItem="{Binding SampleRate}"/>
<!-- Row 2-->
<TextBlock Text="Mixdown" FontWeight="Bold" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"/>
- <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22" />
+ <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22"
+ ItemsSource="{Binding DataContext.AudioMixdowns, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
+ SelectedItem="{Binding MixDown}"/>
<TextBlock Text="DRC" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"/>
- <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Margin="5,0,5,0" />
+ <NumericUpDown:NumericUpDown Width="45" Value="{Binding DRC}" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Left" Margin="5,0,5,0" />
<TextBlock Text="Gain" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"/>
- <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
+ <NumericUpDown:NumericUpDown Width="45" Value="{Binding Gain}" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
</Grid>
@@ -92,7 +101,7 @@ <Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="RemoveJob">
+ <cal:ActionMessage MethodName="Remove">
<cal:Parameter Value="{Binding}" />
</cal:ActionMessage>
</i:EventTrigger>
diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 4b2d9b61a..0e302fd4c 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -22,7 +22,6 @@ <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Content="Add" Name="AddTrack" Grid.Column="0" Width="75" Margin="0,0,10,0" cal:Message.Attach="[Event Click] = [Action Add]" />
- <Button Content="Remove" Name="RemoveTrack" Grid.Column="1" Width="75" Margin="0,0,10,0" cal:Message.Attach="[Event Click] = [Action Remove]" />
<Button Content="Import SRT" Grid.Column="2" Width="75" cal:Message.Attach="[Event Click] = [Action Import]" />
</Grid>
@@ -71,21 +70,22 @@ <!-- 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" />
+ <ComboBox Width="100" ItemsSource="{Binding DataContext.SourceTracks, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
+ SelectedItem="{Binding SourceTrack}" Grid.Column="1" Margin="5,0,5,0" Height="22" />
<TextBlock Text="Forced Only" FontWeight="Bold" Grid.Column="2" VerticalAlignment="Center" />
- <CheckBox Grid.Column="3" VerticalAlignment="Center" Margin="5,0,5,0"/>
+ <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" />
- <CheckBox Grid.Column="5" VerticalAlignment="Center" Margin="5,0,5,0"/>
+ <CheckBox Grid.Column="5" IsChecked="{Binding Burned}" VerticalAlignment="Center" Margin="5,0,5,0"/>
<TextBlock Text="Default" FontWeight="Bold" Grid.Column="6" VerticalAlignment="Center" />
- <CheckBox Grid.Column="7" VerticalAlignment="Center" Margin="5,0,5,0"/>
+ <CheckBox Grid.Column="7" IsChecked="{Binding Default}" VerticalAlignment="Center" Margin="5,0,5,0"/>
<!-- Row 2-->
<TextBlock Text="Language" FontWeight="Bold" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center"/>
- <ComboBox Width="100" Grid.Column="1" Margin="5,0,5,0" Grid.Row="1" Height="22" />
+ <ComboBox Width="100" Grid.Column="1" ItemsSource="{Binding DataContext.Langauges, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" SelectedItem="{Binding SrtLang}" Margin="5,0,5,0" Grid.Row="1" Height="22" />
<TextBlock Text="Char Code" FontWeight="Bold" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center"/>
- <ComboBox Width="100" Grid.Column="3" Grid.Row="1" Margin="5,0,5,0" Height="22" />
- <TextBlock Text="Offset" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"/>
- <NumericUpDown:NumericUpDown Width="45" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
+ <ComboBox Width="100" Grid.Column="3" ItemsSource="{Binding DataContext.CharacterCodes, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" SelectedItem="{Binding SrtCharCode}" Grid.Row="1" Margin="5,0,5,0" Height="22" />
+ <TextBlock Text="Offset (ms)" FontWeight="Bold" Grid.Column="4" Grid.Row="1" VerticalAlignment="Center"/>
+ <NumericUpDown:NumericUpDown Width="45" Value="{Binding SrtOffset}" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Left" Margin="5,0,5,0" />
</Grid>
@@ -93,7 +93,7 @@ <Image Source="Images/delete.png" Width="16" Height="16" Grid.Column="2" Margin="10,0,10,0">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown">
- <cal:ActionMessage MethodName="RemoveJob">
+ <cal:ActionMessage MethodName="Remove">
<cal:Parameter Value="{Binding}" />
</cal:ActionMessage>
</i:EventTrigger>
|