diff options
author | sr55 <sr55.hb@outlook.com> | 2012-06-19 18:42:08 +0000 |
---|---|---|
committer | sr55 <sr55.hb@outlook.com> | 2012-06-19 18:42:08 +0000 |
commit | e4460af63dd76181f489da5f6281a3716c2bf58f (patch) | |
tree | 0627446f346cb92bfff2e2948bdd2d6cdc81ef88 | |
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
6 files changed, 61 insertions, 30 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleType.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleType.cs index 64e8f8ff8..a249060b5 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleType.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleType.cs @@ -31,6 +31,8 @@ namespace HandBrake.ApplicationServices.Model.Encoding [Description("PGS")]
PGS,
[Description("Unknown")]
- Unknown
+ Unknown,
+ [Description("Foreign Audio Search")]
+ ForeignAudioSearch, // Special Type for Foreign Audio Search
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs index a7c7158a6..6548f3aaf 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs @@ -173,7 +173,7 @@ namespace HandBrake.ApplicationServices.Parsing /// <returns>A string formatted as: {track #} {language}</returns>
public override string ToString()
{
- return string.Format("{0} {1} ({2})", TrackNumber, Language, TypeString);
+ return this.SubtitleType == SubtitleType.ForeignAudioSearch ? "Foreign Audio Scan" : string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.TypeString);
}
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index 804a963b6..bab41a9b8 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -116,7 +116,8 @@ namespace HandBrake.ApplicationServices.Services #region Public Methods
/// <summary>
- /// Add a new preset to the system
+ /// Add a new preset to the system.
+ /// Performs an Update if it already exists
/// </summary>
/// <param name="preset">
/// A Preset to add
@@ -135,6 +136,11 @@ namespace HandBrake.ApplicationServices.Services // Update the presets file
this.UpdatePresetFiles();
return true;
+ }
+ else
+ {
+ this.Update(preset);
+ return true;
}
return false;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index ec6f74562..1fbd1244c 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -407,7 +407,10 @@ namespace HandBrake.ApplicationServices.Utilities switch (task.VideoEncoder)
{
case VideoEncoder.FFMpeg:
- query += " -e ffmpeg";
+ query += " -e ffmpeg4";
+ break;
+ case VideoEncoder.FFMpeg2:
+ query += " -e ffmpeg2";
break;
case VideoEncoder.X264:
query += " -e x264";
@@ -743,7 +746,7 @@ namespace HandBrake.ApplicationServices.Utilities subCount++;
// Find --subtitle <string>
- if (item.Track.Contains("Foreign Audio Search"))
+ if (item.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
itemToAdd = "scan";
else
{
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);
}
}
|