diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/Functions/Queue.cs | 106 | ||||
-rw-r--r-- | win/C#/HandBrakeCS.csproj | 14 | ||||
-rw-r--r-- | win/C#/Properties/Settings.Designer.cs | 2 | ||||
-rw-r--r-- | win/C#/Properties/Settings.settings | 2 | ||||
-rw-r--r-- | win/C#/Resources/JobPassLarge.png | bin | 0 -> 4673 bytes | |||
-rw-r--r-- | win/C#/app.config | 2 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 27 | ||||
-rw-r--r-- | win/C#/frmQueue.Designer.cs | 301 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 238 |
9 files changed, 397 insertions, 295 deletions
diff --git a/win/C#/Functions/Queue.cs b/win/C#/Functions/Queue.cs new file mode 100644 index 000000000..e566c2e08 --- /dev/null +++ b/win/C#/Functions/Queue.cs @@ -0,0 +1,106 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections;
+
+namespace Handbrake.Functions
+{
+ public class Queue
+ {
+ ArrayList queue = new ArrayList();
+ string lastQuery;
+
+ public ArrayList getQueue()
+ {
+ return queue;
+ }
+
+ /// <summary>
+ /// Get's the next CLI query for encoding
+ /// </summary>
+ /// <returns>String</returns>
+ public string getNextItemForEncoding()
+ {
+ string query = queue[0].ToString();
+ lastQuery = query;
+ remove(0);
+ return query;
+ }
+
+ /// <summary>
+ /// Add's a new item to the queue
+ /// </summary>
+ /// <param name="query">String</param>
+ public void add(string query)
+ {
+ queue.Add(query);
+ }
+
+ /// <summary>
+ /// Removes an item from the queue.
+ /// </summary>
+ /// <param name="index">Index</param>
+ /// <returns>Bolean true if successful</returns>
+ public Boolean remove(int index)
+ {
+ try
+ {
+ queue.RemoveAt(index);
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Returns how many items are in the queue
+ /// </summary>
+ /// <returns>Int</returns>
+ public int count()
+ {
+ return queue.Count;
+ }
+
+ /// <summary>
+ /// Get's the last query to be selected for encoding by getNextItemForEncoding()
+ /// </summary>
+ /// <returns>String</returns>
+ public string getLastQuery()
+ {
+ return lastQuery;
+ }
+
+ /// <summary>
+ /// Move an item with an index x, up in the queue
+ /// </summary>
+ /// <param name="index">Int</param>
+ public void moveUp(int index)
+ {
+ if (index != 0)
+ {
+ string item = queue[index].ToString();
+
+ queue.Insert((index - 1), item);
+ queue.RemoveAt((index + 1));
+ }
+ }
+
+ /// <summary>
+ /// Move an item with an index x, down in the queue
+ /// </summary>
+ /// <param name="index">Int</param>
+ public void moveDown(int index)
+ {
+ if (index != queue.Count - 1)
+ {
+ string item = queue[index].ToString();
+
+ queue.Insert((index + 2), item);
+ queue.RemoveAt((index));
+ }
+ }
+
+ }
+}
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj index a8b3107d9..96ae9194c 100644 --- a/win/C#/HandBrakeCS.csproj +++ b/win/C#/HandBrakeCS.csproj @@ -82,18 +82,6 @@ <PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
- <Reference Include="C4F.DevKit.Contacts.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bdc1b65c439c6a1f, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>C:\Documents and Settings\Scott\My Documents\C4F\C4F Developer Kit 2008\Controls\C4F.DevKit.Contacts.Controls.dll</HintPath>
- </Reference>
- <Reference Include="C4F.DevKit.Messaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=76ac60f2feb1ad78, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>C:\Documents and Settings\Scott\My Documents\C4F\C4F Developer Kit 2008\Controls\C4F.DevKit.Messaging.dll</HintPath>
- </Reference>
- <Reference Include="C4F.DevKit.Telephony, Version=1.0.0.0, Culture=neutral, PublicKeyToken=db6017b098a30de9, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>C:\Documents and Settings\Scott\My Documents\C4F\C4F Developer Kit 2008\Controls\C4F.DevKit.Telephony.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
@@ -154,6 +142,7 @@ </Compile>
<Compile Include="Functions\Common.cs" />
<Compile Include="Functions\Presets.cs" />
+ <Compile Include="Functions\Queue.cs" />
<Compile Include="Functions\RssReader.cs" />
<Compile Include="Functions\CLI.cs" />
<Compile Include="Functions\QueryParser.cs" />
@@ -245,6 +234,7 @@ <None Include="Resources\logo128.png" />
<None Include="Resources\ActivityWindow.png" />
<None Include="Resources\AddToQueue.png" />
+ <Content Include="Resources\JobPassLarge.png" />
<Content Include="Resources\Output_Small.png" />
<None Include="Resources\Pause.png" />
<None Include="Resources\Play.png" />
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index f4ab1fb8a..48947cc1c 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -73,7 +73,7 @@ namespace Handbrake.Properties { [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("SVN1477")]
+ [global::System.Configuration.DefaultSettingValueAttribute("SVN1544")]
public string hb_version {
get {
return ((string)(this["hb_version"]));
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index c216caee5..463e8ac6c 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -15,7 +15,7 @@ <Value Profile="(Default)">Checked</Value>
</Setting>
<Setting Name="hb_version" Type="System.String" Scope="User">
- <Value Profile="(Default)">SVN1477</Value>
+ <Value Profile="(Default)">SVN1544</Value>
</Setting>
<Setting Name="tooltipEnable" Type="System.String" Scope="User">
<Value Profile="(Default)">Checked</Value>
diff --git a/win/C#/Resources/JobPassLarge.png b/win/C#/Resources/JobPassLarge.png Binary files differnew file mode 100644 index 000000000..da9700787 --- /dev/null +++ b/win/C#/Resources/JobPassLarge.png diff --git a/win/C#/app.config b/win/C#/app.config index 0b4648b4b..001038654 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -20,7 +20,7 @@ <value>Checked</value>
</setting>
<setting name="hb_version" serializeAs="String">
- <value>SVN1477</value>
+ <value>SVN1544</value>
</setting>
<setting name="tooltipEnable" serializeAs="String">
<value>Checked</value>
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 4328c2090..96a817686 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -25,6 +25,7 @@ namespace Handbrake Functions.Common hb_common_func = new Functions.Common();
Functions.x264Panel x264PanelFunctions = new Functions.x264Panel();
Functions.CLI cliObj = new Functions.CLI();
+ Functions.Queue encodeQueue = new Functions.Queue();
Parsing.Title selectedTitle;
internal Process hbProc;
private Parsing.DVD thisDVD;
@@ -56,8 +57,7 @@ namespace Handbrake // show the form, but leave disabled until preloading is complete then show the main form
this.Enabled = false;
this.Show();
- // Forces frmMain to draw
- Application.DoEvents();
+ Application.DoEvents(); // Forces frmMain to draw
// update the status
if (Properties.Settings.Default.updateStatus == "Checked")
@@ -342,7 +342,8 @@ namespace Handbrake private void mnu_encode_Click(object sender, EventArgs e)
{
- showQueue();
+ queueWindow.setQueue(encodeQueue);
+ queueWindow.Show();
}
private void mnu_viewDVDdata_Click(object sender, EventArgs e)
{
@@ -441,19 +442,21 @@ namespace Handbrake MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
{
- String query;
+
+ String query = hb_common_func.GenerateTheQuery(this);
if (rtf_query.Text != "")
query = rtf_query.Text;
- else
- query = hb_common_func.GenerateTheQuery(this);
- queueWindow.list_queue.Items.Add(query);
+ encodeQueue.add(query);
+
+ queueWindow.setQueue(encodeQueue);
queueWindow.Show();
}
}
private void btn_showQueue_Click(object sender, EventArgs e)
{
- showQueue();
+ queueWindow.setQueue(encodeQueue);
+ queueWindow.Show();
}
private void btn_ActivityWindow_Click(object sender, EventArgs e)
{
@@ -1900,7 +1903,7 @@ namespace Handbrake int normal = 0;
foreach (TreeNode treenode in treeView_presets.Nodes)
{
- if (treenode.ToString().Equals("TreeNode: Normal"))
+ if (treenode.Text.ToString().Equals("Normal"))
normal = treenode.Index;
}
@@ -1988,12 +1991,6 @@ namespace Handbrake x264PanelFunctions.X264_SetCurrentSettingsInPanel(this);
}
}
-
- // Queue system functions
- private void showQueue()
- {
- queueWindow.Show();
- }
#endregion
#region Encoding and Queue
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index cc7b9cf6a..c7617df92 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -39,15 +39,7 @@ namespace Handbrake this.btn_down = new System.Windows.Forms.Button();
this.btn_up = new System.Windows.Forms.Button();
this.btn_delete = new System.Windows.Forms.Button();
- this.list_queue = new System.Windows.Forms.ListBox();
- this.btn_Close = new System.Windows.Forms.Button();
- this.progressBar = new System.Windows.Forms.ProgressBar();
- this.label2 = new System.Windows.Forms.Label();
- this.lbl_progressValue = new System.Windows.Forms.Label();
- this.lbl_status = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.text_edit = new System.Windows.Forms.TextBox();
- this.btn_updateQuery = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.lbl_chapt = new System.Windows.Forms.Label();
this.lbl_title = new System.Windows.Forms.Label();
@@ -64,6 +56,17 @@ namespace Handbrake this.btn_batch = new System.Windows.Forms.ToolStripButton();
this.SaveFile = new System.Windows.Forms.SaveFileDialog();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.list_queue = new System.Windows.Forms.ListView();
+ this.Title = new System.Windows.Forms.ColumnHeader();
+ this.Chapters = new System.Windows.Forms.ColumnHeader();
+ this.Source = new System.Windows.Forms.ColumnHeader();
+ this.Destination = new System.Windows.Forms.ColumnHeader();
+ this.EncoderVideo = new System.Windows.Forms.ColumnHeader();
+ this.Audio = new System.Windows.Forms.ColumnHeader();
+ this.lbl_progressValue = new System.Windows.Forms.Label();
+ this.progressBar = new System.Windows.Forms.ProgressBar();
+ this.label2 = new System.Windows.Forms.Label();
+ this.lbl_status = new System.Windows.Forms.Label();
this.toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
@@ -74,9 +77,9 @@ namespace Handbrake this.btn_down.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_down.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_down.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_down.Location = new System.Drawing.Point(74, 327);
+ this.btn_down.Location = new System.Drawing.Point(610, 124);
this.btn_down.Name = "btn_down";
- this.btn_down.Size = new System.Drawing.Size(64, 22);
+ this.btn_down.Size = new System.Drawing.Size(75, 22);
this.btn_down.TabIndex = 33;
this.btn_down.TabStop = false;
this.btn_down.Text = "Down";
@@ -89,9 +92,9 @@ namespace Handbrake this.btn_up.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_up.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_up.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_up.Location = new System.Drawing.Point(13, 327);
+ this.btn_up.Location = new System.Drawing.Point(539, 124);
this.btn_up.Name = "btn_up";
- this.btn_up.Size = new System.Drawing.Size(55, 22);
+ this.btn_up.Size = new System.Drawing.Size(64, 22);
this.btn_up.TabIndex = 32;
this.btn_up.TabStop = false;
this.btn_up.Text = "Up";
@@ -104,110 +107,20 @@ namespace Handbrake this.btn_delete.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_delete.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_delete.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_delete.Location = new System.Drawing.Point(144, 327);
+ this.btn_delete.Location = new System.Drawing.Point(692, 124);
this.btn_delete.Name = "btn_delete";
- this.btn_delete.Size = new System.Drawing.Size(64, 22);
+ this.btn_delete.Size = new System.Drawing.Size(75, 22);
this.btn_delete.TabIndex = 31;
this.btn_delete.TabStop = false;
this.btn_delete.Text = "Delete";
this.btn_delete.UseVisualStyleBackColor = true;
this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click);
//
- // list_queue
- //
- this.list_queue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.list_queue.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.list_queue.HorizontalScrollbar = true;
- this.list_queue.Location = new System.Drawing.Point(12, 176);
- this.list_queue.Name = "list_queue";
- this.list_queue.Size = new System.Drawing.Size(701, 145);
- this.list_queue.TabIndex = 28;
- this.list_queue.SelectedIndexChanged += new System.EventHandler(this.list_queue_SelectedIndexChanged);
- //
- // btn_Close
- //
- this.btn_Close.BackColor = System.Drawing.SystemColors.ControlLight;
- this.btn_Close.FlatAppearance.BorderColor = System.Drawing.Color.Black;
- this.btn_Close.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- 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(605, 12);
- this.btn_Close.Name = "btn_Close";
- this.btn_Close.Size = new System.Drawing.Size(108, 22);
- this.btn_Close.TabIndex = 27;
- this.btn_Close.TabStop = false;
- this.btn_Close.Text = "Close Window";
- this.btn_Close.UseVisualStyleBackColor = false;
- this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);
- //
- // progressBar
- //
- this.progressBar.Location = new System.Drawing.Point(67, 360);
- this.progressBar.Name = "progressBar";
- this.progressBar.Size = new System.Drawing.Size(616, 23);
- this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
- this.progressBar.TabIndex = 34;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(10, 366);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(51, 13);
- this.label2.TabIndex = 35;
- this.label2.Text = "Progress:";
- //
- // lbl_progressValue
- //
- this.lbl_progressValue.AutoSize = true;
- this.lbl_progressValue.Location = new System.Drawing.Point(689, 366);
- this.lbl_progressValue.Name = "lbl_progressValue";
- this.lbl_progressValue.Size = new System.Drawing.Size(24, 13);
- this.lbl_progressValue.TabIndex = 36;
- this.lbl_progressValue.Text = "0 %";
- //
- // lbl_status
- //
- this.lbl_status.AutoSize = true;
- this.lbl_status.BackColor = System.Drawing.Color.Transparent;
- this.lbl_status.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbl_status.Location = new System.Drawing.Point(274, 366);
- this.lbl_status.Name = "lbl_status";
- this.lbl_status.Size = new System.Drawing.Size(176, 13);
- this.lbl_status.TabIndex = 42;
- this.lbl_status.Text = "Encode Queue Completed!";
- this.lbl_status.Visible = false;
- //
- // text_edit
- //
- this.text_edit.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.text_edit.Location = new System.Drawing.Point(214, 328);
- this.text_edit.Name = "text_edit";
- this.text_edit.Size = new System.Drawing.Size(430, 20);
- this.text_edit.TabIndex = 43;
- this.toolTip1.SetToolTip(this.text_edit, "Avoid using this feature when the encoder is about to start a new task. You may o" +
- "verwrite the wrong job");
- //
- // btn_updateQuery
- //
- this.btn_updateQuery.BackColor = System.Drawing.SystemColors.ControlLight;
- this.btn_updateQuery.FlatAppearance.BorderColor = System.Drawing.Color.Black;
- this.btn_updateQuery.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btn_updateQuery.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_updateQuery.Location = new System.Drawing.Point(649, 325);
- this.btn_updateQuery.Name = "btn_updateQuery";
- this.btn_updateQuery.Size = new System.Drawing.Size(64, 23);
- this.btn_updateQuery.TabIndex = 46;
- this.btn_updateQuery.TabStop = false;
- this.btn_updateQuery.Text = "Update";
- this.btn_updateQuery.UseVisualStyleBackColor = true;
- this.btn_updateQuery.Click += new System.EventHandler(this.btn_updateQuery_Click);
- //
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label4.Location = new System.Drawing.Point(232, 125);
+ this.label4.Location = new System.Drawing.Point(269, 121);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(47, 26);
this.label4.TabIndex = 70;
@@ -216,9 +129,9 @@ namespace Handbrake // lbl_chapt
//
this.lbl_chapt.AutoSize = true;
- this.lbl_chapt.Location = new System.Drawing.Point(175, 137);
+ this.lbl_chapt.Location = new System.Drawing.Point(202, 133);
this.lbl_chapt.Name = "lbl_chapt";
- this.lbl_chapt.Size = new System.Drawing.Size(10, 13);
+ this.lbl_chapt.Size = new System.Drawing.Size(12, 13);
this.lbl_chapt.TabIndex = 69;
this.lbl_chapt.Text = "-";
//
@@ -226,36 +139,36 @@ namespace Handbrake //
this.lbl_title.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.lbl_title.AutoSize = true;
- this.lbl_title.Location = new System.Drawing.Point(175, 124);
+ this.lbl_title.Location = new System.Drawing.Point(202, 120);
this.lbl_title.Name = "lbl_title";
- this.lbl_title.Size = new System.Drawing.Size(10, 13);
+ this.lbl_title.Size = new System.Drawing.Size(12, 13);
this.lbl_title.TabIndex = 68;
this.lbl_title.Text = "-";
//
// lbl_aEnc
//
this.lbl_aEnc.AutoSize = true;
- this.lbl_aEnc.Location = new System.Drawing.Point(285, 138);
+ this.lbl_aEnc.Location = new System.Drawing.Point(330, 134);
this.lbl_aEnc.Name = "lbl_aEnc";
- this.lbl_aEnc.Size = new System.Drawing.Size(10, 13);
+ this.lbl_aEnc.Size = new System.Drawing.Size(12, 13);
this.lbl_aEnc.TabIndex = 67;
this.lbl_aEnc.Text = "-";
//
// lbl_vEnc
//
this.lbl_vEnc.AutoSize = true;
- this.lbl_vEnc.Location = new System.Drawing.Point(285, 125);
+ this.lbl_vEnc.Location = new System.Drawing.Point(330, 121);
this.lbl_vEnc.Name = "lbl_vEnc";
- this.lbl_vEnc.Size = new System.Drawing.Size(10, 13);
+ this.lbl_vEnc.Size = new System.Drawing.Size(12, 13);
this.lbl_vEnc.TabIndex = 66;
this.lbl_vEnc.Text = "-";
//
// lbl_dest
//
this.lbl_dest.AutoSize = true;
- this.lbl_dest.Location = new System.Drawing.Point(175, 112);
+ this.lbl_dest.Location = new System.Drawing.Point(202, 108);
this.lbl_dest.Name = "lbl_dest";
- this.lbl_dest.Size = new System.Drawing.Size(10, 13);
+ this.lbl_dest.Size = new System.Drawing.Size(12, 13);
this.lbl_dest.TabIndex = 65;
this.lbl_dest.Text = "-";
this.lbl_dest.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -263,9 +176,9 @@ namespace Handbrake // lbl_source
//
this.lbl_source.AutoSize = true;
- this.lbl_source.Location = new System.Drawing.Point(175, 99);
+ this.lbl_source.Location = new System.Drawing.Point(202, 95);
this.lbl_source.Name = "lbl_source";
- this.lbl_source.Size = new System.Drawing.Size(10, 13);
+ this.lbl_source.Size = new System.Drawing.Size(12, 13);
this.lbl_source.TabIndex = 64;
this.lbl_source.Text = "-";
//
@@ -273,7 +186,7 @@ namespace Handbrake //
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.Location = new System.Drawing.Point(50, 99);
+ this.label1.Location = new System.Drawing.Point(56, 95);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(99, 52);
this.label1.TabIndex = 63;
@@ -283,7 +196,7 @@ namespace Handbrake //
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label3.Location = new System.Drawing.Point(50, 77);
+ this.label3.Location = new System.Drawing.Point(56, 73);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(82, 13);
this.label3.TabIndex = 62;
@@ -301,7 +214,7 @@ namespace Handbrake this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
- this.toolStrip1.Size = new System.Drawing.Size(729, 49);
+ this.toolStrip1.Size = new System.Drawing.Size(780, 49);
this.toolStrip1.TabIndex = 71;
this.toolStrip1.Text = "toolStrip1";
//
@@ -349,39 +262,126 @@ namespace Handbrake // pictureBox1
//
this.pictureBox1.Image = global::Handbrake.Properties.Resources.Queue;
- this.pictureBox1.Location = new System.Drawing.Point(12, 65);
+ this.pictureBox1.Location = new System.Drawing.Point(12, 61);
this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(32, 32);
+ this.pictureBox1.Size = new System.Drawing.Size(37, 32);
this.pictureBox1.TabIndex = 61;
this.pictureBox1.TabStop = false;
//
+ // list_queue
+ //
+ this.list_queue.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.Title,
+ this.Chapters,
+ this.Source,
+ this.Destination,
+ this.EncoderVideo,
+ this.Audio});
+ this.list_queue.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.list_queue.FullRowSelect = true;
+ this.list_queue.GridLines = true;
+ this.list_queue.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.list_queue.Location = new System.Drawing.Point(12, 157);
+ this.list_queue.MultiSelect = false;
+ this.list_queue.Name = "list_queue";
+ this.list_queue.Size = new System.Drawing.Size(755, 185);
+ this.list_queue.TabIndex = 72;
+ this.list_queue.UseCompatibleStateImageBehavior = false;
+ this.list_queue.View = System.Windows.Forms.View.Details;
+ //
+ // Title
+ //
+ this.Title.Text = "Title";
+ this.Title.Width = 39;
+ //
+ // Chapters
+ //
+ this.Chapters.Text = "Chapters";
+ this.Chapters.Width = 71;
+ //
+ // Source
+ //
+ this.Source.Text = "Source";
+ this.Source.Width = 219;
+ //
+ // Destination
+ //
+ this.Destination.Text = "Destination";
+ this.Destination.Width = 215;
+ //
+ // EncoderVideo
+ //
+ this.EncoderVideo.Text = "Video Encoder";
+ this.EncoderVideo.Width = 110;
+ //
+ // Audio
+ //
+ this.Audio.Text = "Audio Encoder";
+ this.Audio.Width = 94;
+ //
+ // lbl_progressValue
+ //
+ this.lbl_progressValue.AutoSize = true;
+ this.lbl_progressValue.Location = new System.Drawing.Point(737, 353);
+ this.lbl_progressValue.Name = "lbl_progressValue";
+ this.lbl_progressValue.Size = new System.Drawing.Size(30, 13);
+ this.lbl_progressValue.TabIndex = 36;
+ this.lbl_progressValue.Text = "0 %";
+ //
+ // progressBar
+ //
+ this.progressBar.Location = new System.Drawing.Point(76, 348);
+ this.progressBar.Name = "progressBar";
+ this.progressBar.Size = new System.Drawing.Size(655, 23);
+ this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
+ this.progressBar.TabIndex = 34;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(9, 353);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(62, 13);
+ this.label2.TabIndex = 35;
+ this.label2.Text = "Progress:";
+ //
+ // lbl_status
+ //
+ this.lbl_status.AutoSize = true;
+ this.lbl_status.BackColor = System.Drawing.Color.Transparent;
+ this.lbl_status.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbl_status.Location = new System.Drawing.Point(319, 353);
+ this.lbl_status.Name = "lbl_status";
+ this.lbl_status.Size = new System.Drawing.Size(176, 13);
+ this.lbl_status.TabIndex = 42;
+ this.lbl_status.Text = "Encode Queue Completed!";
+ this.lbl_status.Visible = false;
+ //
// frmQueue
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(729, 400);
+ this.ClientSize = new System.Drawing.Size(780, 386);
+ this.Controls.Add(this.lbl_status);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.list_queue);
+ this.Controls.Add(this.progressBar);
+ this.Controls.Add(this.lbl_progressValue);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.btn_down);
+ this.Controls.Add(this.btn_up);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.label4);
- this.Controls.Add(this.lbl_chapt);
- this.Controls.Add(this.lbl_title);
- this.Controls.Add(this.lbl_aEnc);
- this.Controls.Add(this.lbl_vEnc);
this.Controls.Add(this.lbl_dest);
+ this.Controls.Add(this.btn_delete);
+ this.Controls.Add(this.lbl_vEnc);
+ this.Controls.Add(this.lbl_chapt);
this.Controls.Add(this.lbl_source);
- this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.list_queue);
- this.Controls.Add(this.btn_updateQuery);
- this.Controls.Add(this.btn_delete);
- this.Controls.Add(this.lbl_status);
- this.Controls.Add(this.btn_up);
- this.Controls.Add(this.text_edit);
- this.Controls.Add(this.btn_down);
- this.Controls.Add(this.lbl_progressValue);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.progressBar);
- this.Controls.Add(this.btn_Close);
+ this.Controls.Add(this.lbl_aEnc);
+ this.Controls.Add(this.lbl_title);
+ this.Controls.Add(this.label1);
+ this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "frmQueue";
@@ -400,15 +400,7 @@ namespace Handbrake internal System.Windows.Forms.Button btn_down;
internal System.Windows.Forms.Button btn_up;
internal System.Windows.Forms.Button btn_delete;
- internal System.Windows.Forms.Button btn_Close;
- private System.Windows.Forms.ProgressBar progressBar;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label lbl_progressValue;
- private System.Windows.Forms.Label lbl_status;
private System.Windows.Forms.ToolTip toolTip1;
- public System.Windows.Forms.ListBox list_queue;
- private System.Windows.Forms.TextBox text_edit;
- internal System.Windows.Forms.Button btn_updateQuery;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lbl_chapt;
private System.Windows.Forms.Label lbl_title;
@@ -425,5 +417,16 @@ namespace Handbrake private System.Windows.Forms.ToolStripButton btn_stop;
private System.Windows.Forms.ToolStripButton btn_batch;
private System.Windows.Forms.SaveFileDialog SaveFile;
+ private System.Windows.Forms.ListView list_queue;
+ private System.Windows.Forms.ColumnHeader Title;
+ private System.Windows.Forms.ColumnHeader Chapters;
+ private System.Windows.Forms.ColumnHeader Source;
+ private System.Windows.Forms.ColumnHeader Destination;
+ private System.Windows.Forms.ColumnHeader EncoderVideo;
+ private System.Windows.Forms.ColumnHeader Audio;
+ private System.Windows.Forms.Label lbl_progressValue;
+ private System.Windows.Forms.ProgressBar progressBar;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label lbl_status;
}
}
\ No newline at end of file diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 37c646256..1a50f1cc0 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -25,15 +25,27 @@ namespace Handbrake Functions.CLI cliObj = new Functions.CLI();
Boolean cancel = false;
Process hbProc = null;
+ Functions.Queue queue;
public frmQueue()
{
- InitializeComponent();
+ InitializeComponent();
}
+ /// <summary>
+ /// Initializes the Queue list with the Arraylist from the Queue class
+ /// </summary>
+ /// <param name="qw"></param>
+ public void setQueue(Functions.Queue qw)
+ {
+ queue = qw;
+ redrawQueue();
+ }
- #region Queue / Handling
-
+ /// <summary>
+ /// Returns if there is currently an item being encoded by the queue
+ /// </summary>
+ /// <returns>Boolean true if encoding</returns>
public Boolean isEncoding()
{
if (hbProc == null)
@@ -42,11 +54,48 @@ namespace Handbrake return true;
}
- private void btn_encode_Click(object sender, EventArgs e)
+ // Redraw's the queue with the latest data from the Queue class
+ private void redrawQueue()
{
- // Reset some values
+ list_queue.Items.Clear();
+ foreach (string queue_item in queue.getQueue())
+ {
+ Functions.QueryParser parsed = Functions.QueryParser.Parse(queue_item);
+
+ // Get the DVD Title
+ string title = "";
+ if (parsed.DVDTitle == 0)
+ title = "Auto";
+ else
+ title = parsed.DVDTitle.ToString();
+
+ // Get the DVD Chapters
+ string chapters = "";
+ if (parsed.DVDChapterStart == 0)
+ chapters = "Auto";
+ else
+ {
+ chapters = parsed.DVDChapterStart.ToString();
+ if (parsed.DVDChapterFinish != 0)
+ chapters = chapters + " - " + parsed.DVDChapterFinish;
+ }
+
+ ListViewItem item = new ListViewItem();
+ item.Text = title; // Title
+ item.SubItems.Add(chapters); // Chapters
+ item.SubItems.Add(parsed.Source); // Source
+ item.SubItems.Add(parsed.Destination); // Destination
+ item.SubItems.Add(parsed.VideoEncoder); // Video
+ item.SubItems.Add(parsed.AudioEncoder1); // Audio
+
+ list_queue.Items.Add(item);
+ }
+ }
- if (list_queue.Items.Count != 0)
+ // Initializes the encode process
+ private void btn_encode_Click(object sender, EventArgs e)
+ {
+ if (queue.count() != 0)
{
lbl_status.Visible = false;
btn_encode.Enabled = false;
@@ -56,16 +105,14 @@ namespace Handbrake // Start the encode
try
{
- if (list_queue.Items.Count != 0)
+ if (queue.count() != 0)
{
// Setup or reset some values
btn_stop.Visible = true;
progressBar.Value = 0;
lbl_progressValue.Text = "0 %";
- progressBar.Step = 100 / list_queue.Items.Count;
+ progressBar.Step = 100 / queue.count();
progressBar.Update();
- //ThreadPool.QueueUserWorkItem(startProc);
- // Testing a new way of launching a thread. Hopefully will fix a random freeze up of the main thread.
Thread theQ = new Thread(startProc);
theQ.Start();
}
@@ -76,26 +123,19 @@ namespace Handbrake }
}
- private void btn_stop_Click(object sender, EventArgs e)
- {
- cancel = true;
- btn_stop.Visible = false;
- btn_encode.Enabled = true;
- MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode Video' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
-
+ // Starts the encoding process
private void startProc(object state)
{
try
{
-
- while (list_queue.Items.Count != 0)
+ // Run through each item on the queue
+ while (queue.count() != 0)
{
- string query = list_queue.Items[0].ToString();
+ string query = queue.getNextItemForEncoding();
+
setEncValue();
updateUIElements();
-
hbProc = cliObj.runCli(this, query);
hbProc.WaitForExit();
@@ -108,12 +148,11 @@ namespace Handbrake if (cancel == true)
{
break;
- }
+ }
}
resetQueue();
-
// After the encode is done, we may want to shutdown, suspend etc.
cliObj.afterEncodeAction();
}
@@ -123,27 +162,7 @@ namespace Handbrake }
}
- private void updateUIElements()
- {
- try
- {
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
- return;
- }
- this.list_queue.Items.RemoveAt(0);
-
- progressBar.PerformStep();
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
- progressBar.Update();
- }
- catch (Exception exc)
- {
- MessageBox.Show(exc.ToString());
- }
- }
-
+ // Reset's the window to the default state.
private void resetQueue()
{
try
@@ -161,15 +180,13 @@ namespace Handbrake {
lbl_status.Visible = true;
lbl_status.Text = "Encode Queue Cancelled!";
- text_edit.Text = "";
}
else
{
lbl_status.Visible = true;
lbl_status.Text = "Encode Queue Completed!";
- text_edit.Text = "";
}
-
+
lbl_progressValue.Text = "0 %";
progressBar.Value = 0;
progressBar.Update();
@@ -186,7 +203,40 @@ namespace Handbrake MessageBox.Show(exc.ToString());
}
}
-
+
+ // Stop's the queue from continuing.
+ private void btn_stop_Click(object sender, EventArgs e)
+ {
+ cancel = true;
+ btn_stop.Visible = false;
+ btn_encode.Enabled = true;
+ MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode Video' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+
+ // Updates the progress bar and progress label for a new status.
+ private void updateUIElements()
+ {
+ try
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
+ return;
+ }
+
+ redrawQueue();
+
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
+ progressBar.Update();
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.ToString());
+ }
+ }
+
+ // Set's the information lables about the current encode.
private void setEncValue()
{
try
@@ -196,10 +246,8 @@ namespace Handbrake this.BeginInvoke(new setEncoding(setEncValue));
}
- string query = query = list_queue.Items[0].ToString();
-
// found query is a global varible
- Functions.QueryParser parsed = Functions.QueryParser.Parse(query);
+ Functions.QueryParser parsed = Functions.QueryParser.Parse(queue.getLastQuery());
lbl_source.Text = parsed.Source;
lbl_dest.Text = parsed.Destination;
@@ -231,64 +279,43 @@ namespace Handbrake }
}
- private void list_queue_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (list_queue.SelectedItem != null)
- text_edit.Text = list_queue.SelectedItem.ToString();
-
- listCount = list_queue.Items.Count;
- }
-
- #endregion
-
- #region Buttons
-
+ // Move an item up the Queue
private void btn_up_Click(object sender, EventArgs e)
{
- int count = list_queue.Items.Count;
- int itemToMove = list_queue.SelectedIndex;
- int previousItemint = 0;
- String previousItem = "";
-
- if (itemToMove > 0)
+ if (list_queue.SelectedIndices.Count != 0)
{
- previousItemint = itemToMove - 1;
- previousItem = list_queue.Items[previousItemint].ToString();
- list_queue.Items[previousItemint] = list_queue.Items[itemToMove];
- list_queue.Items[itemToMove] = previousItem;
- list_queue.SelectedIndex = list_queue.SelectedIndex - 1;
+ queue.moveUp(list_queue.SelectedIndices[0]);
+ redrawQueue();
}
}
+ // Move an item down the Queue
private void btn_down_Click(object sender, EventArgs e)
{
- int count = list_queue.Items.Count;
- int itemToMove = list_queue.SelectedIndex;
- int itemAfterInt = 0;
- String itemAfter = "";
-
- if (itemToMove < (count - 1))
+ if (list_queue.SelectedIndices.Count != 0)
{
- itemAfterInt = itemToMove + 1;
- itemAfter = list_queue.Items[itemAfterInt].ToString();
- list_queue.Items[itemAfterInt] = list_queue.Items[itemToMove];
- list_queue.Items[itemToMove] = itemAfter;
- list_queue.SelectedIndex = list_queue.SelectedIndex + 1;
+ queue.moveDown(list_queue.SelectedIndices[0]);
+ redrawQueue();
}
}
+ // Remove an item from the queue
private void btn_delete_Click(object sender, EventArgs e)
{
- list_queue.Items.Remove(list_queue.SelectedItem);
+ if (list_queue.SelectedIndices.Count != 0)
+ {
+ queue.remove(list_queue.SelectedIndices[0]);
+ redrawQueue();
+ }
}
+ // Generate a batch file script to run the encode seperate of HandBrake
private void btn_batch_Click(object sender, EventArgs e)
{
string queries = "";
- for (int i = 0; i < list_queue.Items.Count; i++)
+ foreach (string query_item in queue.getQueue())
{
- string query = list_queue.Items[i].ToString();
- string fullQuery = '"' + Application.StartupPath.ToString() + "\\HandBrakeCLI.exe" + '"' + query;
+ string fullQuery = '"' + Application.StartupPath.ToString() + "\\HandBrakeCLI.exe" + '"' + query_item;
if (queries == "")
queries = queries + fullQuery;
@@ -304,13 +331,10 @@ namespace Handbrake {
try
{
- // Create a StreamWriter and open the file
+ // Create a StreamWriter and open the file, Write the batch file query to the file and
+ // Close the stream
StreamWriter line = new StreamWriter(filename);
-
- // Write the batch file query to the file
line.WriteLine(strCmdLine);
-
- // close the stream
line.Close();
MessageBox.Show("Your batch script has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
@@ -323,37 +347,19 @@ namespace Handbrake }
}
- int listCount = 0;
- private void btn_updateQuery_Click(object sender, EventArgs e)
- {
- if (text_edit.Text != "")
- {
- if (list_queue.Items.Count != listCount)
- {
- MessageBox.Show("Unable to modify the selected item. The number of items on the list has changed. \nPlease avoid modifying an item when a new encode is about to start!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- if (list_queue.SelectedItem != null)
- list_queue.Items[list_queue.SelectedIndex] = text_edit.Text;
-
- }
- }
- }
-
+ // Hide's the window from the users view.
private void btn_Close_Click(object sender, EventArgs e)
{
this.Hide();
}
- #endregion
-
+ // Hide's the window when the user tries to "x" out of the window instead of closing it.
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel = true;
this.Hide();
base.OnClosing(e);
}
-
+
}
}
\ No newline at end of file |