summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/AudioEnumConverter.cs83
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs77
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs21
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs13
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs42
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs17
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs144
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs11
-rw-r--r--win/CS/HandBrakeWPF/Views/AudioView.xaml27
-rw-r--r--win/CS/HandBrakeWPF/Views/SubtitlesView.xaml20
19 files changed, 436 insertions, 95 deletions
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>