From b62992bfb1623ae6c0930c41e00c2b150ea780d9 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 13 Jan 2013 16:50:49 +0000 Subject: WinGui: Numerous bug fixes. Many around the automatic selection feature on the Audio Panel. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5168 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/Encoding/AudioTrack.cs | 2 +- win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 141 +++++++++++---------- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 1 - win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 8 +- .../HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 82 ++++++------ win/CS/HandBrakeWPF/Views/OptionsView.xaml | 2 +- 6 files changed, 117 insertions(+), 119 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs index 051052e47..c8238927f 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AudioTrack.cs @@ -260,7 +260,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding } /// - /// Gets the The UI display value for sample rate + /// Gets or sets the The UI display value for sample rate /// public string SampleRateDisplayValue { diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 8f7cbbc01..eeb3def77 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -259,7 +259,7 @@ namespace HandBrakeWPF.ViewModels { if (this.SourceTracks != null) { - Audio track = sourceTrack ?? this.SourceTracks.FirstOrDefault(); + Audio track = sourceTrack ?? this.GetPreferredAudioTrack(); if (track != null) { this.Task.AudioTracks.Add(new AudioTrack { ScannedTrack = track }); @@ -272,11 +272,20 @@ namespace HandBrakeWPF.ViewModels /// private void AddAllRemainingTracks() { + // For all the source audio tracks foreach (Audio sourceTrack in this.SourceTracks) { - bool found = this.Task.AudioTracks.Any(audioTrack => audioTrack.ScannedTrack == sourceTrack); + // Step 1: If "Add only One per language" is turned on, check to see if this language is already added. + if (this.CanSkipSourceTrack(sourceTrack)) + { + continue; + } + + // Step 2: Check if the track list already contrains this track + bool found = this.Task.AudioTracks.Any(audioTrack => Equals(audioTrack.ScannedTrack, sourceTrack)); if (!found) { + // If it doesn't, add it. this.Add(sourceTrack); } } @@ -287,24 +296,20 @@ namespace HandBrakeWPF.ViewModels /// public void AddAllRemainingForSelectedLanguages() { - // Figure out the source tracks we want to add - List