]> granicus.if.org Git - handbrake/commitdiff
WinGui:WinGui:
authorsr55 <sr55.hb@outlook.com>
Tue, 19 Jun 2012 18:42:08 +0000 (18:42 +0000)
committersr55 <sr55.hb@outlook.com>
Tue, 19 Jun 2012 18:42:08 +0000 (18:42 +0000)
- 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

win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleType.cs
win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs
win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs

index 64e8f8ff897e0c3b7b049eccf11fb78b1a6c7bc5..a249060b5637e905e3b547ce54ceb7f87cb611ce 100644 (file)
@@ -31,6 +31,8 @@ namespace HandBrake.ApplicationServices.Model.Encoding
         [Description("PGS")]\r
         PGS,\r
         [Description("Unknown")]\r
-        Unknown\r
+        Unknown,\r
+        [Description("Foreign Audio Search")]\r
+        ForeignAudioSearch, // Special Type for Foreign Audio Search\r
     }\r
 }
\ No newline at end of file
index a7c7158a658b9b15027ff404ef878c4e2234aea4..6548f3aafcc5376503278421b843c3169c649a70 100644 (file)
@@ -173,7 +173,7 @@ namespace HandBrake.ApplicationServices.Parsing
         /// <returns>A string formatted as: {track #} {language}</returns>\r
         public override string ToString()\r
         {\r
-            return string.Format("{0} {1} ({2})", TrackNumber, Language, TypeString);\r
+            return this.SubtitleType == SubtitleType.ForeignAudioSearch ? "Foreign Audio Scan" : string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.TypeString);\r
         }\r
     }\r
 }
\ No newline at end of file
index 804a963b6ac122dfd8826e2075cc462e5d901930..bab41a9b833cf60d7c6e7b6182d19b0a6b13cd85 100644 (file)
@@ -116,7 +116,8 @@ namespace HandBrake.ApplicationServices.Services
         #region Public Methods\r
 \r
         /// <summary>\r
-        /// Add a new preset to the system\r
+        /// Add a new preset to the system.\r
+        /// Performs an Update if it already exists\r
         /// </summary>\r
         /// <param name="preset">\r
         /// A Preset to add\r
@@ -135,6 +136,11 @@ namespace HandBrake.ApplicationServices.Services
                 // Update the presets file\r
                 this.UpdatePresetFiles();\r
                 return true;\r
+            } \r
+            else\r
+            {\r
+                this.Update(preset);\r
+                return true;\r
             }\r
 \r
             return false;\r
index ec6f7456213a26ce7c30b3f1f9ce11eaeb1ddcf5..1fbd1244ce6c196358164dc0e01184fbd81a007e 100644 (file)
@@ -407,7 +407,10 @@ namespace HandBrake.ApplicationServices.Utilities
             switch (task.VideoEncoder)\r
             {\r
                 case VideoEncoder.FFMpeg:\r
-                    query += " -e ffmpeg";\r
+                    query += " -e ffmpeg4";\r
+                    break;\r
+                case VideoEncoder.FFMpeg2:\r
+                    query += " -e ffmpeg2";\r
                     break;\r
                 case VideoEncoder.X264:\r
                     query += " -e x264";\r
@@ -743,7 +746,7 @@ namespace HandBrake.ApplicationServices.Utilities
                         subCount++;\r
 \r
                         // Find --subtitle <string>\r
-                        if (item.Track.Contains("Foreign Audio Search"))\r
+                        if (item.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)\r
                             itemToAdd = "scan";\r
                         else\r
                         {\r
index c6ec62f6be99114e24d85b6c4f1d5cb6f2dc4f2c..5a5bd00344b65d19427593b4bab295d95d38e033 100644 (file)
@@ -165,8 +165,11 @@ namespace HandBrakeWPF.ViewModels
 \r
             if (this.presetService.CheckIfPresetExists(this.Preset.Name))\r
             {\r
-                this.errorService.ShowMessageBox("A Preset with this name already exists. Please choose a new name", "Error", MessageBoxButton.OK, MessageBoxImage.Error);\r
-                return;\r
+               MessageBoxResult result = this.errorService.ShowMessageBox("A Preset with this name already exists. Would you like to overwrite it?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Error);\r
+               if (result == MessageBoxResult.No)\r
+               {\r
+                   return;\r
+               }\r
             }\r
 \r
             this.Preset.UsePictureFilters = this.Preset.UsePictureFilters;\r
index 515b25eb93d01d39bf2134a0473bb7f7aace6484..657318f34674f3e9774fbd33570180e8c487fd00 100644 (file)
@@ -13,6 +13,7 @@ namespace HandBrakeWPF.ViewModels
 {\r
     using System.Collections.Generic;\r
     using System.Collections.Specialized;\r
+    using System.ComponentModel;\r
     using System.ComponentModel.Composition;\r
     using System.Linq;\r
 \r
@@ -39,7 +40,12 @@ namespace HandBrakeWPF.ViewModels
         /// <summary>\r
         /// Backing field for the source subtitle tracks.\r
         /// </summary>\r
-        private IEnumerable<Subtitle> sourceTracks;\r
+        private IList<Subtitle> sourceTracks;\r
+\r
+        /// <summary>\r
+        /// The Foreign Audio Search Track\r
+        /// </summary>\r
+        private readonly Subtitle ForeignAudioSearchTrack;\r
 \r
         #endregion\r
 \r
@@ -60,6 +66,9 @@ namespace HandBrakeWPF.ViewModels
 \r
             this.Langauges = LanguageUtilities.MapLanguages().Keys;\r
             this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();\r
+\r
+            this.ForeignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search (Bitmap)" };\r
+            this.SourceTracks = new List<Subtitle> { this.ForeignAudioSearchTrack };\r
         }\r
 \r
         #endregion\r
@@ -79,7 +88,7 @@ namespace HandBrakeWPF.ViewModels
         /// <summary>\r
         /// Gets or sets SourceTracks.\r
         /// </summary>\r
-        public IEnumerable<Subtitle> SourceTracks\r
+        public IList<Subtitle> SourceTracks\r
         {\r
             get\r
             {\r
@@ -149,7 +158,9 @@ namespace HandBrakeWPF.ViewModels
         {\r
             VistaOpenFileDialog dialog = new VistaOpenFileDialog\r
                 {\r
-                   Filter = "SRT files (*.srt)|*.srt", CheckFileExists = true, Multiselect = true \r
+                    Filter = "SRT files (*.srt)|*.srt",\r
+                    CheckFileExists = true,\r
+                    Multiselect = true\r
                 };\r
 \r
             dialog.ShowDialog();\r
@@ -158,10 +169,10 @@ namespace HandBrakeWPF.ViewModels
             {\r
                 SubtitleTrack track = new SubtitleTrack\r
                     {\r
-                        SrtFileName = Path.GetFileNameWithoutExtension(srtFile), \r
-                        SrtOffset = 0, \r
-                        SrtCharCode = "UTF-8", \r
-                        SrtLang = "English", \r
+                        SrtFileName = Path.GetFileNameWithoutExtension(srtFile),\r
+                        SrtOffset = 0,\r
+                        SrtCharCode = "UTF-8",\r
+                        SrtLang = "English",\r
                         SubtitleType = SubtitleType.SRT,\r
                         SrtPath = srtFile\r
                     };\r
@@ -255,7 +266,13 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         public void SetSource(Title title, Preset preset, EncodeTask task)\r
         {\r
-            this.SourceTracks = title.Subtitles;\r
+            this.SourceTracks.Clear();\r
+            this.SourceTracks.Add(ForeignAudioSearchTrack);\r
+            foreach (Subtitle subtitle in title.Subtitles)\r
+            {\r
+                this.SourceTracks.Add(subtitle);\r
+            }\r
+\r
             this.Task = task;\r
             this.NotifyOfPropertyChange(() => this.Task);\r
 \r
@@ -281,24 +298,24 @@ namespace HandBrakeWPF.ViewModels
         /// </param>\r
         private void Add(Subtitle subtitle)\r
         {\r
-            if (this.SourceTracks != null)\r
-            {\r
-                string preferred =\r
-                    this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles);\r
+            string preferred =\r
+                this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguageForSubtitles);\r
 \r
-                Subtitle source = subtitle ??\r
-                                  (this.SourceTracks.FirstOrDefault(l => l.Language == preferred) ??\r
-                                   this.SourceTracks.FirstOrDefault());\r
+            Subtitle source = subtitle ??\r
+                              ((this.SourceTracks != null)\r
+                                   ? (this.SourceTracks.FirstOrDefault(l => l.Language == preferred) ??\r
+                                      this.SourceTracks.FirstOrDefault(s => s.SubtitleType != SubtitleType.ForeignAudioSearch))\r
+                                   : null);\r
 \r
-                if (source != null)\r
-                {\r
-                    SubtitleTrack track = new SubtitleTrack\r
-                        {\r
-                           SubtitleType = SubtitleType.VobSub, SourceTrack = source, \r
-                        };\r
+            if (source != null)\r
+            {\r
+                SubtitleTrack track = new SubtitleTrack\r
+                    {\r
+                        SubtitleType = SubtitleType.VobSub,\r
+                        SourceTrack = source,\r
+                    };\r
 \r
-                    this.Task.SubtitleTracks.Add(track);\r
-                }\r
+                this.Task.SubtitleTracks.Add(track);\r
             }\r
         }\r
 \r