diff options
author | sr55 <[email protected]> | 2012-01-08 15:09:40 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-01-08 15:09:40 +0000 |
commit | 54e6a851ccec4be58087f8d90d4e04fb2623b4b5 (patch) | |
tree | f4d603eeb208ab9c5e09b74d81e8a01823da701b /win/CS/HandBrakeWPF/ViewModels | |
parent | 4eebc527c8183ec0bbc905da7f648e004f44d9db (diff) |
WinGui: (WPF) Further work on hooking up the various tabs on the Main Window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4404 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
15 files changed, 1150 insertions, 35 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 9b50acc5c..a11f2a8e8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -13,7 +13,9 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Model.Encoding.x264;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -23,6 +25,32 @@ namespace HandBrakeWPF.ViewModels [Export(typeof(IAdvancedViewModel))]
public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel
{
+ #region Constants and Fields
+
+ /// <summary>
+ /// The query.
+ /// </summary>
+ private string query;
+
+ /// <summary>
+ /// The x264 preset.
+ /// </summary>
+ private x264Preset x264Preset;
+
+ /// <summary>
+ /// The x264 profile.
+ /// </summary>
+ private x264Profile x264Profile;
+
+ /// <summary>
+ /// The x264 tune.
+ /// </summary>
+ private x264Tune x264Tune;
+
+ #endregion
+
+ #region Constructors and Destructors
+
/// <summary>
/// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
/// </summary>
@@ -36,9 +64,92 @@ namespace HandBrakeWPF.ViewModels {
}
+ #endregion
+
+ #region Public Properties
+
/// <summary>
/// Gets or sets State.
/// </summary>
- public string Query { get; set; }
+ public string Query
+ {
+ get
+ {
+ return this.query;
+ }
+ set
+ {
+ this.query = value;
+ this.NotifyOfPropertyChange(() => this.Query);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Preset.
+ /// </summary>
+ public x264Preset X264Preset
+ {
+ get
+ {
+ return this.x264Preset;
+ }
+ set
+ {
+ this.x264Preset = value;
+ this.NotifyOfPropertyChange(() => this.X264Preset);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Profile.
+ /// </summary>
+ public x264Profile X264Profile
+ {
+ get
+ {
+ return this.x264Profile;
+ }
+ set
+ {
+ this.x264Profile = value;
+ this.NotifyOfPropertyChange(() => this.X264Profile);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets X264Tune.
+ /// </summary>
+ public x264Tune X264Tune
+ {
+ get
+ {
+ return this.x264Tune;
+ }
+ set
+ {
+ this.x264Tune = value;
+ this.NotifyOfPropertyChange(() => this.X264Tune);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ this.Query = preset.Task.AdvancedEncoderOptions;
+ this.X264Preset = preset.Task.x264Preset;
+ this.X264Profile = preset.Task.x264Profile;
+ this.X264Tune = preset.Task.X264Tune;
+ }
+
+ #endregion
}
-}
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index d8e4c194d..e20e3ae95 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -14,6 +14,7 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -58,5 +59,15 @@ namespace HandBrakeWPF.ViewModels public void Remove()
{
}
+
+ /// <summary>
+ /// Set the selected preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index 672082b51..262d6585d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -18,6 +18,7 @@ namespace HandBrakeWPF.ViewModels using Caliburn.Micro;
using HandBrake.ApplicationServices.Exceptions;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -32,10 +33,16 @@ namespace HandBrakeWPF.ViewModels [Export(typeof(IChaptersViewModel))]
public class ChaptersViewModel : ViewModelBase, IChaptersViewModel
{
+ #region Constants and Fields
+
/// <summary>
- /// Gets or sets SourceChapterList.
+ /// The include chapter markers.
/// </summary>
- private ObservableCollection<Chapter> SourceChapterList { get; set; }
+ private bool includeChapterMarkers;
+
+ #endregion
+
+ #region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="ChaptersViewModel"/> class.
@@ -51,6 +58,10 @@ namespace HandBrakeWPF.ViewModels this.Chapters = new ObservableCollection<ChapterMarker>();
}
+ #endregion
+
+ #region Public Properties
+
/// <summary>
/// Gets or sets State.
/// </summary>
@@ -59,25 +70,45 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Gets or sets a value indicating whether chapter markers are enabled.
/// </summary>
- public bool IncludeChapterMarkers { get; set; }
+ public bool IncludeChapterMarkers
+ {
+ get
+ {
+ return this.includeChapterMarkers;
+ }
+ set
+ {
+ this.includeChapterMarkers = value;
+ this.NotifyOfPropertyChange(() => this.IncludeChapterMarkers);
+ }
+ }
+
+ #endregion
+
+ #region Properties
/// <summary>
- /// Set the Source Chapters List
+ /// Gets or sets SourceChapterList.
/// </summary>
- /// <param name="sourceChapters">
- /// The source chapters.
- /// </param>
- public void SetSourceChapters(IEnumerable<Chapter> sourceChapters)
- {
- // Cache the chapters in this screen
- this.SourceChapterList = new ObservableCollection<Chapter>(sourceChapters);
- this.Chapters.Clear();
+ private ObservableCollection<Chapter> SourceChapterList { get; set; }
- // Then Add new Chapter Markers.
- foreach (Chapter chapter in SourceChapterList)
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Export a CSV file.
+ /// </summary>
+ public void Export()
+ {
+ var saveFileDialog = new VistaSaveFileDialog
+ {
+ Filter = "Csv File|*.csv", DefaultExt = "csv", CheckPathExists = true
+ };
+ saveFileDialog.ShowDialog();
+ if (!string.IsNullOrEmpty(saveFileDialog.FileName))
{
- ChapterMarker marker = new ChapterMarker(chapter.ChapterNumber, chapter.ChapterName);
- this.Chapters.Add(marker);
+ this.ExportChaptersToCSV(saveFileDialog.FileName);
}
}
@@ -103,23 +134,26 @@ namespace HandBrakeWPF.ViewModels csv += row.ChapterName.Replace(",", "\\,");
csv += Environment.NewLine;
}
- StreamWriter file = new StreamWriter(filename);
+ var file = new StreamWriter(filename);
file.Write(csv);
file.Close();
file.Dispose();
}
catch (Exception exc)
{
- throw new GeneralApplicationException("Unable to save Chapter Makrers file! ", "Chapter marker names will NOT be saved in your encode.", exc);
+ throw new GeneralApplicationException(
+ "Unable to save Chapter Makrers file! ",
+ "Chapter marker names will NOT be saved in your encode.",
+ exc);
}
}
/// <summary>
/// Import a CSV file
/// </summary>
- private void Import()
+ public void Import()
{
- VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
+ var dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
dialog.ShowDialog();
string filename = dialog.FileName;
@@ -131,7 +165,7 @@ namespace HandBrakeWPF.ViewModels IDictionary<int, string> chapterMap = new Dictionary<int, string>();
try
{
- StreamReader sr = new StreamReader(filename);
+ var sr = new StreamReader(filename);
string csv = sr.ReadLine();
while (csv != null)
{
@@ -152,26 +186,51 @@ namespace HandBrakeWPF.ViewModels }
// Now iterate over each chatper we have, and set it's name
- foreach (ChapterMarker item in Chapters)
+ foreach (ChapterMarker item in this.Chapters)
{
string chapterName;
chapterMap.TryGetValue(item.ChapterNumber, out chapterName);
item.ChapterName = chapterName;
+
// TODO force a fresh of this property
}
}
/// <summary>
- /// Export a CSV file.
+ /// The set preset.
/// </summary>
- private void Export()
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="currentTitle">
+ /// The current Title.
+ /// </param>
+ public void Setup(Preset preset, Title currentTitle)
{
- VistaSaveFileDialog saveFileDialog = new VistaSaveFileDialog { Filter = "Csv File|*.csv", DefaultExt = "csv", CheckPathExists = true };
- saveFileDialog.ShowDialog();
- if (!string.IsNullOrEmpty(saveFileDialog.FileName))
+ this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers;
+ this.SetSourceChapters(currentTitle.Chapters);
+ }
+
+ /// <summary>
+ /// Set the Source Chapters List
+ /// </summary>
+ /// <param name="sourceChapters">
+ /// The source chapters.
+ /// </param>
+ public void SetSourceChapters(IEnumerable<Chapter> sourceChapters)
+ {
+ // Cache the chapters in this screen
+ this.SourceChapterList = new ObservableCollection<Chapter>(sourceChapters);
+ this.Chapters.Clear();
+
+ // Then Add new Chapter Markers.
+ foreach (Chapter chapter in this.SourceChapterList)
{
- this.ExportChaptersToCSV(saveFileDialog.FileName);
+ var marker = new ChapterMarker(chapter.ChapterNumber, chapter.ChapterName);
+ this.Chapters.Add(marker);
}
}
+
+ #endregion
}
-}
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 3b54e3295..2b4c9a08c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -54,6 +54,26 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private Detelecine selectedDetelecine;
+ /// <summary>
+ /// Backing field for the custom decomb value
+ /// </summary>
+ private string customDeinterlace;
+
+ /// <summary>
+ /// Backing field for the custom debcomb value
+ /// </summary>
+ private string customDecomb;
+
+ /// <summary>
+ /// Backing field for the custom detelecine value
+ /// </summary>
+ private string customDetelecine;
+
+ /// <summary>
+ /// Backing field for the custom denoise value
+ /// </summary>
+ private string customDenoise;
+
#endregion
#region Constructors and Destructors
@@ -271,6 +291,96 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public bool ShowDetelecineCustom { get; set; }
+ /// <summary>
+ /// Gets or sets CustomDeinterlace.
+ /// </summary>
+ public string CustomDeinterlace
+ {
+ get
+ {
+ return this.customDeinterlace;
+ }
+ set
+ {
+ this.customDeinterlace = value;
+ this.NotifyOfPropertyChange(() => this.CustomDeinterlace);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CustomDecomb.
+ /// </summary>
+ public string CustomDecomb
+ {
+ get
+ {
+ return this.customDecomb;
+ }
+ set
+ {
+ this.customDecomb = value;
+ this.NotifyOfPropertyChange(() => this.CustomDecomb);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CustomDetelecine.
+ /// </summary>
+ public string CustomDetelecine
+ {
+ get
+ {
+ return this.customDetelecine;
+ }
+ set
+ {
+ this.customDetelecine = value;
+ this.NotifyOfPropertyChange(() => this.CustomDetelecine);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CustomDenoise.
+ /// </summary>
+ public string CustomDenoise
+ {
+ get
+ {
+ return this.customDenoise;
+ }
+ set
+ {
+ this.customDenoise = value;
+ this.NotifyOfPropertyChange(() => this.CustomDenoise);
+ }
+ }
+
#endregion
+
+ /// <summary>
+ /// Setup a selected preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The Current Preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ if (preset != null)
+ {
+ // Properties
+ this.SelectedDenoise = EnumHelper<Denoise>.GetDisplay(preset.Task.Denoise);
+ this.SelectedDecomb = EnumHelper<Decomb>.GetDisplay(preset.Task.Decomb);
+ this.SelectedDeInterlace = EnumHelper<Deinterlace>.GetDisplay(preset.Task.Deinterlace);
+ this.SelectedDetelecine = EnumHelper<Detelecine>.GetDisplay(preset.Task.Detelecine);
+ this.Grayscale = preset.Task.Grayscale;
+ this.DeblockValue = preset.Task.Deblock;
+
+ // Custom Values
+ this.CustomDecomb = preset.Task.CustomDecomb;
+ this.CustomDeinterlace = preset.Task.CustomDeinterlace;
+ this.CustomDetelecine = preset.Task.CustomDetelecine;
+ this.CustomDenoise = preset.Task.CustomDenoise;
+ }
+ }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs index 1ffb86c96..199c10ff9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Advanced View Model Interface
/// </summary>
public interface IAdvancedViewModel
{
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ void SetPreset(Preset preset);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs index bd13345db..d29242625 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Audio View Model Interface
/// </summary>
public interface IAudioViewModel
{
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ void SetPreset(Preset preset);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs index 8e9710d74..494e1aaa6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs @@ -9,10 +9,23 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// The Chapters View Model Interface
/// </summary>
public interface IChaptersViewModel
{
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ /// <param name="currentTitle">
+ /// The current Title.
+ /// </param>
+ void Setup(Preset preset, Title currentTitle);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs index 24662f946..3390b328b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Filters View Model Interface
/// </summary>
public interface IFiltersViewModel
{
+ /// <summary>
+ /// Setup a selected preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The Current Preset.
+ /// </param>
+ void SetPreset(Preset preset);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs index 35a8e4eaf..ef816de5f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs @@ -9,10 +9,26 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
+
/// <summary>
/// The Picture Settings View Model Interface
/// </summary>
public interface IPictureSettingsViewModel
{
+ /// <summary>
+ /// Setup the window after a scan.
+ /// </summary>
+ /// <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);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs index 2a490c274..d0ff210b2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Subtiles View Model Interface
/// </summary>
public interface ISubtitlesViewModel
{
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ void SetPreset(Preset preset);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs index 7690b87a9..4a6c01c43 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Video View Model Interface
/// </summary>
public interface IVideoViewModel
{
+ /// <summary>
+ /// Set the selected preset
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ void SetPreset(Preset preset);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 68b327ec1..8899ece9d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1016,6 +1016,21 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange("CurrentTask");
}
+ /// <summary>
+ /// Setup the UI tabs. Passes in any relevant models for setup.
+ /// </summary>
+ 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);
+ }
+
#endregion
#region Event Handlers
@@ -1052,6 +1067,7 @@ namespace HandBrakeWPF.ViewModels 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";
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 5fc397f41..f7ca69f6c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -9,6 +9,7 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Collections.Generic;
using System.ComponentModel.Composition;
using Caliburn.Micro;
@@ -16,6 +17,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -25,6 +27,87 @@ namespace HandBrakeWPF.ViewModels [Export(typeof(IPictureSettingsViewModel))]
public class PictureSettingsViewModel : ViewModelBase, IPictureSettingsViewModel
{
+ #region Constants and Fields
+
+ /// <summary>
+ /// The crop bottom.
+ /// </summary>
+ private int cropBottom;
+
+ /// <summary>
+ /// The crop left.
+ /// </summary>
+ private int cropLeft;
+
+ /// <summary>
+ /// The crop right.
+ /// </summary>
+ private int cropRight;
+
+ /// <summary>
+ /// The crop top.
+ /// </summary>
+ private int cropTop;
+
+ /// <summary>
+ /// The display size.
+ /// </summary>
+ private string displaySize;
+
+ /// <summary>
+ /// The display width.
+ /// </summary>
+ private int displayWidth;
+
+ /// <summary>
+ /// The height.
+ /// </summary>
+ private int height;
+
+ /// <summary>
+ /// The is custom crop.
+ /// </summary>
+ private bool isCustomCrop;
+
+ /// <summary>
+ /// The maintain aspect ratio.
+ /// </summary>
+ private bool maintainAspectRatio;
+
+ /// <summary>
+ /// The par height.
+ /// </summary>
+ private int parHeight;
+
+ /// <summary>
+ /// The par width.
+ /// </summary>
+ private int parWidth;
+
+ /// <summary>
+ /// The selected anamorphic mode.
+ /// </summary>
+ private Anamorphic selectedAnamorphicMode;
+
+ /// <summary>
+ /// The selected modulus
+ /// </summary>
+ private int selectedModulus;
+
+ /// <summary>
+ /// The source info.
+ /// </summary>
+ private string sourceInfo;
+
+ /// <summary>
+ /// The width.
+ /// </summary>
+ private int width;
+
+ #endregion
+
+ #region Constructors and Destructors
+
/// <summary>
/// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.PictureSettingsViewModel"/> class.
/// </summary>
@@ -36,9 +119,280 @@ namespace HandBrakeWPF.ViewModels /// </param>
public PictureSettingsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
+ this.SelectedModulus = 16;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets AnamorphicModes.
+ /// </summary>
+ public IEnumerable<Anamorphic> AnamorphicModes
+ {
+ get
+ {
+ return new List<Anamorphic> { Anamorphic.None, Anamorphic.Strict, Anamorphic.Loose, Anamorphic.Custom };
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CropBottom.
+ /// </summary>
+ public int CropBottom
+ {
+ get
+ {
+ return this.cropBottom;
+ }
+ set
+ {
+ this.cropBottom = value;
+ this.NotifyOfPropertyChange(() => this.CropBottom);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CropLeft.
+ /// </summary>
+ public int CropLeft
+ {
+ get
+ {
+ return this.cropLeft;
+ }
+ set
+ {
+ this.cropLeft = value;
+ this.NotifyOfPropertyChange(() => this.CropLeft);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets CropRight.
+ /// </summary>
+ public int CropRight
+ {
+ get
+ {
+ return this.cropRight;
+ }
+ set
+ {
+ this.cropRight = value;
+ this.NotifyOfPropertyChange(() => this.CropRight);
+ }
}
/// <summary>
+ /// Gets or sets CropTop.
+ /// </summary>
+ public int CropTop
+ {
+ get
+ {
+ return this.cropTop;
+ }
+ set
+ {
+ this.cropTop = value;
+ this.NotifyOfPropertyChange(() => this.CropTop);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets DisplaySize.
+ /// </summary>
+ public string DisplaySize
+ {
+ get
+ {
+ return this.displaySize;
+ }
+ set
+ {
+ this.displaySize = value;
+ this.NotifyOfPropertyChange(() => this.DisplaySize);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets DisplayWidth.
+ /// </summary>
+ public int DisplayWidth
+ {
+ get
+ {
+ return this.displayWidth;
+ }
+ set
+ {
+ this.displayWidth = value;
+ this.NotifyOfPropertyChange(() => this.DisplayWidth);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Height.
+ /// </summary>
+ public int Height
+ {
+ get
+ {
+ return this.height;
+ }
+ set
+ {
+ this.height = value;
+ this.NotifyOfPropertyChange(() => this.Height);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsCustomCrop.
+ /// </summary>
+ public bool IsCustomCrop
+ {
+ get
+ {
+ return this.isCustomCrop;
+ }
+ set
+ {
+ this.isCustomCrop = value;
+ this.NotifyOfPropertyChange(() => this.IsCustomCrop);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether MaintainAspectRatio.
+ /// </summary>
+ public bool MaintainAspectRatio
+ {
+ get
+ {
+ return this.maintainAspectRatio;
+ }
+ set
+ {
+ this.maintainAspectRatio = value;
+ this.NotifyOfPropertyChange(() => this.MaintainAspectRatio);
+ }
+ }
+
+ /// <summary>
+ /// Gets ModulusValues.
+ /// </summary>
+ public IEnumerable<int> ModulusValues
+ {
+ get
+ {
+ return new List<int> { 16, 8, 4, 2 };
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets ParHeight.
+ /// </summary>
+ public int ParHeight
+ {
+ get
+ {
+ return this.parHeight;
+ }
+ set
+ {
+ this.parHeight = value;
+ this.NotifyOfPropertyChange(() => this.ParHeight);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets ParWidth.
+ /// </summary>
+ public int ParWidth
+ {
+ get
+ {
+ return this.parWidth;
+ }
+ set
+ {
+ this.parWidth = value;
+ this.NotifyOfPropertyChange(() => this.ParWidth);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SelectedAnamorphicMode.
+ /// </summary>
+ public Anamorphic SelectedAnamorphicMode
+ {
+ get
+ {
+ return this.selectedAnamorphicMode;
+ }
+ set
+ {
+ this.selectedAnamorphicMode = value;
+ this.NotifyOfPropertyChange(() => this.SelectedAnamorphicMode);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SelectedModulus.
+ /// </summary>
+ public int SelectedModulus
+ {
+ get
+ {
+ return this.selectedModulus;
+ }
+ set
+ {
+ this.selectedModulus = value;
+ this.NotifyOfPropertyChange(() => this.SelectedModulus);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SourceInfo.
+ /// </summary>
+ public string SourceInfo
+ {
+ get
+ {
+ return this.sourceInfo;
+ }
+ set
+ {
+ this.sourceInfo = value;
+ this.NotifyOfPropertyChange(() => this.SourceInfo);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets Width.
+ /// </summary>
+ public int Width
+ {
+ get
+ {
+ return this.width;
+ }
+ set
+ {
+ this.width = value;
+ this.NotifyOfPropertyChange(() => this.Width);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
/// Setup the window after a scan.
/// </summary>
/// <param name="selectedTitle">
@@ -47,9 +401,13 @@ namespace HandBrakeWPF.ViewModels /// <param name="currentTask">
/// The current task.
/// </param>
- public void Setup(Title selectedTitle, EncodeTask currentTask)
+ /// <param name="currentPreset">
+ /// The Current preset
+ /// </param>
+ public void Setup(Title selectedTitle, EncodeTask currentTask, Preset currentPreset)
{
-
}
+
+ #endregion
}
-}
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index d57f19fb9..81a9c07db 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -20,6 +20,8 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.ViewModels.Interfaces;
+ using HandBrake.ApplicationServices.Model;
+
/// <summary>
/// The Subtitles View Model
/// </summary>
@@ -46,6 +48,16 @@ namespace HandBrakeWPF.ViewModels public ObservableCollection<SubtitleTrack> SubtitleTracks { get; set; }
/// <summary>
+ /// Set the currently selected preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ }
+
+ /// <summary>
/// Add a new Track
/// </summary>
public void Add()
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 59b6a98f5..0368c781c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -9,11 +9,15 @@ namespace HandBrakeWPF.ViewModels
{
+ using System.Collections.Generic;
using System.ComponentModel.Composition;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Functions;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -23,6 +27,77 @@ namespace HandBrakeWPF.ViewModels [Export(typeof(IVideoViewModel))]
public class VideoViewModel : ViewModelBase, IVideoViewModel
{
+ #region Constants and Fields
+
+ /// <summary>
+ /// The average bitrate.
+ /// </summary>
+ private int averageBitrate;
+
+ /// <summary>
+ /// The is constant framerate.
+ /// </summary>
+ private bool isConstantFramerate;
+
+ /// <summary>
+ /// The is constant quantity.
+ /// </summary>
+ private bool isConstantQuantity;
+
+ /// <summary>
+ /// The is peak framerate.
+ /// </summary>
+ private bool isPeakFramerate;
+
+ /// <summary>
+ /// The is turbo first pass.
+ /// </summary>
+ private bool isTurboFirstPass;
+
+ /// <summary>
+ /// The is two pass.
+ /// </summary>
+ private bool isTwoPass;
+
+ /// <summary>
+ /// The is variable framerate.
+ /// </summary>
+ private bool isVariableFramerate;
+
+ /// <summary>
+ /// The quality max.
+ /// </summary>
+ private int qualityMax;
+
+ /// <summary>
+ /// The quality min.
+ /// </summary>
+ private int qualityMin;
+
+ /// <summary>
+ /// The rf.
+ /// </summary>
+ private int rf;
+
+ /// <summary>
+ /// The selected framerate.
+ /// </summary>
+ private double? selectedFramerate;
+
+ /// <summary>
+ /// The selected video encoder.
+ /// </summary>
+ private VideoEncoder selectedVideoEncoder;
+
+ /// <summary>
+ /// The show peak framerate.
+ /// </summary>
+ private bool showPeakFramerate;
+
+ #endregion
+
+ #region Constructors and Destructors
+
/// <summary>
/// Initializes a new instance of the <see cref="VideoViewModel"/> class.
/// </summary>
@@ -34,6 +109,295 @@ namespace HandBrakeWPF.ViewModels /// </param>
public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
+ this.QualityMin = 0;
+ this.QualityMax = 51;
+ this.IsConstantQuantity = true;
}
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Gets or sets AverageBitrate.
+ /// </summary>
+ public string AverageBitrate
+ {
+ get
+ {
+ return this.averageBitrate.ToString();
+ }
+ set
+ {
+ if (value != null)
+ {
+ this.averageBitrate = int.Parse(value);
+ }
+ this.NotifyOfPropertyChange(() => this.AverageBitrate);
+ }
+ }
+
+ /// <summary>
+ /// Gets Framerates.
+ /// </summary>
+ public IEnumerable<string> Framerates
+ {
+ get
+ {
+ return new List<string> { "Same as source", "5", "10", "12", "15", "23.976", "24", "25", "29.97`" };
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsConstantFramerate.
+ /// </summary>
+ public bool IsConstantFramerate
+ {
+ get
+ {
+ return this.isConstantFramerate;
+ }
+ set
+ {
+ this.isConstantFramerate = value;
+ if (value)
+ {
+ this.IsVariableFramerate = false;
+ this.IsPeakFramerate = false;
+ }
+
+ this.NotifyOfPropertyChange(() => this.IsConstantFramerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsConstantQuantity.
+ /// </summary>
+ public bool IsConstantQuantity
+ {
+ get
+ {
+ return this.isConstantQuantity;
+ }
+ set
+ {
+ this.isConstantQuantity = value;
+ this.NotifyOfPropertyChange(() => this.IsConstantQuantity);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsPeakFramerate.
+ /// </summary>
+ public bool IsPeakFramerate
+ {
+ get
+ {
+ return this.isPeakFramerate;
+ }
+ set
+ {
+ this.isPeakFramerate = value;
+ if (value)
+ {
+ this.IsVariableFramerate = false;
+ this.IsConstantFramerate = false;
+ }
+
+ this.NotifyOfPropertyChange(() => this.IsPeakFramerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsTurboFirstPass.
+ /// </summary>
+ public bool IsTurboFirstPass
+ {
+ get
+ {
+ return this.isTurboFirstPass;
+ }
+ set
+ {
+ this.isTurboFirstPass = value;
+ this.NotifyOfPropertyChange(() => this.IsTurboFirstPass);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsTwoPass.
+ /// </summary>
+ public bool IsTwoPass
+ {
+ get
+ {
+ return this.isTwoPass;
+ }
+ set
+ {
+ this.isTwoPass = value;
+ this.NotifyOfPropertyChange(() => this.IsTwoPass);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsVariableFramerate.
+ /// </summary>
+ public bool IsVariableFramerate
+ {
+ get
+ {
+ return this.isVariableFramerate;
+ }
+ set
+ {
+ this.isVariableFramerate = value;
+ if (value)
+ {
+ this.IsPeakFramerate = false;
+ this.IsConstantFramerate = false;
+ }
+
+ this.NotifyOfPropertyChange(() => this.IsVariableFramerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets QualityMax.
+ /// </summary>
+ public int QualityMax
+ {
+ get
+ {
+ return this.qualityMax;
+ }
+ set
+ {
+ this.qualityMax = value;
+ this.NotifyOfPropertyChange(() => this.QualityMax);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets QualityMin.
+ /// </summary>
+ public int QualityMin
+ {
+ get
+ {
+ return this.qualityMin;
+ }
+ set
+ {
+ this.qualityMin = value;
+ this.NotifyOfPropertyChange(() => this.QualityMin);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets RF.
+ /// </summary>
+ public int RF
+ {
+ get
+ {
+ return this.rf;
+ }
+ set
+ {
+ this.rf = value;
+ this.NotifyOfPropertyChange(() => this.RF);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SelectedFramerate.
+ /// </summary>
+ public string SelectedFramerate
+ {
+ get
+ {
+ if (this.selectedFramerate == null)
+ {
+ return "Same as source";
+ }
+
+ return this.selectedFramerate.ToString();
+ }
+ set
+ {
+ if (value == "Same as source")
+ {
+ this.selectedFramerate = null;
+ this.ShowPeakFramerate = false;
+ }
+ else
+ {
+ this.ShowPeakFramerate = true;
+ this.selectedFramerate = double.Parse(value);
+ }
+
+ this.NotifyOfPropertyChange(() => this.SelectedFramerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets SelectedVideoEncoder.
+ /// </summary>
+ public string SelectedVideoEncoder
+ {
+ get
+ {
+ return EnumHelper<VideoEncoder>.GetDisplay(this.selectedVideoEncoder);
+ }
+ set
+ {
+ this.selectedVideoEncoder = EnumHelper<VideoEncoder>.GetValue(value);
+ this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether ShowPeakFramerate.
+ /// </summary>
+ public bool ShowPeakFramerate
+ {
+ get
+ {
+ return this.showPeakFramerate;
+ }
+ set
+ {
+ this.showPeakFramerate = value;
+ this.NotifyOfPropertyChange(() => this.ShowPeakFramerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets VideoEncoders.
+ /// </summary>
+ public IEnumerable<string> VideoEncoders
+ {
+ get
+ {
+ return EnumHelper<VideoEncoder>.GetEnumDisplayValues(typeof(VideoEncoder));
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Set the currently selected preset.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ public void SetPreset(Preset preset)
+ {
+ }
+
+ #endregion
}
-}
+}
\ No newline at end of file |