From 0023b69f26cb79492c5c32e5ba227a5d91da418c Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 17 Apr 2016 15:17:51 +0100 Subject: WinGui: Change the Audio Default and Subtitle panels to be modal windows. (Similar to the MacGUI). This should allow for more space needed to implement Audio templates. Also fixed a sanitise mixdown call crash. --- .../Interop/HandBrakeEncoderHelpers.cs | 5 ++ .../Properties/ResourcesUI.Designer.cs | 9 +++ win/CS/HandBrakeWPF/Properties/ResourcesUI.resx | 3 + .../Services/Encode/Model/Models/AudioTrack.cs | 3 +- win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 61 +++++-------------- .../HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 71 ++++++---------------- win/CS/HandBrakeWPF/Views/AudioView.xaml | 14 +---- win/CS/HandBrakeWPF/Views/PopupWindowView.xaml | 30 +++++---- win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 14 +---- 9 files changed, 71 insertions(+), 139 deletions(-) (limited to 'win') diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs index e4312e451..519d0480a 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -458,6 +458,11 @@ namespace HandBrake.ApplicationServices.Interop /// public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout) { + if (mixdown == null) + { + return null; + } + int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id); if (sanitizedMixdown != -1) { diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 698cf086d..1eab4eee8 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -123,6 +123,15 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to Configure how the Audio Tracks are automatically selected and configured when you select a new title or source video.. + /// + public static string AudioView_AudioDefaultsDescription { + get { + return ResourceManager.GetString("AudioView_AudioDefaultsDescription", resourceCulture); + } + } + /// /// Looks up a localized string similar to 'Auto Passthru' Behaviour:. /// diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index c77f2580c..29a0ea5ec 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -866,4 +866,7 @@ This will not affect your current settings in the Subtitle tab. The selected titles will be added using the "{0}" preset. + + Configure how the Audio Tracks are automatically selected and configured when you select a new title or source video. + \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs index 43138481a..53b162f87 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs @@ -645,12 +645,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models HBMixdown sanitisedMixdown = HandBrakeEncoderHelpers.SanitizeMixdown(currentMixdown, aencoder, (uint)this.ScannedTrack.ChannelLayout); HBMixdown defaultMixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(aencoder, (uint)this.ScannedTrack.ChannelLayout); - if (this.mixDown == null || this.mixDown == "none") { this.MixDown = defaultMixdown.ShortName; } - else + else if (sanitisedMixdown != null) { this.MixDown = sanitisedMixdown.ShortName; } diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 04115d5b8..86f8b36d2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -38,21 +38,10 @@ namespace HandBrakeWPF.ViewModels /// public class AudioViewModel : ViewModelBase, IAudioViewModel { - /// - /// Backing field for the source tracks list. - /// + private readonly IWindowManager windowManager; private IEnumerable