summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-06-02 22:03:16 +0100
committersr55 <[email protected]>2017-06-02 22:03:16 +0100
commit27f366140509b18897f0dc54194a1a0d55cf0bb6 (patch)
tree62fc39ba1edd10fc4d5914177760df318eb4a25c /win/CS/HandBrakeWPF/ViewModels
parent844a0bf724abc56edcad0390d82bf92eae219144 (diff)
WinGui: Support for the new sharpen filter.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs136
1 files changed, 132 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index 67476f57f..d3afd0e8b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -12,11 +12,15 @@ namespace HandBrakeWPF.ViewModels
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
+ using System.Linq;
using Caliburn.Micro;
+ using HandBrake.ApplicationServices.Interop;
+ using HandBrake.ApplicationServices.Interop.HbLib;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrakeWPF.Model.Filters;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
using HandBrakeWPF.Services.Scan.Model;
@@ -594,11 +598,131 @@ namespace HandBrakeWPF.ViewModels
}
}
+ #region Sharpen Filter
+
+ public IEnumerable<Sharpen> SharpenOptions
+ {
+ get
+ {
+ return EnumHelper<Sharpen>.GetEnumList();
+ }
+ }
+
+ public object SharpenPresets { get; set; }
+
+ public object SharpenTunes { get; set; }
+
+ public Sharpen SelectedSharpen
+ {
+ get
+ {
+ return this.CurrentTask.Sharpen;
+ }
+
+ set
+ {
+ if (value == this.CurrentTask.Sharpen) return;
+ this.CurrentTask.Sharpen = value;
+ this.NotifyOfPropertyChange(() => this.SelectedSharpen);
+ this.NotifyOfPropertyChange(() => this.ShowSharpenOptions);
+ this.NotifyOfPropertyChange(() => this.ShowSharpenTune);
+ this.NotifyOfPropertyChange(() => this.ShowSharpenCustom);
+
+ // Default preset and tune.
+ switch (value)
+ {
+ case Sharpen.LapSharp:
+ if (this.SelectedSharpenPreset == null)
+ this.SelectedSharpenPreset = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_LAPSHARP).FirstOrDefault(s => s.ShortName == "medium"));
+ if (this.SelectedSharpenTune == null)
+ this.SelectedSharpenTune = new FilterTune(HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_LAPSHARP).FirstOrDefault(s => s.ShortName == "none"));
+ break;
+ case Sharpen.UnSharp:
+ if (this.SelectedSharpenPreset == null)
+ this.SelectedSharpenPreset = new FilterPreset(HandBrakeFilterHelpers.GetFilterPresets((int)hb_filter_ids.HB_FILTER_UNSHARP).FirstOrDefault(s => s.ShortName == "medium"));
+ if (this.SelectedSharpenTune == null)
+ this.SelectedSharpenTune = new FilterTune(HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_UNSHARP).FirstOrDefault(s => s.ShortName == "none"));
+ break;
+ }
+
+ this.NotifyOfPropertyChange(() => this.SelectedSharpenTune);
+ this.NotifyOfPropertyChange(() => this.SelectedSharpenPreset);
+ }
+ }
+
+ public FilterPreset SelectedSharpenPreset
+ {
+ get
+ {
+ return this.CurrentTask.SharpenPreset;
+ }
+ set
+ {
+ if (Equals(value, this.CurrentTask.SharpenPreset)) return;
+ this.CurrentTask.SharpenPreset = value;
+ this.NotifyOfPropertyChange(() => this.SelectedSharpenPreset);
+ this.NotifyOfPropertyChange(() => this.ShowSharpenTune);
+ this.NotifyOfPropertyChange(() => this.ShowSharpenCustom);
+ }
+ }
+
+ public FilterTune SelectedSharpenTune
+ {
+ get
+ {
+ return this.CurrentTask.SharpenTune;
+ }
+ set
+ {
+ if (value == this.CurrentTask.SharpenTune) return;
+ this.CurrentTask.SharpenTune = value;
+ this.NotifyOfPropertyChange(() => this.SelectedSharpenTune);
+ }
+ }
+
+ public string CustomSharpen
+ {
+ get
+ {
+ return this.CurrentTask.SharpenCustom;
+ }
+ set
+ {
+ if (value == this.CurrentTask.SharpenCustom) return;
+ this.CurrentTask.SharpenCustom = value;
+ this.NotifyOfPropertyChange(() => this.CustomSharpen);
+ }
+ }
+
+ public bool ShowSharpenTune
+ {
+ get
+ {
+ return this.SelectedSharpenPreset != null && this.SelectedSharpenPreset.DisplayName != "Custom";
+ }
+ }
+
+ public bool ShowSharpenCustom
+ {
+ get
+ {
+ return this.SelectedSharpenPreset != null && this.SelectedSharpenPreset.DisplayName == "Custom";
+ }
+ }
+
+ public bool ShowSharpenOptions
+ {
+ get
+ {
+ return this.SelectedSharpen != Sharpen.Off;
+ }
+ }
+
#endregion
- #region Implemented Interfaces
+ #endregion
- #region ITabInterface
+ #region Implemented Interfaces
/// <summary>
/// Setup this tab for the specified preset.
@@ -641,6 +765,12 @@ namespace HandBrakeWPF.ViewModels
this.SelectedDenoisePreset = preset.Task.DenoisePreset;
this.SelectedDenoiseTune = preset.Task.DenoiseTune;
+ // Sharpen
+ this.SelectedSharpen = preset.Task.Sharpen;
+ this.SelectedSharpenPreset = preset.Task.SharpenPreset;
+ this.SelectedSharpenTune = preset.Task.SharpenTune;
+ this.CustomSharpen = preset.Task.SharpenCustom;
+
// Custom Values
this.CustomDecomb = preset.Task.CustomDecomb;
this.CustomDeinterlace = preset.Task.CustomDeinterlace;
@@ -716,7 +846,5 @@ namespace HandBrakeWPF.ViewModels
}
#endregion
-
- #endregion
}
} \ No newline at end of file