summaryrefslogtreecommitdiffstats
path: root/win/CS/frmMain.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-04-30 21:25:53 +0000
committersr55 <[email protected]>2011-04-30 21:25:53 +0000
commit3d7392c9e4f114408b2fd16bd848a2e10c36fa32 (patch)
treecd802e9671489ddaadbc10bb293c6b21d659b11b /win/CS/frmMain.cs
parent5b285a225cc750a7d07b3eea799058e1ffcf07cd (diff)
WinGui:
- Fix to the Audio Panel Track Display which was intermittently not showing a track. - Fixed a number of bugs in the plist parser which was prevent imports. - Fixed a number of Issues with the Preset Import/Export. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3972 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/frmMain.cs')
-rw-r--r--win/CS/frmMain.cs49
1 files changed, 40 insertions, 9 deletions
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs
index 10cd69952..1b053150c 100644
--- a/win/CS/frmMain.cs
+++ b/win/CS/frmMain.cs
@@ -589,7 +589,7 @@ namespace Handbrake
// Now enable the save menu if the selected preset is a user preset
if (treeView_presets.SelectedNode != null)
- pmnu_saveChanges.Enabled = presetHandler.CanUpdatePreset(treeView_presets.SelectedNode.Text);
+ pmnu_saveChanges.Enabled = presetHandler.CanUpdatePreset(treeView_presets.SelectedNode.Text);
treeView_presets.Select();
}
@@ -634,7 +634,6 @@ namespace Handbrake
treeView_presets.Select();
}
-
private void MnuSetDefaultPreset_Click(object sender, EventArgs e)
{
if (treeView_presets.SelectedNode != null)
@@ -648,7 +647,7 @@ namespace Handbrake
}
private void MnuImportPreset_Click(object sender, EventArgs e)
- {
+ {
this.ImportPreset();
}
@@ -800,22 +799,43 @@ namespace Handbrake
/// </summary>
private void ImportPreset()
{
+ if (this.selectedTitle == null)
+ {
+ MessageBox.Show(
+ "Please scan a source before trying to import a preset.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+
if (openPreset.ShowDialog() == DialogResult.OK)
{
EncodeTask parsed = PlistPresetHandler.Import(openPreset.FileName);
- if (presetHandler.CheckIfPresetExists(parsed.PresetName + " (Imported)"))
+ if (presetHandler.CheckIfPresetExists(parsed.PresetName))
{
+ if (!presetHandler.CanUpdatePreset(parsed.PresetName))
+ {
+ MessageBox.Show(
+ "You can not import a preset with the same name as a built-in preset.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+
DialogResult result =
MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?",
"Overwrite preset?",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
+
PresetLoader.LoadPreset(this, parsed, parsed.PresetName);
Preset preset = new Preset
{
- Name = parsed.PresetName + " (Imported)",
+ Name = parsed.PresetName,
Query = QueryGenerator.GenerateFullQuery(this),
CropSettings = parsed.UsesPictureSettings
};
@@ -829,16 +849,17 @@ namespace Handbrake
Preset preset = new Preset
{
- Name = parsed.PresetName + " (Imported)",
+ Name = parsed.PresetName,
Query = QueryGenerator.GenerateFullQuery(this),
- CropSettings = parsed.UsesPictureSettings
+ CropSettings = parsed.UsesPictureSettings,
};
if (presetHandler.Add(preset))
{
- TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)")
+ TreeNode preset_treeview = new TreeNode(parsed.PresetName)
{
- ForeColor = Color.Black
+ ForeColor = Color.Black,
+ Tag = preset,
};
treeView_presets.Nodes.Add(preset_treeview);
}
@@ -851,6 +872,16 @@ namespace Handbrake
/// </summary>
private void ExportPreset()
{
+ if (this.selectedTitle == null)
+ {
+ MessageBox.Show(
+ "Please scan a source before trying to export a preset.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+
SaveFileDialog savefiledialog = new SaveFileDialog { Filter = "plist|*.plist" };
if (treeView_presets.SelectedNode != null)