OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 18 Apr 2010 16:23:40 +0000 (16:23 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 18 Apr 2010 16:23:40 +0000 (16:23 +0000)
- Queue Edit now only scans the title that was added rather than all titles.

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

win/C#/Model/Job.cs
win/C#/Services/Queue.cs
win/C#/Services/Scan.cs
win/C#/frmMain.cs
win/C#/frmQueue.Designer.cs
win/C#/frmQueue.cs

index bd8888e..a2ccc00 100644 (file)
@@ -17,6 +17,11 @@ namespace Handbrake.Model
         public int Id { get; set; }\r
 \r
         /// <summary>\r
+        /// Gets or sets the selected Title.\r
+        /// </summary>\r
+        public int Title { get; set; }\r
+\r
+        /// <summary>\r
         /// Gets or sets the query string.\r
         /// </summary>\r
         public string Query { get; set; }\r
index 59b1437..525fd75 100644 (file)
@@ -94,11 +94,12 @@ namespace Handbrake.Services
         /// <param name="customJob">\r
         /// Custom job\r
         /// </param>\r
-        public void Add(string query, string source, string destination, bool customJob)\r
+        public void Add(string query, int title, string source, string destination, bool customJob)\r
         {\r
             Job newJob = new Job\r
                              {\r
-                                 Id = this.nextJobId++, \r
+                                 Id = this.nextJobId++,\r
+                                 Title = title,\r
                                  Query = query, \r
                                  Source = source, \r
                                  Destination = destination, \r
index aae87a0..abecfec 100644 (file)
@@ -33,7 +33,10 @@ namespace Handbrake.Services
         /// </summary>\r
         private StringBuilder logBuffer;\r
 \r
-        static object locker = new object();\r
+        /// <summary>\r
+        /// A Lock object\r
+        /// </summary>\r
+        private static object locker = new object();\r
 \r
         /// <summary>\r
         /// The line number thats been read to in the log file\r
@@ -140,30 +143,34 @@ namespace Handbrake.Services
                 ResetLogReader();\r
 \r
                 string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
-                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+                string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +\r
+                                "\\HandBrake\\logs";\r
                 string dvdInfoPath = Path.Combine(logDir, "last_scan_log.txt");\r
 \r
                 // Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)\r
                 if (File.Exists(dvdInfoPath))\r
                     File.Delete(dvdInfoPath);\r
 \r
-                string dvdnav = string.Empty;\r
+                string extraArguments = string.Empty;\r
                 if (Properties.Settings.Default.noDvdNav)\r
-                    dvdnav = " --no-dvdnav";\r
+                    extraArguments = " --no-dvdnav";\r
+\r
+                if (title > 0)\r
+                    extraArguments += " --scan ";\r
 \r
                 this.hbProc = new Process\r
-                                  {\r
-                                      StartInfo =\r
-                                          {\r
-                                              FileName = handbrakeCLIPath,\r
-                                              Arguments =\r
-                                                  String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),\r
-                                              RedirectStandardOutput = true,\r
-                                              RedirectStandardError = true,\r
-                                              UseShellExecute = false,\r
-                                              CreateNoWindow = true\r
-                                          }\r
-                                  };\r
+                                      {\r
+                                          StartInfo =\r
+                                              {\r
+                                                  FileName = handbrakeCLIPath,\r
+                                                  Arguments =\r
+                                                      String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, extraArguments),\r
+                                                  RedirectStandardOutput = true,\r
+                                                  RedirectStandardError = true,\r
+                                                  UseShellExecute = false,\r
+                                                  CreateNoWindow = true\r
+                                              }\r
+                                      };\r
 \r
                 // Start the Scan\r
                 this.hbProc.Start();\r
index 42f0cd4..6c4a2ed 100644 (file)
@@ -856,7 +856,7 @@ namespace Handbrake
                     if (overwrite == DialogResult.Yes)\r
                     {\r
                         if (encodeQueue.Count == 0)\r
-                            encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
+                            encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
 \r
                         queueWindow.SetQueue();\r
                         if (encodeQueue.Count > 1)\r
@@ -895,10 +895,10 @@ namespace Handbrake
                             "There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?",\r
                             "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
                     if (result == DialogResult.Yes)\r
-                        encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
+                        encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
                 }\r
                 else\r
-                    encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
+                    encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));\r
 \r
                 lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";\r
 \r
@@ -1436,8 +1436,8 @@ namespace Handbrake
                     double cqStep = Properties.Settings.Default.x264cqstep;\r
                     double multiplier = 1.0 / cqStep;\r
                     double value = slider_videoQuality.Value * multiplier;\r
-                    \r
-                    slider_videoQuality.Maximum = (int)(51/Properties.Settings.Default.x264cqstep);\r
+\r
+                    slider_videoQuality.Maximum = (int)(51 / Properties.Settings.Default.x264cqstep);\r
 \r
                     if (value < slider_videoQuality.Maximum)\r
                         slider_videoQuality.Value = slider_videoQuality.Maximum - (int)value;\r
@@ -1703,7 +1703,7 @@ namespace Handbrake
                 // Enable the creation of chapter markers if the file is an image of a dvd.\r
                 int start, end;\r
                 int.TryParse(drop_chapterStart.Items[0].ToString(), out start);\r
-                int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count -1].ToString(), out end);\r
+                int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);\r
                 if (end > start)\r
                     Check_ChapterMarkers.Enabled = true;\r
                 else\r
@@ -1803,8 +1803,7 @@ namespace Handbrake
         public void RecievingJob(Job job)\r
         {\r
             string query = job.Query;\r
-            StartScan(job.Source, 0);\r
-\r
+            StartScan(job.Source, job.Title);\r
 \r
             if (query != null)\r
             {\r
@@ -1938,6 +1937,24 @@ namespace Handbrake
             treeView_presets.Update();\r
         }\r
 \r
+        /// <summary>\r
+        /// Get the title from the selected item in the title dropdown.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The title.\r
+        /// </returns>\r
+        private int getTitle()\r
+        {\r
+            int title = 0;\r
+            if (drp_dvdtitle.SelectedItem != null)\r
+            {\r
+                string[] titleInfo = drp_dvdtitle.SelectedItem.ToString().Split(' ');\r
+                int.TryParse(titleInfo[0], out title);\r
+            }\r
+\r
+            return title;\r
+        }\r
+\r
         #endregion\r
 \r
         #region Overrides\r
index 73d3146..12a5bcc 100644 (file)
@@ -58,7 +58,6 @@ 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
@@ -71,6 +70,8 @@ namespace Handbrake
             this.mnu_up = new System.Windows.Forms.ToolStripMenuItem();\r
             this.mnu_Down = new System.Windows.Forms.ToolStripMenuItem();\r
             this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();\r
+            this.mnu_edit = new System.Windows.Forms.ToolStripMenuItem();\r
+            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();\r
             this.mnu_delete = new System.Windows.Forms.ToolStripMenuItem();\r
             this.statusStrip1 = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encodesPending = new System.Windows.Forms.ToolStripStatusLabel();\r
@@ -282,8 +283,7 @@ namespace Handbrake
             this.mnu_import,\r
             this.mnu_export,\r
             this.toolStripSeparator2,\r
-            this.mnu_readd,\r
-            this.mnu_reconfigureJob});\r
+            this.mnu_readd});\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
@@ -295,7 +295,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(238, 22);\r
+            this.mnu_batch.Size = new System.Drawing.Size(235, 22);\r
             this.mnu_batch.Text = "Generate Batch Script";\r
             this.mnu_batch.Click += new System.EventHandler(this.MnuBatchClick);\r
             // \r
@@ -303,7 +303,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(238, 22);\r
+            this.mnu_import.Size = new System.Drawing.Size(235, 22);\r
             this.mnu_import.Text = "Import Queue";\r
             this.mnu_import.Click += new System.EventHandler(this.MnuImportClick);\r
             // \r
@@ -311,34 +311,25 @@ 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(238, 22);\r
+            this.mnu_export.Size = new System.Drawing.Size(235, 22);\r
             this.mnu_export.Text = "Export Queue";\r
             this.mnu_export.Click += new System.EventHandler(this.MnuExportClick);\r
             // \r
             // toolStripSeparator2\r
             // \r
             this.toolStripSeparator2.Name = "toolStripSeparator2";\r
-            this.toolStripSeparator2.Size = new System.Drawing.Size(235, 6);\r
+            this.toolStripSeparator2.Size = new System.Drawing.Size(232, 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(238, 22);\r
+            this.mnu_readd.Size = new System.Drawing.Size(235, 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.MnuReaddClick);\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.MnuReconfigureJobClick);\r
-            // \r
             // SaveFile\r
             // \r
             this.SaveFile.Filter = "Batch|.bat";\r
@@ -402,33 +393,47 @@ namespace Handbrake
             this.mnu_up,\r
             this.mnu_Down,\r
             this.toolStripSeparator3,\r
+            this.mnu_edit,\r
+            this.toolStripSeparator4,\r
             this.mnu_delete});\r
             this.mnu_queue.Name = "mnu_queue";\r
-            this.mnu_queue.Size = new System.Drawing.Size(139, 76);\r
+            this.mnu_queue.Size = new System.Drawing.Size(153, 126);\r
             // \r
             // mnu_up\r
             // \r
             this.mnu_up.Name = "mnu_up";\r
-            this.mnu_up.Size = new System.Drawing.Size(138, 22);\r
+            this.mnu_up.Size = new System.Drawing.Size(152, 22);\r
             this.mnu_up.Text = "Move Up";\r
             this.mnu_up.Click += new System.EventHandler(this.MnuUpClick);\r
             // \r
             // mnu_Down\r
             // \r
             this.mnu_Down.Name = "mnu_Down";\r
-            this.mnu_Down.Size = new System.Drawing.Size(138, 22);\r
+            this.mnu_Down.Size = new System.Drawing.Size(152, 22);\r
             this.mnu_Down.Text = "Move Down";\r
             this.mnu_Down.Click += new System.EventHandler(this.MnuDownClick);\r
             // \r
             // toolStripSeparator3\r
             // \r
             this.toolStripSeparator3.Name = "toolStripSeparator3";\r
-            this.toolStripSeparator3.Size = new System.Drawing.Size(135, 6);\r
+            this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);\r
+            // \r
+            // mnu_edit\r
+            // \r
+            this.mnu_edit.Name = "mnu_edit";\r
+            this.mnu_edit.Size = new System.Drawing.Size(152, 22);\r
+            this.mnu_edit.Text = "Edit";\r
+            this.mnu_edit.Click += new System.EventHandler(this.MnuEditClick);\r
+            // \r
+            // toolStripSeparator4\r
+            // \r
+            this.toolStripSeparator4.Name = "toolStripSeparator4";\r
+            this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);\r
             // \r
             // mnu_delete\r
             // \r
             this.mnu_delete.Name = "mnu_delete";\r
-            this.mnu_delete.Size = new System.Drawing.Size(138, 22);\r
+            this.mnu_delete.Size = new System.Drawing.Size(152, 22);\r
             this.mnu_delete.Text = "Delete";\r
             this.mnu_delete.Click += new System.EventHandler(this.MnuDeleteClick);\r
             // \r
@@ -614,6 +619,7 @@ 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
+        private System.Windows.Forms.ToolStripMenuItem mnu_edit;\r
+        private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;\r
     }\r
 }\r
index 8bb0e19..b6d1904 100644 (file)
@@ -397,6 +397,32 @@ namespace Handbrake
         }\r
 \r
         /// <summary>\r
+        /// Edit a job\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void MnuEditClick(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
+        /// <summary>\r
         /// Handle the delete Menu Item\r
         /// </summary>\r
         /// <param name="sender">\r
@@ -596,39 +622,17 @@ namespace Handbrake
         {\r
             if (!queue.LastEncode.IsEmpty)\r
             {\r
-                queue.Add(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination,\r
-                          queue.LastEncode.CustomQuery);\r
+                queue.Add(\r
+                    queue.LastEncode.Query, \r
+                    queue.LastEncode.Title, \r
+                    queue.LastEncode.Source,\r
+                    queue.LastEncode.Destination,\r
+                    queue.LastEncode.CustomQuery);\r
                 UpdateUiElements();\r
             }\r
         }\r
 \r
         /// <summary>\r
-        /// Edit Job\r
-        /// </summary>\r
-        /// <param name="sender">\r
-        /// The sender.\r
-        /// </param>\r
-        /// <param name="e">\r
-        /// The e.\r
-        /// </param>\r
-        private void MnuReconfigureJobClick(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
-        /// <summary>\r
         /// Hide's the window when the user tries to "x" out of the window instead of closing it.\r
         /// </summary>\r
         /// <param name="e">\r