diff options
author | sr55 <[email protected]> | 2019-11-25 21:18:14 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2019-11-25 21:18:27 +0000 |
commit | a5d359d79f28924fd0a57603793d6aa57499c49a (patch) | |
tree | 39e02a5eda92ac8b1571443408d0d4e7d2aa6652 | |
parent | 8de6f15a477e0f903ed7f4d7c3344d5255b21800 (diff) |
WinGui: Fix a bug in the Add presets window where the Audio / Subtitle defaults would not set. Fixes #2457
7 files changed, 38 insertions, 2 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index ab49f09c2..d2c5f9452 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -307,7 +307,9 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void EditAudioDefaults()
{
- if (this.windowManager.ShowDialog(this.audioDefaultsViewModel) == true)
+ this.audioDefaultsViewModel.ResetApplied();
+ bool? result = this.windowManager.ShowDialog(this.audioDefaultsViewModel);
+ if (audioDefaultsViewModel.IsApplied)
{
this.Preset.AudioTrackBehaviours = this.audioDefaultsViewModel.AudioBehaviours.Clone();
}
@@ -318,10 +320,12 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void EditSubtitleDefaults()
{
+ this.subtitlesDefaultsViewModel.ResetApplied();
SubtitlesDefaultsView view = new SubtitlesDefaultsView();
view.DataContext = this.subtitlesDefaultsViewModel;
+ view.ShowDialog();
- if (view.ShowDialog() == true)
+ if (subtitlesDefaultsViewModel.IsApplied)
{
this.Preset.SubtitleTrackBehaviours = this.subtitlesDefaultsViewModel.SubtitleBehaviours.Clone();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs index 8da815bd1..24f32211a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs @@ -130,6 +130,8 @@ namespace HandBrakeWPF.ViewModels } } + public bool IsApplied { get; set; } + /// <summary> /// Gets SelectedLangauges. /// </summary> @@ -430,6 +432,11 @@ namespace HandBrakeWPF.ViewModels this.AudioBehaviours.SelectedLangauges.Clear(); } + public void ResetApplied() + { + this.IsApplied = false; + } + #endregion #region Methods @@ -446,6 +453,7 @@ namespace HandBrakeWPF.ViewModels public void Setup(Preset preset, EncodeTask task) { // Reset + this.IsApplied = false; this.AudioBehaviours = new AudioBehaviours(); // Setup for this Encode Task. diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs index 897568ed8..7136c3cb8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs @@ -23,6 +23,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// </summary>
AudioBehaviours AudioBehaviours { get; }
+ bool IsApplied { get; }
+
/// <summary>
/// The setup languages.
/// </summary>
@@ -38,5 +40,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The refresh task.
/// </summary>
void RefreshTask();
+
+ void ResetApplied();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs index ed4521897..a3b731100 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs @@ -22,6 +22,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// </summary> SubtitleBehaviours SubtitleBehaviours { get; } + bool IsApplied { get; } + /// <summary> /// The setup languages. /// </summary> @@ -37,5 +39,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The behaviours. /// </param> void SetupLanguages(SubtitleBehaviours behaviours); + + void ResetApplied(); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs index f94661bcc..102ae68ac 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs @@ -56,6 +56,8 @@ namespace HandBrakeWPF.ViewModels #region Properties + public bool IsApplied { get; set; } + /// <summary> /// Gets CharacterCodes. /// </summary> @@ -213,6 +215,11 @@ namespace HandBrakeWPF.ViewModels } } + public void ResetApplied() + { + this.IsApplied = false; + } + /// <summary> /// The setup languages. /// </summary> @@ -221,6 +228,9 @@ namespace HandBrakeWPF.ViewModels /// </param> public void SetupLanguages(SubtitleBehaviours behaviours) { + // Reset + this.IsApplied = false; + // Step 1, Set the behaviour mode this.SubtitleBehaviours.SelectedBehaviour = SubtitleBehaviourModes.None; this.SubtitleBehaviours.SelectedBurnInBehaviour = SubtitleBurnInBehaviourModes.None; diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs index f787ba780..57912f52a 100644 --- a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs @@ -12,6 +12,8 @@ namespace HandBrakeWPF.Views using System.Windows; using System.Windows.Controls; + using HandBrakeWPF.ViewModels; + /// <summary> /// Interaction logic for AudioDefaultsView.xaml /// </summary> @@ -27,6 +29,7 @@ namespace HandBrakeWPF.Views private void Apply_OnClick(object sender, RoutedEventArgs e) { + ((AudioDefaultsViewModel)DataContext).IsApplied = true; this.Close(); } } diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs index c0008dc73..429692903 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs @@ -12,6 +12,8 @@ namespace HandBrakeWPF.Views using System.Windows; using System.Windows.Controls; + using HandBrakeWPF.ViewModels; + /// <summary> /// Interaction logic for SubtitlesDefaultsView.xaml /// </summary> @@ -27,6 +29,7 @@ namespace HandBrakeWPF.Views private void Apply_OnClick(object sender, RoutedEventArgs e) { + ((SubtitlesDefaultsViewModel)DataContext).IsApplied = true; this.Close(); } } |