OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 31 Jul 2007 18:31:06 +0000 (18:31 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 31 Jul 2007 18:31:06 +0000 (18:31 +0000)
- Few queue bugs fixed.
- Active queueing now works properly. Items can be added on the fly. DVD's can be scanned on the fly while the there is an encode process already going etc.
- Fixed a potential unhandled exception in the DVD information window.

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

win/C#/frmDvdInfo.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmQueue.cs

index 7f50322..3b2cfd8 100644 (file)
@@ -20,18 +20,25 @@ namespace Handbrake
             InitializeComponent();\r
             this.rtf_dvdInfo.Text = string.Empty;\r
 \r
-            string appPath = Application.StartupPath.ToString();\r
-            appPath = appPath + "\\";\r
-            StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");\r
-            \r
-            string line = sr.ReadLine();\r
-\r
-            while (line != null)\r
+            try\r
             {\r
-                this.rtf_dvdInfo.AppendText(line + System.Environment.NewLine);\r
-                line = sr.ReadLine();\r
+                string appPath = Application.StartupPath.ToString();\r
+                appPath = appPath + "\\";\r
+                StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");\r
+\r
+                string line = sr.ReadLine();\r
+\r
+                while (line != null)\r
+                {\r
+                    this.rtf_dvdInfo.AppendText(line + System.Environment.NewLine);\r
+                    line = sr.ReadLine();\r
+                }\r
+                sr.Close();\r
+            }\r
+            catch (Exception)\r
+            { \r
+               // Don't do anything\r
             }\r
-            sr.Close();\r
         }\r
 \r
         /*public void HandleParsedData(object Sender, string Data)\r
index 6986482..fc0c3f5 100644 (file)
@@ -1075,7 +1075,7 @@ namespace Handbrake
             this.TabPage3.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage3.Name = "TabPage3";\r
             this.TabPage3.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage3.Size = new System.Drawing.Size(639, 242);\r
+            this.TabPage3.Size = new System.Drawing.Size(622, 242);\r
             this.TabPage3.TabIndex = 2;\r
             this.TabPage3.Text = "Video Settings";\r
             // \r
@@ -1317,7 +1317,7 @@ namespace Handbrake
             this.TabPage2.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage2.Name = "TabPage2";\r
             this.TabPage2.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage2.Size = new System.Drawing.Size(639, 242);\r
+            this.TabPage2.Size = new System.Drawing.Size(622, 242);\r
             this.TabPage2.TabIndex = 3;\r
             this.TabPage2.Text = "Audio Settings";\r
             // \r
@@ -1470,7 +1470,7 @@ namespace Handbrake
             this.h264Tab.Location = new System.Drawing.Point(4, 22);\r
             this.h264Tab.Name = "h264Tab";\r
             this.h264Tab.Padding = new System.Windows.Forms.Padding(3);\r
-            this.h264Tab.Size = new System.Drawing.Size(639, 242);\r
+            this.h264Tab.Size = new System.Drawing.Size(622, 242);\r
             this.h264Tab.TabIndex = 5;\r
             this.h264Tab.Text = "H.264";\r
             // \r
@@ -1557,7 +1557,7 @@ namespace Handbrake
             this.TabPage6.Location = new System.Drawing.Point(4, 22);\r
             this.TabPage6.Name = "TabPage6";\r
             this.TabPage6.Padding = new System.Windows.Forms.Padding(3);\r
-            this.TabPage6.Size = new System.Drawing.Size(639, 242);\r
+            this.TabPage6.Size = new System.Drawing.Size(622, 242);\r
             this.TabPage6.TabIndex = 6;\r
             this.TabPage6.Text = "Query Editor";\r
             // \r
index 1e84ef1..59e31c5 100644 (file)
@@ -638,8 +638,15 @@ namespace Handbrake
         {\r
             if (text_destination.Text != "" && text_source.Text != "")\r
             {\r
-\r
-                String query = GenerateTheQuery();\r
+                string query;\r
+                if (QueryEditorText.Text == "")\r
+                {\r
+                    query = GenerateTheQuery();\r
+                }\r
+                else\r
+                {\r
+                    query = QueryEditorText.Text;\r
+                }\r
                 queueWindow.list_queue.Items.Add(query);\r
                 queueWindow.Show();\r
             } \r
index c0c0a8c..ee6301a 100644 (file)
@@ -19,24 +19,90 @@ namespace Handbrake
             InitializeComponent();\r
         }\r
 \r
-        private void btn_Close_Click(object sender, EventArgs e)\r
+        int initialListCount = 0;\r
+        bool started = false;\r
+\r
+      \r
+        private void btn_q_encoder_Click(object sender, EventArgs e)\r
         {\r
-            this.Hide();\r
+            progressBar.Value = 0;\r
+            lbl_progressValue.Text = "0 %";\r
+            progressBar.Step = 100 / list_queue.Items.Count;\r
+            progressBar.Update();\r
+            ThreadPool.QueueUserWorkItem(startProc);\r
         }\r
 \r
-        private void btn_delete_Click(object sender, EventArgs e)\r
+        /*\r
+         * \r
+         * Code to Handle the CLI and updating of the UI as each process is completed.\r
+         * \r
+         */\r
+        private void startProc(object state)\r
         {\r
-            list_queue.Items.Remove(list_queue.SelectedItem);\r
+            started = true;\r
+            initialListCount = list_queue.Items.Count;\r
+            for (int i = 0; i < initialListCount; i++)\r
+            {\r
+                string query = list_queue.Items[0].ToString();\r
+\r
+                Functions.CLI process = new Functions.CLI();\r
+                Process hbProc = process.runCli(this, query, false, false, false, false);\r
+                \r
+                hbProc.WaitForExit();\r
+                hbProc.Close();\r
+                hbProc.Dispose();\r
+                updateUIElements();\r
+\r
+                if ((initialListCount - i) != (list_queue.Items.Count))\r
+                {\r
+                    MessageBox.Show("Added an Item");\r
+                    initialListCount++;\r
+                }\r
+            }\r
+            started = false;\r
+            resetQueue();\r
+            MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
+        }\r
+\r
+        private void updateUIElements()\r
+        {\r
+            if (this.InvokeRequired)\r
+            {\r
+                this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));\r
+                return;\r
+            }\r
+            this.list_queue.Items.RemoveAt(0);\r
+            progressBar.PerformStep();\r
+            lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);\r
+            progressBar.Update();\r
         }\r
 \r
+        private void resetQueue()\r
+        {\r
+            if (this.InvokeRequired)\r
+            {\r
+                this.BeginInvoke(new ProgressUpdateHandler(resetQueue));\r
+                return;\r
+            }\r
+            lbl_progressValue.Text = "0 %";\r
+            progressBar.Value = 0;\r
+            progressBar.Update();\r
+        }\r
+\r
+        /*\r
+         * \r
+         * Code to Re-arrange / Delete items from the Queue\r
+         * \r
+         */\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
+            int previousItemint = 0;\r
             String previousItem = "";\r
 \r
-             if (itemToMove > 0){\r
+            if (itemToMove > 0)\r
+            {\r
                 previousItemint = itemToMove - 1;\r
                 previousItem = list_queue.Items[previousItemint].ToString();\r
                 list_queue.Items[previousItemint] = list_queue.Items[itemToMove];\r
@@ -49,7 +115,7 @@ namespace Handbrake
         {\r
             int count = list_queue.Items.Count;\r
             int itemToMove = list_queue.SelectedIndex;\r
-            int itemAfterInt = 0; \r
+            int itemAfterInt = 0;\r
             String itemAfter = "";\r
 \r
             if (itemToMove < (count - 1))\r
@@ -62,52 +128,19 @@ namespace Handbrake
             }\r
         }\r
 \r
-        private void btn_q_encoder_Click(object sender, EventArgs e)\r
-        {\r
-            progressBar.Value = 0;\r
-            lbl_progressValue.Text = "0 %";\r
-            progressBar.Step = 100 / list_queue.Items.Count;\r
-            progressBar.Update();\r
-            ThreadPool.QueueUserWorkItem(startProc);\r
-        }\r
-\r
-        private void startProc(object state)\r
+        private void btn_delete_Click(object sender, EventArgs e)\r
         {\r
-            int initialListCount = list_queue.Items.Count;\r
-            for (int i = 0; i < initialListCount; i++)\r
-            {\r
-                string query = list_queue.Items[0].ToString();\r
-\r
-                Functions.CLI process = new Functions.CLI();\r
-                Process hbProc = process.runCli(this, query, false, false, false, false);\r
-       \r
-                hbProc.WaitForExit();\r
-                hbProc.Close();\r
-                hbProc.Dispose();\r
-\r
-                updateUIElements();\r
-            }\r
+            list_queue.Items.Remove(list_queue.SelectedItem);\r
+            if (started == true)\r
+                initialListCount--;\r
         }\r
 \r
-        private void updateUIElements()\r
+        /*\r
+         * Hide the Queue Window\r
+         */\r
+        private void btn_Close_Click(object sender, EventArgs e)\r
         {\r
-            if (this.InvokeRequired)\r
-            {\r
-                this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));\r
-                return;\r
-            }\r
-            this.list_queue.Items.RemoveAt(0);\r
-            progressBar.PerformStep();\r
-            lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);\r
-            progressBar.Update();\r
-\r
-            if (progressBar.Value == 100)\r
-            {\r
-                MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
-                progressBar.Value = 0;\r
-                progressBar.Update();\r
-                lbl_progressValue.Text = "0 %";\r
-            }\r
+            this.Hide();\r
         }\r
     }\r
 }
\ No newline at end of file