summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorScott <[email protected]>2015-10-24 22:34:31 +0100
committerScott <[email protected]>2015-10-24 22:34:31 +0100
commit054b9d9faf5334cb6c47b31784c87406b51e19fa (patch)
tree8a831aeedf1e9584730095f45ead8966a1ae1b10 /win/CS/HandBrakeWPF/ViewModels
parentcf1ebbc2087abe9ac9ac14c2284397db754b597c (diff)
Improving the Deinterlace / Decomb Filters Tab UI. Now uses the same "presets / custom" format that the other UI's do.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs140
1 files changed, 89 insertions, 51 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index 8810c65d9..f136035ab 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -32,10 +32,7 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public class FiltersViewModel : ViewModelBase, IFiltersViewModel
{
- /// <summary>
- /// The is deinterlace mode.
- /// </summary>
- private bool isDeinterlaceMode;
+ private DeinterlaceFilter deinterlaceFilter;
#region Constructors and Destructors
@@ -52,7 +49,7 @@ namespace HandBrakeWPF.ViewModels
{
this.CurrentTask = new EncodeTask();
this.DeblockValue = 4; // OFF
- this.IsDeinterlaceMode = true;
+ this.SelectedDeinterlaceFilter = DeinterlaceFilter.Off;
}
#endregion
@@ -206,6 +203,17 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Gets DeinterlaceFilterOptions.
+ /// </summary>
+ public IEnumerable<DeinterlaceFilter> DeinterlaceFilterOptions
+ {
+ get
+ {
+ return EnumHelper<DeinterlaceFilter>.GetEnumList();
+ }
+ }
+
+ /// <summary>
/// Gets or sets a value indicating whether Grayscale.
/// </summary>
public bool Grayscale
@@ -235,23 +243,14 @@ namespace HandBrakeWPF.ViewModels
set
{
this.CurrentTask.Deinterlace = value;
- if (this.CurrentTask.Deinterlace != Deinterlace.Off)
- {
- this.SelectedDecomb = Decomb.Off;
- }
-
this.NotifyOfPropertyChange(() => this.SelectedDeInterlace);
if (value != Deinterlace.Custom) this.CustomDeinterlace = string.Empty;
// Show / Hide the Custom Control
- this.ShowDeinterlaceCustom = this.CurrentTask.Deinterlace == Deinterlace.Custom;
+ this.NotifyOfPropertyChange(() => this.ShowDecombCustom);
this.NotifyOfPropertyChange(() => this.ShowDeinterlaceCustom);
-
- if (value != Deinterlace.Off)
- {
- this.IsDeinterlaceMode = true;
- }
+ this.NotifyOfPropertyChange(() => this.ShowDeinterlaceDecombCustom);
}
}
@@ -268,23 +267,14 @@ namespace HandBrakeWPF.ViewModels
set
{
this.CurrentTask.Decomb = value;
- if (this.CurrentTask.Decomb != Decomb.Off)
- {
- this.SelectedDeInterlace = Deinterlace.Off;
- }
-
this.NotifyOfPropertyChange(() => this.SelectedDecomb);
if (value != Decomb.Custom) this.CustomDecomb = string.Empty;
// Show / Hide the Custom Control
- this.ShowDecombCustom = this.CurrentTask.Decomb == Decomb.Custom;
this.NotifyOfPropertyChange(() => this.ShowDecombCustom);
-
- if (value != Decomb.Off)
- {
- this.IsDeinterlaceMode = false;
- }
+ this.NotifyOfPropertyChange(() => this.ShowDeinterlaceCustom);
+ this.NotifyOfPropertyChange(() => this.ShowDeinterlaceDecombCustom);
}
}
@@ -339,12 +329,17 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Gets or sets a value indicating whether ShowDecombCustom.
/// </summary>
- public bool ShowDecombCustom { get; set; }
+ public bool ShowDecombCustom => this.SelectedDeinterlaceFilter == DeinterlaceFilter.Decomb && this.SelectedDecomb == Decomb.Custom;
+
+ /// <summary>
+ /// Gets or sets a value indicating whether ShowDeinterlaceDecombCustom.
+ /// </summary>
+ public bool ShowDeinterlaceDecombCustom => (this.SelectedDeinterlaceFilter == DeinterlaceFilter.Decomb && this.SelectedDecomb == Decomb.Custom) || (this.SelectedDeinterlaceFilter == DeinterlaceFilter.Deinterlace && this.SelectedDeInterlace == Deinterlace.Custom);
/// <summary>
/// Gets or sets a value indicating whether ShowDelelecineCustom.
/// </summary>
- public bool ShowDeinterlaceCustom { get; set; }
+ public bool ShowDeinterlaceCustom => this.SelectedDeinterlaceFilter == DeinterlaceFilter.Deinterlace && this.SelectedDeInterlace == Deinterlace.Custom;
/// <summary>
/// Gets or sets a value indicating whether ShowDenoiseCustom.
@@ -357,41 +352,64 @@ namespace HandBrakeWPF.ViewModels
public bool ShowDetelecineCustom { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether is deinterlace mode.
+ /// Gets or sets the selected deinterlace filter mode.
/// </summary>
- public bool IsDeinterlaceMode
+ public DeinterlaceFilter SelectedDeinterlaceFilter
{
get
{
- return this.isDeinterlaceMode;
+ return this.deinterlaceFilter;
}
set
{
- if (!Equals(this.isDeinterlaceMode, value))
+ if (value == this.deinterlaceFilter)
{
- this.isDeinterlaceMode = value;
- this.NotifyOfPropertyChange(() => this.IsDeinterlaceMode);
-
- this.DeinterlaceControlText = value ? "Deinterlace:" : "Decomb:";
+ return;
+ }
- if (value)
- {
- this.SelectedDecomb = Decomb.Off;
- }
- else
- {
- this.SelectedDeInterlace = Deinterlace.Off;
- }
+ this.deinterlaceFilter = value;
+ this.CurrentTask.DeinterlaceFilter = value;
- this.NotifyOfPropertyChange(() => this.DeinterlaceControlText);
+ if (this.deinterlaceFilter == DeinterlaceFilter.Deinterlace)
+ {
+ this.IsDeinterlaceMode = true;
+ this.IsDecombMode = false;
+ }
+ else if (this.deinterlaceFilter == DeinterlaceFilter.Decomb)
+ {
+ this.IsDeinterlaceMode = false;
+ this.IsDecombMode = true;
+ }
+ else
+ {
+ this.IsDeinterlaceMode = false;
+ this.IsDecombMode = false;
}
+
+ this.NotifyOfPropertyChange(() => this.SelectedDeinterlaceFilter);
+ this.NotifyOfPropertyChange(() => this.IsDeinterlaceMode);
+ this.NotifyOfPropertyChange(() => this.IsDecombMode);
+ this.NotifyOfPropertyChange(() => this.IsDeinterlaceDecomb);
+ this.NotifyOfPropertyChange(() => this.ShowDecombCustom);
+ this.NotifyOfPropertyChange(() => this.ShowDeinterlaceCustom);
+ this.NotifyOfPropertyChange(() => this.ShowDeinterlaceDecombCustom);
}
}
/// <summary>
- /// Gets or sets the deinterlace control text.
+ /// Gets or sets a value indicating whether is deinterlace mode.
+ /// </summary>
+ public bool IsDeinterlaceMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is decomb mode.
/// </summary>
- public string DeinterlaceControlText { get; set; }
+ public bool IsDecombMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is deinterlace or decomb mode.
+ /// </summary>
+ public bool IsDeinterlaceDecomb => this.SelectedDeinterlaceFilter != DeinterlaceFilter.Off;
/// <summary>
/// Gets or sets the selected denoise tune.
@@ -501,9 +519,24 @@ namespace HandBrakeWPF.ViewModels
{
// Properties
this.SelectedDenoise = preset.Task.Denoise;
+ this.SelectedDetelecine = preset.Task.Detelecine;
+
this.SelectedDecomb = preset.Task.Decomb;
this.SelectedDeInterlace = preset.Task.Deinterlace;
- this.SelectedDetelecine = preset.Task.Detelecine;
+ if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace)
+ {
+ this.SelectedDeinterlaceFilter = DeinterlaceFilter.Deinterlace;
+ }
+ else if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb)
+ {
+ this.SelectedDeinterlaceFilter = DeinterlaceFilter.Decomb;
+ }
+ else
+ {
+ this.SelectedDeinterlaceFilter = DeinterlaceFilter.Off;
+ }
+
+
this.Grayscale = preset.Task.Grayscale;
this.DeblockValue = preset.Task.Deblock == 0 ? 4 : preset.Task.Deblock;
this.SelectedDenoisePreset = preset.Task.DenoisePreset;
@@ -519,8 +552,8 @@ namespace HandBrakeWPF.ViewModels
{
// Default everything to off
this.SelectedDenoise = Denoise.Off;
- this.SelectedDecomb = Decomb.Off;
- this.SelectedDeInterlace = Deinterlace.Off;
+ this.SelectedDecomb = Decomb.Default;
+ this.SelectedDeInterlace = Deinterlace.Fast;
this.SelectedDetelecine = Detelecine.Off;
this.Grayscale = false;
this.DeblockValue = 0;
@@ -548,6 +581,11 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.CustomDeinterlace);
this.NotifyOfPropertyChange(() => this.CustomDetelecine);
this.NotifyOfPropertyChange(() => this.CustomDenoise);
+
+ this.NotifyOfPropertyChange(() => this.IsDeinterlaceMode);
+ this.NotifyOfPropertyChange(() => this.IsDecombMode);
+ this.NotifyOfPropertyChange(() => this.IsDeinterlaceDecomb);
+
}
/// <summary>