summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-09-20 15:11:23 +0000
committersr55 <[email protected]>2008-09-20 15:11:23 +0000
commitb9601981bb42dc82e5d49377fbc6c2de989973cb (patch)
tree02bda4b9c43d029c1e2071f4cc884fe81da11390
parentb3b3fc83847dc15ac9d0aaed2f41e8ffd8228ef2 (diff)
WinGui:
- User presets and built in presets are now show in seperate colours. User preset's are shown in black and built in are blue. - Added cancel button to add preset. - Removed File Menu > Import. This is not required. Users can import old .hb files as text into the query editor if need be. - Adding a new user preset no longer stores Title and file input/output information. While these were never used, it's a waste of space storing them in the user presets file. - Added a comfirm dialog for removing presets. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1735 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/Functions/Common.cs79
-rw-r--r--win/C#/Functions/Presets.cs17
-rw-r--r--win/C#/frmAddPreset.Designer.cs20
-rw-r--r--win/C#/frmAddPreset.cs7
-rw-r--r--win/C#/frmMain.Designer.cs23
-rw-r--r--win/C#/frmMain.cs57
-rw-r--r--win/C#/frmMain.resx19
7 files changed, 100 insertions, 122 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs
index 3fc0b35e0..b954a02b7 100644
--- a/win/C#/Functions/Common.cs
+++ b/win/C#/Functions/Common.cs
@@ -431,7 +431,7 @@ namespace Handbrake.Functions
query += " -o " + '"' + mainWindow.text_destination.Text + '"';
#endregion
- query += generateTabbedComponentsQuery(mainWindow, mainWindow.text_source.Text);
+ query += generateTabbedComponentsQuery(mainWindow);
return query;
}
@@ -466,7 +466,7 @@ namespace Handbrake.Functions
#endregion
- query += generateTabbedComponentsQuery(mainWindow, mainWindow.text_source.Text);
+ query += generateTabbedComponentsQuery(mainWindow);
return query;
}
@@ -476,34 +476,28 @@ namespace Handbrake.Functions
/// <param name="mainWindow"></param>
/// <param name="source"></param>
/// <returns></returns>
- private string generateTabbedComponentsQuery(frmMain mainWindow, string source)
+ public string generateTabbedComponentsQuery(frmMain mainWindow)
{
string query = "";
+ // The Output Settings box above the tabbed section.
+ #region Output Settings Box
query += " -f " + mainWindow.drop_format.Text.ToLower().Replace(" file", "");
+ // These are output settings features
+ if (mainWindow.check_largeFile.Checked)
+ query += " -4 ";
+
+ if (mainWindow.check_iPodAtom.Checked)
+ query += " -I ";
+
+ if (mainWindow.check_optimiseMP4.Checked)
+ query += " -O ";
+ #endregion
+
// Picture Settings Tab
#region Picture Settings Tab
- switch (mainWindow.drp_videoEncoder.Text)
- {
- case "MPEG-4 (FFmpeg)":
- query += " -e ffmpeg";
- break;
- case "MPEG-4 (XviD)":
- query += " -e xvid";
- break;
- case "H.264 (x264)":
- query += " -e x264";
- break;
- case "VP3 (Theora)":
- query += " -e theora";
- break;
- default:
- query += " -e x264";
- break;
- }
-
if (mainWindow.text_width.Text != "")
query += " -w " + mainWindow.text_width.Text;
@@ -560,9 +554,6 @@ namespace Handbrake.Functions
query += " --decomb ";
}
- if (mainWindow.check_grayscale.Checked)
- query += " -g ";
-
if (mainWindow.drp_anamorphic.SelectedIndex == 1)
query += " -p ";
else if (mainWindow.drp_anamorphic.SelectedIndex == 2)
@@ -580,15 +571,28 @@ namespace Handbrake.Functions
// Video Settings Tab
#region Video Settings Tab
- // These are output settings features
- if (mainWindow.check_largeFile.Checked)
- query += " -4 ";
- if (mainWindow.check_iPodAtom.Checked)
- query += " -I ";
+ switch (mainWindow.drp_videoEncoder.Text)
+ {
+ case "MPEG-4 (FFmpeg)":
+ query += " -e ffmpeg";
+ break;
+ case "MPEG-4 (XviD)":
+ query += " -e xvid";
+ break;
+ case "H.264 (x264)":
+ query += " -e x264";
+ break;
+ case "VP3 (Theora)":
+ query += " -e theora";
+ break;
+ default:
+ query += " -e x264";
+ break;
+ }
- if (mainWindow.check_optimiseMP4.Checked)
- query += " -O ";
+ if (mainWindow.check_grayscale.Checked)
+ query += " -g ";
// Video Settings
if (mainWindow.text_bitrate.Text != "")
@@ -608,17 +612,15 @@ namespace Handbrake.Functions
if (mainWindow.check_2PassEncode.Checked)
query += " -2 ";
+ if (mainWindow.check_turbo.Checked)
+ query += " -T ";
+
if (mainWindow.drp_videoFramerate.Text != "Same as source")
{
if (!mainWindow.check_vfr.Checked)
query += " -r " + mainWindow.drp_videoFramerate.Text;
}
- if (mainWindow.check_turbo.Checked)
- query += " -T ";
-
-
-
switch (mainWindow.drp_deNoise.Text)
{
case "None":
@@ -673,7 +675,6 @@ namespace Handbrake.Functions
string Mixdown4 = mainWindow.drp_audmix_4.Text;
string drc4 = mainWindow.trackBar4.Value.ToString();
-
//
// Audio Track Selections
//
@@ -859,7 +860,7 @@ namespace Handbrake.Functions
// Attach Source name and dvd title to the start of the chapters.csv filename.
// This is for the queue. It allows different chapter name files for each title.
string source_name = mainWindow.text_source.Text;
- string[] sourceName = source.Split('\\');
+ string[] sourceName = source_name.Split('\\');
source_name = sourceName[sourceName.Length - 1];
source_name = source_name.Replace("\"", "");
diff --git a/win/C#/Functions/Presets.cs b/win/C#/Functions/Presets.cs
index 9c23aef1d..353846b23 100644
--- a/win/C#/Functions/Presets.cs
+++ b/win/C#/Functions/Presets.cs
@@ -87,11 +87,10 @@ namespace Handbrake.Functions
}
/// <summary>
- /// Get an Arraylist of all the preset names.
- /// Includes both built in and user presets.
+ /// Get a List of all the built in preset names.
/// </summary>
- /// <returns>Arraylist of preset names</returns>
- public List<string> getPresetNames()
+ /// <returns>List<String> of preset names</returns>
+ public List<string> getBuildInPresetNames()
{
List<string> names = new List<string>();
@@ -104,6 +103,16 @@ namespace Handbrake.Functions
names.Add(presetName[0]);
}
+ return names;
+ }
+
+ /// <summary>
+ /// Get a List of all the User preset names.
+ /// </summary>
+ /// <returns>List<String> of preset names</returns>
+ public List<string> getUserPresetNames()
+ {
+ List<string> names = new List<string>();
// User Presets
foreach (string item in user_presets)
diff --git a/win/C#/frmAddPreset.Designer.cs b/win/C#/frmAddPreset.Designer.cs
index 00f33ba21..3db705c1b 100644
--- a/win/C#/frmAddPreset.Designer.cs
+++ b/win/C#/frmAddPreset.Designer.cs
@@ -38,6 +38,7 @@ namespace Handbrake
this.lbl_name = new System.Windows.Forms.Label();
this.txt_preset_name = new System.Windows.Forms.TextBox();
this.btn_add = new System.Windows.Forms.Button();
+ this.btn_cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lbl_name
@@ -65,7 +66,7 @@ namespace Handbrake
this.btn_add.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_add.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_add.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_add.Location = new System.Drawing.Point(284, 42);
+ this.btn_add.Location = new System.Drawing.Point(284, 44);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(66, 22);
this.btn_add.TabIndex = 0;
@@ -74,11 +75,27 @@ namespace Handbrake
this.btn_add.UseVisualStyleBackColor = false;
this.btn_add.Click += new System.EventHandler(this.btn_add_Click);
//
+ // btn_cancel
+ //
+ this.btn_cancel.BackColor = System.Drawing.SystemColors.Control;
+ this.btn_cancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+ this.btn_cancel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_cancel.Location = new System.Drawing.Point(212, 44);
+ this.btn_cancel.Name = "btn_cancel";
+ this.btn_cancel.Size = new System.Drawing.Size(66, 22);
+ this.btn_cancel.TabIndex = 3;
+ this.btn_cancel.TabStop = false;
+ this.btn_cancel.Text = "Cancel";
+ this.btn_cancel.UseVisualStyleBackColor = false;
+ this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
+ //
// frmAddPreset
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(362, 76);
+ this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_add);
this.Controls.Add(this.txt_preset_name);
this.Controls.Add(this.lbl_name);
@@ -102,5 +119,6 @@ namespace Handbrake
private System.Windows.Forms.Label lbl_name;
private System.Windows.Forms.TextBox txt_preset_name;
internal System.Windows.Forms.Button btn_add;
+ internal System.Windows.Forms.Button btn_cancel;
}
} \ No newline at end of file
diff --git a/win/C#/frmAddPreset.cs b/win/C#/frmAddPreset.cs
index 1a18c0a17..44e99105d 100644
--- a/win/C#/frmAddPreset.cs
+++ b/win/C#/frmAddPreset.cs
@@ -30,7 +30,7 @@ namespace Handbrake
private void btn_add_Click(object sender, EventArgs e)
{
- String query = hb_common_func.GenerateTheQuery(frmMainWindow);
+ String query = hb_common_func.generateTabbedComponentsQuery(frmMainWindow);
if (presetCode.addPreset(txt_preset_name.Text.Trim(), query) == true)
{
@@ -39,5 +39,10 @@ namespace Handbrake
}
}
+ private void btn_cancel_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
}
} \ No newline at end of file
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 5aa479623..acd734f0f 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -91,8 +91,6 @@ namespace Handbrake
this.File_Open = new System.Windows.Forms.OpenFileDialog();
this.ISO_Open = new System.Windows.Forms.OpenFileDialog();
this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_open = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_exit = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_open3 = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -1023,32 +1021,15 @@ namespace Handbrake
// FileToolStripMenuItem
//
this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.mnu_open,
- this.toolStripSeparator2,
this.mnu_exit});
this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
this.FileToolStripMenuItem.Size = new System.Drawing.Size(38, 20);
this.FileToolStripMenuItem.Text = "&File";
//
- // mnu_open
- //
- this.mnu_open.Image = ((System.Drawing.Image)(resources.GetObject("mnu_open.Image")));
- this.mnu_open.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.mnu_open.Name = "mnu_open";
- this.mnu_open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
- this.mnu_open.Size = new System.Drawing.Size(210, 22);
- this.mnu_open.Text = "&Import Preset";
- this.mnu_open.Click += new System.EventHandler(this.mnu_open_Click);
- //
- // toolStripSeparator2
- //
- this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(207, 6);
- //
// mnu_exit
//
this.mnu_exit.Name = "mnu_exit";
- this.mnu_exit.Size = new System.Drawing.Size(210, 22);
+ this.mnu_exit.Size = new System.Drawing.Size(152, 22);
this.mnu_exit.Text = "E&xit";
this.mnu_exit.Click += new System.EventHandler(this.mnu_exit_Click);
//
@@ -3310,8 +3291,6 @@ namespace Handbrake
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.SaveFileDialog DVD_Save;
private System.Windows.Forms.OpenFileDialog File_Open;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
- private System.Windows.Forms.ToolStripMenuItem mnu_open;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
internal System.Windows.Forms.CheckBox check_vfr;
internal System.Windows.Forms.CheckBox check_iPodAtom;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 349ba98a2..092e9b7de 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -192,36 +192,6 @@ namespace Handbrake
// The Applications Main Menu *****************************************
#region File Menu
- private void mnu_open_Click(object sender, EventArgs e)
- {
- string filename;
- File_Open.ShowDialog();
- filename = File_Open.FileName;
-
- if (filename != "")
- {
- try
- {
- // Create StreamReader & open file
- StreamReader line = new StreamReader(filename);
-
- // Send the query from the file to the Query Parser class then load the preset
- Functions.QueryParser presetQuery = Functions.QueryParser.Parse(line.ReadLine());
- hb_common_func.presetLoader(this, presetQuery, filename);
-
- // Close the stream
- line.Close();
-
- Form preset = new frmAddPreset(this, presetHandler);
- preset.ShowDialog();
-
- }
- catch (Exception exc)
- {
- MessageBox.Show("Unable to load profile. \n\n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- }
- }
private void mnu_exit_Click(object sender, EventArgs e)
{
Application.Exit();
@@ -1362,10 +1332,14 @@ namespace Handbrake
}
private void btn_removePreset_Click(object sender, EventArgs e)
{
- if (treeView_presets.SelectedNode != null)
- presetHandler.remove(treeView_presets.SelectedNode.Text);
- // Now reload the preset panel
- loadPresetPanel();
+ DialogResult result = MessageBox.Show("Are you sure you wish to delete the selected preset?", "Preset", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ if (result == DialogResult.Yes)
+ {
+ if (treeView_presets.SelectedNode != null)
+ presetHandler.remove(treeView_presets.SelectedNode.Text);
+ // Now reload the preset panel
+ loadPresetPanel();
+ }
}
private void btn_setDefault_Click(object sender, EventArgs e)
{
@@ -1770,13 +1744,22 @@ namespace Handbrake
treeView_presets.Nodes.Clear();
List<string> presetNameList = new List<string>();
- presetNameList = presetHandler.getPresetNames();
+ TreeNode preset_treeview = new TreeNode();
+
+ presetNameList = presetHandler.getBuildInPresetNames();
+ foreach (string preset in presetNameList)
+ {
+ preset_treeview = new TreeNode(preset);
+
+ // Now Fill Out List View with Items
+ treeView_presets.Nodes.Add(preset_treeview);
+ }
- // Adds a new preset name to the preset list.
- TreeNode preset_treeview = new TreeNode();
+ presetNameList = presetHandler.getUserPresetNames();
foreach (string preset in presetNameList)
{
preset_treeview = new TreeNode(preset);
+ preset_treeview.ForeColor = Color.Black;
// Now Fill Out List View with Items
treeView_presets.Nodes.Add(preset_treeview);
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx
index 1b5323eb3..a016a1825 100644
--- a/win/C#/frmMain.resx
+++ b/win/C#/frmMain.resx
@@ -164,30 +164,13 @@ Note: Do not change any of the chapter numbers!</value>
<metadata name="ISO_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>329, 15</value>
</metadata>
- <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
- <data name="mnu_open.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlpJREFUOE+tk21I
- k1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC
- TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p
- AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0
- BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr
- UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG
- CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5
- F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS
- rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt
- NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp
- 59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W
- AAAAAElFTkSuQmCC
-</value>
- </data>
<metadata name="frmMainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>106, 15</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>731, 18</value>
</metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btn_dvd_source.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8