diff options
author | sr55 <[email protected]> | 2011-09-24 22:15:17 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-09-24 22:15:17 +0000 |
commit | 6edc65ef71072a5ebc519cecf267dbf457bee2a6 (patch) | |
tree | 520a7d265a89f88bc61b0a45a16feae91db00ea9 /win | |
parent | f62a6501bae828a835383e6226f3bd86173e36ae (diff) |
WinGui: Some further fixes to the preset code. Plist import fixes. (Still need to update the imported to work with new settings)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4247 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/Functions/PresetLoader.cs | 19 | ||||
-rw-r--r-- | win/CS/Functions/QueryGenerator.cs | 9 | ||||
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Model/Preset.cs | 5 | ||||
-rw-r--r-- | win/CS/frmMain.cs | 4 |
4 files changed, 31 insertions, 6 deletions
diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index e78754925..de4058210 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -28,6 +28,21 @@ namespace Handbrake.Functions private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
/// <summary>
+ /// Load an Encode task as a Preset
+ /// </summary>
+ /// <param name="mainWindow">
+ /// The main window.
+ /// </param>
+ /// <param name="encodeTask">
+ /// The encode task.
+ /// </param>
+ public static void LoadPreset(frmMain mainWindow, EncodeTask encodeTask)
+ {
+ Preset preset = new Preset { Name = "Unknown", Task = encodeTask };
+ LoadPreset(mainWindow, preset);
+ }
+
+ /// <summary>
/// This function takes in a Query which has been parsed by QueryParser and
/// set's all the GUI widgets correctly.
/// </summary>
@@ -37,10 +52,10 @@ namespace Handbrake.Functions /// <param name="preset">
/// The preset.
/// </param>
- public static void LoadPreset(frmMain mainWindow, Preset preset)
+ 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);
+ EncodeTask presetQuery = preset.Task ?? QueryParserUtility.Parse(preset.Query);
#region Source
diff --git a/win/CS/Functions/QueryGenerator.cs b/win/CS/Functions/QueryGenerator.cs index ac5947ba6..c042daa79 100644 --- a/win/CS/Functions/QueryGenerator.cs +++ b/win/CS/Functions/QueryGenerator.cs @@ -69,7 +69,14 @@ namespace Handbrake.Functions query += GenerateTabbedComponentsQuery(mainWindow, true, QueryPictureSettingsMode.UserInterfaceSettings, 0, 0);
// Create the Queue Task and setup the EncodeTask model object.
- Preset preset = mainWindow.treeView_presets.SelectedNode.Tag as Preset;
+
+
+ Preset preset = null;
+ if (mainWindow.treeView_presets.SelectedNode != null)
+ {
+ preset = mainWindow.treeView_presets.SelectedNode.Tag as Preset;
+ }
+
bool isCustom = true;
if (preset != null && preset.IsBuildIn)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs index eedf3f737..b9e52ca9f 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Preset.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Preset.cs @@ -51,6 +51,11 @@ namespace HandBrake.ApplicationServices.Model public bool IsDefault { get; set; }
/// <summary>
+ /// Gets or sets task.
+ /// </summary>
+ public EncodeTask Task { get; set; }
+
+ /// <summary>
/// Override the ToString Method
/// </summary>
/// <returns>
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 072b18b2c..599cf31d4 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -839,6 +839,7 @@ namespace Handbrake if (openPreset.ShowDialog() == DialogResult.OK)
{
EncodeTask parsed = PlistPresetHandler.Import(openPreset.FileName);
+ PresetLoader.LoadPreset(this, parsed);
if (presetHandler.CheckIfPresetExists(parsed.PresetName))
{
if (!presetHandler.CanUpdatePreset(parsed.PresetName))
@@ -864,8 +865,6 @@ namespace Handbrake CropSettings = parsed.UsesPictureSettings
};
- PresetLoader.LoadPreset(this, preset);
-
presetHandler.Update(preset);
}
}
@@ -878,7 +877,6 @@ namespace Handbrake Query = QueryGenerator.GenerateFullQuery(this).Query,
CropSettings = parsed.UsesPictureSettings,
};
- PresetLoader.LoadPreset(this, preset);
if (presetHandler.Add(preset))
{
|