]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Thu, 2 Apr 2009 15:10:21 +0000 (15:10 +0000)
committersr55 <sr55.hb@outlook.com>
Thu, 2 Apr 2009 15:10:21 +0000 (15:10 +0000)
- Fix for Destination Browse button exception is destination is empty. (http://forum.handbrake.fr/viewtopic.php?f=12&t=10140)
- Added warning if user is about to add 2 or more items to the queue with the same destination path.

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

win/C#/Queue/QueueHandler.cs
win/C#/frmMain.cs
win/C#/frmOptions.Designer.cs

index 8008d17eac2ec920926248915011cf64ada738c8..945a2ae4d5ab45c2dd43fccdd3ccf2dc8596724e 100644 (file)
@@ -57,17 +57,28 @@ namespace Handbrake.Queue
         /// <param name="destination"></param>\r
         public void add(string query, string source, string destination)\r
         {\r
-            QueueItem newJob = new QueueItem();\r
-            newJob.Id = id;\r
-            newJob.Query = query;\r
-            newJob.Source = source;\r
-            newJob.Destination = destination;\r
+            QueueItem newJob = new QueueItem {Id = id, Query = query, Source = source, Destination = destination};\r
             id++;\r
 \r
-            // Adds the job to the queue\r
             queue.Add(newJob);\r
         }\r
 \r
+        /// <summary>\r
+        /// Check to see if a destination path is already on the queue\r
+        /// </summary>\r
+        /// <param name="destination">Destination path</param>\r
+        /// <returns>Boolean True/False. True = Path Exists</returns>\r
+        public Boolean checkDestinationPath(string destination)\r
+        {\r
+            foreach (QueueItem checkItem in queue)\r
+            {\r
+\r
+                if (checkItem.Destination.Contains(destination.Replace("\\\\", "\\")))\r
+                    return true;\r
+            }\r
+            return false;\r
+        }\r
+\r
         /// <summary>\r
         /// Removes an item from the queue.\r
         /// </summary>\r
index a915148fb2f44ea3263b8fb8a6c1b18807cbdec7..bdce184de2215e3931472f728a6e4fcc75d0b011 100644 (file)
@@ -635,9 +635,18 @@ namespace Handbrake
                 if (rtf_query.Text != "")\r
                     query = rtf_query.Text;\r
 \r
-                encodeQueue.add(query, text_source.Text, text_destination.Text);\r
-                encodeQueue.write2disk("hb_queue_recovery.xml"); // Writes the queue to the recovery file, just incase the GUI crashes.\r
 \r
+                if (encodeQueue.checkDestinationPath(text_destination.Text))\r
+                {\r
+                    DialogResult result = MessageBox.Show("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, text_source.Text, text_destination.Text);\r
+\r
+                } else\r
+                    encodeQueue.add(query, text_source.Text, text_destination.Text);\r
+\r
+                encodeQueue.write2disk("hb_queue_recovery.xml"); // Writes the queue to the recovery file, just incase the GUI crashes.\r
                 queueWindow.Show();\r
             }\r
         }\r
@@ -936,8 +945,8 @@ namespace Handbrake
         {\r
             // This removes the file extension from the filename box on the save file dialog.\r
             // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected.\r
-            DVD_Save.FileName = Path.Combine(Path.GetDirectoryName(text_destination.Text), Path.GetFileNameWithoutExtension(text_destination.Text));\r
-\r
+            if (Path.HasExtension(text_destination.Text))\r
+                DVD_Save.FileName = Path.Combine(Path.GetDirectoryName(text_destination.Text), Path.GetFileNameWithoutExtension(text_destination.Text));\r
 \r
             // Show the dialog and set the main form file path\r
             if (drop_format.SelectedIndex.Equals(0))\r
index 91c0222bf5850b1f112d3ea0799bb4d1516d2207..fce6af7de19a8fd840975eea78c0ce2faa4a3c8f 100644 (file)
@@ -491,9 +491,9 @@ namespace Handbrake
             this.check_cli_minimized.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.check_cli_minimized.Location = new System.Drawing.Point(71, 18);\r
             this.check_cli_minimized.Name = "check_cli_minimized";\r
-            this.check_cli_minimized.Size = new System.Drawing.Size(155, 17);\r
+            this.check_cli_minimized.Size = new System.Drawing.Size(162, 17);\r
             this.check_cli_minimized.TabIndex = 76;\r
-            this.check_cli_minimized.Text = "Use window minimized";\r
+            this.check_cli_minimized.Text = "Start window minimized";\r
             this.ToolTip.SetToolTip(this.check_cli_minimized, "Starts a CLI window minimized.");\r
             this.check_cli_minimized.UseVisualStyleBackColor = true;\r
             this.check_cli_minimized.CheckedChanged += new System.EventHandler(this.check_cli_minimized_CheckedChanged);\r