From df3c74d3c2c64781f119d1b0c80f0f744be6bc0b Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 2 Apr 2009 15:10:21 +0000 Subject: WinGui: - 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 | 23 +++++++++++++++++------ win/C#/frmMain.cs | 17 +++++++++++++---- win/C#/frmOptions.Designer.cs | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/win/C#/Queue/QueueHandler.cs b/win/C#/Queue/QueueHandler.cs index 8008d17ea..945a2ae4d 100644 --- a/win/C#/Queue/QueueHandler.cs +++ b/win/C#/Queue/QueueHandler.cs @@ -57,17 +57,28 @@ namespace Handbrake.Queue /// public void add(string query, string source, string destination) { - QueueItem newJob = new QueueItem(); - newJob.Id = id; - newJob.Query = query; - newJob.Source = source; - newJob.Destination = destination; + QueueItem newJob = new QueueItem {Id = id, Query = query, Source = source, Destination = destination}; id++; - // Adds the job to the queue queue.Add(newJob); } + /// + /// Check to see if a destination path is already on the queue + /// + /// Destination path + /// Boolean True/False. True = Path Exists + public Boolean checkDestinationPath(string destination) + { + foreach (QueueItem checkItem in queue) + { + + if (checkItem.Destination.Contains(destination.Replace("\\\\", "\\"))) + return true; + } + return false; + } + /// /// Removes an item from the queue. /// diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index a915148fb..bdce184de 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -635,9 +635,18 @@ namespace Handbrake if (rtf_query.Text != "") query = rtf_query.Text; - encodeQueue.add(query, text_source.Text, text_destination.Text); - encodeQueue.write2disk("hb_queue_recovery.xml"); // Writes the queue to the recovery file, just incase the GUI crashes. + if (encodeQueue.checkDestinationPath(text_destination.Text)) + { + 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?", + "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (result == DialogResult.Yes) + encodeQueue.add(query, text_source.Text, text_destination.Text); + + } else + encodeQueue.add(query, text_source.Text, text_destination.Text); + + encodeQueue.write2disk("hb_queue_recovery.xml"); // Writes the queue to the recovery file, just incase the GUI crashes. queueWindow.Show(); } } @@ -936,8 +945,8 @@ namespace Handbrake { // This removes the file extension from the filename box on the save file dialog. // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected. - DVD_Save.FileName = Path.Combine(Path.GetDirectoryName(text_destination.Text), Path.GetFileNameWithoutExtension(text_destination.Text)); - + if (Path.HasExtension(text_destination.Text)) + DVD_Save.FileName = Path.Combine(Path.GetDirectoryName(text_destination.Text), Path.GetFileNameWithoutExtension(text_destination.Text)); // Show the dialog and set the main form file path if (drop_format.SelectedIndex.Equals(0)) diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs index 91c0222bf..fce6af7de 100644 --- a/win/C#/frmOptions.Designer.cs +++ b/win/C#/frmOptions.Designer.cs @@ -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))); this.check_cli_minimized.Location = new System.Drawing.Point(71, 18); this.check_cli_minimized.Name = "check_cli_minimized"; - this.check_cli_minimized.Size = new System.Drawing.Size(155, 17); + this.check_cli_minimized.Size = new System.Drawing.Size(162, 17); this.check_cli_minimized.TabIndex = 76; - this.check_cli_minimized.Text = "Use window minimized"; + this.check_cli_minimized.Text = "Start window minimized"; this.ToolTip.SetToolTip(this.check_cli_minimized, "Starts a CLI window minimized."); this.check_cli_minimized.UseVisualStyleBackColor = true; this.check_cli_minimized.CheckedChanged += new System.EventHandler(this.check_cli_minimized_CheckedChanged); -- cgit v1.2.3