diff options
author | sr55 <[email protected]> | 2011-09-02 22:40:19 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-09-02 22:40:19 +0000 |
commit | 1d1cd92bb0a5a4af27be7e67561b96129421aa8a (patch) | |
tree | bda617871db1c52f8f534e2d8f41801dba27ebd9 /win/CS | |
parent | bda88d1a98a98a5ddac7087ea8b37889dd14bc7b (diff) |
WinGui: Initial support for batch queueing.
A new option "Add All" which will add all scanned titles using the current settings. Ideally used with batch scanned sources.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4202 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs | 4 | ||||
-rw-r--r-- | win/CS/ToolWindows/BatchAdd.Designer.cs | 177 | ||||
-rw-r--r-- | win/CS/ToolWindows/BatchAdd.cs | 85 | ||||
-rw-r--r-- | win/CS/ToolWindows/BatchAdd.resx | 6 | ||||
-rw-r--r-- | win/CS/defaultsettings.xml | 4 | ||||
-rw-r--r-- | win/CS/frmMain.Designer.cs | 33 | ||||
-rw-r--r-- | win/CS/frmMain.cs | 115 | ||||
-rw-r--r-- | win/CS/frmQueue.Designer.cs | 57 | ||||
-rw-r--r-- | win/CS/frmQueue.cs | 17 |
9 files changed, 345 insertions, 153 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs index ace53f97f..eeb003d3c 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/UserSettingService.cs @@ -205,8 +205,8 @@ namespace HandBrake.ApplicationServices.Services userSettings["AutoNameRemoveUnderscore"] = true;
userSettings["ActivityWindowLastMode"] = 0;
userSettings["useClosedCaption"] = false;
- userSettings["batchMinDuration"] = 35;
- userSettings["batchMaxDuration"] = 65;
+ userSettings["batchMinDuration"] = "00:18:00";
+ userSettings["batchMaxDuration"] = "02:30:00";
userSettings["defaultPlayer"] = false;
userSettings["SelectedLanguages"] = new StringCollection();
userSettings["DubModeAudio"] = 0;
diff --git a/win/CS/ToolWindows/BatchAdd.Designer.cs b/win/CS/ToolWindows/BatchAdd.Designer.cs index e8f832339..08a457f19 100644 --- a/win/CS/ToolWindows/BatchAdd.Designer.cs +++ b/win/CS/ToolWindows/BatchAdd.Designer.cs @@ -29,49 +29,29 @@ private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BatchAdd));
- this.label1 = new System.Windows.Forms.Label();
- this.minDuration = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
- this.maxDuration = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
+ this.maxDuration = new System.Windows.Forms.MaskedTextBox();
+ this.minDuration = new System.Windows.Forms.MaskedTextBox();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.label37 = new System.Windows.Forms.Label();
+ this.panel2 = new System.Windows.Forms.Panel();
+ this.label8 = new System.Windows.Forms.Label();
+ this.pictureBox2 = new System.Windows.Forms.PictureBox();
+ this.lbl_display = new System.Windows.Forms.Label();
+ this.panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(12, 9);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(114, 13);
- this.label1.TabIndex = 1;
- this.label1.Text = "Add all Titles between:";
- //
- // minDuration
- //
- this.minDuration.Location = new System.Drawing.Point(53, 34);
- this.minDuration.Name = "minDuration";
- this.minDuration.Size = new System.Drawing.Size(51, 20);
- this.minDuration.TabIndex = 2;
- this.minDuration.Text = "0";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(17, 68);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(250, 26);
- this.label2.TabIndex = 3;
- this.label2.Text = "Warning: This may lead to wasted encodes.\r\nDifferent titles may require different" +
- " encode settings.";
- //
// btnAdd
//
+ this.btnAdd.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnAdd.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btnAdd.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAdd.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btnAdd.Location = new System.Drawing.Point(232, 108);
+ this.btnAdd.Location = new System.Drawing.Point(194, 117);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(90, 22);
this.btnAdd.TabIndex = 4;
@@ -82,10 +62,11 @@ //
// btnCancel
//
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btnCancel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btnCancel.Location = new System.Drawing.Point(15, 108);
+ this.btnCancel.Location = new System.Drawing.Point(128, 117);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(60, 22);
this.btnCancel.TabIndex = 5;
@@ -94,18 +75,10 @@ this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancelClick);
//
- // maxDuration
- //
- this.maxDuration.Location = new System.Drawing.Point(141, 34);
- this.maxDuration.Name = "maxDuration";
- this.maxDuration.Size = new System.Drawing.Size(51, 20);
- this.maxDuration.TabIndex = 6;
- this.maxDuration.Text = "0";
- //
// label3
//
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(110, 37);
+ this.label3.Location = new System.Drawing.Point(125, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(25, 13);
this.label3.TabIndex = 7;
@@ -114,30 +87,120 @@ // label4
//
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(198, 37);
+ this.label4.Location = new System.Drawing.Point(227, 74);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(69, 13);
+ this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 8;
- this.label4.Text = "minutes long.";
+ this.label4.Text = "(hh:mm:ss)";
+ //
+ // maxDuration
+ //
+ this.maxDuration.Location = new System.Drawing.Point(156, 71);
+ this.maxDuration.Mask = "00:00:00";
+ this.maxDuration.Name = "maxDuration";
+ this.maxDuration.RejectInputOnFirstFailure = true;
+ this.maxDuration.Size = new System.Drawing.Size(65, 20);
+ this.maxDuration.TabIndex = 11;
+ this.maxDuration.Text = "023000";
+ this.maxDuration.TextChanged += new System.EventHandler(this.maxDuration_TextChanged);
+ //
+ // minDuration
+ //
+ this.minDuration.Location = new System.Drawing.Point(54, 71);
+ this.minDuration.Mask = "00:00:00";
+ this.minDuration.Name = "minDuration";
+ this.minDuration.Size = new System.Drawing.Size(65, 20);
+ this.minDuration.TabIndex = 10;
+ this.minDuration.Text = "001800";
+ this.minDuration.TextChanged += new System.EventHandler(this.minDuration_TextChanged);
+ //
+ // panel1
+ //
+ this.panel1.BackColor = System.Drawing.Color.White;
+ this.panel1.Controls.Add(this.label37);
+ this.panel1.Controls.Add(this.panel2);
+ this.panel1.Controls.Add(this.label8);
+ this.panel1.Controls.Add(this.pictureBox2);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel1.Location = new System.Drawing.Point(0, 0);
+ this.panel1.Margin = new System.Windows.Forms.Padding(0);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(299, 65);
+ this.panel1.TabIndex = 63;
+ //
+ // label37
+ //
+ this.label37.AutoSize = true;
+ this.label37.Location = new System.Drawing.Point(51, 27);
+ this.label37.Margin = new System.Windows.Forms.Padding(3);
+ this.label37.Name = "label37";
+ this.label37.Size = new System.Drawing.Size(166, 13);
+ this.label37.TabIndex = 105;
+ this.label37.Text = "Using the current encode settings";
+ //
+ // panel2
+ //
+ this.panel2.BackColor = System.Drawing.SystemColors.Control;
+ this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.panel2.Location = new System.Drawing.Point(0, 55);
+ this.panel2.MaximumSize = new System.Drawing.Size(0, 10);
+ this.panel2.MinimumSize = new System.Drawing.Size(0, 10);
+ this.panel2.Name = "panel2";
+ this.panel2.Size = new System.Drawing.Size(299, 10);
+ this.panel2.TabIndex = 59;
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label8.Location = new System.Drawing.Point(51, 11);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(124, 13);
+ this.label8.TabIndex = 61;
+ this.label8.Text = "Add all Titles betwen";
+ //
+ // pictureBox2
+ //
+ this.pictureBox2.Image = global::Handbrake.Properties.Resources.AddToQueue;
+ this.pictureBox2.Location = new System.Drawing.Point(12, 9);
+ this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
+ this.pictureBox2.Name = "pictureBox2";
+ this.pictureBox2.Size = new System.Drawing.Size(32, 32);
+ this.pictureBox2.TabIndex = 60;
+ this.pictureBox2.TabStop = false;
+ //
+ // lbl_display
+ //
+ this.lbl_display.AutoSize = true;
+ this.lbl_display.Location = new System.Drawing.Point(51, 96);
+ this.lbl_display.Name = "lbl_display";
+ this.lbl_display.Size = new System.Drawing.Size(112, 13);
+ this.lbl_display.TabIndex = 64;
+ this.lbl_display.Text = "This will add {0} items.";
//
// BatchAdd
//
+ this.AcceptButton = this.btnAdd;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(334, 137);
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(299, 151);
+ this.Controls.Add(this.lbl_display);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.maxDuration);
+ this.Controls.Add(this.minDuration);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
- this.Controls.Add(this.maxDuration);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnAdd);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.minDuration);
- this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "BatchAdd";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Batch Add";
+ this.Text = "*** THIS IS A CONCEPT WINDOW ***";
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -145,13 +208,17 @@ #endregion
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox minDuration;
- private System.Windows.Forms.Label label2;
internal System.Windows.Forms.Button btnAdd;
internal System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.TextBox maxDuration;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.MaskedTextBox maxDuration;
+ private System.Windows.Forms.MaskedTextBox minDuration;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label label37;
+ private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.PictureBox pictureBox2;
+ private System.Windows.Forms.Label lbl_display;
}
}
\ No newline at end of file diff --git a/win/CS/ToolWindows/BatchAdd.cs b/win/CS/ToolWindows/BatchAdd.cs index fbb864e70..25b6d4abc 100644 --- a/win/CS/ToolWindows/BatchAdd.cs +++ b/win/CS/ToolWindows/BatchAdd.cs @@ -6,9 +6,11 @@ namespace Handbrake.ToolWindows
{
using System;
+ using System.Linq;
using System.Windows.Forms;
using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
/// <summary>
@@ -17,20 +19,35 @@ namespace Handbrake.ToolWindows public partial class BatchAdd : Form
{
/// <summary>
+ /// The standard display count texts
+ /// </summary>
+ private const string DisplayAddCount = "This will add {0} items.";
+
+ /// <summary>
+ /// The Source Data (IF Available)
+ /// </summary>
+ private readonly Source sourceData;
+
+ /// <summary>
/// The User Setting Service.
/// </summary>
private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
-
+
/// <summary>
/// Initializes a new instance of the <see cref="BatchAdd"/> class.
/// </summary>
- public BatchAdd()
+ /// <param name="sourceData">
+ /// The source Data.
+ /// </param>
+ public BatchAdd(Source sourceData)
{
+ this.sourceData = sourceData;
InitializeComponent();
// Get the Default values for batch encoding.
- this.minDuration.Text = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.BatchMinDuration).ToString();
- this.maxDuration.Text = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.BatchMaxDuration).ToString();
+ this.minDuration.Text = this.UserSettingService.GetUserSetting<string>(UserSettingConstants.BatchMinDuration);
+ this.maxDuration.Text = this.UserSettingService.GetUserSetting<string>(UserSettingConstants.BatchMaxDuration);
+ this.UpdateEncodeDisplay();
}
/// <summary>
@@ -50,18 +67,20 @@ namespace Handbrake.ToolWindows /// <param name="e">The EventArgs</param>
private void BtnScanClick(object sender, EventArgs e)
{
+ this.UserSettingService.SetUserSetting(UserSettingConstants.BatchMinDuration, this.minDuration.Text);
+ this.UserSettingService.SetUserSetting(UserSettingConstants.BatchMaxDuration, this.maxDuration.Text);
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// Gets the minimum duration that the user entered.
/// </summary>
- public int Min
+ public TimeSpan Min
{
get
{
- int title;
- int.TryParse(this.minDuration.Text, out title);
+ TimeSpan title;
+ TimeSpan.TryParse(this.minDuration.Text, out title);
return title;
}
@@ -70,15 +89,61 @@ namespace Handbrake.ToolWindows /// <summary>
/// Gets the maximum duration that the user entered.
/// </summary>
- public int Max
+ public TimeSpan Max
{
get
{
- int title;
- int.TryParse(this.maxDuration.Text, out title);
+ TimeSpan title;
+ TimeSpan.TryParse(this.maxDuration.Text, out title);
return title;
}
}
+
+ /// <summary>
+ /// Update the Display which shows the number of titles that will be added.
+ /// </summary>
+ private void UpdateEncodeDisplay()
+ {
+ int count = this.sourceData.Titles.Count(title => title.Duration.TotalSeconds > this.Min.TotalSeconds && title.Duration.TotalSeconds < this.Max.TotalSeconds);
+
+ if (count > 0)
+ {
+ lbl_display.Text = string.Format(DisplayAddCount, count);
+ lbl_display.Visible = true;
+ }
+ else
+ {
+ lbl_display.Visible = false;
+ }
+ }
+
+ /// <summary>
+ /// Min Duration has changed.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void minDuration_TextChanged(object sender, EventArgs e)
+ {
+ this.UpdateEncodeDisplay();
+ }
+
+ /// <summary>
+ /// Max duration was changed
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void maxDuration_TextChanged(object sender, EventArgs e)
+ {
+ this.UpdateEncodeDisplay();
+ }
}
}
\ No newline at end of file diff --git a/win/CS/ToolWindows/BatchAdd.resx b/win/CS/ToolWindows/BatchAdd.resx index ff217dc4f..c3c3ff8ef 100644 --- a/win/CS/ToolWindows/BatchAdd.resx +++ b/win/CS/ToolWindows/BatchAdd.resx @@ -112,12 +112,12 @@ <value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
- <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA
diff --git a/win/CS/defaultsettings.xml b/win/CS/defaultsettings.xml index 7c47d6601..6fea12dc4 100644 --- a/win/CS/defaultsettings.xml +++ b/win/CS/defaultsettings.xml @@ -341,7 +341,7 @@ <string>batchMinDuration</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">35</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">00:18:00</anyType>
</value>
</item>
<item>
@@ -349,7 +349,7 @@ <string>batchMaxDuration</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">65</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">02:30:00</anyType>
</value>
</item>
<item>
diff --git a/win/CS/frmMain.Designer.cs b/win/CS/frmMain.Designer.cs index 07f337c0d..1561e0213 100644 --- a/win/CS/frmMain.Designer.cs +++ b/win/CS/frmMain.Designer.cs @@ -141,7 +141,9 @@ namespace Handbrake this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.btn_start = new System.Windows.Forms.ToolStripButton();
- this.btn_add2Queue = new System.Windows.Forms.ToolStripButton();
+ this.btn_add2Queue = new System.Windows.Forms.ToolStripSplitButton();
+ this.mnu_AddAllTitles = new System.Windows.Forms.ToolStripMenuItem();
+ this.mnu_AddTittleRange = new System.Windows.Forms.ToolStripMenuItem();
this.btn_showQueue = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.tb_preview = new System.Windows.Forms.ToolStripButton();
@@ -1312,14 +1314,35 @@ namespace Handbrake //
// btn_add2Queue
//
+ this.btn_add2Queue.DropDownButtonWidth = 20;
+ this.btn_add2Queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnu_AddAllTitles,
+ this.mnu_AddTittleRange});
this.btn_add2Queue.Image = global::Handbrake.Properties.Resources.AddToQueue;
this.btn_add2Queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.btn_add2Queue.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btn_add2Queue.Name = "btn_add2Queue";
- this.btn_add2Queue.Size = new System.Drawing.Size(117, 36);
+ this.btn_add2Queue.Size = new System.Drawing.Size(138, 36);
this.btn_add2Queue.Text = "Add to Queue";
this.btn_add2Queue.ToolTipText = "Add a new item to the Queue";
- this.btn_add2Queue.Click += new System.EventHandler(this.btn_add2Queue_Click);
+ this.btn_add2Queue.ButtonClick += new System.EventHandler(this.btn_add2Queue_Click);
+ //
+ // mnu_AddAllTitles
+ //
+ this.mnu_AddAllTitles.Name = "mnu_AddAllTitles";
+ this.mnu_AddAllTitles.Size = new System.Drawing.Size(152, 22);
+ this.mnu_AddAllTitles.Text = "Add All";
+ this.mnu_AddAllTitles.ToolTipText = "Add all titles to the queue.\r\nUse caution with this feature as incorrect usage ma" +
+ "y result in a queue of failed encodes.";
+ this.mnu_AddAllTitles.Click += new System.EventHandler(this.mnu_AddAllTitles_Click);
+ //
+ // mnu_AddTittleRange
+ //
+ this.mnu_AddTittleRange.Name = "mnu_AddTittleRange";
+ this.mnu_AddTittleRange.Size = new System.Drawing.Size(152, 22);
+ this.mnu_AddTittleRange.Text = "Add Range";
+ this.mnu_AddTittleRange.Visible = false;
+ this.mnu_AddTittleRange.Click += new System.EventHandler(this.mnu_AddTittleRange_Click);
//
// btn_showQueue
//
@@ -1860,7 +1883,6 @@ namespace Handbrake internal System.Windows.Forms.Button btn_clear;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton btn_start;
- private System.Windows.Forms.ToolStripButton btn_add2Queue;
private System.Windows.Forms.ToolStripButton btn_showQueue;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripButton btn_ActivityWindow;
@@ -1958,5 +1980,8 @@ namespace Handbrake private Panel panel1;
internal Controls.AdvancedEncoderOpts advancedEncoderOpts;
public Controls.AudioPanel AudioSettings;
+ private ToolStripSplitButton btn_add2Queue;
+ private ToolStripMenuItem mnu_AddAllTitles;
+ private ToolStripMenuItem mnu_AddTittleRange;
}
}
\ No newline at end of file diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index efe741522..05515983c 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -14,6 +14,7 @@ namespace Handbrake using System.IO;
using System.Linq;
using System.Threading;
+ using System.Windows;
using System.Windows.Forms;
using Functions;
@@ -36,7 +37,12 @@ namespace Handbrake using Properties;
+ using Application = System.Windows.Forms.Application;
+ using DataFormats = System.Windows.Forms.DataFormats;
+ using DragDropEffects = System.Windows.Forms.DragDropEffects;
+ using DragEventArgs = System.Windows.Forms.DragEventArgs;
using Main = Handbrake.Functions.Main;
+ using MessageBox = System.Windows.Forms.MessageBox;
/// <summary>
/// The Main Window
@@ -1075,34 +1081,101 @@ namespace Handbrake }
/// <summary>
+ /// Add All Scanned Titles
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs.
+ /// </param>
+ private void mnu_AddAllTitles_Click(object sender, EventArgs e)
+ {
+ AddRangeOfTitles(false);
+ }
+
+ /// <summary>
+ /// Add a range of scanned titles
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The EventArgs.
+ /// </param>
+ private void mnu_AddTittleRange_Click(object sender, EventArgs e)
+ {
+ AddRangeOfTitles(true);
+ }
+
+ /// <summary>
/// Add Multiple Items to the Queue at once.
/// </summary>
- /// <param name="sender">The Sender</param>
- /// <param name="e">The EventArgs</param>
- private void MnuAddMultiToQueueClick(object sender, EventArgs e)
+ /// <param name="addRange">
+ /// The add Range.
+ /// </param>
+ private void AddRangeOfTitles(bool addRange)
{
if (!this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
{
- MessageBox.Show("Destination Auto Naming must be enabled in preferences for this feature to work.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(
+ "You need to enable 'Auto Naming' in options to use this feature.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
return;
}
if (this.SourceScan.SouceData == null)
{
- MessageBox.Show("You must first scan a source or collection of source to use this feature.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(
+ "You must first scan a source before you can use this feature. Select the 'Source' button on the toolbar.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
return;
}
- BatchAdd batchAdd = new BatchAdd();
- if (batchAdd.ShowDialog() == DialogResult.OK)
+ bool errors = false;
+ if (addRange) // Add Range
{
- int min = batchAdd.Min;
- int max = batchAdd.Max;
- bool errors = false;
+ BatchAdd batchAdd = new BatchAdd(this.SourceScan.SouceData);
+ if (batchAdd.ShowDialog() == DialogResult.OK)
+ {
+ TimeSpan min = batchAdd.Min;
+ TimeSpan max = batchAdd.Max;
+
+ foreach (Title title in this.SourceScan.SouceData.Titles)
+ {
+ if (title.Duration.TotalSeconds > min.TotalSeconds && title.Duration.TotalSeconds < max.TotalSeconds)
+ {
+ // Add to Queue
+ this.drp_dvdtitle.SelectedItem = title;
- foreach (Title title in this.SourceScan.SouceData.Titles)
+ if (!this.AddItemToQueue(false))
+ {
+ errors = true;
+ }
+ }
+ }
+ }
+ }
+ else // Add All
+ {
+
+ string warning = string.Format(
+ "You are about to add *ALL* titles to the queue. \nCurrent settings will be applied to *ALL {0} Titles*. \n\nAre you sure you want to do this?", this.SourceScan.SouceData.Titles.Count);
+
+ DialogResult question =
+ MessageBox.Show(
+ warning,
+ "Warning",
+ MessageBoxButtons.YesNoCancel,
+ MessageBoxIcon.Warning);
+
+ if (question == DialogResult.Yes)
{
- if (title.Duration.TotalMinutes > min && title.Duration.TotalMinutes < max)
+ foreach (Title title in this.SourceScan.SouceData.Titles)
{
// Add to Queue
this.drp_dvdtitle.SelectedItem = title;
@@ -1113,16 +1186,17 @@ namespace Handbrake }
}
}
+ }
- if (errors)
- {
- MessageBox.Show(
- "One or more items could not be added to the queue. You should check your queue and manually add any missing jobs.",
- "Warning",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- }
+ if (errors)
+ {
+ MessageBox.Show(
+ "One or more items could not be added to the queue. You should check your queue and manually add any missing jobs.",
+ "Warning",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Warning);
}
+
}
private bool AddItemToQueue(bool showError)
@@ -2591,7 +2665,6 @@ namespace Handbrake #endregion
-
// This is the END of the road ****************************************
}
}
\ No newline at end of file diff --git a/win/CS/frmQueue.Designer.cs b/win/CS/frmQueue.Designer.cs index 6dbd68269..88f982682 100644 --- a/win/CS/frmQueue.Designer.cs +++ b/win/CS/frmQueue.Designer.cs @@ -48,8 +48,6 @@ namespace Handbrake 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.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
- this.mnu_readd = new System.Windows.Forms.ToolStripMenuItem();
this.drp_completeOption = new System.Windows.Forms.ToolStripComboBox();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.SaveFile = new System.Windows.Forms.SaveFileDialog();
@@ -68,7 +66,9 @@ namespace Handbrake this.mnu_edit = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_Retry = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnuClearAll = new System.Windows.Forms.ToolStripMenuItem();
this.mnuClearCompleted = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_delete = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lbl_encodesPending = new System.Windows.Forms.ToolStripStatusLabel();
@@ -79,8 +79,6 @@ namespace Handbrake this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
- this.mnuClearAll = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.toolStrip1.SuspendLayout();
this.mnu_queue.SuspendLayout();
this.statusStrip1.SuspendLayout();
@@ -178,9 +176,7 @@ namespace Handbrake this.drop_button_queue.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnu_batch,
this.mnu_import,
- this.mnu_export,
- this.toolStripSeparator2,
- this.mnu_readd});
+ 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;
@@ -192,7 +188,7 @@ namespace Handbrake //
this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small;
this.mnu_batch.Name = "mnu_batch";
- this.mnu_batch.Size = new System.Drawing.Size(235, 22);
+ this.mnu_batch.Size = new System.Drawing.Size(187, 22);
this.mnu_batch.Text = "Generate Batch Script";
this.mnu_batch.Click += new System.EventHandler(this.MnuBatchClick);
//
@@ -200,7 +196,7 @@ namespace Handbrake //
this.mnu_import.Image = global::Handbrake.Properties.Resources.folder;
this.mnu_import.Name = "mnu_import";
- this.mnu_import.Size = new System.Drawing.Size(235, 22);
+ this.mnu_import.Size = new System.Drawing.Size(187, 22);
this.mnu_import.Text = "Import Queue";
this.mnu_import.Click += new System.EventHandler(this.MnuImportClick);
//
@@ -208,25 +204,10 @@ namespace Handbrake //
this.mnu_export.Image = global::Handbrake.Properties.Resources.save;
this.mnu_export.Name = "mnu_export";
- this.mnu_export.Size = new System.Drawing.Size(235, 22);
+ this.mnu_export.Size = new System.Drawing.Size(187, 22);
this.mnu_export.Text = "Export Queue";
this.mnu_export.Click += new System.EventHandler(this.MnuExportClick);
//
- // toolStripSeparator2
- //
- this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(232, 6);
- //
- // mnu_readd
- //
- this.mnu_readd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
- this.mnu_readd.Image = global::Handbrake.Properties.Resources.AddToQueue_small;
- this.mnu_readd.Name = "mnu_readd";
- this.mnu_readd.Size = new System.Drawing.Size(235, 22);
- this.mnu_readd.Text = "Re-Add Currently Running Job";
- this.mnu_readd.ToolTipText = "Readds the currently encoding job back onto the queue.";
- this.mnu_readd.Click += new System.EventHandler(this.MnuReaddClick);
- //
// drp_completeOption
//
this.drp_completeOption.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
@@ -372,6 +353,13 @@ namespace Handbrake this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(160, 6);
//
+ // mnuClearAll
+ //
+ this.mnuClearAll.Name = "mnuClearAll";
+ this.mnuClearAll.Size = new System.Drawing.Size(163, 22);
+ this.mnuClearAll.Text = "Clear All";
+ this.mnuClearAll.Click += new System.EventHandler(this.mnuClearAll_Click);
+ //
// mnuClearCompleted
//
this.mnuClearCompleted.Name = "mnuClearCompleted";
@@ -379,6 +367,11 @@ namespace Handbrake this.mnuClearCompleted.Text = "Clear Completed";
this.mnuClearCompleted.Click += new System.EventHandler(this.mnuClearCompleted_Click);
//
+ // toolStripSeparator5
+ //
+ this.toolStripSeparator5.Name = "toolStripSeparator5";
+ this.toolStripSeparator5.Size = new System.Drawing.Size(160, 6);
+ //
// mnu_delete
//
this.mnu_delete.Name = "mnu_delete";
@@ -488,18 +481,6 @@ namespace Handbrake this.panel1.Size = new System.Drawing.Size(15, 214);
this.panel1.TabIndex = 0;
//
- // mnuClearAll
- //
- this.mnuClearAll.Name = "mnuClearAll";
- this.mnuClearAll.Size = new System.Drawing.Size(163, 22);
- this.mnuClearAll.Text = "Clear All";
- this.mnuClearAll.Click += new System.EventHandler(this.mnuClearAll_Click);
- //
- // toolStripSeparator5
- //
- this.toolStripSeparator5.Name = "toolStripSeparator5";
- this.toolStripSeparator5.Size = new System.Drawing.Size(160, 6);
- //
// frmQueue
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -555,8 +536,6 @@ namespace Handbrake private System.Windows.Forms.ToolStripMenuItem mnu_export;
private System.Windows.Forms.OpenFileDialog OpenFile;
private System.Windows.Forms.ToolStripStatusLabel lbl_encodesPending;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
- private System.Windows.Forms.ToolStripMenuItem mnu_readd;
private System.Windows.Forms.ContextMenuStrip mnu_queue;
private System.Windows.Forms.ToolStripMenuItem mnu_up;
private System.Windows.Forms.ToolStripMenuItem mnu_Down;
diff --git a/win/CS/frmQueue.cs b/win/CS/frmQueue.cs index 82cb4e7b1..d9902b52a 100644 --- a/win/CS/frmQueue.cs +++ b/win/CS/frmQueue.cs @@ -702,23 +702,6 @@ namespace Handbrake queue.QueueManager.RestoreQueue(OpenFile.FileName);
}
- /// <summary>
- /// Readd current job to queue
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void MnuReaddClick(object sender, EventArgs e)
- {
- if (queue.QueueManager.LastProcessedJob != null && !queue.QueueManager.LastProcessedJob.IsEmpty)
- {
- queue.QueueManager.Add(queue.QueueManager.LastProcessedJob);
- }
- }
-
/* Overrides */
/// <summary>
|