summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-04-21 14:28:52 +0000
committersr55 <[email protected]>2013-04-21 14:28:52 +0000
commit76d311c9aa5e4e6b58dfd1d570d275caf44051c4 (patch)
tree34f7b8b67bd9eba5bd3427777a29fd3f47357181 /win/CS
parent6a3f1580b2988575fbd63b49ff26d714f7d449e3 (diff)
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
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Factories/PlistPresetFactory.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs15
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
/// </summary>
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. */
+
/// <summary>
/// Backing field for the Preset Service
/// </summary>
@@ -50,16 +50,13 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
- /// <param name="windowManager">
- /// The window manager.
- /// </param>
/// <param name="presetService">
/// The Preset Service
/// </param>
/// <param name="errorService">
/// The Error Service
/// </param>
- 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;