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 --- .../HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 82 +++++++++++----------- 1 file changed, 40 insertions(+), 42 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 446fab6cf..b52dd961a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -120,13 +120,10 @@ namespace HandBrakeWPF.ViewModels /// public void AddAllClosedCaptions() { - if (this.UserSettingService.GetUserSetting(UserSettingConstants.UseClosedCaption)) + + foreach (Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC)) { - foreach ( - Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC)) - { - this.Add(subtitle); - } + this.Add(subtitle); } } @@ -160,38 +157,6 @@ namespace HandBrakeWPF.ViewModels } } - /// - /// Automatic Subtitle Selection based on user preferences. - /// - public void AutomaticSubtitleSelection() - { - this.Task.SubtitleTracks.Clear(); - - // New DUB Settings - int mode = this.UserSettingService.GetUserSetting(UserSettingConstants.DubModeSubtitle); - switch (mode) - { - case 1: // Adding all remaining subtitle tracks - this.AddAllRemaining(); - break; - case 2: // Adding only the first or preferred first subtitle track. - this.Add(); - break; - case 3: // Selected Languages Only - this.AddAllRemainingForSelectedLanguages(); - break; - case 4: // Prefered Only - this.AddForPreferredLanaguages(true); - break; - case 5: // Prefered Only All - this.AddForPreferredLanaguages(false); - break; - } - - // Add all closed captions if enabled. - this.AddAllClosedCaptions(); - } - /// /// Import an SRT File. /// @@ -279,6 +244,41 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.Task); } + /// + /// Automatic Subtitle Selection based on user preferences. + /// + public void AutomaticSubtitleSelection() + { + this.Task.SubtitleTracks.Clear(); + + // New DUB Settings + int mode = this.UserSettingService.GetUserSetting(UserSettingConstants.DubModeSubtitle); + switch (mode) + { + case 1: // Adding all remaining subtitle tracks + this.AddAllRemaining(); + break; + case 2: // Adding only the first or preferred first subtitle track. + this.Add(); + break; + case 3: // Selected Languages Only + this.AddAllRemainingForSelectedLanguages(); + break; + case 4: // Prefered Only + this.AddForPreferredLanaguages(true); + break; + case 5: // Prefered Only All + this.AddForPreferredLanaguages(false); + break; + } + + // Add all closed captions if enabled. + if (this.UserSettingService.GetUserSetting(UserSettingConstants.UseClosedCaption)) + { + this.AddAllClosedCaptions(); + } + } + #endregion #region Implemented Interfaces @@ -419,10 +419,8 @@ namespace HandBrakeWPF.ViewModels private IEnumerable SourceTitlesSubset(IEnumerable subtitles) { return subtitles != null - ? subtitles.Where( - subtitle => !this.Task.SubtitleTracks.Any(track => track.SourceTrack == subtitle)).ToList() - : this.SourceTracks.Where( - subtitle => !this.Task.SubtitleTracks.Any(track => track.SourceTrack == subtitle)).ToList(); + ? subtitles.Where(subtitle => !this.Task.SubtitleTracks.Any(track => Equals(track.SourceTrack, subtitle))).ToList() + : this.SourceTracks.Where(subtitle => !this.Task.SubtitleTracks.Any(track => Equals(track.SourceTrack, subtitle))).ToList(); } #endregion -- cgit v1.2.3