diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index d5e949809..8d6dafb2c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -7,14 +7,12 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-using System.IO;
-
namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.ComponentModel;
using System.ComponentModel.Composition;
+ using System.IO;
using System.Linq;
using Caliburn.Micro;
@@ -120,6 +118,51 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Add all closed captions not already on the list.
+ /// </summary>
+ public void AddAllClosedCaptions()
+ {
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseClosedCaption))
+ {
+ foreach (
+ Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC))
+ {
+ this.Add(subtitle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Add all the remaining subtitle tracks.
+ /// </summary>
+ public void AddAllRemaining()
+ {
+ foreach (Subtitle subtitle in this.SourceTitlesSubset(null))
+ {
+ this.Add(subtitle);
+ }
+ }
+
+ /// <summary>
+ /// Add all remaining tracks for the users preferred and selected languages
+ /// </summary>
+ public void AddAllRemainingForSelectedLanguages()
+ {
+ // Get a list of subtitle tracks that match the users lanaguages
+ StringCollection userSelectedLanguages =
+ this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
+ userSelectedLanguages.Add(
+ this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles));
+ List<Subtitle> availableTracks =
+ this.SourceTracks.Where(subtitle => userSelectedLanguages.Contains(subtitle.Language)).ToList();
+
+ foreach (Subtitle subtitle in this.SourceTitlesSubset(availableTracks))
+ {
+ this.Add(subtitle);
+ }
+ }
+
+ /// <summary>
/// Automatic Subtitle Selection based on user preferences.
/// </summary>
public void AutomaticSubtitleSelection()
@@ -192,6 +235,14 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Clear all Tracks
+ /// </summary>
+ public void Clear()
+ {
+ this.Task.SubtitleTracks.Clear();
+ }
+
+ /// <summary>
/// Select the default subtitle track.
/// </summary>
/// <param name="subtitle">
@@ -335,51 +386,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Add all closed captions not already on the list.
- /// </summary>
- private void AddAllClosedCaptions()
- {
- if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseClosedCaption))
- {
- foreach (
- Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC))
- {
- this.Add(subtitle);
- }
- }
- }
-
- /// <summary>
- /// Add all the remaining subtitle tracks.
- /// </summary>
- private void AddAllRemaining()
- {
- foreach (Subtitle subtitle in this.SourceTitlesSubset(null))
- {
- this.Add(subtitle);
- }
- }
-
- /// <summary>
- /// Add all remaining tracks for the users preferred and selected languages
- /// </summary>
- private void AddAllRemainingForSelectedLanguages()
- {
- // Get a list of subtitle tracks that match the users lanaguages
- StringCollection userSelectedLanguages =
- this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages);
- userSelectedLanguages.Add(
- this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles));
- List<Subtitle> availableTracks =
- this.SourceTracks.Where(subtitle => userSelectedLanguages.Contains(subtitle.Language)).ToList();
-
- foreach (Subtitle subtitle in this.SourceTitlesSubset(availableTracks))
- {
- this.Add(subtitle);
- }
- }
-
- /// <summary>
/// Add all tracks for the preferred languages settings.
/// </summary>
/// <param name="firstOnly">
|