From b9fb350aea3bb37349f24d6b33341b2644407588 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 10 Sep 2008 11:16:21 +0000 Subject: WinGui: - New option to allow the user to enter which format they wish the autoName function to use. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1686 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/Common.cs | 26 +++++-- win/C#/Properties/Settings.Designer.cs | 14 +++- win/C#/Properties/Settings.settings | 3 + win/C#/app.config | 3 + win/C#/frmOptions.Designer.cs | 51 +++++++++++-- win/C#/frmOptions.cs | 7 ++ win/C#/frmQueue.Designer.cs | 132 ++++++++++++++++----------------- win/C#/frmQueue.resx | 2 +- 8 files changed, 157 insertions(+), 81 deletions(-) (limited to 'win/C#') diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs index c9d65192b..96c56a856 100644 --- a/win/C#/Functions/Common.cs +++ b/win/C#/Functions/Common.cs @@ -1113,17 +1113,22 @@ namespace Handbrake.Functions { if (mainWindow.drp_dvdtitle.Text != "Automatic") { + // Todo: This code is a tad messy. Clean it up at some point. + // Get the Source Name string source = mainWindow.text_source.Text; string[] sourceName = source.Split('\\'); source = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", ""); + // Get the Selected Title Number string title = mainWindow.drp_dvdtitle.Text; string[] titlesplit = title.Split(' '); title = titlesplit[0]; + // Get the Chapter Start and Chapter End Numbers string cs = mainWindow.drop_chapterStart.Text; string cf = mainWindow.drop_chapterFinish.Text; + // Just incase the above are set to their default Automatic values, set the varible to "" if (title == "Automatic") title = ""; if (cs == "Auto") @@ -1131,10 +1136,22 @@ namespace Handbrake.Functions if (cf == "Auto") cf = ""; + // If both CS and CF are populated, set the dash varible string dash = ""; if (cf != "Auto") dash = "-"; + // Get the destination filename. + string destination_filename = ""; + if (Properties.Settings.Default.autoNameFormat != "") + { + destination_filename = Properties.Settings.Default.autoNameFormat; + destination_filename = destination_filename.Replace("{source}", source).Replace("{title}", title).Replace("{chapters}", cs + dash + cf); + } + else + destination_filename = source + "_T" + title + "_C" + cs + dash + cf; + + // If the text box is blank if (!mainWindow.text_destination.Text.Contains("\\")) { string filePath = ""; @@ -1143,19 +1160,16 @@ namespace Handbrake.Functions if (Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location") filePath = Properties.Settings.Default.autoNamePath + "\\"; } - mainWindow.text_destination.Text = filePath + source + "_T" + title + "_C" + cs + dash + cf + ".mp4"; + mainWindow.text_destination.Text = filePath + destination_filename + ".mp4"; } - else + else // If the text box already has a path and file { string dest = mainWindow.text_destination.Text; - string[] destName = dest.Split('\\'); - - string[] extension = dest.Split('.'); string ext = extension[extension.Length - 1]; - destName[destName.Length - 1] = source + "_T" + title + "_C" + cs + dash + cf + "." + ext; + destName[destName.Length - 1] = destination_filename + "." + ext; string fullDest = ""; foreach (string part in destName) diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index 487ee378c..0ce64f345 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1433 +// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -250,5 +250,17 @@ namespace Handbrake.Properties { this["default_decomb"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("{source}-{title}-{chapters}")] + public string autoNameFormat { + get { + return ((string)(this["autoNameFormat"])); + } + set { + this["autoNameFormat"] = value; + } + } } } diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index db282ddad..c7e206e1a 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -59,5 +59,8 @@ 4:10:15:9:10:35:9 + + {source}-{title}-{chapters} + \ No newline at end of file diff --git a/win/C#/app.config b/win/C#/app.config index 2ade94d35..e36dca948 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -64,6 +64,9 @@ 4:10:15:9:10:35:9 + + {source}-{title}-{chapters} + \ No newline at end of file diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index 1e1623077..a8f2e1641 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -69,6 +69,9 @@ namespace Handbrake this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pathFinder = new System.Windows.Forms.FolderBrowserDialog(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); + this.txt_autoNameFormat = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); this.tab_options.SuspendLayout(); this.tab_general.SuspendLayout(); this.tab_picture.SuspendLayout(); @@ -83,7 +86,7 @@ namespace Handbrake this.btn_close.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btn_close.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_close.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - this.btn_close.Location = new System.Drawing.Point(395, 323); + this.btn_close.Location = new System.Drawing.Point(395, 346); this.btn_close.Name = "btn_close"; this.btn_close.Size = new System.Drawing.Size(107, 22); this.btn_close.TabIndex = 53; @@ -120,11 +123,14 @@ namespace Handbrake this.tab_options.Location = new System.Drawing.Point(12, 55); this.tab_options.Name = "tab_options"; this.tab_options.SelectedIndex = 0; - this.tab_options.Size = new System.Drawing.Size(490, 262); + this.tab_options.Size = new System.Drawing.Size(490, 285); this.tab_options.TabIndex = 58; // // tab_general // + this.tab_general.Controls.Add(this.label7); + this.tab_general.Controls.Add(this.label5); + this.tab_general.Controls.Add(this.txt_autoNameFormat); this.tab_general.Controls.Add(this.btn_browse); this.tab_general.Controls.Add(this.label10); this.tab_general.Controls.Add(this.text_an_path); @@ -138,7 +144,7 @@ namespace Handbrake this.tab_general.Controls.Add(this.drp_completeOption); this.tab_general.Location = new System.Drawing.Point(4, 22); this.tab_general.Name = "tab_general"; - this.tab_general.Size = new System.Drawing.Size(482, 236); + this.tab_general.Size = new System.Drawing.Size(482, 259); this.tab_general.TabIndex = 3; this.tab_general.Text = "General"; this.tab_general.UseVisualStyleBackColor = true; @@ -268,7 +274,7 @@ namespace Handbrake this.tab_picture.Controls.Add(this.label3); this.tab_picture.Location = new System.Drawing.Point(4, 22); this.tab_picture.Name = "tab_picture"; - this.tab_picture.Size = new System.Drawing.Size(482, 236); + this.tab_picture.Size = new System.Drawing.Size(482, 292); this.tab_picture.TabIndex = 5; this.tab_picture.Text = "Picture"; this.tab_picture.UseVisualStyleBackColor = true; @@ -302,7 +308,7 @@ namespace Handbrake this.tab_cli.Controls.Add(this.Label4); this.tab_cli.Location = new System.Drawing.Point(4, 22); this.tab_cli.Name = "tab_cli"; - this.tab_cli.Size = new System.Drawing.Size(482, 236); + this.tab_cli.Size = new System.Drawing.Size(482, 292); this.tab_cli.TabIndex = 2; this.tab_cli.Text = "CLI"; this.tab_cli.UseVisualStyleBackColor = true; @@ -404,7 +410,7 @@ namespace Handbrake this.tab_advanced.Location = new System.Drawing.Point(4, 22); this.tab_advanced.Name = "tab_advanced"; this.tab_advanced.Padding = new System.Windows.Forms.Padding(3); - this.tab_advanced.Size = new System.Drawing.Size(482, 236); + this.tab_advanced.Size = new System.Drawing.Size(482, 292); this.tab_advanced.TabIndex = 4; this.tab_advanced.Text = "Advanced"; this.tab_advanced.UseVisualStyleBackColor = true; @@ -484,9 +490,37 @@ namespace Handbrake this.ToolTip.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; this.ToolTip.ToolTipTitle = "Tooltip"; // + // txt_autoNameFormat + // + this.txt_autoNameFormat.Location = new System.Drawing.Point(199, 198); + this.txt_autoNameFormat.Name = "txt_autoNameFormat"; + this.txt_autoNameFormat.Size = new System.Drawing.Size(255, 21); + this.txt_autoNameFormat.TabIndex = 79; + this.txt_autoNameFormat.TextChanged += new System.EventHandler(this.txt_autoNameFormat_TextChanged); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(111, 201); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(52, 13); + this.label5.TabIndex = 80; + this.label5.Text = "Format:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label7.Location = new System.Drawing.Point(197, 222); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(242, 12); + this.label7.TabIndex = 81; + this.label7.Text = "Available Options: {source} {title} {chapters}"; + // // frmOptions // - this.ClientSize = new System.Drawing.Size(514, 355); + this.ClientSize = new System.Drawing.Size(514, 375); this.Controls.Add(this.label8); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.tab_options); @@ -549,5 +583,8 @@ namespace Handbrake private System.Windows.Forms.TabPage tab_picture; private System.Windows.Forms.TextBox txt_decomb; private System.Windows.Forms.Label label3; + internal System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox txt_autoNameFormat; + private System.Windows.Forms.Label label7; } } \ No newline at end of file diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs index 2a7695fab..a94b2c752 100644 --- a/win/C#/frmOptions.cs +++ b/win/C#/frmOptions.cs @@ -57,6 +57,8 @@ namespace Handbrake if (Properties.Settings.Default.autoNaming == "Checked") check_autoNaming.CheckState = CheckState.Checked; + txt_autoNameFormat.Text = Properties.Settings.Default.autoNameFormat; + if (Properties.Settings.Default.drive_detection == "Checked") btn_drive_detect.CheckState = CheckState.Checked; @@ -121,6 +123,11 @@ namespace Handbrake Properties.Settings.Default.autoNaming = check_autoNaming.CheckState.ToString(); } + private void txt_autoNameFormat_TextChanged(object sender, EventArgs e) + { + Properties.Settings.Default.autoNameFormat = txt_autoNameFormat.Text; + } + private void btn_browse_Click(object sender, EventArgs e) { pathFinder.ShowDialog(); diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index 6c41a4e97..a02794142 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -50,7 +50,13 @@ namespace Handbrake this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.btn_encode = new System.Windows.Forms.ToolStripButton(); + this.btn_stop = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.drop_button_queue = new System.Windows.Forms.ToolStripDropDownButton(); + this.mnu_batch = new System.Windows.Forms.ToolStripMenuItem(); + this.mnu_import = new System.Windows.Forms.ToolStripMenuItem(); + this.mnu_export = new System.Windows.Forms.ToolStripMenuItem(); this.SaveFile = new System.Windows.Forms.SaveFileDialog(); this.list_queue = new System.Windows.Forms.ListView(); this.Title = new System.Windows.Forms.ColumnHeader(); @@ -65,12 +71,6 @@ namespace Handbrake this.lbl_progressValue = new System.Windows.Forms.ToolStripStatusLabel(); this.OpenFile = new System.Windows.Forms.OpenFileDialog(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.btn_encode = new System.Windows.Forms.ToolStripButton(); - this.btn_stop = new System.Windows.Forms.ToolStripButton(); - this.drop_button_queue = new System.Windows.Forms.ToolStripDropDownButton(); - this.mnu_batch = new System.Windows.Forms.ToolStripMenuItem(); - this.mnu_import = new System.Windows.Forms.ToolStripMenuItem(); - this.mnu_export = new System.Windows.Forms.ToolStripMenuItem(); this.toolStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -222,11 +222,71 @@ namespace Handbrake this.toolStrip1.TabIndex = 71; this.toolStrip1.Text = "toolStrip1"; // + // btn_encode + // + this.btn_encode.Image = global::Handbrake.Properties.Resources.Play; + this.btn_encode.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btn_encode.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btn_encode.Name = "btn_encode"; + this.btn_encode.Padding = new System.Windows.Forms.Padding(5); + this.btn_encode.Size = new System.Drawing.Size(88, 46); + this.btn_encode.Text = "Encode"; + this.btn_encode.Click += new System.EventHandler(this.btn_encode_Click); + // + // btn_stop + // + this.btn_stop.Image = global::Handbrake.Properties.Resources.Pause; + this.btn_stop.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.btn_stop.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btn_stop.Name = "btn_stop"; + this.btn_stop.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; + this.btn_stop.Size = new System.Drawing.Size(72, 46); + this.btn_stop.Text = "Pause"; + this.btn_stop.Visible = false; + this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(6, 49); // + // drop_button_queue + // + this.drop_button_queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnu_batch, + this.mnu_import, + this.mnu_export}); + this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow; + this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta; + this.drop_button_queue.Name = "drop_button_queue"; + this.drop_button_queue.Size = new System.Drawing.Size(84, 46); + this.drop_button_queue.Text = "Queue"; + // + // mnu_batch + // + this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small; + this.mnu_batch.Name = "mnu_batch"; + this.mnu_batch.Size = new System.Drawing.Size(190, 22); + this.mnu_batch.Text = "Generate Batch Script"; + this.mnu_batch.Click += new System.EventHandler(this.mnu_batch_Click); + // + // mnu_import + // + this.mnu_import.Image = global::Handbrake.Properties.Resources.folder; + this.mnu_import.Name = "mnu_import"; + this.mnu_import.Size = new System.Drawing.Size(190, 22); + this.mnu_import.Text = "Import Queue"; + this.mnu_import.Click += new System.EventHandler(this.mnu_import_Click); + // + // mnu_export + // + this.mnu_export.Image = global::Handbrake.Properties.Resources.save; + this.mnu_export.Name = "mnu_export"; + this.mnu_export.Size = new System.Drawing.Size(190, 22); + this.mnu_export.Text = "Export Queue"; + this.mnu_export.Click += new System.EventHandler(this.mnu_export_Click); + // // SaveFile // this.SaveFile.Filter = "Batch|.bat"; @@ -325,66 +385,6 @@ namespace Handbrake this.pictureBox1.TabIndex = 61; this.pictureBox1.TabStop = false; // - // btn_encode - // - this.btn_encode.Image = global::Handbrake.Properties.Resources.Play; - this.btn_encode.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.btn_encode.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btn_encode.Name = "btn_encode"; - this.btn_encode.Padding = new System.Windows.Forms.Padding(5); - this.btn_encode.Size = new System.Drawing.Size(88, 46); - this.btn_encode.Text = "Encode"; - this.btn_encode.Click += new System.EventHandler(this.btn_encode_Click); - // - // btn_stop - // - this.btn_stop.Image = global::Handbrake.Properties.Resources.Pause; - this.btn_stop.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.btn_stop.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btn_stop.Name = "btn_stop"; - this.btn_stop.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never; - this.btn_stop.Size = new System.Drawing.Size(72, 46); - this.btn_stop.Text = "Pause"; - this.btn_stop.Visible = false; - this.btn_stop.Click += new System.EventHandler(this.btn_stop_Click); - // - // drop_button_queue - // - this.drop_button_queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnu_batch, - this.mnu_import, - this.mnu_export}); - this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow; - this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta; - this.drop_button_queue.Name = "drop_button_queue"; - this.drop_button_queue.Size = new System.Drawing.Size(84, 46); - this.drop_button_queue.Text = "Queue"; - // - // mnu_batch - // - this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small; - this.mnu_batch.Name = "mnu_batch"; - this.mnu_batch.Size = new System.Drawing.Size(190, 22); - this.mnu_batch.Text = "Generate Batch Script"; - this.mnu_batch.Click += new System.EventHandler(this.mnu_batch_Click); - // - // mnu_import - // - this.mnu_import.Image = global::Handbrake.Properties.Resources.folder; - this.mnu_import.Name = "mnu_import"; - this.mnu_import.Size = new System.Drawing.Size(190, 22); - this.mnu_import.Text = "Import Queue"; - this.mnu_import.Click += new System.EventHandler(this.mnu_import_Click); - // - // mnu_export - // - this.mnu_export.Image = global::Handbrake.Properties.Resources.save; - this.mnu_export.Name = "mnu_export"; - this.mnu_export.Size = new System.Drawing.Size(190, 22); - this.mnu_export.Text = "Export Queue"; - this.mnu_export.Click += new System.EventHandler(this.mnu_export_Click); - // // frmQueue // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F); diff --git a/win/C#/frmQueue.resx b/win/C#/frmQueue.resx index 4e272770b..2575392e8 100644 --- a/win/C#/frmQueue.resx +++ b/win/C#/frmQueue.resx @@ -127,7 +127,7 @@ 176, 17 - 366, 17 + 324, 17 252, 17 -- cgit v1.2.3