diff options
author | sr55 <[email protected]> | 2017-11-02 20:21:33 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-11-02 20:23:36 +0000 |
commit | 20cda6ce966d09726d6c00536f3e2705835f8e63 (patch) | |
tree | 7617177d3dd3e039b58c8254289d28f30ddd2329 /win/CS/HandBrakeWPF/ViewModels | |
parent | 07533c32b79b0098d415e3c143d35498c17f108b (diff) |
WinGui: Adding Preset Category support into the Windows UI. Single layer support only. #833
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index f8974a0c4..398fff3c8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
+ using System.Linq;
using System.Windows;
using Caliburn.Micro;
@@ -35,39 +36,20 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public class AddPresetViewModel : ViewModelBase, IAddPresetViewModel
{
- /// <summary>
- /// Backing field for the Preset Service
- /// </summary>
private readonly IPresetService presetService;
-
- /// <summary>
- /// Backing field for the error service
- /// </summary>
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;
-
- /// <summary>
- /// Backging field for show custom inputs
- /// </summary>
private bool showCustomInputs;
-
- /// <summary>
- /// The source.
- /// </summary>
private Title selectedTitle;
private IAudioDefaultsViewModel audioDefaultsViewModel;
private ISubtitlesDefaultsViewModel subtitlesDefaultsViewModel;
+ private PresetDisplayCategory selectedPresetCategory;
+ private readonly PresetDisplayCategory addNewCategory = new PresetDisplayCategory(ResourcesUI.AddPresetView_AddNewCategory, true, null);
+ private bool canAddNewPresetCategory;
+
/// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
@@ -85,9 +67,11 @@ namespace HandBrakeWPF.ViewModels this.presetService = presetService;
this.errorService = errorService;
this.windowManager = windowManager;
- this.Title = "Add Preset";
+ this.Title = ResourcesUI.AddPresetView_AddPreset;
this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName };
this.PictureSettingsModes = EnumHelper<PresetPictureSettingsMode>.GetEnumList();
+ this.PresetCategories = presetService.GetPresetCategories(true).Union(new List<PresetDisplayCategory> { addNewCategory }).ToList();
+ this.SelectedPresetCategory = this.PresetCategories.FirstOrDefault(n => n.Category == PresetService.UserPresetCatgoryName);
}
/// <summary>
@@ -126,6 +110,58 @@ namespace HandBrakeWPF.ViewModels }
}
+ public List<PresetDisplayCategory> PresetCategories { get; set; }
+
+ public PresetDisplayCategory SelectedPresetCategory
+ {
+ get
+ {
+ return this.selectedPresetCategory;
+ }
+ set
+ {
+ this.selectedPresetCategory = value;
+ this.CanAddNewPresetCategory = Equals(value, this.addNewCategory);
+
+ if (this.selectedPresetCategory != null
+ && !object.Equals(this.selectedPresetCategory, this.addNewCategory))
+ {
+ this.PresetCategory = this.selectedPresetCategory.Category;
+ }
+ else
+ {
+ this.PresetCategory = PresetService.UserPresetCatgoryName;
+ }
+ }
+ }
+
+ public string PresetCategory
+ {
+ get
+ {
+ return this.Preset.Category;
+ }
+ set
+ {
+ this.Preset.Category = value;
+ this.NotifyOfPropertyChange(() => this.PresetCategory);
+ }
+ }
+
+ public bool CanAddNewPresetCategory
+ {
+ get
+ {
+ return this.canAddNewPresetCategory;
+ }
+ set
+ {
+ if (value == this.canAddNewPresetCategory) return;
+ this.canAddNewPresetCategory = value;
+ this.NotifyOfPropertyChange();
+ }
+ }
+
/// <summary>
/// Gets or sets SelectedPictureSettingMode.
/// </summary>
|