summaryrefslogtreecommitdiffstats
path: root/win/CS/frmMain.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-09-24 21:52:17 +0000
committersr55 <[email protected]>2011-09-24 21:52:17 +0000
commitf62a6501bae828a835383e6226f3bd86173e36ae (patch)
tree84a26e33d971999935bb4632ea88b8d6b79f3ead /win/CS/frmMain.cs
parent1d1054492cc183ee7b731cf9d1ce787707c7abf5 (diff)
WinGui: Some bug fixes and re-factoring of the preset code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4246 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/frmMain.cs')
-rw-r--r--win/CS/frmMain.cs40
1 files changed, 27 insertions, 13 deletions
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs
index 6687dd540..072b18b2c 100644
--- a/win/CS/frmMain.cs
+++ b/win/CS/frmMain.cs
@@ -182,10 +182,9 @@ namespace Handbrake
ToolTip.Active = true;
// Load the user's default settings or Normal Preset
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset) != string.Empty
- && presetHandler.GetPreset(userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset)) != null)
+ if (this.presetHandler.DefaultPreset != null)
{
- this.loadPreset(userSettingService.GetUserSetting<string>(UserSettingConstants.DefaultPreset));
+ this.loadPreset(this.presetHandler.DefaultPreset.Name);
}
else
loadPreset("Normal");
@@ -569,12 +568,7 @@ namespace Handbrake
/// </param>
private void pmnu_delete_click(object sender, EventArgs e)
{
- if (treeView_presets.SelectedNode != null)
- {
- presetHandler.Remove((Preset)treeView_presets.SelectedNode.Tag);
- treeView_presets.Nodes.Remove(treeView_presets.SelectedNode);
- }
- treeView_presets.Select();
+ BtnRemovePreset_Click(sender, e);
}
/// <summary>
@@ -639,21 +633,41 @@ namespace Handbrake
}
else
{
+ Preset preset = treeView_presets.SelectedNode.Tag as Preset;
+ if (preset != null && preset.IsDefault)
+ {
+ MessageBox.Show(
+ "Your default preset can not be deleted. It is a required preset.",
+ "Warning",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+
// Delete the selected item.
presetHandler.Remove((Preset)treeView_presets.SelectedNode.Tag);
}
- treeView_presets.Nodes.Remove(treeView_presets.SelectedNode);
+
+ this.LoadPresetPanel();
}
treeView_presets.Select();
+ treeView_presets.ExpandAll();
}
private void MnuSetDefaultPreset_Click(object sender, EventArgs e)
{
if (treeView_presets.SelectedNode != null)
{
- this.userSettingService.SetUserSetting(UserSettingConstants.DefaultPreset, treeView_presets.SelectedNode.Text);
- MessageBox.Show("New default preset set: " + treeView_presets.SelectedNode.Text, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ Preset preset = treeView_presets.SelectedNode.Tag as Preset;
+ if (preset != null)
+ {
+ MessageBox.Show(
+ "New default preset set: " + treeView_presets.SelectedNode.Text,
+ "Alert",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ this.presetHandler.SetDefault(preset);
+ }
}
else
MessageBox.Show("Please select a preset first.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -1548,7 +1562,7 @@ namespace Handbrake
text_destination.Text = autoPath;
else
MessageBox.Show(
- "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a valid default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'General' Tab -> 'Default Path')",
+ "You currently have \"Automatically name output files\" enabled for the destination file box, but you do not have a valid default directory set.\n\nYou should set a \"Default Path\" in HandBrakes preferences. (See 'Tools' menu -> 'Options' -> 'Output Files' Tab -> 'Default Path')",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}