OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 30 Jun 2008 14:24:47 +0000 (14:24 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 30 Jun 2008 14:24:47 +0000 (14:24 +0000)
- Queue system moved into it's own class.
- Queue now uses a listview display instead of a simple list. It now displays some information about each encode instead of the CLI String.
- Misc other Fixes.

git-svn-id: svn://localhost/HandBrake/trunk@1544 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/Functions/Queue.cs [new file with mode: 0644]
win/C#/HandBrakeCS.csproj
win/C#/Properties/Settings.Designer.cs
win/C#/Properties/Settings.settings
win/C#/Resources/JobPassLarge.png [new file with mode: 0644]
win/C#/app.config
win/C#/frmMain.cs
win/C#/frmQueue.Designer.cs
win/C#/frmQueue.cs

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