diff options
author | sr55 <[email protected]> | 2011-12-30 18:57:30 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-12-30 18:57:30 +0000 |
commit | cd3e951792f05944fb9ba4f1bc17e581318bfe8f (patch) | |
tree | cc36dcf807b7d371132429fd7a7a5550233ee737 /win/CS/HandBrakeWPF/ViewModels | |
parent | 1a4342793d9c7054b1a70030787af46f77208288 (diff) |
WinGui: (WPF) Move all the main UI tab UserControls into an MVVM format. Mostly code shuffling.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4393 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
24 files changed, 666 insertions, 43 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs index c300487e3..e506fb987 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs @@ -25,11 +25,6 @@ namespace HandBrakeWPF.ViewModels public class AboutViewModel : ViewModelBase, IAboutViewModel
{
/// <summary>
- /// Backing Field for the User setting service.
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// Initializes a new instance of the <see cref="AboutViewModel"/> class.
/// </summary>
/// <param name="windowManager">
@@ -39,9 +34,7 @@ namespace HandBrakeWPF.ViewModels /// The user Setting Service.
/// </param>
public AboutViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
- : base(windowManager)
{
- this.userSettingService = userSettingService;
this.Title = "About HandBrake";
}
@@ -52,11 +45,11 @@ namespace HandBrakeWPF.ViewModels {
get
{
- string nightly = userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
+ string nightly = UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion).Contains("svn") ? " (SVN / Nightly Build)" : string.Empty;
return string.Format(
"{0} ({1}) {2}",
- userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
+ UserSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ UserSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild),
nightly);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index d4a6f077c..c46792c7c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -7,18 +7,20 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-using System.Windows;
-using HandBrake.ApplicationServices.Model;
-using HandBrake.ApplicationServices.Services.Interfaces;
-using HandBrake.ApplicationServices.Utilities;
-using HandBrakeWPF.Services.Interfaces;
-
namespace HandBrakeWPF.ViewModels
{
using System.ComponentModel.Composition;
- using Interfaces;
+ using System.Windows;
+
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.ApplicationServices.Utilities;
+
+ using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.ViewModels.Interfaces;
+
/// <summary>
/// The Add Preset View Model
/// </summary>
@@ -47,7 +49,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="errorService">
/// The Error Service
/// </param>
- public AddPresetViewModel(IWindowManager windowManager, IPresetService presetService, IErrorService errorService) : base(windowManager)
+ public AddPresetViewModel(IWindowManager windowManager, IPresetService presetService, IErrorService errorService)
{
this.presetService = presetService;
this.errorService = errorService;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs new file mode 100644 index 000000000..9b50acc5c --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -0,0 +1,44 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AdvancedViewModel.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>
+// The Advanced View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Advanced View Model
+ /// </summary>
+ [Export(typeof(IAdvancedViewModel))]
+ public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public AdvancedViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets State.
+ /// </summary>
+ public string Query { get; set; }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs new file mode 100644 index 000000000..d8e4c194d --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -0,0 +1,62 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioViewModel.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>
+// The Audio View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.Collections.ObjectModel;
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Audio View Model
+ /// </summary>
+ [Export(typeof(IAudioViewModel))]
+ public class AudioViewModel : ViewModelBase, IAudioViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AudioViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ this.AudioTracks = new ObservableCollection<AudioTrack>();
+ }
+
+ /// <summary>
+ /// Gets or sets AudioTracks.
+ /// </summary>
+ public ObservableCollection<AudioTrack> AudioTracks { get; set; }
+
+ /// <summary>
+ /// Add an Audio Track
+ /// </summary>
+ public void Add()
+ {
+ this.AudioTracks.Add(new AudioTrack());
+ }
+
+ /// <summary>
+ /// Remove the Selected Track
+ /// </summary>
+ public void Remove()
+ {
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs new file mode 100644 index 000000000..672082b51 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -0,0 +1,177 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ChaptersViewModel.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>
+// The Chapters View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
+ using System.ComponentModel.Composition;
+ using System.IO;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Exceptions;
+ using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ using Ookii.Dialogs.Wpf;
+
+ /// <summary>
+ /// The Chapters View Model
+ /// </summary>
+ [Export(typeof(IChaptersViewModel))]
+ public class ChaptersViewModel : ViewModelBase, IChaptersViewModel
+ {
+ /// <summary>
+ /// Gets or sets SourceChapterList.
+ /// </summary>
+ private ObservableCollection<Chapter> SourceChapterList { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChaptersViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public ChaptersViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ this.Chapters = new ObservableCollection<ChapterMarker>();
+ }
+
+ /// <summary>
+ /// Gets or sets State.
+ /// </summary>
+ public ObservableCollection<ChapterMarker> Chapters { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether chapter markers are enabled.
+ /// </summary>
+ public bool IncludeChapterMarkers { get; set; }
+
+ /// <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 SourceChapterList)
+ {
+ ChapterMarker marker = new ChapterMarker(chapter.ChapterNumber, chapter.ChapterName);
+ this.Chapters.Add(marker);
+ }
+ }
+
+ /// <summary>
+ /// Export the Chapter Markers to a CSV file
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <exception cref="GeneralApplicationException">
+ /// Thrown when exporting fails.
+ /// </exception>
+ public void ExportChaptersToCSV(string filename)
+ {
+ try
+ {
+ string csv = string.Empty;
+
+ foreach (ChapterMarker row in this.Chapters)
+ {
+ csv += row.ChapterNumber.ToString();
+ csv += ",";
+ csv += row.ChapterName.Replace(",", "\\,");
+ csv += Environment.NewLine;
+ }
+ StreamWriter 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);
+ }
+ }
+
+ /// <summary>
+ /// Import a CSV file
+ /// </summary>
+ private void Import()
+ {
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "CSV files (*.csv)|*.csv", CheckFileExists = true };
+ dialog.ShowDialog();
+ string filename = dialog.FileName;
+
+ if (string.IsNullOrEmpty(filename))
+ {
+ return;
+ }
+
+ IDictionary<int, string> chapterMap = new Dictionary<int, string>();
+ try
+ {
+ StreamReader sr = new StreamReader(filename);
+ string csv = sr.ReadLine();
+ while (csv != null)
+ {
+ if (csv.Trim() != string.Empty)
+ {
+ csv = csv.Replace("\\,", "<!comma!>");
+ string[] contents = csv.Split(',');
+ int chapter;
+ int.TryParse(contents[0], out chapter);
+ chapterMap.Add(chapter, contents[1].Replace("<!comma!>", ","));
+ }
+ csv = sr.ReadLine();
+ }
+ }
+ catch (Exception)
+ {
+ // Do Nothing
+ }
+
+ // Now iterate over each chatper we have, and set it's name
+ foreach (ChapterMarker item in Chapters)
+ {
+ string chapterName;
+ chapterMap.TryGetValue(item.ChapterNumber, out chapterName);
+ item.ChapterName = chapterName;
+ // TODO force a fresh of this property
+ }
+ }
+
+ /// <summary>
+ /// Export a CSV file.
+ /// </summary>
+ private void Export()
+ {
+ VistaSaveFileDialog saveFileDialog = new VistaSaveFileDialog { Filter = "Csv File|*.csv", DefaultExt = "csv", CheckPathExists = true };
+ saveFileDialog.ShowDialog();
+ if (!string.IsNullOrEmpty(saveFileDialog.FileName))
+ {
+ this.ExportChaptersToCSV(saveFileDialog.FileName);
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ErrorViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ErrorViewModel.cs index b93671970..bed8806a4 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ErrorViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ErrorViewModel.cs @@ -46,7 +46,6 @@ namespace HandBrakeWPF.ViewModels /// Initializes a new instance of the <see cref="ErrorViewModel"/> class.
/// </summary>
public ErrorViewModel()
- : base(null)
{
this.Title = "Error";
this.ErrorMessage = "An Unknown Error has occured.";
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs new file mode 100644 index 000000000..571606e1d --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -0,0 +1,39 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FiltersViewModel.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>
+// The Filters View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Filters View Model
+ /// </summary>
+ [Export(typeof(IFiltersViewModel))]
+ public class FiltersViewModel : ViewModelBase, IFiltersViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FiltersViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public FiltersViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs new file mode 100644 index 000000000..1ffb86c96 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IAdvancedViewModel.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 IAdvancedViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Advanced View Model Interface
+ /// </summary>
+ public interface IAdvancedViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs new file mode 100644 index 000000000..bd13345db --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IAudioViewModel.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 IAudioViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Audio View Model Interface
+ /// </summary>
+ public interface IAudioViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs new file mode 100644 index 000000000..8e9710d74 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IChaptersViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IChaptersViewModel.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 IChaptersViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Chapters View Model Interface
+ /// </summary>
+ public interface IChaptersViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs index a0fa8e36d..6094157b0 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IErrorViewModel.cs @@ -15,17 +15,17 @@ namespace HandBrakeWPF.ViewModels.Interfaces public interface IErrorViewModel
{
/// <summary>
- /// The Error Details
+ /// Sets Details.
/// </summary>
string Details { set; }
/// <summary>
- /// The Error Message
+ /// Sets ErrorMessage.
/// </summary>
string ErrorMessage { set; }
/// <summary>
- /// The Error Solution
+ /// Sets Solution.
/// </summary>
string Solution { set; }
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs new file mode 100644 index 000000000..24662f946 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IFiltersViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IFiltersViewModel.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 IFiltersViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Filters View Model Interface
+ /// </summary>
+ public interface IFiltersViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs new file mode 100644 index 000000000..35a8e4eaf --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPictureSettingsViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IPictureSettingsViewModel.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 IPictureSettingsViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Picture Settings View Model Interface
+ /// </summary>
+ public interface IPictureSettingsViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs new file mode 100644 index 000000000..2a490c274 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ISubtitlesViewModel.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 ISubtitlesViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Subtiles View Model Interface
+ /// </summary>
+ public interface ISubtitlesViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs new file mode 100644 index 000000000..7690b87a9 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IVideoViewModel.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 IVideoViewModel type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels.Interfaces
+{
+ /// <summary>
+ /// The Video View Model Interface
+ /// </summary>
+ public interface IVideoViewModel
+ {
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs index aeba8e32e..8733445fd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -69,7 +69,6 @@ namespace HandBrakeWPF.ViewModels /// The scan service.
/// </param>
public LogViewModel(IWindowManager windowManager, IEncode encodeService, IScan scanService)
- : base(windowManager)
{
this.encodeService = encodeService;
this.scanService = scanService;
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index d742eea5c..daf8bcce0 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -42,11 +42,6 @@ namespace HandBrakeWPF.ViewModels #region Private Variables and Services
/// <summary>
- /// The Backing field for the user setting service.
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// The Source Scan Service.
/// </summary>
private readonly IScan scanService;
@@ -153,9 +148,7 @@ namespace HandBrakeWPF.ViewModels [ImportingConstructor]
public MainViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
IErrorService errorService)
- : base(windowManager)
{
- this.userSettingService = userSettingService;
this.scanService = scanService;
this.encodeService = encodeService;
this.presetService = presetService;
@@ -178,6 +171,44 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
}
+ #region View Model Properties
+ /// <summary>
+ /// Gets or sets PictureSettingsViewModel.
+ /// </summary>
+ public IPictureSettingsViewModel PictureSettingsViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets AudioViewModel.
+ /// </summary>
+ public IAudioViewModel AudioViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets SubtitleViewModel.
+ /// </summary>
+ public ISubtitlesViewModel SubtitleViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets ChaptersViewModel.
+ /// </summary>
+ public IChaptersViewModel ChaptersViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets AdvancedViewModel.
+ /// </summary>
+ public IAdvancedViewModel AdvancedViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets VideoViewModel.
+ /// </summary>
+ public IVideoViewModel VideoViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets FiltersViewModel.
+ /// </summary>
+ public IFiltersViewModel FiltersViewModel { get; set; }
+
+ #endregion
+
#region Properties
/// <summary>
/// Gets or sets TestProperty.
@@ -934,7 +965,7 @@ namespace HandBrakeWPF.ViewModels // TODO
// 1. Disable GUI.
this.sourcePath = filename;
- this.scanService.Scan(filename, title, this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount));
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount));
}
/// <summary>
@@ -948,7 +979,7 @@ namespace HandBrakeWPF.ViewModels // Make sure the output extension is set correctly based on the users preferences and selection.
if (newExtension == ".mp4" || newExtension == ".m4v")
{
- switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
+ switch (this.UserSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Auto
newExtension = this.CurrentTask.RequiresM4v ? ".m4v" : ".mp4";
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 4d11f6786..1f5802503 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -318,10 +318,9 @@ namespace HandBrakeWPF.ViewModels /// The user Setting Service.
/// </param>
public OptionsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
- : base(windowManager)
{
this.Title = "Options";
- this.userSettingService = userSettingService;
+ this.userSettingService = this.UserSettingService;
this.Load();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs new file mode 100644 index 000000000..60c6feb09 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -0,0 +1,39 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PictureSettingsViewModel.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>
+// The Picture Settings View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Picture Settings View Model
+ /// </summary>
+ [Export(typeof(IPictureSettingsViewModel))]
+ public class PictureSettingsViewModel : ViewModelBase, IPictureSettingsViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.PictureSettingsViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public PictureSettingsViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs index e7fd8f098..0f9c7a213 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs @@ -23,7 +23,7 @@ namespace HandBrakeWPF.ViewModels /// <param name="windowManager">
/// The window manager.
/// </param>
- public PreviewViewModel(IWindowManager windowManager) : base(windowManager)
+ public PreviewViewModel(IWindowManager windowManager)
{
this.Title = "Preview";
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index e651d9830..060d9ec38 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -65,7 +65,6 @@ namespace HandBrakeWPF.ViewModels /// The Error Service
/// </param>
public QueueViewModel(IWindowManager windowManager, IQueueProcessor queueProcessor, IErrorService errorService)
- : base(windowManager)
{
this.queueProcessor = queueProcessor;
this.errorService = errorService;
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs new file mode 100644 index 000000000..d57f19fb9 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -0,0 +1,72 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitlesViewModel.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>
+// The Subtitles View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System;
+ using System.Collections.ObjectModel;
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Subtitles View Model
+ /// </summary>
+ [Export(typeof(ISubtitlesViewModel))]
+ public class SubtitlesViewModel : ViewModelBase, ISubtitlesViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.SubtitlesViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public SubtitlesViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();
+ }
+
+ /// <summary>
+ /// Gets or sets State.
+ /// </summary>
+ public ObservableCollection<SubtitleTrack> SubtitleTracks { get; set; }
+
+ /// <summary>
+ /// Add a new Track
+ /// </summary>
+ public void Add()
+ {
+ this.SubtitleTracks.Add(new SubtitleTrack());
+ }
+
+ /// <summary>
+ /// Remove a Track
+ /// </summary>
+ public void Remove()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Import an SRT File.
+ /// </summary>
+ public void Import()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs new file mode 100644 index 000000000..59b6a98f5 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -0,0 +1,39 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoViewModel.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>
+// The Video View Model
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.ViewModels
+{
+ using System.ComponentModel.Composition;
+
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ using HandBrakeWPF.ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Video View Model
+ /// </summary>
+ [Export(typeof(IVideoViewModel))]
+ public class VideoViewModel : ViewModelBase, IVideoViewModel
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoViewModel"/> class.
+ /// </summary>
+ /// <param name="windowManager">
+ /// The window manager.
+ /// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ {
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs index e226fc549..f1766741e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -11,6 +11,8 @@ namespace HandBrakeWPF.ViewModels {
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -37,12 +39,8 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Initializes a new instance of the <see cref="ViewModelBase"/> class.
/// </summary>
- /// <param name="windowManager">
- /// The window manager.
- /// </param>
- public ViewModelBase(IWindowManager windowManager)
+ public ViewModelBase()
{
- this.WindowManager = windowManager;
}
#endregion
@@ -67,9 +65,14 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets WindowManager.
+ /// Gets or sets WindowManager.
+ /// </summary>
+ public IWindowManager WindowManager { get; set; }
+
+ /// <summary>
+ /// Gets or sets UserSettingService.
/// </summary>
- public IWindowManager WindowManager { get; private set; }
+ public IUserSettingService UserSettingService { get; set; }
#endregion
|