From 76d311c9aa5e4e6b58dfd1d570d275caf44051c4 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 21 Apr 2013 14:28:52 +0000 Subject: [PATCH] WinGui: Added some additional sanity checking around preset import/export code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5405 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Factories/PlistPresetFactory.cs | 4 ++-- .../HandBrakeWPF/ViewModels/AddPresetViewModel.cs | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs b/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs index 9179f3887..6e738351a 100644 --- a/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs +++ b/win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs @@ -127,10 +127,10 @@ namespace HandBrake.ApplicationServices.Factories preset.Task.Cropping.Right = kvp.Value; break; case "PictureHeight": - preset.Task.Height = kvp.Value; + preset.Task.Height = kvp.Value == null || kvp.Value == 0 ? null : kvp.Value; break; case "PictureWidth": - preset.Task.Width = kvp.Value; + preset.Task.Width = kvp.Value == null || kvp.Value == 0 ? null : kvp.Value; break; case "PictureKeepRatio": preset.Task.KeepDisplayAspect = kvp.Value == 1; diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index aa447e2e2..f4f496fcb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -12,8 +12,6 @@ namespace HandBrakeWPF.ViewModels using System.Collections.Generic; using System.Windows; - using Caliburn.Micro; - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services; using HandBrake.ApplicationServices.Services.Interfaces; @@ -27,6 +25,8 @@ namespace HandBrakeWPF.ViewModels /// public class AddPresetViewModel : ViewModelBase, IAddPresetViewModel { + /* TODO this window is up for redesign. Quite a few nippy edge cases that can cause odd behaviour with importing presets. */ + /// /// Backing field for the Preset Service /// @@ -50,16 +50,13 @@ namespace HandBrakeWPF.ViewModels /// /// Initializes a new instance of the class. /// - /// - /// The window manager. - /// /// /// The Preset Service /// /// /// The Error Service /// - public AddPresetViewModel(IWindowManager windowManager, IPresetService presetService, IErrorService errorService) + public AddPresetViewModel(IPresetService presetService, IErrorService errorService) { this.presetService = presetService; this.errorService = errorService; @@ -151,6 +148,12 @@ namespace HandBrakeWPF.ViewModels } } + if (this.SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum && (this.Preset.Task.Width == null || this.Preset.Task.Width == 0)) + { + this.errorService.ShowMessageBox("You must first scan a source to use the 'Source Maximum' Option.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); + return; + } + this.Preset.UsePictureFilters = this.Preset.UsePictureFilters; this.Preset.PictureSettingsMode = this.SelectedPictureSettingMode; -- 2.40.0