diff options
author | sr55 <[email protected]> | 2011-08-27 21:39:15 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-08-27 21:39:15 +0000 |
commit | 3e32e57c216db0b6acf6166b9f23f2ede3aece30 (patch) | |
tree | b130fe618627832fe6d01f68198f15079d9b840c | |
parent | f73206bf585737a16706b7445a7add49959bc6a3 (diff) |
WinGui: Some refactoring of the preset services to make them simpler and restoring old functionality that allowed storing of crop settings to match the macgui.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4194 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/CS/Functions/PresetLoader.cs | 17 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs | 5 | ||||
-rw-r--r-- | win/CS/frmMain.cs | 25 |
3 files changed, 22 insertions, 25 deletions
diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index d448c22f2..69acda4b2 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -12,6 +12,7 @@ namespace Handbrake.Functions using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
using OutputFormat = HandBrake.ApplicationServices.Model.Encoding.OutputFormat;
@@ -33,14 +34,14 @@ namespace Handbrake.Functions /// <param name="mainWindow">
/// FrmMain window
/// </param>
- /// <param name="presetQuery">
- /// The Parsed CLI Query
+ /// <param name="preset">
+ /// The preset.
/// </param>
- /// <param name="name">
- /// Name of the preset
- /// </param>
- public static void LoadPreset(frmMain mainWindow, EncodeTask presetQuery, string name)
+ public static void LoadPreset(frmMain mainWindow, Preset preset)
{
+ // Send the query from the file to the Query Parser class
+ EncodeTask presetQuery = QueryParserUtility.Parse(preset.Query);
+
#region Source
// Reset some vaules to stock first to prevent errors.
@@ -95,7 +96,7 @@ namespace Handbrake.Functions #region Picture
mainWindow.PictureSettings.check_autoCrop.Checked = true;
- if (presetQuery.IsCustomCropping)
+ if (preset.CropSettings)
{
mainWindow.PictureSettings.check_customCrop.Checked = true;
mainWindow.PictureSettings.crop_top.Value = presetQuery.Cropping.Top;
@@ -282,7 +283,7 @@ namespace Handbrake.Functions mainWindow.x264Panel.X264Query = presetQuery.AdvancedEncoderOptions;
// Set the preset name
- mainWindow.labelPreset.Text = "Output Settings (Preset: " + name + ")";
+ mainWindow.labelPreset.Text = "Output Settings (Preset: " + preset.Name + ")";
#endregion
}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 1d7c61913..31b46acdf 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -113,11 +113,6 @@ namespace HandBrake.ApplicationServices.Model public int? MaxHeight { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether CustomCropping.
- /// </summary>
- public bool IsCustomCropping { get; set; }
-
- /// <summary>
/// Gets or sets Cropping.
/// </summary>
public Cropping Cropping { get; set; }
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index ba4826209..efe741522 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -766,11 +766,8 @@ namespace Handbrake // Ok, Reset all the H264 widgets before changing the preset
x264Panel.Reset2Defaults();
- // Send the query from the file to the Query Parser class
- EncodeTask presetQuery = QueryParserUtility.Parse(query);
-
// Now load the preset
- PresetLoader.LoadPreset(this, presetQuery, presetName);
+ PresetLoader.LoadPreset(this, preset);
// The x264 widgets will need updated, so do this now:
x264Panel.StandardizeOptString();
@@ -838,9 +835,6 @@ namespace Handbrake MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
-
- PresetLoader.LoadPreset(this, parsed, parsed.PresetName);
-
Preset preset = new Preset
{
Name = parsed.PresetName,
@@ -848,19 +842,22 @@ namespace Handbrake CropSettings = parsed.UsesPictureSettings
};
+ PresetLoader.LoadPreset(this, preset);
+
presetHandler.Update(preset);
}
}
else
{
- PresetLoader.LoadPreset(this, parsed, parsed.PresetName);
+
Preset preset = new Preset
{
Name = parsed.PresetName,
Query = QueryGenerator.GenerateFullQuery(this),
CropSettings = parsed.UsesPictureSettings,
};
-
+ PresetLoader.LoadPreset(this, preset);
+
if (presetHandler.Add(preset))
{
TreeNode preset_treeview = new TreeNode(parsed.PresetName)
@@ -2144,11 +2141,15 @@ namespace Handbrake // Setup UI
if (queueEdit.Query != null)
{
- // Send the query from the file to the Query Parser class
- EncodeTask presetQuery = QueryParserUtility.Parse(queueEdit.Query);
+ Preset preset = new Preset
+ {
+ Name = "Loaded Back From Queue",
+ Query = queueEdit.Query,
+ CropSettings = true,
+ };
// Now load the preset
- PresetLoader.LoadPreset(this, presetQuery, "Load Back From Queue");
+ PresetLoader.LoadPreset(this, preset);
// Set the destination path
this.text_destination.Text = queueEdit.Destination;
|