summaryrefslogtreecommitdiffstats
path: root/win/C#/Presets
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-01-08 19:51:08 +0000
committersr55 <[email protected]>2009-01-08 19:51:08 +0000
commita385d189c2830994e460b8739546825d7f4418d2 (patch)
tree3659a2f82578a3c894974c355532a6a6e8f744d2 /win/C#/Presets
parent603a154a73ced4dbdfa187ee88eda66833952d87 (diff)
WinGui:
- Patch (slightly modified) by ween to allow users to update their own presets via a "save changes" option in the presets right click menu. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2068 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Presets')
-rw-r--r--win/C#/Presets/PresetsHandler.cs45
1 files changed, 41 insertions, 4 deletions
diff --git a/win/C#/Presets/PresetsHandler.cs b/win/C#/Presets/PresetsHandler.cs
index fbd36fbdb..171b313c1 100644
--- a/win/C#/Presets/PresetsHandler.cs
+++ b/win/C#/Presets/PresetsHandler.cs
@@ -20,6 +20,7 @@ namespace Handbrake.Presets
/// </summary>
/// <param name="presetName">String, The name of the new preset</param>
/// <param name="query">String, the CLI query for the new preset</param>
+ /// <param name="pictureSettings"> Bool, store crop/picture sizes in the presets</param>
public Boolean addPreset(string presetName, string query, Boolean pictureSettings)
{
if (checkIfPresetExists(presetName) == false)
@@ -68,16 +69,32 @@ namespace Handbrake.Presets
}
user_presets = newUserPresets;
- // Now, Update the presets.xml and user_presets.xml file with the new items.
- string userPresets = Application.StartupPath.ToString() + "\\user_presets.xml";
- string presetsFile = Application.StartupPath.ToString() + "\\presets.xml";
-
// Rebuild the user_presets.xml file
updateUserPresetsFile();
updatePresetsFile();
}
/// <summary>
+ /// Save changes to a given preset in the user preset list.
+ /// </summary>
+ /// <param name="presetName">String, The name of the new preset</param>
+ /// <param name="query">String, the CLI query for the new preset</param>
+ /// <param name="pictureSettings"> Bool, store crop/picture sizes in the preset</param>
+ public void updatePreset(string presetName, string query, Boolean pictureSettings)
+ {
+ // User Presets
+ foreach (Preset item in user_presets)
+ {
+ if (item.Name == presetName)
+ {
+ item.Query = query;
+ item.PictureSettings = pictureSettings;
+ MessageBox.Show("Changes to \"" + presetName + "\" Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+ }
+
+ /// <summary>
/// Get a List of all the built in preset names.
/// </summary>
/// <returns>List<String> of preset names</returns>
@@ -314,5 +331,25 @@ namespace Handbrake.Presets
return false;
}
+
+ /// <summary>
+ /// Check if the user preset "name" exists in user_presets list.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public Boolean checkIfUserPresetExists(string name)
+ {
+ if (name == string.Empty)
+ return false;
+
+ // User Presets
+ foreach (Preset item in user_presets)
+ {
+ if (item.Name == name)
+ return true;
+ }
+
+ return false;
+ }
}
} \ No newline at end of file