From c5e37a65bdc7facc356d505b79c4f2b290bcf246 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 22 Jan 2015 17:18:34 +0000 Subject: WinGui: Some minor tidy up for the last checkin. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6790 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Video/EncoderOptionsTooltipConverter.cs | 44 +++++++++++++++++----- win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 5 +-- 2 files changed, 36 insertions(+), 13 deletions(-) (limited to 'win/CS/HandBrakeWPF') diff --git a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs index a67fc9ad8..a94134fc1 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs @@ -11,9 +11,11 @@ namespace HandBrakeWPF.Converters.Video { using System; using System.Globalization; + using System.Linq; using System.Windows.Data; using HandBrake.ApplicationServices.Services.Encode.Model; + using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video; using HandBrake.Interop.Model.Encoding; /// @@ -27,7 +29,18 @@ namespace HandBrakeWPF.Converters.Video /// /// A converted value. If the method returns null, the valid null value is used. /// - /// The value produced by the binding source.The type of the binding target property.The converter parameter to use.The culture to use in the converter. + /// + /// The value produced by the binding source. + /// + /// + /// The type of the binding target property. + /// + /// + /// The converter parameter to use. + /// + /// + /// The culture to use in the converter. + /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { EncodeTask task = value as EncodeTask; @@ -38,13 +51,15 @@ namespace HandBrakeWPF.Converters.Video return task.AdvancedEncoderOptions; } - //return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}", - // EnumHelper.GetDisplay(task.X264Preset), - // EnumHelper.GetDisplay(task.X264Tune), - // task.H264Profile, - // task.H264Level, - // string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments, - // Environment.NewLine); + VideoTune tune = task.VideoTunes.FirstOrDefault(); + + return string.Format("Preset: {0}{5}Tune: {1}{5}Profile: {2}{5}Level: {3}{5}Extra Arguments: {4}{5}", + task.VideoPreset != null ? task.VideoPreset.ShortName : VideoPreset.None.DisplayName, + tune != null ? tune.ShortName : VideoTune.None.DisplayName, + task.VideoProfile != null ? task.VideoProfile.ShortName : VideoProfile.Auto.DisplayName, + task.VideoLevel != null ? task.VideoLevel.ShortName : VideoLevel.Auto.DisplayName, + string.IsNullOrEmpty(task.ExtraAdvancedArguments) ? "None" : task.ExtraAdvancedArguments, + Environment.NewLine); } return task != null ? task.AdvancedEncoderOptions.Trim() : string.Empty; @@ -56,7 +71,18 @@ namespace HandBrakeWPF.Converters.Video /// /// A converted value. If the method returns null, the valid null value is used. /// - /// The value that is produced by the binding target.The type to convert to.The converter parameter to use.The culture to use in the converter. + /// + /// The value that is produced by the binding target. + /// + /// + /// The type to convert to. + /// + /// + /// The converter parameter to use. + /// + /// + /// The culture to use in the converter. + /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 9fe599fc2..a5d03cbb0 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -544,7 +544,6 @@ namespace HandBrakeWPF.ViewModels /// Gets or sets a value indicating whether display non qsv controls. /// public bool DisplayNonQSVControls - { get { @@ -879,12 +878,10 @@ namespace HandBrakeWPF.ViewModels this.VideoProfile = preset.Task.VideoProfile != null ? preset.Task.VideoProfile.Clone() : this.VideoProfiles.FirstOrDefault(); this.VideoPresetValue = preset.Task.VideoPreset != null ? this.VideoPresets.IndexOf(preset.Task.VideoPreset) : 0; this.FastDecode = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Contains(VideoTune.FastDecode); - this.VideoTune = preset.Task.VideoTunes != null ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault(); + this.VideoTune = preset.Task.VideoTunes != null && preset.Task.VideoTunes.Any() ? preset.Task.VideoTunes.FirstOrDefault(t => !Equals(t, VideoTune.FastDecode)) : this.VideoTunes.FirstOrDefault(); } } - // TODO Hide Controls. - this.ExtraArguments = preset.Task.ExtraAdvancedArguments; this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab; } -- cgit v1.2.3