From 54e6a851ccec4be58087f8d90d4e04fb2623b4b5 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 8 Jan 2012 15:09:40 +0000 Subject: 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 --- .../Services/ScanService.cs | 2 +- win/CS/HandBrakeWPF/Converters/BooleanConverter.cs | 78 +++++ win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 1 + .../HandBrakeWPF/ViewModels/AdvancedViewModel.cs | 115 ++++++- win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 11 + .../HandBrakeWPF/ViewModels/ChaptersViewModel.cs | 117 +++++-- win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs | 110 +++++++ .../ViewModels/Interfaces/IAdvancedViewModel.cs | 9 + .../ViewModels/Interfaces/IAudioViewModel.cs | 9 + .../ViewModels/Interfaces/IChaptersViewModel.cs | 13 + .../ViewModels/Interfaces/IFiltersViewModel.cs | 9 + .../Interfaces/IPictureSettingsViewModel.cs | 16 + .../ViewModels/Interfaces/ISubtitlesViewModel.cs | 9 + .../ViewModels/Interfaces/IVideoViewModel.cs | 9 + win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 16 + .../ViewModels/PictureSettingsViewModel.cs | 364 +++++++++++++++++++- .../HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 12 + win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 366 ++++++++++++++++++++- win/CS/HandBrakeWPF/Views/ChaptersView.xaml | 4 +- win/CS/HandBrakeWPF/Views/FiltersView.xaml | 8 +- win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml | 39 ++- win/CS/HandBrakeWPF/Views/VideoView.xaml | 37 ++- 22 files changed, 1280 insertions(+), 74 deletions(-) create mode 100644 win/CS/HandBrakeWPF/Converters/BooleanConverter.cs diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index da9be176b..7c6192636 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -98,7 +98,7 @@ namespace HandBrake.ApplicationServices.Services { get { - string noLog = "No log data available... Log data will show where after you scan a source. \n\nOpen the log file directory to get previous log files."; + string noLog = "No log data available... Log data will show here after you scan a source. \n\nOpen the log file directory to get previous log files."; return string.IsNullOrEmpty(this.logBuffer.ToString()) ? this.header + noLog : this.header + this.logBuffer.ToString(); } } diff --git a/win/CS/HandBrakeWPF/Converters/BooleanConverter.cs b/win/CS/HandBrakeWPF/Converters/BooleanConverter.cs new file mode 100644 index 000000000..a01b3bf67 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/BooleanConverter.cs @@ -0,0 +1,78 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Defines the BooleanConverter type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Converters +{ + using System.Globalization; + using System.Windows.Data; + using System; + + /// + /// Boolean to Visibility Converter + /// + public sealed class BooleanConverter : IValueConverter + { + /// + /// Convert a boolean to visibility property. + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. (A boolean which inverts the output) + /// + /// + /// The culture. + /// + /// + /// Visibility property + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + // Paramater is a boolean which inverts the output. + var param = System.Convert.ToBoolean(parameter, CultureInfo.InvariantCulture); + + if (value is Boolean) + { + return param ? !(bool)value : value; + } + + return value; + } + + /// + /// Convert Back for the IValueConverter Interface. Not used! + /// + /// + /// The value. + /// + /// + /// The target type. + /// + /// + /// The parameter. + /// + /// + /// The culture. + /// + /// + /// Nothing + /// + /// + /// This method is not used! + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return this.Convert(value, targetType, parameter, culture); + } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 17c12b9a2..86bb02532 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -81,6 +81,7 @@ MSBuild:Compile Designer + 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 + + /// + /// The query. + /// + private string query; + + /// + /// The x264 preset. + /// + private x264Preset x264Preset; + + /// + /// The x264 profile. + /// + private x264Profile x264Profile; + + /// + /// The x264 tune. + /// + private x264Tune x264Tune; + + #endregion + + #region Constructors and Destructors + /// /// Initializes a new instance of the class. /// @@ -36,9 +64,92 @@ namespace HandBrakeWPF.ViewModels { } + #endregion + + #region Public Properties + /// /// Gets or sets State. /// - public string Query { get; set; } + public string Query + { + get + { + return this.query; + } + set + { + this.query = value; + this.NotifyOfPropertyChange(() => this.Query); + } + } + + /// + /// Gets or sets X264Preset. + /// + public x264Preset X264Preset + { + get + { + return this.x264Preset; + } + set + { + this.x264Preset = value; + this.NotifyOfPropertyChange(() => this.X264Preset); + } + } + + /// + /// Gets or sets X264Profile. + /// + public x264Profile X264Profile + { + get + { + return this.x264Profile; + } + set + { + this.x264Profile = value; + this.NotifyOfPropertyChange(() => this.X264Profile); + } + } + + /// + /// Gets or sets X264Tune. + /// + public x264Tune X264Tune + { + get + { + return this.x264Tune; + } + set + { + this.x264Tune = value; + this.NotifyOfPropertyChange(() => this.X264Tune); + } + } + + #endregion + + #region Public Methods + + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + 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() { } + + /// + /// Set the selected preset. + /// + /// + /// The preset. + /// + 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 + /// - /// Gets or sets SourceChapterList. + /// The include chapter markers. /// - private ObservableCollection SourceChapterList { get; set; } + private bool includeChapterMarkers; + + #endregion + + #region Constructors and Destructors /// /// Initializes a new instance of the class. @@ -51,6 +58,10 @@ namespace HandBrakeWPF.ViewModels this.Chapters = new ObservableCollection(); } + #endregion + + #region Public Properties + /// /// Gets or sets State. /// @@ -59,25 +70,45 @@ namespace HandBrakeWPF.ViewModels /// /// Gets or sets a value indicating whether chapter markers are enabled. /// - public bool IncludeChapterMarkers { get; set; } + public bool IncludeChapterMarkers + { + get + { + return this.includeChapterMarkers; + } + set + { + this.includeChapterMarkers = value; + this.NotifyOfPropertyChange(() => this.IncludeChapterMarkers); + } + } + + #endregion + + #region Properties /// - /// Set the Source Chapters List + /// Gets or sets SourceChapterList. /// - /// - /// The source chapters. - /// - public void SetSourceChapters(IEnumerable sourceChapters) - { - // Cache the chapters in this screen - this.SourceChapterList = new ObservableCollection(sourceChapters); - this.Chapters.Clear(); + private ObservableCollection SourceChapterList { get; set; } - // Then Add new Chapter Markers. - foreach (Chapter chapter in SourceChapterList) + #endregion + + #region Public Methods + + /// + /// Export a CSV file. + /// + 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); } } /// /// Import a CSV file /// - 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 chapterMap = new Dictionary(); 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 } } /// - /// Export a CSV file. + /// The set preset. /// - private void Export() + /// + /// The preset. + /// + /// + /// The current Title. + /// + 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); + } + + /// + /// Set the Source Chapters List + /// + /// + /// The source chapters. + /// + public void SetSourceChapters(IEnumerable sourceChapters) + { + // Cache the chapters in this screen + this.SourceChapterList = new ObservableCollection(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 /// private Detelecine selectedDetelecine; + /// + /// Backing field for the custom decomb value + /// + private string customDeinterlace; + + /// + /// Backing field for the custom debcomb value + /// + private string customDecomb; + + /// + /// Backing field for the custom detelecine value + /// + private string customDetelecine; + + /// + /// Backing field for the custom denoise value + /// + private string customDenoise; + #endregion #region Constructors and Destructors @@ -271,6 +291,96 @@ namespace HandBrakeWPF.ViewModels /// public bool ShowDetelecineCustom { get; set; } + /// + /// Gets or sets CustomDeinterlace. + /// + public string CustomDeinterlace + { + get + { + return this.customDeinterlace; + } + set + { + this.customDeinterlace = value; + this.NotifyOfPropertyChange(() => this.CustomDeinterlace); + } + } + + /// + /// Gets or sets CustomDecomb. + /// + public string CustomDecomb + { + get + { + return this.customDecomb; + } + set + { + this.customDecomb = value; + this.NotifyOfPropertyChange(() => this.CustomDecomb); + } + } + + /// + /// Gets or sets CustomDetelecine. + /// + public string CustomDetelecine + { + get + { + return this.customDetelecine; + } + set + { + this.customDetelecine = value; + this.NotifyOfPropertyChange(() => this.CustomDetelecine); + } + } + + /// + /// Gets or sets CustomDenoise. + /// + public string CustomDenoise + { + get + { + return this.customDenoise; + } + set + { + this.customDenoise = value; + this.NotifyOfPropertyChange(() => this.CustomDenoise); + } + } + #endregion + + /// + /// Setup a selected preset. + /// + /// + /// The Current Preset. + /// + public void SetPreset(Preset preset) + { + if (preset != null) + { + // Properties + this.SelectedDenoise = EnumHelper.GetDisplay(preset.Task.Denoise); + this.SelectedDecomb = EnumHelper.GetDisplay(preset.Task.Decomb); + this.SelectedDeInterlace = EnumHelper.GetDisplay(preset.Task.Deinterlace); + this.SelectedDetelecine = EnumHelper.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; + /// /// The Advanced View Model Interface /// public interface IAdvancedViewModel { + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + 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; + /// /// The Audio View Model Interface /// public interface IAudioViewModel { + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + 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; + /// /// The Chapters View Model Interface /// public interface IChaptersViewModel { + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + /// + /// The current Title. + /// + 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; + /// /// The Filters View Model Interface /// public interface IFiltersViewModel { + /// + /// Setup a selected preset. + /// + /// + /// The Current Preset. + /// + 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; + /// /// The Picture Settings View Model Interface /// public interface IPictureSettingsViewModel { + /// + /// Setup the window after a scan. + /// + /// + /// The selected title. + /// + /// + /// The current task. + /// + /// + /// The Current preset + /// + 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; + /// /// The Subtiles View Model Interface /// public interface ISubtitlesViewModel { + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + 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; + /// /// The Video View Model Interface /// public interface IVideoViewModel { + /// + /// Set the selected preset + /// + /// + /// The preset. + /// + 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"); } + /// + /// Setup the UI tabs. Passes in any relevant models for setup. + /// + 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 + + /// + /// The crop bottom. + /// + private int cropBottom; + + /// + /// The crop left. + /// + private int cropLeft; + + /// + /// The crop right. + /// + private int cropRight; + + /// + /// The crop top. + /// + private int cropTop; + + /// + /// The display size. + /// + private string displaySize; + + /// + /// The display width. + /// + private int displayWidth; + + /// + /// The height. + /// + private int height; + + /// + /// The is custom crop. + /// + private bool isCustomCrop; + + /// + /// The maintain aspect ratio. + /// + private bool maintainAspectRatio; + + /// + /// The par height. + /// + private int parHeight; + + /// + /// The par width. + /// + private int parWidth; + + /// + /// The selected anamorphic mode. + /// + private Anamorphic selectedAnamorphicMode; + + /// + /// The selected modulus + /// + private int selectedModulus; + + /// + /// The source info. + /// + private string sourceInfo; + + /// + /// The width. + /// + private int width; + + #endregion + + #region Constructors and Destructors + /// /// Initializes a new instance of the class. /// @@ -36,8 +119,279 @@ namespace HandBrakeWPF.ViewModels /// public PictureSettingsViewModel(IWindowManager windowManager, IUserSettingService userSettingService) { + this.SelectedModulus = 16; + } + + #endregion + + #region Public Properties + + /// + /// Gets AnamorphicModes. + /// + public IEnumerable AnamorphicModes + { + get + { + return new List { Anamorphic.None, Anamorphic.Strict, Anamorphic.Loose, Anamorphic.Custom }; + } + } + + /// + /// Gets or sets CropBottom. + /// + public int CropBottom + { + get + { + return this.cropBottom; + } + set + { + this.cropBottom = value; + this.NotifyOfPropertyChange(() => this.CropBottom); + } + } + + /// + /// Gets or sets CropLeft. + /// + public int CropLeft + { + get + { + return this.cropLeft; + } + set + { + this.cropLeft = value; + this.NotifyOfPropertyChange(() => this.CropLeft); + } + } + + /// + /// Gets or sets CropRight. + /// + public int CropRight + { + get + { + return this.cropRight; + } + set + { + this.cropRight = value; + this.NotifyOfPropertyChange(() => this.CropRight); + } } + /// + /// Gets or sets CropTop. + /// + public int CropTop + { + get + { + return this.cropTop; + } + set + { + this.cropTop = value; + this.NotifyOfPropertyChange(() => this.CropTop); + } + } + + /// + /// Gets or sets DisplaySize. + /// + public string DisplaySize + { + get + { + return this.displaySize; + } + set + { + this.displaySize = value; + this.NotifyOfPropertyChange(() => this.DisplaySize); + } + } + + /// + /// Gets or sets DisplayWidth. + /// + public int DisplayWidth + { + get + { + return this.displayWidth; + } + set + { + this.displayWidth = value; + this.NotifyOfPropertyChange(() => this.DisplayWidth); + } + } + + /// + /// Gets or sets Height. + /// + public int Height + { + get + { + return this.height; + } + set + { + this.height = value; + this.NotifyOfPropertyChange(() => this.Height); + } + } + + /// + /// Gets or sets a value indicating whether IsCustomCrop. + /// + public bool IsCustomCrop + { + get + { + return this.isCustomCrop; + } + set + { + this.isCustomCrop = value; + this.NotifyOfPropertyChange(() => this.IsCustomCrop); + } + } + + /// + /// Gets or sets a value indicating whether MaintainAspectRatio. + /// + public bool MaintainAspectRatio + { + get + { + return this.maintainAspectRatio; + } + set + { + this.maintainAspectRatio = value; + this.NotifyOfPropertyChange(() => this.MaintainAspectRatio); + } + } + + /// + /// Gets ModulusValues. + /// + public IEnumerable ModulusValues + { + get + { + return new List { 16, 8, 4, 2 }; + } + } + + /// + /// Gets or sets ParHeight. + /// + public int ParHeight + { + get + { + return this.parHeight; + } + set + { + this.parHeight = value; + this.NotifyOfPropertyChange(() => this.ParHeight); + } + } + + /// + /// Gets or sets ParWidth. + /// + public int ParWidth + { + get + { + return this.parWidth; + } + set + { + this.parWidth = value; + this.NotifyOfPropertyChange(() => this.ParWidth); + } + } + + /// + /// Gets or sets SelectedAnamorphicMode. + /// + public Anamorphic SelectedAnamorphicMode + { + get + { + return this.selectedAnamorphicMode; + } + set + { + this.selectedAnamorphicMode = value; + this.NotifyOfPropertyChange(() => this.SelectedAnamorphicMode); + } + } + + /// + /// Gets or sets SelectedModulus. + /// + public int SelectedModulus + { + get + { + return this.selectedModulus; + } + set + { + this.selectedModulus = value; + this.NotifyOfPropertyChange(() => this.SelectedModulus); + } + } + + /// + /// Gets or sets SourceInfo. + /// + public string SourceInfo + { + get + { + return this.sourceInfo; + } + set + { + this.sourceInfo = value; + this.NotifyOfPropertyChange(() => this.SourceInfo); + } + } + + /// + /// Gets or sets Width. + /// + public int Width + { + get + { + return this.width; + } + set + { + this.width = value; + this.NotifyOfPropertyChange(() => this.Width); + } + } + + #endregion + + #region Public Methods + /// /// Setup the window after a scan. /// @@ -47,9 +401,13 @@ namespace HandBrakeWPF.ViewModels /// /// The current task. /// - public void Setup(Title selectedTitle, EncodeTask currentTask) + /// + /// The Current preset + /// + 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; + /// /// The Subtitles View Model /// @@ -45,6 +47,16 @@ namespace HandBrakeWPF.ViewModels /// public ObservableCollection SubtitleTracks { get; set; } + /// + /// Set the currently selected preset. + /// + /// + /// The preset. + /// + public void SetPreset(Preset preset) + { + } + /// /// Add a new Track /// 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 + + /// + /// The average bitrate. + /// + private int averageBitrate; + + /// + /// The is constant framerate. + /// + private bool isConstantFramerate; + + /// + /// The is constant quantity. + /// + private bool isConstantQuantity; + + /// + /// The is peak framerate. + /// + private bool isPeakFramerate; + + /// + /// The is turbo first pass. + /// + private bool isTurboFirstPass; + + /// + /// The is two pass. + /// + private bool isTwoPass; + + /// + /// The is variable framerate. + /// + private bool isVariableFramerate; + + /// + /// The quality max. + /// + private int qualityMax; + + /// + /// The quality min. + /// + private int qualityMin; + + /// + /// The rf. + /// + private int rf; + + /// + /// The selected framerate. + /// + private double? selectedFramerate; + + /// + /// The selected video encoder. + /// + private VideoEncoder selectedVideoEncoder; + + /// + /// The show peak framerate. + /// + private bool showPeakFramerate; + + #endregion + + #region Constructors and Destructors + /// /// Initializes a new instance of the class. /// @@ -34,6 +109,295 @@ namespace HandBrakeWPF.ViewModels /// public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService) { + this.QualityMin = 0; + this.QualityMax = 51; + this.IsConstantQuantity = true; } + + #endregion + + #region Public Properties + + /// + /// Gets or sets AverageBitrate. + /// + public string AverageBitrate + { + get + { + return this.averageBitrate.ToString(); + } + set + { + if (value != null) + { + this.averageBitrate = int.Parse(value); + } + this.NotifyOfPropertyChange(() => this.AverageBitrate); + } + } + + /// + /// Gets Framerates. + /// + public IEnumerable Framerates + { + get + { + return new List { "Same as source", "5", "10", "12", "15", "23.976", "24", "25", "29.97`" }; + } + } + + /// + /// Gets or sets a value indicating whether IsConstantFramerate. + /// + public bool IsConstantFramerate + { + get + { + return this.isConstantFramerate; + } + set + { + this.isConstantFramerate = value; + if (value) + { + this.IsVariableFramerate = false; + this.IsPeakFramerate = false; + } + + this.NotifyOfPropertyChange(() => this.IsConstantFramerate); + } + } + + /// + /// Gets or sets a value indicating whether IsConstantQuantity. + /// + public bool IsConstantQuantity + { + get + { + return this.isConstantQuantity; + } + set + { + this.isConstantQuantity = value; + this.NotifyOfPropertyChange(() => this.IsConstantQuantity); + } + } + + /// + /// Gets or sets a value indicating whether IsPeakFramerate. + /// + public bool IsPeakFramerate + { + get + { + return this.isPeakFramerate; + } + set + { + this.isPeakFramerate = value; + if (value) + { + this.IsVariableFramerate = false; + this.IsConstantFramerate = false; + } + + this.NotifyOfPropertyChange(() => this.IsPeakFramerate); + } + } + + /// + /// Gets or sets a value indicating whether IsTurboFirstPass. + /// + public bool IsTurboFirstPass + { + get + { + return this.isTurboFirstPass; + } + set + { + this.isTurboFirstPass = value; + this.NotifyOfPropertyChange(() => this.IsTurboFirstPass); + } + } + + /// + /// Gets or sets a value indicating whether IsTwoPass. + /// + public bool IsTwoPass + { + get + { + return this.isTwoPass; + } + set + { + this.isTwoPass = value; + this.NotifyOfPropertyChange(() => this.IsTwoPass); + } + } + + /// + /// Gets or sets a value indicating whether IsVariableFramerate. + /// + public bool IsVariableFramerate + { + get + { + return this.isVariableFramerate; + } + set + { + this.isVariableFramerate = value; + if (value) + { + this.IsPeakFramerate = false; + this.IsConstantFramerate = false; + } + + this.NotifyOfPropertyChange(() => this.IsVariableFramerate); + } + } + + /// + /// Gets or sets QualityMax. + /// + public int QualityMax + { + get + { + return this.qualityMax; + } + set + { + this.qualityMax = value; + this.NotifyOfPropertyChange(() => this.QualityMax); + } + } + + /// + /// Gets or sets QualityMin. + /// + public int QualityMin + { + get + { + return this.qualityMin; + } + set + { + this.qualityMin = value; + this.NotifyOfPropertyChange(() => this.QualityMin); + } + } + + /// + /// Gets or sets RF. + /// + public int RF + { + get + { + return this.rf; + } + set + { + this.rf = value; + this.NotifyOfPropertyChange(() => this.RF); + } + } + + /// + /// Gets or sets SelectedFramerate. + /// + 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); + } + } + + /// + /// Gets or sets SelectedVideoEncoder. + /// + public string SelectedVideoEncoder + { + get + { + return EnumHelper.GetDisplay(this.selectedVideoEncoder); + } + set + { + this.selectedVideoEncoder = EnumHelper.GetValue(value); + this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder); + } + } + + /// + /// Gets or sets a value indicating whether ShowPeakFramerate. + /// + public bool ShowPeakFramerate + { + get + { + return this.showPeakFramerate; + } + set + { + this.showPeakFramerate = value; + this.NotifyOfPropertyChange(() => this.ShowPeakFramerate); + } + } + + /// + /// Gets VideoEncoders. + /// + public IEnumerable VideoEncoders + { + get + { + return EnumHelper.GetEnumDisplayValues(typeof(VideoEncoder)); + } + } + + #endregion + + #region Public Methods + + /// + /// Set the currently selected preset. + /// + /// + /// The preset. + /// + public void SetPreset(Preset preset) + { + } + + #endregion } -} +} \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Views/ChaptersView.xaml b/win/CS/HandBrakeWPF/Views/ChaptersView.xaml index 9166dcf80..1c46e57ee 100644 --- a/win/CS/HandBrakeWPF/Views/ChaptersView.xaml +++ b/win/CS/HandBrakeWPF/Views/ChaptersView.xaml @@ -33,8 +33,6 @@ - - - + diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml index 1460e8f16..53e75a6b0 100644 --- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml +++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml @@ -35,22 +35,22 @@ - - - - diff --git a/win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml b/win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml index 4bc306ddf..5ebe36b33 100644 --- a/win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml +++ b/win/CS/HandBrakeWPF/Views/PictureSettingsView.xaml @@ -1,7 +1,12 @@  + xmlns:NumericUpDown="clr-namespace:EagleBoost.Wpf.Presentation.Controls.NumericUpDown;assembly=EagleBoost.Wpf.Presentation" + xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"> + + + + @@ -12,16 +17,16 @@ @@ -47,20 +52,20 @@ @@ -42,21 +48,24 @@ - - + + - + - - + + - - + + -- cgit v1.2.3