summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-05-25 15:22:10 +0000
committersr55 <[email protected]>2013-05-25 15:22:10 +0000
commitbe639f834ba19e1853d6c2844386478fb8c9a13c (patch)
treebbf8974965e23da167ded1906788b0fdc5bab43c /win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
parent3c4dcbe57e88d64eb9ff4e1186f7daf5793e02f2 (diff)
WinGui: Refactor the Presets Picture Size handling to make it a bit clearer what's actually happening.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5512 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs17
1 files changed, 11 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
index f4f496fcb..488f58d74 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs
@@ -13,6 +13,7 @@ namespace HandBrakeWPF.ViewModels
using System.Windows;
using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -25,8 +26,6 @@ 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>
@@ -48,6 +47,11 @@ namespace HandBrakeWPF.ViewModels
private bool showCustomInputs;
/// <summary>
+ /// The source.
+ /// </summary>
+ private Title selectedTitle;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
/// <param name="presetService">
@@ -123,9 +127,10 @@ namespace HandBrakeWPF.ViewModels
/// <param name="task">
/// The Encode Task.
/// </param>
- public void Setup(EncodeTask task)
+ public void Setup(EncodeTask task, Title title)
{
this.Preset.Task = new EncodeTask(task);
+ this.selectedTitle = title;
}
/// <summary>
@@ -148,7 +153,7 @@ namespace HandBrakeWPF.ViewModels
}
}
- if (this.SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum && (this.Preset.Task.Width == null || this.Preset.Task.Width == 0))
+ if (this.SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum && this.selectedTitle == null)
{
this.errorService.ShowMessageBox("You must first scan a source to use the 'Source Maximum' Option.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
@@ -174,8 +179,8 @@ namespace HandBrakeWPF.ViewModels
if (this.SelectedPictureSettingMode == PresetPictureSettingsMode.SourceMaximum)
{
- this.Preset.Task.MaxWidth = this.Preset.Task.Width;
- this.Preset.Task.MaxHeight = this.Preset.Task.Height;
+ this.Preset.Task.MaxWidth = selectedTitle.Resolution.Width;
+ this.Preset.Task.MaxHeight = selectedTitle.Resolution.Height;
}
// Add the Preset