diff options
author | sr55 <[email protected]> | 2012-06-19 18:42:08 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-06-19 18:42:08 +0000 |
commit | e4460af63dd76181f489da5f6281a3716c2bf58f (patch) | |
tree | 0627446f346cb92bfff2e2948bdd2d6cdc81ef88 /win/CS/HandBrakeWPF | |
parent | 5371a5167357f3d1f2120fc8fefad4c4fd1527a8 (diff) |
WinGui:WinGui:
- Fix Foreign Audio Search Feature
- Fix FFMpeg4/2 encoder selection
- Allow the Preset window to overwrite existing presets.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4756 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 63 |
2 files changed, 45 insertions, 25 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index c6ec62f6b..5a5bd0034 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -165,8 +165,11 @@ namespace HandBrakeWPF.ViewModels if (this.presetService.CheckIfPresetExists(this.Preset.Name))
{
- this.errorService.ShowMessageBox("A Preset with this name already exists. Please choose a new name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
- return;
+ MessageBoxResult result = this.errorService.ShowMessageBox("A Preset with this name already exists. Would you like to overwrite it?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Error);
+ if (result == MessageBoxResult.No)
+ {
+ return;
+ }
}
this.Preset.UsePictureFilters = this.Preset.UsePictureFilters;
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 515b25eb9..657318f34 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -13,6 +13,7 @@ namespace HandBrakeWPF.ViewModels {
using System.Collections.Generic;
using System.Collections.Specialized;
+ using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Linq;
@@ -39,7 +40,12 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Backing field for the source subtitle tracks.
/// </summary>
- private IEnumerable<Subtitle> sourceTracks;
+ private IList<Subtitle> sourceTracks;
+
+ /// <summary>
+ /// The Foreign Audio Search Track
+ /// </summary>
+ private readonly Subtitle ForeignAudioSearchTrack;
#endregion
@@ -60,6 +66,9 @@ namespace HandBrakeWPF.ViewModels this.Langauges = LanguageUtilities.MapLanguages().Keys;
this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();
+
+ this.ForeignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search (Bitmap)" };
+ this.SourceTracks = new List<Subtitle> { this.ForeignAudioSearchTrack };
}
#endregion
@@ -79,7 +88,7 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Gets or sets SourceTracks.
/// </summary>
- public IEnumerable<Subtitle> SourceTracks
+ public IList<Subtitle> SourceTracks
{
get
{
@@ -149,7 +158,9 @@ namespace HandBrakeWPF.ViewModels {
VistaOpenFileDialog dialog = new VistaOpenFileDialog
{
- Filter = "SRT files (*.srt)|*.srt", CheckFileExists = true, Multiselect = true
+ Filter = "SRT files (*.srt)|*.srt",
+ CheckFileExists = true,
+ Multiselect = true
};
dialog.ShowDialog();
@@ -158,10 +169,10 @@ namespace HandBrakeWPF.ViewModels {
SubtitleTrack track = new SubtitleTrack
{
- SrtFileName = Path.GetFileNameWithoutExtension(srtFile),
- SrtOffset = 0,
- SrtCharCode = "UTF-8",
- SrtLang = "English",
+ SrtFileName = Path.GetFileNameWithoutExtension(srtFile),
+ SrtOffset = 0,
+ SrtCharCode = "UTF-8",
+ SrtLang = "English",
SubtitleType = SubtitleType.SRT,
SrtPath = srtFile
};
@@ -255,7 +266,13 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void SetSource(Title title, Preset preset, EncodeTask task)
{
- this.SourceTracks = title.Subtitles;
+ this.SourceTracks.Clear();
+ this.SourceTracks.Add(ForeignAudioSearchTrack);
+ foreach (Subtitle subtitle in title.Subtitles)
+ {
+ this.SourceTracks.Add(subtitle);
+ }
+
this.Task = task;
this.NotifyOfPropertyChange(() => this.Task);
@@ -281,24 +298,24 @@ namespace HandBrakeWPF.ViewModels /// </param>
private void Add(Subtitle subtitle)
{
- if (this.SourceTracks != null)
- {
- string preferred =
- this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles);
+ string preferred =
+ this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles);
- Subtitle source = subtitle ??
- (this.SourceTracks.FirstOrDefault(l => l.Language == preferred) ??
- this.SourceTracks.FirstOrDefault());
+ Subtitle source = subtitle ??
+ ((this.SourceTracks != null)
+ ? (this.SourceTracks.FirstOrDefault(l => l.Language == preferred) ??
+ this.SourceTracks.FirstOrDefault(s => s.SubtitleType != SubtitleType.ForeignAudioSearch))
+ : null);
- if (source != null)
- {
- SubtitleTrack track = new SubtitleTrack
- {
- SubtitleType = SubtitleType.VobSub, SourceTrack = source,
- };
+ if (source != null)
+ {
+ SubtitleTrack track = new SubtitleTrack
+ {
+ SubtitleType = SubtitleType.VobSub,
+ SourceTrack = source,
+ };
- this.Task.SubtitleTracks.Add(track);
- }
+ this.Task.SubtitleTracks.Add(track);
}
}
|