summaryrefslogtreecommitdiffstats
path: root/win/CS/ToolWindows
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-09-02 22:40:19 +0000
committersr55 <[email protected]>2011-09-02 22:40:19 +0000
commit1d1cd92bb0a5a4af27be7e67561b96129421aa8a (patch)
treebda617871db1c52f8f534e2d8f41801dba27ebd9 /win/CS/ToolWindows
parentbda88d1a98a98a5ddac7087ea8b37889dd14bc7b (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/ToolWindows')
-rw-r--r--win/CS/ToolWindows/BatchAdd.Designer.cs177
-rw-r--r--win/CS/ToolWindows/BatchAdd.cs85
-rw-r--r--win/CS/ToolWindows/BatchAdd.resx6
3 files changed, 200 insertions, 68 deletions
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