diff options
author | sr55 <[email protected]> | 2017-09-17 15:43:47 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-09-17 15:44:02 +0100 |
commit | 361f4d9e6c055faa48c3ca61a97872d0216261f6 (patch) | |
tree | c298da50abab13e5f7ae07cece8a0bc77fa6fe3d /win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | |
parent | 491e02354e74118ba9aca4ef201c8d2c3a42bda4 (diff) |
WinGui: Initial ground work on code that will detect when the user modifies settings that don't match the currently selected preset.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 83f509269..9d04261b0 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -9,6 +9,7 @@ namespace HandBrakeWPF.ViewModels
{
+ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -20,6 +21,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrake.ApplicationServices.Utilities;
+ using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
@@ -71,6 +73,8 @@ namespace HandBrakeWPF.ViewModels #endregion
+ public event EventHandler<TabStatusEventArgs> TabStatusChanged;
+
#region Properties
/// <summary>
@@ -266,6 +270,81 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.Task);
}
+ public bool MatchesPreset(Preset preset)
+ {
+ // Check the default behaviours still match the preset.
+ if (preset.AudioTrackBehaviours.SelectedBehaviour != this.AudioBehaviours.SelectedBehaviour)
+ {
+ return false;
+ }
+
+ if (preset.AudioTrackBehaviours.SelectedTrackDefaultBehaviour
+ != this.AudioBehaviours.SelectedTrackDefaultBehaviour)
+ {
+ return false;
+ }
+
+ foreach (var item in this.AudioBehaviours.SelectedLangauges)
+ {
+ if (!preset.AudioTrackBehaviours.SelectedLangauges.Contains(item))
+ {
+ return false;
+ }
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowMP3Pass != this.Task.AllowedPassthruOptions.AudioAllowMP3Pass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowAACPass != this.Task.AllowedPassthruOptions.AudioAllowAACPass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowAC3Pass != this.Task.AllowedPassthruOptions.AudioAllowAC3Pass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowEAC3Pass != this.Task.AllowedPassthruOptions.AudioAllowEAC3Pass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowDTSPass != this.Task.AllowedPassthruOptions.AudioAllowDTSPass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowDTSHDPass != this.Task.AllowedPassthruOptions.AudioAllowDTSHDPass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowTrueHDPass != this.Task.AllowedPassthruOptions.AudioAllowTrueHDPass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioAllowFlacPass != this.Task.AllowedPassthruOptions.AudioAllowFlacPass)
+ {
+ return false;
+ }
+
+ if (preset.Task.AllowedPassthruOptions.AudioEncoderFallback != this.Task.AllowedPassthruOptions.AudioEncoderFallback)
+ {
+ return false;
+ }
+
+ if (preset.AudioTrackBehaviours.SelectedLangauges != this.AudioBehaviours.SelectedLangauges)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
/// <summary>
/// Set the Source Title
/// </summary>
@@ -326,6 +405,10 @@ namespace HandBrakeWPF.ViewModels #endregion
#region Methods
+ protected virtual void OnTabStatusChanged(TabStatusEventArgs e)
+ {
+ this.TabStatusChanged?.Invoke(this, e);
+ }
/// <summary>
/// Add the specified source track, or the first track in the SourceTracks collection if available.
|