From 361f4d9e6c055faa48c3ca61a97872d0216261f6 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 17 Sep 2017 15:43:47 +0100 Subject: WinGui: Initial ground work on code that will detect when the user modifies settings that don't match the currently selected preset. --- win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index a65fca5eb..5409e7502 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -55,6 +55,7 @@ namespace HandBrakeWPF.ViewModels this.userSettingService = userSettingService; } + public event EventHandler TabStatusChanged; public event EventHandler OutputFormatChanged; public Preset Preset @@ -309,6 +310,31 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.AlignAVStart); } + public bool MatchesPreset(Preset preset) + { + if (preset.Task.OutputFormat != this.SelectedOutputFormat) + { + return false; + } + + if (preset.Task.OptimizeMP4 != this.OptimizeMP4) + { + return false; + } + + if (preset.Task.AlignAVStart != this.AlignAVStart) + { + return false; + } + + if (preset.Task.IPod5GSupport != this.IPod5GSupport) + { + return false; + } + + return true; + } + public void UpdateDisplayedInfo() { if (this.CurrentTitle == null) @@ -377,6 +403,11 @@ namespace HandBrakeWPF.ViewModels #region Private Methods + protected virtual void OnTabStatusChanged(TabStatusEventArgs e) + { + this.TabStatusChanged?.Invoke(this, e); + } + private void UpdateSettings(Preset selectedPreset) { // Main Window Settings -- cgit v1.2.3