]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Fri, 15 Jan 2010 22:47:48 +0000 (22:47 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 15 Jan 2010 22:47:48 +0000 (22:47 +0000)
- Send a job (which is not currently encoding) from the queue, back to the main window so that the user can alter the encode settings. Sending a job back causes a rescan of the source following by the current configuration being loaded back into the main gui window.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3072 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/EncodeQueue/Queue.cs
win/C#/frmMain.cs
win/C#/frmQueue.Designer.cs
win/C#/frmQueue.cs

index f279a974f448fc041fb97ed8a0c3e951124234f8..0372d90b75e6ed54e236de558bad4a608ac17bb9 100644 (file)
@@ -102,6 +102,19 @@ namespace Handbrake.EncodeQueue
             WriteQueueStateToFile("hb_queue_recovery.xml");\r
         }\r
 \r
+        /// <summary>\r
+        /// Retrieve a job from the queue\r
+        /// </summary>\r
+        /// <param name="index"></param>\r
+        /// <returns></returns>\r
+        public Job GetJob(int index)\r
+        {\r
+            if (queue.Count >= (index +1))\r
+                return queue[index];\r
+\r
+            return new Job();\r
+        }\r
+\r
         /// <summary>\r
         /// Moves an item up one position in the queue.\r
         /// </summary>\r
index 822e8a734d3ba9fd91aa0f8287bc1665fbc8e8da..4d45b7fcc4b4d6dbc4242fa4350e94a5674d2954 100644 (file)
@@ -88,7 +88,7 @@ namespace Handbrake
             treeView_presets.ExpandAll();\r
             lbl_encode.Text = "";\r
             drop_mode.SelectedIndex = 0;\r
-            queueWindow = new frmQueue(encodeQueue);        // Prepare the Queue\r
+            queueWindow = new frmQueue(encodeQueue, this);        // Prepare the Queue\r
             if (!Properties.Settings.Default.QueryEditorTab)\r
                 tabs_panel.TabPages.RemoveAt(7); // Remove the query editor tab if the user does not want it enabled.\r
 \r
@@ -1817,6 +1817,39 @@ namespace Handbrake
         }\r
         #endregion\r
 \r
+        public void RecievingJob(Job job)\r
+        {\r
+            string query = job.Query;\r
+            StartScan(job.Source, 0);\r
+     \r
+\r
+            if (query != null)\r
+            {\r
+                //Ok, Reset all the H264 widgets before changing the preset\r
+                x264Panel.reset2Defaults();\r
+\r
+                // Send the query from the file to the Query Parser class\r
+                QueryParser presetQuery = QueryParser.Parse(query);\r
+\r
+                // Now load the preset\r
+                PresetLoader.presetLoader(this, presetQuery, "Load Back From Queue", true);\r
+\r
+                // The x264 widgets will need updated, so do this now:\r
+                x264Panel.X264_StandardizeOptString();\r
+                x264Panel.X264_SetCurrentSettingsInPanel();\r
+\r
+                // Finally, let this window have a copy of the preset settings.\r
+                CurrentlySelectedPreset = null;\r
+                PictureSettings.SetPresetCropWarningLabel(null);\r
+            }\r
+\r
+        }\r
+\r
+        private void UpdateGuiWithQueueItemAfterScan()\r
+        {\r
+            \r
+        }\r
+\r
         // This is the END of the road ****************************************\r
     }\r
 }
\ No newline at end of file
index e3d72597dea9c716b67cb526feff3f46838412d5..bff81f0aff29aff0ccdadf51d9cb91649740e37f 100644 (file)
@@ -59,6 +59,7 @@ namespace Handbrake
             this.mnu_export = new System.Windows.Forms.ToolStripMenuItem();\r
             this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();\r
             this.mnu_readd = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.mnu_reconfigureJob = new System.Windows.Forms.ToolStripMenuItem();\r
             this.SaveFile = new System.Windows.Forms.SaveFileDialog();\r
             this.list_queue = new System.Windows.Forms.ListView();\r
             this.Title = new System.Windows.Forms.ColumnHeader();\r
@@ -282,7 +283,8 @@ namespace Handbrake
             this.mnu_import,\r
             this.mnu_export,\r
             this.toolStripSeparator2,\r
-            this.mnu_readd});\r
+            this.mnu_readd,\r
+            this.mnu_reconfigureJob});\r
             this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow;\r
             this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;\r
             this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta;\r
@@ -294,7 +296,7 @@ namespace Handbrake
             // \r
             this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small;\r
             this.mnu_batch.Name = "mnu_batch";\r
-            this.mnu_batch.Size = new System.Drawing.Size(187, 22);\r
+            this.mnu_batch.Size = new System.Drawing.Size(238, 22);\r
             this.mnu_batch.Text = "Generate Batch Script";\r
             this.mnu_batch.Click += new System.EventHandler(this.mnu_batch_Click);\r
             // \r
@@ -302,7 +304,7 @@ namespace Handbrake
             // \r
             this.mnu_import.Image = global::Handbrake.Properties.Resources.folder;\r
             this.mnu_import.Name = "mnu_import";\r
-            this.mnu_import.Size = new System.Drawing.Size(187, 22);\r
+            this.mnu_import.Size = new System.Drawing.Size(238, 22);\r
             this.mnu_import.Text = "Import Queue";\r
             this.mnu_import.Click += new System.EventHandler(this.mnu_import_Click);\r
             // \r
@@ -310,24 +312,34 @@ namespace Handbrake
             // \r
             this.mnu_export.Image = global::Handbrake.Properties.Resources.save;\r
             this.mnu_export.Name = "mnu_export";\r
-            this.mnu_export.Size = new System.Drawing.Size(187, 22);\r
+            this.mnu_export.Size = new System.Drawing.Size(238, 22);\r
             this.mnu_export.Text = "Export Queue";\r
             this.mnu_export.Click += new System.EventHandler(this.mnu_export_Click);\r
             // \r
             // toolStripSeparator2\r
             // \r
             this.toolStripSeparator2.Name = "toolStripSeparator2";\r
-            this.toolStripSeparator2.Size = new System.Drawing.Size(184, 6);\r
+            this.toolStripSeparator2.Size = new System.Drawing.Size(235, 6);\r
             // \r
             // mnu_readd\r
             // \r
             this.mnu_readd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;\r
             this.mnu_readd.Image = global::Handbrake.Properties.Resources.AddToQueue_small;\r
             this.mnu_readd.Name = "mnu_readd";\r
-            this.mnu_readd.Size = new System.Drawing.Size(187, 22);\r
-            this.mnu_readd.Text = "Re-Add Current Job";\r
+            this.mnu_readd.Size = new System.Drawing.Size(238, 22);\r
+            this.mnu_readd.Text = "Re-Add Currently Running Job";\r
+            this.mnu_readd.ToolTipText = "Readds the currently encoding job back onto the queue.";\r
             this.mnu_readd.Click += new System.EventHandler(this.mnu_readd_Click);\r
             // \r
+            // mnu_reconfigureJob\r
+            // \r
+            this.mnu_reconfigureJob.Name = "mnu_reconfigureJob";\r
+            this.mnu_reconfigureJob.Size = new System.Drawing.Size(238, 22);\r
+            this.mnu_reconfigureJob.Text = "Reconfigure Job (Experimental)";\r
+            this.mnu_reconfigureJob.ToolTipText = "Removes the job from the queue and sends it back to the main window.\r\nFrom there," +\r
+                " you can change settings then re-add it to the queue";\r
+            this.mnu_reconfigureJob.Click += new System.EventHandler(this.mnu_reconfigureJob_Click);\r
+            // \r
             // SaveFile\r
             // \r
             this.SaveFile.Filter = "Batch|.bat";\r
@@ -603,5 +615,6 @@ namespace Handbrake
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;\r
         private System.Windows.Forms.ToolStripMenuItem mnu_delete;\r
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;\r
+        private System.Windows.Forms.ToolStripMenuItem mnu_reconfigureJob;\r
     }\r
 }\r
index 3d3e28f7f166f2a9e87434e3cf9d5547d7db3164..739413cefe07cb5f030dfcde9fc7c6db29d27d44 100644 (file)
@@ -17,11 +17,14 @@ namespace Handbrake
     {\r
         private delegate void UpdateHandler();\r
         private Queue queue;\r
+        private frmMain mainWindow;\r
 \r
-        public frmQueue(Queue q)\r
+        public frmQueue(Queue q, frmMain mw)\r
         {\r
             InitializeComponent();\r
 \r
+            this.mainWindow = mw;\r
+\r
             this.queue = q;\r
             queue.NewJobStarted += new EventHandler(QueueOnEncodeStart);\r
             queue.QueueCompleted += new EventHandler(QueueOnQueueFinished);\r
@@ -94,6 +97,7 @@ namespace Handbrake
             MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
         }\r
 \r
+\r
         // Window Display Management\r
         private void SetUIEncodeStarted()\r
         {\r
@@ -384,6 +388,23 @@ namespace Handbrake
                 UpdateUIElements();\r
             }\r
         }\r
+        private void mnu_reconfigureJob_Click(object sender, EventArgs e)\r
+        {\r
+            if (list_queue.SelectedIndices != null)\r
+            {\r
+                lock (queue)\r
+                {\r
+                    lock (list_queue)\r
+                    {\r
+                        int index = list_queue.SelectedIndices[0];\r
+                        mainWindow.RecievingJob(queue.GetJob(index));\r
+                        queue.Remove(index);\r
+                        RedrawQueue();\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\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
@@ -392,6 +413,5 @@ namespace Handbrake
             this.Hide();\r
             base.OnClosing(e);\r
         }\r
-\r
     }\r
 }\r