]> granicus.if.org Git - handbrake/commitdiff
WinGui: Some minor tidy up for the last checkin.
authorsr55 <sr55.hb@outlook.com>
Thu, 22 Jan 2015 17:18:34 +0000 (17:18 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 22 Jan 2015 17:18:34 +0000 (17:18 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6790 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/Video/VideoPreset.cs
win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs
win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs

index 11dc04125c6144f04b271ecc998527b3de0f696a..aea5986428c7793da54187bd6eab4012ce131e4b 100644 (file)
@@ -16,6 +16,11 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models.Video
     /// </summary>\r
     public class VideoPreset\r
     {\r
+        /// <summary>\r
+        /// A built-in version of the "None" object.\r
+        /// </summary>\r
+        public static VideoPreset None = new VideoPreset("None", "none");\r
+\r
         /// <summary>\r
         /// Initializes a new instance of the <see cref="VideoPreset"/> class.\r
         /// </summary>\r
index a67fc9ad82014ea76eb955ef54ba875671622041..a94134fc126074441429e447a9a469ecca311673 100644 (file)
@@ -11,9 +11,11 @@ namespace HandBrakeWPF.Converters.Video
 {\r
     using System;\r
     using System.Globalization;\r
+    using System.Linq;\r
     using System.Windows.Data;\r
 \r
     using HandBrake.ApplicationServices.Services.Encode.Model;\r
+    using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;\r
     using HandBrake.Interop.Model.Encoding;\r
 \r
     /// <summary>\r
@@ -27,7 +29,18 @@ namespace HandBrakeWPF.Converters.Video
         /// <returns>\r
         /// A converted value. If the method returns null, the valid null value is used.\r
         /// </returns>\r
-        /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>\r
+        /// <param name="value">\r
+        /// The value produced by the binding source.\r
+        /// </param>\r
+        /// <param name="targetType">\r
+        /// The type of the binding target property.\r
+        /// </param>\r
+        /// <param name="parameter">\r
+        /// The converter parameter to use.\r
+        /// </param>\r
+        /// <param name="culture">\r
+        /// The culture to use in the converter.\r
+        /// </param>\r
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
             EncodeTask task = value as EncodeTask;\r
@@ -38,13 +51,15 @@ namespace HandBrakeWPF.Converters.Video
                     return task.AdvancedEncoderOptions;\r
                 }\r
 \r
-                //return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}", \r
-                //    EnumHelper<x264Preset>.GetDisplay(task.X264Preset),\r
-                //    EnumHelper<x264Tune>.GetDisplay(task.X264Tune),\r
-                //    task.H264Profile,\r
-                //    task.H264Level, \r
-                //    string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments,\r
-                //    Environment.NewLine);\r
+                VideoTune tune = task.VideoTunes.FirstOrDefault();\r
+\r
+                return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}",\r
+                    task.VideoPreset != null ? task.VideoPreset.ShortName : VideoPreset.None.DisplayName,\r
+                    tune != null ? tune.ShortName : VideoTune.None.DisplayName,\r
+                    task.VideoProfile != null ? task.VideoProfile.ShortName : VideoProfile.Auto.DisplayName,\r
+                    task.VideoLevel != null ? task.VideoLevel.ShortName : VideoLevel.Auto.DisplayName, \r
+                    string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments, \r
+                    Environment.NewLine);\r
             }\r
 \r
             return task != null ? task.AdvancedEncoderOptions.Trim() : string.Empty;\r
@@ -56,7 +71,18 @@ namespace HandBrakeWPF.Converters.Video
         /// <returns>\r
         /// A converted value. If the method returns null, the valid null value is used.\r
         /// </returns>\r
-        /// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>\r
+        /// <param name="value">\r
+        /// The value that is produced by the binding target.\r
+        /// </param>\r
+        /// <param name="targetType">\r
+        /// The type to convert to.\r
+        /// </param>\r
+        /// <param name="parameter">\r
+        /// The converter parameter to use.\r
+        /// </param>\r
+        /// <param name="culture">\r
+        /// The culture to use in the converter.\r
+        /// </param>\r
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\r
         {\r
             throw new NotImplementedException();\r
index 9fe599fc20bbcda78b65a8b15ad6dc0dd83be610..a5d03cbb08796f17b89f2561e1180e05b88228ad 100644 (file)
@@ -544,7 +544,6 @@ namespace HandBrakeWPF.ViewModels
         /// Gets or sets a value indicating whether display non qsv controls.\r
         /// </summary>\r
         public bool DisplayNonQSVControls\r
-\r
         {\r
             get\r
             {\r
@@ -879,12 +878,10 @@ namespace HandBrakeWPF.ViewModels
                         this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault();\r
                         this.VideoPresetValue = preset.Task.VideoPreset != null ? this.VideoPresets.IndexOf(preset.Task.VideoPreset) : 0;\r
                         this.FastDecode = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Contains(VideoTune.FastDecode);\r
-                        this.VideoTune = preset.Task.VideoTunes != null ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault();\r
+                        this.VideoTune = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Any() ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault();\r
                     }\r
                 }\r
 \r
-                // TODO Hide Controls.\r
-\r
                 this.ExtraArguments = preset.Task.ExtraAdvancedArguments;\r
                 this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;\r
             }\r