summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-01-13 16:50:49 +0000
committersr55 <[email protected]>2013-01-13 16:50:49 +0000
commitb62992bfb1623ae6c0930c41e00c2b150ea780d9 (patch)
tree4e70b89c49f51b3548904794309584d7e63cec9a /win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
parentd917bc2ad4fa1e2c12828f0e234a32cd19f682c1 (diff)
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
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs82
1 files changed, 40 insertions, 42 deletions
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
/// </summary>
public void AddAllClosedCaptions()
{
- if (this.UserSettingService.GetUserSetting<bool>(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);
}
}
@@ -161,38 +158,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Automatic Subtitle Selection based on user preferences.
- /// </summary>
- public void AutomaticSubtitleSelection()
- {
- this.Task.SubtitleTracks.Clear();
-
- // New DUB Settings
- int mode = this.UserSettingService.GetUserSetting<int>(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();
- }
-
- /// <summary>
/// Import an SRT File.
/// </summary>
public void Import()
@@ -279,6 +244,41 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.Task);
}
+ /// <summary>
+ /// Automatic Subtitle Selection based on user preferences.
+ /// </summary>
+ public void AutomaticSubtitleSelection()
+ {
+ this.Task.SubtitleTracks.Clear();
+
+ // New DUB Settings
+ int mode = this.UserSettingService.GetUserSetting<int>(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<bool>(UserSettingConstants.UseClosedCaption))
+ {
+ this.AddAllClosedCaptions();
+ }
+ }
+
#endregion
#region Implemented Interfaces
@@ -419,10 +419,8 @@ namespace HandBrakeWPF.ViewModels
private IEnumerable<Subtitle> SourceTitlesSubset(IEnumerable<Subtitle> 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