From a9cad63afe88581bf0ea5463e3199bd0d1b474c0 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 29 Dec 2013 20:23:51 +0000 Subject: [PATCH] WinGui: Fix a few bugs: - Advanced query getting nulled out for QSV due to some dead code. - Updated the regex for the decomb value to accept unquoted value as well as quoted. - Remapped Ctrl-F to Ctrl-O to be more standard. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5944 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/EncodeTask.cs | 14 +++- .../Utilities/QueryParserUtility.cs | 2 +- .../Commands/ProcessShortcutCommand.cs | 7 ++ win/CS/HandBrakeWPF/Views/ShellView.xaml.cs | 1 + win/CS/HandBrakeWPF/Views/VideoView.xaml | 6 +- win/CS/HandBrakeWPF/Views/VideoView.xaml.cs | 72 ------------------- 6 files changed, 25 insertions(+), 77 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index ec805ab9d..f20589f7d 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -33,6 +33,8 @@ namespace HandBrake.ApplicationServices.Model /// private bool showAdvancedTab; + private string advancedEncoderOptions; + #endregion /// @@ -405,7 +407,17 @@ namespace HandBrake.ApplicationServices.Model /// /// Gets or sets AdvancedEncoderOptions. /// - public string AdvancedEncoderOptions { get; set; } + public string AdvancedEncoderOptions + { + get + { + return this.advancedEncoderOptions; + } + set + { + this.advancedEncoderOptions = value; + } + } /// /// Gets or sets x264Preset. diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs index db92b3504..4872d6e7d 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryParserUtility.cs @@ -75,7 +75,7 @@ namespace HandBrake.ApplicationServices.Utilities // Picture Settings - Filters Match decomb = Regex.Match(input, @" --decomb"); - Match decombValue = Regex.Match(input, @" --decomb=\""([a-zA-Z0-9.:]*)\"""); + Match decombValue = Regex.Match(input, @" --decomb=([a-zA-Z0-9.:""\\]*)"); Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z0-9.:]*)\"""); Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z0-9.:]*)\"""); Match deblock = Regex.Match(input, @"--deblock=([0-9:]*)"); diff --git a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs index 636c424e6..912ea6f11 100644 --- a/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs +++ b/win/CS/HandBrakeWPF/Commands/ProcessShortcutCommand.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.Commands { using System; + using System.Windows; using System.Windows.Input; using Caliburn.Micro; @@ -79,6 +80,12 @@ namespace HandBrakeWPF.Commands // Scan a File (Ctrl+F) if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.F) + { + mainViewModel.FileScan(); + MessageBox.Show("Please use Ctrl-O in future. Ctrl-F is being deprecated in favour of something more standard. :)"); + } + + if (gesture.Modifiers == ModifierKeys.Control && gesture.Key == Key.O) { mainViewModel.FileScan(); } diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs index fbf700b4a..35e1e0333 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs @@ -77,6 +77,7 @@ namespace HandBrakeWPF.Views this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Q, ModifierKeys.Control)), new KeyGesture(Key.Q, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control)), new KeyGesture(Key.A, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F, ModifierKeys.Control)), new KeyGesture(Key.F, ModifierKeys.Control))); + this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.R, ModifierKeys.Control)), new KeyGesture(Key.R, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.D, ModifierKeys.Control | ModifierKeys.Shift))); diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml b/win/CS/HandBrakeWPF/Views/VideoView.xaml index fffbfd0b2..1f0b31764 100644 --- a/win/CS/HandBrakeWPF/Views/VideoView.xaml +++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml @@ -96,7 +96,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -192,7 +192,7 @@ + IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" /> diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs index 9f12972be..8a0842a96 100644 --- a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs @@ -9,14 +9,8 @@ namespace HandBrakeWPF.Views { - using System.Collections.Generic; - using System.Windows; using System.Windows.Controls; - using HandBrake.ApplicationServices.Model; - - using HandBrakeWPF.ViewModels; - /// /// Interaction logic for VideoView.xaml /// @@ -29,71 +23,5 @@ namespace HandBrakeWPF.Views { InitializeComponent(); } - - /// - /// The qsv_preset_radiobutton. - /// - /// - /// The sender. - /// - /// - /// The e. - /// - private void qsv_preset_radiobutton(object sender, System.Windows.RoutedEventArgs e) - { - qsv_preset_ValueChanged(sender, null); - } - - /// - /// The qsv_preset_ value changed. - /// - /// - /// The sender. - /// - /// - /// The e. - /// - private void qsv_preset_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - VideoViewModel mvm = ((VideoViewModel)this.DataContext); - EncodeTask task = mvm.Task; - - string full_string = string.Empty; - - IDictionary newOptions = new Dictionary(); - string[] existingSegments = full_string.Split(':'); - foreach (string existingSegment in existingSegments) - { - string optionName = existingSegment; - string optionValue = string.Empty; - int equalsIndex = existingSegment.IndexOf('='); - if (equalsIndex >= 0) - { - optionName = existingSegment.Substring( - 0, existingSegment.IndexOf("=", System.StringComparison.Ordinal)); - optionValue = existingSegment.Substring(equalsIndex); - } - - if (optionName != string.Empty) - { - if (newOptions.ContainsKey(optionName)) - newOptions.Remove(optionName); - newOptions.Add(optionName, optionValue); - } - } - - full_string = string.Empty; - foreach (KeyValuePair entry in newOptions) - { - full_string += entry.Key; - if (entry.Value != string.Empty) - full_string += entry.Value; - full_string += ":"; - } - full_string = full_string.TrimEnd(':'); - - task.AdvancedEncoderOptions = full_string; - task.NotifyOfPropertyChange(() => task.AdvancedEncoderOptions); - } } } -- 2.40.0