diff options
author | sr55 <[email protected]> | 2016-02-06 15:29:34 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2016-02-06 15:29:34 +0000 |
commit | 8ce01f3f60df3e2065e44bdf2629f81b7b10b2b6 (patch) | |
tree | 3dbce92cee59bcd7b3ff09e8dbce0a7f140ef1c4 /win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs | |
parent | 3053ec908dab32b4da6ce9ec022215087a28a37e (diff) |
WinGui:
- Refractor the Audio and Subtitle Defaults into their own View/ViewModel
- Add a new PopupWindow container system.
- Add "Edit Defaults" for Audio and Subtitles on the Add Preset Pane to make the feature more discoverable. (Note, this does not change the existing settings on the Audio/Subtitle Tabs)
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 2d8a7bd68..6bc8b2998 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -12,7 +12,8 @@ namespace HandBrakeWPF.ViewModels using System.Collections.Generic;
using System.Windows;
- using HandBrake.ApplicationServices.Utilities;
+ using Caliburn.Micro;
+
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Model.Audio;
@@ -45,6 +46,11 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
/// <summary>
+ /// The window manager.
+ /// </summary>
+ private readonly IWindowManager windowManager;
+
+ /// <summary>
/// Backing fields for Selected Picture settings mode.
/// </summary>
private PresetPictureSettingsMode selectedPictureSettingMode;
@@ -59,6 +65,9 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private Title selectedTitle;
+ private IAudioDefaultsViewModel audioDefaultsViewModel;
+ private ISubtitlesDefaultsViewModel subtitlesDefaultsViewModel;
+
/// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
@@ -68,10 +77,14 @@ namespace HandBrakeWPF.ViewModels /// <param name="errorService">
/// The Error Service
/// </param>
- public AddPresetViewModel(IPresetService presetService, IErrorService errorService)
+ /// <param name="windowManager">
+ /// The window Manager.
+ /// </param>
+ public AddPresetViewModel(IPresetService presetService, IErrorService errorService, IWindowManager windowManager)
{
this.presetService = presetService;
this.errorService = errorService;
+ this.windowManager = windowManager;
this.Title = "Add Preset";
this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName};
this.PictureSettingsModes = EnumHelper<PresetPictureSettingsMode>.GetEnumList();
@@ -146,9 +159,16 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void Setup(EncodeTask task, Title title, AudioBehaviours audioBehaviours, SubtitleBehaviours subtitleBehaviours)
{
+ this.audioDefaultsViewModel = new AudioDefaultsViewModel();
+ this.audioDefaultsViewModel.SetupLanguages(audioBehaviours);
+
+ this.subtitlesDefaultsViewModel = new SubtitlesDefaultsViewModel();
+ this.subtitlesDefaultsViewModel.SetupLanguages(subtitleBehaviours);
+
this.Preset.Task = new EncodeTask(task);
- this.Preset.AudioTrackBehaviours = audioBehaviours.Clone();
+ this.Preset.AudioTrackBehaviours = audioBehaviours;
this.Preset.SubtitleTrackBehaviours = subtitleBehaviours.Clone();
+
this.selectedTitle = title;
switch (task.Anamorphic)
@@ -236,6 +256,39 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// The edit audio defaults.
+ /// </summary>
+ public void EditAudioDefaults()
+ {
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.audioDefaultsViewModel, ResourcesUI.Preset_AudioDefaults_Title, ResourcesUI.Preset_AudioDefaults_SubText);
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ this.Preset.AudioTrackBehaviours = this.audioDefaultsViewModel.AudioBehaviours.Clone();
+ }
+ else
+ {
+ // Handle other case(s)
+ }
+ }
+
+ /// <summary>
+ /// The edit subtitle defaults.
+ /// </summary>
+ public void EditSubtitleDefaults()
+ {
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.subtitlesDefaultsViewModel, ResourcesUI.Preset_SubtitleDefaults_Title, ResourcesUI.Preset_SubtitleDefaults_SubText);
+
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ this.Preset.SubtitleTrackBehaviours = this.subtitlesDefaultsViewModel.SubtitleBehaviours.Clone();
+ }
+ else
+ {
+ // Handle other case(s)
+ }
+ }
+
+ /// <summary>
/// Cancel adding a preset
/// </summary>
public void Cancel()
|