OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 16 Oct 2007 21:20:29 +0000 (21:20 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 16 Oct 2007 21:20:29 +0000 (21:20 +0000)
- Few small enhancements to the queue, including a "stop queue" button

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

win/C#/frmQueue.Designer.cs
win/C#/frmQueue.cs
win/C#/frmQueue.resx
win/C#/frmReadDVD.Designer.cs

index 1e29450..1c809e1 100644 (file)
@@ -28,6 +28,7 @@ namespace Handbrake
         /// </summary>\r
         private void InitializeComponent()\r
         {\r
+            this.components = new System.ComponentModel.Container();\r
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmQueue));\r
             this.btn_down = new System.Windows.Forms.Button();\r
             this.btn_up = new System.Windows.Forms.Button();\r
@@ -41,6 +42,9 @@ namespace Handbrake
             this.label1 = new System.Windows.Forms.Label();\r
             this.pictureBox1 = new System.Windows.Forms.PictureBox();\r
             this.label3 = new System.Windows.Forms.Label();\r
+            this.btn_cancel = new System.Windows.Forms.Button();\r
+            this.lbl_status = new System.Windows.Forms.Label();\r
+            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);\r
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();\r
             this.SuspendLayout();\r
             // \r
@@ -189,12 +193,44 @@ namespace Handbrake
             this.label3.TabIndex = 39;\r
             this.label3.Text = "Queue";\r
             // \r
+            // btn_cancel\r
+            // \r
+            this.btn_cancel.BackColor = System.Drawing.SystemColors.ControlLight;\r
+            this.btn_cancel.FlatAppearance.BorderColor = System.Drawing.Color.Black;\r
+            this.btn_cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.btn_cancel.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.btn_cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));\r
+            this.btn_cancel.Location = new System.Drawing.Point(143, 302);\r
+            this.btn_cancel.Name = "btn_cancel";\r
+            this.btn_cancel.Size = new System.Drawing.Size(91, 22);\r
+            this.btn_cancel.TabIndex = 41;\r
+            this.btn_cancel.TabStop = false;\r
+            this.btn_cancel.Text = "Stop Queue";\r
+            this.toolTip1.SetToolTip(this.btn_cancel, "This will prevent any more encode processes from starting. It will not stop the c" +\r
+                    "urrent process!");\r
+            this.btn_cancel.UseVisualStyleBackColor = false;\r
+            this.btn_cancel.Visible = false;\r
+            this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);\r
+            // \r
+            // lbl_status\r
+            // \r
+            this.lbl_status.AutoSize = true;\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(260, 268);\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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
             this.BackColor = System.Drawing.SystemColors.ControlLight;\r
             this.ClientSize = new System.Drawing.Size(723, 332);\r
+            this.Controls.Add(this.lbl_status);\r
+            this.Controls.Add(this.btn_cancel);\r
             this.Controls.Add(this.label1);\r
             this.Controls.Add(this.label3);\r
             this.Controls.Add(this.pictureBox1);\r
@@ -232,5 +268,8 @@ namespace Handbrake
         private System.Windows.Forms.PictureBox pictureBox1;\r
         private System.Windows.Forms.Label label1;\r
         private System.Windows.Forms.Label label3;\r
+        internal System.Windows.Forms.Button btn_cancel;\r
+        private System.Windows.Forms.Label lbl_status;\r
+        private System.Windows.Forms.ToolTip toolTip1;\r
     }\r
 }
\ No newline at end of file
index 117bb14..bec77f4 100644 (file)
@@ -21,13 +21,21 @@ namespace Handbrake
         }\r
 \r
         #region Queue Handling\r
-\r
+        Boolean cancel = false;\r
         private void btn_q_encoder_Click(object sender, EventArgs e)\r
         {\r
+            // Reset some values\r
+            \r
+            lbl_status.Visible = false;\r
+            cancel = false;\r
+\r
+            // Start the encode\r
             try\r
             {\r
                 if (list_queue.Items.Count != 0)\r
                 {\r
+                    // Setup or reset some values\r
+                    btn_cancel.Visible = true;\r
                     progressBar.Value = 0;\r
                     lbl_progressValue.Text = "0 %";\r
                     progressBar.Step = 100 / list_queue.Items.Count;\r
@@ -41,6 +49,12 @@ namespace Handbrake
             }\r
              \r
         }\r
+        private void btn_cancel_Click(object sender, EventArgs e)\r
+        {\r
+            cancel = true;\r
+            btn_cancel.Visible = false;\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
         [DllImport("user32.dll")]\r
         public static extern void LockWorkStation();\r
@@ -54,6 +68,7 @@ namespace Handbrake
                 while (list_queue.Items.Count != 0)\r
                 {\r
                     string query = list_queue.Items[0].ToString();\r
+                    \r
                     updateUIElements();\r
                         \r
                     Functions.CLI process = new Functions.CLI();\r
@@ -62,9 +77,18 @@ namespace Handbrake
                     hbProc.WaitForExit();\r
                     hbProc.Close();\r
                     hbProc.Dispose();\r
+\r
+                    query = "";\r
+\r
+                    if (cancel == true)\r
+                    {\r
+                        break;\r
+                    }\r
+                    \r
                 }\r
 \r
                 resetQueue();\r
+                \r
 \r
                 // Do something whent he encode ends.\r
                 switch (Properties.Settings.Default.CompletionOption)\r
@@ -90,8 +114,6 @@ namespace Handbrake
                     default:\r
                         break;\r
                 }\r
-\r
-                MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -101,28 +123,55 @@ namespace Handbrake
 \r
         private void updateUIElements()\r
         {\r
-            if (this.InvokeRequired)\r
+            try\r
             {\r
-                this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));\r
-                return;\r
-            }\r
-            this.list_queue.Items.RemoveAt(0);\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
+                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
         private void resetQueue()\r
         {\r
-            if (this.InvokeRequired)\r
+            try\r
+            {\r
+                if (this.InvokeRequired)\r
+                {\r
+                    this.BeginInvoke(new ProgressUpdateHandler(resetQueue));\r
+                    return;\r
+                }\r
+\r
+                if (cancel == true)\r
+                {\r
+                    lbl_status.Visible = true;\r
+                    lbl_status.Text = "Encode Queue Cancelled!";\r
+                }\r
+                else\r
+                {\r
+                    lbl_status.Visible = true;\r
+                    lbl_status.Text = "Encode Queue Completed!";\r
+                }\r
+                btn_cancel.Visible = false;\r
+\r
+                lbl_progressValue.Text = "0 %";\r
+                progressBar.Value = 0;\r
+                progressBar.Update();\r
+            }\r
+            catch (Exception exc)\r
             {\r
-                this.BeginInvoke(new ProgressUpdateHandler(resetQueue));\r
-                return;\r
+                MessageBox.Show(exc.ToString());\r
             }\r
-            lbl_progressValue.Text = "0 %";\r
-            progressBar.Value = 0;\r
-            progressBar.Update();\r
         }\r
 \r
         #endregion\r
@@ -181,5 +230,7 @@ namespace Handbrake
             base.OnClosing(e);\r
         }\r
 \r
+\r
+\r
     }\r
 }
\ No newline at end of file
index 37f9290..2ddcb69 100644 (file)
   <resheader name="writer">\r
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
   </resheader>\r
+  <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>17, 17</value>\r
+  </metadata>\r
   <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />\r
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
index e2395fc..0d33841 100644 (file)
@@ -81,7 +81,6 @@ namespace Handbrake
             this.MaximizeBox = false;\r
             this.MaximumSize = new System.Drawing.Size(538, 113);\r
             this.Name = "frmReadDVD";\r
-            this.ShowInTaskbar = false;\r
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
             this.Text = "Reading DVD...";\r
             this.TopMost = true;\r