From 6edc65ef71072a5ebc519cecf267dbf457bee2a6 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 24 Sep 2011 22:15:17 +0000 Subject: 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 --- win/CS/Functions/PresetLoader.cs | 19 +++++++++++++++++-- win/CS/Functions/QueryGenerator.cs | 9 ++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'win/CS/Functions') 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 @@ -27,6 +27,21 @@ namespace Handbrake.Functions /// private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService; + /// + /// Load an Encode task as a Preset + /// + /// + /// The main window. + /// + /// + /// The encode task. + /// + public static void LoadPreset(frmMain mainWindow, EncodeTask encodeTask) + { + Preset preset = new Preset { Name = "Unknown", Task = encodeTask }; + LoadPreset(mainWindow, preset); + } + /// /// This function takes in a Query which has been parsed by QueryParser and /// set's all the GUI widgets correctly. @@ -37,10 +52,10 @@ namespace Handbrake.Functions /// /// The preset. /// - 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) { -- cgit v1.2.3