[PATCH] WinGUI Patches

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGUI Patches

Post by ExDeus »

I was looking into auto naming and saw the note that it could use some cleaning ("THIS NEEDS FIXED"). I replaced some manual file manipulation with calls to the standard System.IO.Path methods.

The only material change is that the source directory is used instead of no directory if an auto path is not set and the destination is empty. The rest is clean-up.

The logic is:
  • If the auto path is not set, the source directory is used instead of no directory. This is a change.
  • The auto name format and path are used if set, unless there is already a path in the destination textbox.
  • If a destination path is already set in the textbox, the path and extension are used from there, with the auto name format (or the default format).
The net effect is that the destination path and extension are used if already present in the textbox, temporarily overriding the auto path.

[PATCH]

Code: Select all

Index: Main.cs
===================================================================
--- Main.cs	(revision 2179)
+++ Main.cs	(working copy)
@@ -187,11 +187,8 @@
             string AutoNamePath = string.Empty;
             if (drp_dvdtitle.Text != "Automatic")
             {
-                // Get the Source Name - THIS NEEDS FIXED
-                string[] sourceName = source.Split('\\');
-                source = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", "");
-                source.Replace(".wmv", "").Replace(".mp4", "").Replace(".m4v", "").Replace(".avi", "").Replace(".ogm", "").Replace(".tivo", "").Replace(".img", "");
-                source.Replace(".mov", "").Replace(".rm", "");
+                // Get the Source Name 
+                string sourceName = Path.GetFileNameWithoutExtension(source);
 
                 // Get the Selected Title Number
                 string[] titlesplit = drp_dvdtitle.Text.Split(' ');
@@ -209,51 +206,43 @@
                 if (Properties.Settings.Default.autoNameFormat != "")
                 {
                     destination_filename = Properties.Settings.Default.autoNameFormat;
-                    destination_filename = destination_filename.Replace("{source}", source).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);
+                    destination_filename = destination_filename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);
                 }
                 else
-                    destination_filename = source + "_T" + dvdTitle + "_C" + combinedChapterTag;
+                    destination_filename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
 
+                // Add the appropriate file extension
+                if (format == 0)
+                    destination_filename += ".mp4";
+                else if (format == 1)
+                    destination_filename += ".m4v";
+                else if (format == 2)
+                    destination_filename += ".mkv";
+                else if (format == 3)
+                    destination_filename += ".avi";
+                else if (format == 4)
+                    destination_filename += ".ogm";
+
                 // Now work out the path where the file will be stored.
                 // First case: If the destination box doesn't already contain a path, make one.
-                if (!dest.Contains("\\"))
+                if (!dest.Contains(Path.DirectorySeparatorChar.ToString()))
                 {
-                    string filePath = "";
-                    if (Properties.Settings.Default.autoNamePath.Trim() != "")
+                    // If there is an auto name path, use it...
+                    if (Properties.Settings.Default.autoNamePath.Trim() != "" && 
+                        Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location") 
                     {
-                        if (Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
-                            filePath = Properties.Settings.Default.autoNamePath + "\\";
+                        AutoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destination_filename);
                     }
-
-                    if (format == 0)
-                        AutoNamePath = filePath + destination_filename + ".mp4";
-                    else if (format == 1)
-                        AutoNamePath = filePath + destination_filename + ".m4v";
-                    else if (format == 2)
-                        AutoNamePath = filePath + destination_filename + ".mkv";
-                    else if (format == 3)
-                        AutoNamePath = filePath + destination_filename + ".avi";
-                    else if (format == 4)
-                        AutoNamePath = filePath + destination_filename + ".ogm";
+                    else // ...otherwise, output to the source directory
+                    {
+                        AutoNamePath = Path.Combine(Path.GetDirectoryName(source), destination_filename);
+                    }
                 }
                 else // Otherwise, use the path that is already there.
                 {
-                    string destination = AutoNamePath;
-                    string[] destName = dest.Split('\\');
-                    string[] extension = dest.Split('.');
-                    string ext = extension[extension.Length - 1];
-
-                    destName[destName.Length - 1] = destination_filename + "." + ext;
-
-                    string fullDest = "";
-                    foreach (string part in destName)
-                    {
-                        if (fullDest != "")
-                            fullDest = fullDest + "\\" + part;
-                        else
-                            fullDest = fullDest + part;
-                    }
-                    return fullDest;
+                    // Use the path and change the file extension to match the previous destination
+                    AutoNamePath = Path.Combine(Path.GetDirectoryName(dest), destination_filename);
+                    AutoNamePath = Path.ChangeExtension(AutoNamePath, Path.GetExtension(dest));
                 }
             }
 
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGUI Patches

Post by ExDeus »

I was annoyed by the fact that, if the Queue window was already open, clicking 'Show Queue' from the toolbar didn't activate the window.

This patch brings the Queue window to the foreground if it is already open, hence the functionality to 'show the queue'.

Code: Select all

Index: frmMain.cs
===================================================================
--- frmMain.cs	(revision 2179)
+++ frmMain.cs	(working copy)
@@ -647,6 +647,7 @@
         {
             queueWindow.setQueue();
             queueWindow.Show();
+            queueWindow.Activate();
         }
         private void tb_preview_Click(object sender, EventArgs e)
         {
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by ExDeus »

I wanted to be able to manipulate multiple queue jobs at once to move up/down and delete. I also wanted to be able to re-add the current job to the list in case I just needed to kill the job.

This patch enables multi-select in the job list, works with move up/down and delete, and adds a 'Re-Add Current' button.

These are design 'enhancements' that I just decided I wanted myself, so, naturally, their merits are open for debate.

Code: Select all

Index: frmQueue.cs
===================================================================
--- frmQueue.cs	(revision 2179)
+++ frmQueue.cs	(working copy)
@@ -196,61 +196,108 @@
                 // Do Nothing
             }
         }
-
-        // Queue Management
-        private void btn_up_Click(object sender, EventArgs e)
+        private void deleteSelectedItems()
         {
-            if (list_queue.SelectedIndices.Count != 0)
+            // If there are selected items
+            if (list_queue.SelectedIndices.Count > 0)
             {
-                int selected = list_queue.SelectedIndices[0];
+                // Save the selected indices to select them after the move
+                List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
+                foreach (int selectedIndex in list_queue.SelectedIndices)
+                    selectedIndices.Add(selectedIndex);
 
-                queue.moveUp(selected);
+                int firstSelectedIndex = selectedIndices[0];
+
+                // Reverse the list to delete the items from last to first (preserves indices)
+                selectedIndices.Reverse();
+                
+                // Remove each selected item
+                foreach (int selectedIndex in selectedIndices)
+                    queue.remove(selectedIndex);
+
                 queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
                 updateUIElements();
 
-                if (selected - 1 > 0)
-                    list_queue.Items[selected - 1].Selected = true;
+                // Select the item where the first deleted item was previously
+                if (firstSelectedIndex < list_queue.Items.Count) 
+                    list_queue.Items[firstSelectedIndex].Selected = true;
+            }
 
-                list_queue.Select();
+            list_queue.Select(); // Activate the control to show the selected items
+        }
+
+        // Queue Management
+        private void btn_re_add_Click(object sender, EventArgs e)
+        {
+            if (queue.getLastQueryItem() != null)
+            {
+                queue.add(queue.getLastQueryItem().Query, queue.getLastQueryItem().Source, queue.getLastQueryItem().Destination);
+                queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
+                updateUIElements();
             }
         }
-        private void btn_down_Click(object sender, EventArgs e)
+        private void btn_up_Click(object sender, EventArgs e)
         {
-            if (list_queue.SelectedIndices.Count != 0)
+            // If there are selected items and the first item is not selected
+            if (list_queue.SelectedIndices.Count > 0 && ! list_queue.SelectedIndices.Contains(0))
             {
-                int selected = list_queue.SelectedIndices[0];
+                // Copy the selected indices to preserve them during the movement
+                List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
+                foreach (int selectedIndex in list_queue.SelectedIndices)
+                    selectedIndices.Add(selectedIndex);
 
-                queue.moveDown(list_queue.SelectedIndices[0]);
+                // Move up each selected item
+                foreach (int selectedIndex in selectedIndices)
+                    queue.moveUp(selectedIndex);
+
                 queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
                 updateUIElements();
 
-                if (selected + 1 < list_queue.Items.Count)
-                    list_queue.Items[selected + 1].Selected = true;
+                // Keep the selected item(s) selected, now moved up one index
+                foreach (int selectedIndex in selectedIndices)
+                    if (selectedIndex - 1 > -1) // Defensive programming: ensure index is good
+                        list_queue.Items[selectedIndex - 1].Selected = true;
+            }
 
-                list_queue.Select();
-            }
+            list_queue.Select(); // Activate the control to show the selected items
         }
-        private void btn_delete_Click(object sender, EventArgs e)
+        private void btn_down_Click(object sender, EventArgs e)
         {
-            if (list_queue.SelectedIndices.Count != 0)
+            // If there are selected items and the last item is not selected
+            if (list_queue.SelectedIndices.Count > 0 && 
+                ! list_queue.SelectedIndices.Contains(list_queue.Items[list_queue.Items.Count-1].Index))
             {
-                queue.remove(list_queue.SelectedIndices[0]);
+                // Copy the selected indices to preserve them during the movement
+                List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);
+                foreach (int selectedIndex in list_queue.SelectedIndices)
+                    selectedIndices.Add(selectedIndex);
+
+                // Reverse the indices to move the items down from last to first (preserves indices)
+                selectedIndices.Reverse();
+
+                // Move down each selected item
+                foreach (int selectedIndex in selectedIndices)
+                    queue.moveDown(selectedIndex);
+                
                 queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
                 updateUIElements();
-                lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";
+
+                // Keep the selected item(s) selected, now moved down one index
+                foreach (int selectedIndex in selectedIndices)
+                    if (selectedIndex + 1 < list_queue.Items.Count) // Defensive programming: ensure index is good
+                        list_queue.Items[selectedIndex + 1].Selected = true; 
             }
+
+            list_queue.Select(); // Activate the control to show the selected items
         }
+        private void btn_delete_Click(object sender, EventArgs e)
+        {
+            deleteSelectedItems();
+        }
         private void list_queue_deleteKey(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Delete)
-            {
-                if (list_queue.SelectedIndices.Count != 0)
-                {
-                    queue.remove(list_queue.SelectedIndices[0]);
-                    queue.write2disk("hb_queue_recovery.xml"); // Update the queue recovery file
-                    updateUIElements();
-                }
-            }
+                deleteSelectedItems();
         }
 
         // Queue Import/Export Features
@@ -286,5 +333,7 @@
             this.Hide();
             base.OnClosing(e);
         }
+
+        
     }
 }
\ No newline at end of file
Index: frmQueue.Designer.cs
===================================================================
--- frmQueue.Designer.cs	(revision 2179)
+++ frmQueue.Designer.cs	(working copy)
@@ -72,6 +72,7 @@
             this.panel3 = new System.Windows.Forms.Panel();
             this.panel2 = new System.Windows.Forms.Panel();
             this.panel1 = new System.Windows.Forms.Panel();
+            this.btn_re_add = new System.Windows.Forms.Button();
             this.toolStrip1.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.splitContainer1.Panel1.SuspendLayout();
@@ -311,7 +312,6 @@
             this.list_queue.GridLines = true;
             this.list_queue.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
             this.list_queue.Location = new System.Drawing.Point(15, 0);
-            this.list_queue.MultiSelect = false;
             this.list_queue.Name = "list_queue";
             this.list_queue.Size = new System.Drawing.Size(749, 219);
             this.list_queue.TabIndex = 72;
@@ -382,6 +382,7 @@
             // 
             // splitContainer1.Panel1
             // 
+            this.splitContainer1.Panel1.Controls.Add(this.btn_re_add);
             this.splitContainer1.Panel1.Controls.Add(this.label3);
             this.splitContainer1.Panel1.Controls.Add(this.label1);
             this.splitContainer1.Panel1.Controls.Add(this.btn_down);
@@ -430,6 +431,22 @@
             this.panel1.Size = new System.Drawing.Size(15, 234);
             this.panel1.TabIndex = 75;
             // 
+            // btn_re_add
+            // 
+            this.btn_re_add.BackColor = System.Drawing.SystemColors.ControlLight;
+            this.btn_re_add.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+            this.btn_re_add.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.btn_re_add.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+            this.btn_re_add.Location = new System.Drawing.Point(607, 39);
+            this.btn_re_add.Name = "btn_re_add";
+            this.btn_re_add.Size = new System.Drawing.Size(157, 22);
+            this.btn_re_add.TabIndex = 71;
+            this.btn_re_add.TabStop = false;
+            this.btn_re_add.Text = "Re-Add Current";
+            this.toolTip1.SetToolTip(this.btn_re_add, "Remove the selected item from the queue");
+            this.btn_re_add.UseVisualStyleBackColor = true;
+            this.btn_re_add.Click += new System.EventHandler(this.btn_re_add_Click);
+            // 
             // frmQueue
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 13F);
@@ -495,5 +512,6 @@
         private System.Windows.Forms.Panel panel2;
         private System.Windows.Forms.Panel panel1;
         private System.Windows.Forms.Panel panel3;
+        internal System.Windows.Forms.Button btn_re_add;
     }
 }
\ No newline at end of file
Index: Queue/QueueHandler.cs
===================================================================
--- Queue/QueueHandler.cs	(revision 2194)
+++ Queue/QueueHandler.cs	(working copy)
@@ -92,12 +92,12 @@
         /// <param name="index">Int</param>
         public void moveUp(int index)
         {
-            if (index != 0)
+            if (index > 0)
             {
                 QueueItem item = (QueueItem)queue[index];
 
+                queue.RemoveAt(index);
                 queue.Insert((index - 1), item);
-                queue.RemoveAt((index + 1));
             }
         }
 
@@ -107,12 +107,12 @@
         /// <param name="index">Int</param>
         public void moveDown(int index)
         {
-            if (index != queue.Count - 1)
+            if (index < queue.Count - 1)
             {
                 QueueItem item = (QueueItem)queue[index];
 
-                queue.Insert((index + 2), item);
-                queue.RemoveAt((index));
+                queue.RemoveAt(index);
+                queue.Insert((index + 1), item);
             }
         }
 
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by s55 »

Thanks for the patch,

I'm fine with multi-select stuff. I'll look into getting that checked in when I have a spare moment.
I'll take a look at the re-add stuff. I'm undecided about it but using it may settle my mind. It seems a bit odd in the sense that you can pause a job if you need to temporarily stop it.
I'm still working on the code that allows the ability to modify jobs on the queue so I guess that is something that would be more useful when I finish.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] Activate window on 'Show Queue' click

Post by s55 »

Yeh, I'll check that change in. I'm surprised no-one else has complained about it.

Checked in: http://trac.handbrake.fr/changeset/2201

Thanks
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] Auto Name / Path logic

Post by s55 »

The only material change is that the source directory is used instead of no directory if an auto path is not set and the destination is empty. The rest is clean-up.
A large number of users will use a DVD drive as their source. This isn't writeable and they won't know what's happening unless they read the log. Thus, I changed it so that it simply warns the user that the default directory is not set.

the rest + show queue activate checked in at:
http://trac.handbrake.fr/changeset/2201
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

Re: [PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by ExDeus »

Re: re-adding a job, perhaps I wasn't using it correctly, or something else wasn't working.

When I tried pausing the queue, it paused the queue processing, but didn't pause the current job.

There are a few different use cases to consider, as I can see it.

1. User wants to pause queue processing - to stop after the current job.
2. User wants to pause the current job - to stop encoding immediately, with resume capability later.
3. User wants to kill the current job and restart from the beginning later.

Case 1 works with the Pause button now.

Case 2 would be great if it can work, but it didn't for me if it was supposed to. It would decrease the utility of Case 3 if the user could pause/resume jobs across restarts of the program.

Case 3 is what I was considering. In my case, I needed to reboot my machine. If I can't pause/resume a job, then I need a way to stop the job, put the job back on the queue, and then start it again after the reboot. That was my target.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by s55 »

case3: Ok, Fair point.
case 2: Hit the pause button or the p key in the CLI window. (I tried using sendkeys a while back but didn't have much success with it)
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGui: Preview window - Child exception dialogs

Post by ExDeus »

Testing the Preview window, I got a number of exceptions that popped up in modal dialogs behind the modal Preview window itself.

Modal behind modal makes for hard or impossible to find buttons.

Below patch makes the exception dialogs children of the Preview window, so they show in front. Also, dialog titles and warning icons for the QT errors.

[PATCH]

Code: Select all

Index: frmPreview.cs
===================================================================
--- frmPreview.cs	(revision 2179)
+++ frmPreview.cs	(working copy)
@@ -28,7 +28,7 @@
             }
             catch (Exception exc)
             {
-                MessageBox.Show("It would appear QuickTime 7 is not installed. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                MessageBox.Show(mw, "It would appear QuickTime 7 is not installed. QuickTime preview functionality will be disabled! \n\n Debug Info:\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 btn_playQT.Enabled = false;
                 noQT = true;
             }
@@ -58,7 +58,7 @@
         {
             // Make sure we are not already encoding and if we are then display an error.
             if (hbProc != null)
-                MessageBox.Show("Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                MessageBox.Show(this, "Handbrake is already encoding a video!", "Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             else
             {
                 hbProc = process.runCli(this, (string)state);
@@ -99,7 +99,7 @@
             }
             catch (Exception exc)
             {
-                MessageBox.Show("frmPreview.cs encodeCompleted " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                MessageBox.Show(this, "frmPreview.cs encodeCompleted " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         #endregion
@@ -133,10 +133,10 @@
                         lbl_status.Text = "VLC will now launch.";
                     }
                     else
-                        MessageBox.Show("Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in the program options is correct.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                        MessageBox.Show(this, "Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in the program options is correct.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
                 else
-                    MessageBox.Show("Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+                    MessageBox.Show(this, "Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", "VLC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
 
@@ -169,11 +169,11 @@
             catch (COMException ex)
             {
                 QTUtils qtu = new QTUtils();
-                MessageBox.Show("Unable to open movie:\n\nError Code: " + ex.ErrorCode.ToString("X") + "\nQT Error code : " + qtu.QTErrorFromErrorCode(ex.ErrorCode));
+                MessageBox.Show(this, "Unable to open movie:\n\nError Code: " + ex.ErrorCode.ToString("X") + "\nQT Error code : " + qtu.QTErrorFromErrorCode(ex.ErrorCode), "QT", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             catch (Exception ex)
             {
-                MessageBox.Show("Unable to open movie:\n\n" + ex);
+                MessageBox.Show(this, "Unable to open movie:\n\n" + ex, "QT", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         #endregion
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

Re: [PATCH] Activate window on 'Show Queue' click

Post by ExDeus »

I realized the Queue window was also intended to be (re)shown when clicking 'Add to Queue'.

frmQueue.setQueue() is always called before Show(), but once with another bit of code in between.

Rather than write yet another function that a future developer must call to properly set the queue and show and active the window, I just overrode frmQueue.Show().

By default, frmQueue.Show() now sets the queue, and shows and activates the window. I added an additional overload of the function to allow skipping the call to setQueue() if desired. There is already the one instance where it is desirable.

[PATCH]

Code: Select all

Index: frmMain.cs
===================================================================
--- frmMain.cs	(revision 2179)
+++ frmMain.cs	(working copy)
@@ -615,7 +615,7 @@
                     }
                     queueWindow.setQueue();
                     if (encodeQueue.count() > 1)
-                        queueWindow.Show();
+                        queueWindow.Show(false);
 
                     setEncodeStarted(); // Encode is running, so setup the GUI appropriately
                     encodeQueue.startEncode(); // Start The Queue Encoding Process
@@ -639,13 +639,11 @@
                 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.setQueue();
                 queueWindow.Show();
             }
         }
         private void btn_showQueue_Click(object sender, EventArgs e)
         {
-            queueWindow.setQueue();
             queueWindow.Show();
         }
         private void tb_preview_Click(object sender, EventArgs e)
Index: frmQueue.cs
===================================================================
--- frmQueue.cs	(revision 2179)
+++ frmQueue.cs	(working copy)
@@ -50,6 +50,25 @@
             updateUIElements();
         }
 
+        /// <summary>
+        /// Initializes the Queue list, then shows and activates the window
+        /// </summary>
+        public new void Show()
+        {
+            Show(true);
+        }
+
+        /// <summary>
+        /// Initializes the Queue list only if doSetQueue is true, then shows and activates the window
+        /// </summary>
+        /// <param name="doSetQueue">Indicates whether to call setQueue() before showing the window</param>
+        public void Show(bool doSetQueue)
+        {
+            if (doSetQueue) setQueue();
+            base.Show();
+            Activate();
+        }
+
         // Start and Stop Controls
         private void btn_encode_Click(object sender, EventArgs e)
         {
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] Activate window on 'Show Queue' click

Post by s55 »

Any chance I could get you to post any future patches on http://handbrake.fr/pastebin/
It'll give you a URL which you can post.


The forum makes a mess of the patches which makes them a pain to setup to apply.


I've got some time later on today, so i'll get this and the queue patch in.

Thanks
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGui: Preview window - Child exception dialogs

Post by s55 »

The Preview button needed sorting as well. You could click the preview button, while open, and the message would appear behind.

Is there any particular reason you've added "this" to the other message boxes?

http://trac.handbrake.fr/changeset/2230
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by s55 »

Any chance you could post this on pastebin (against svn head if you don't mind)
It's not applying for some reason.
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

Re: [PATCH] WinGui: Preview window - Child exception dialogs

Post by ExDeus »

s55 wrote:Is there any particular reason you've added "this" to the other message boxes?
I assumed it was the COM control for QT that messes up the ownership of the message box.

Not knowing the intricacies of each scenario that might be used for preview controls, I thought it best with the limited number of the MessageBox.Show() calls to set a precedent to add the proper owner, rather than test every scenario or assume it will find the right owner.
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGUI: Decomb default values

Post by ExDeus »

How is the default decomb value from the WinGUI supposed to get used (set in Tools > Options > Picture tab > Decomb)? I don't see where it gets passed on when generating a query.

Why is the default decomb value 1:2:6:9:80:16:16 in the CLI and 4:10:15:9:10:35:9 in the WinGUI? All my searching has yielded nada.

If there's linkage somewhere I don't understand, please let me know.

So, I wrote a patch that adds/changes the decomb options in the drop down. There are now two defaults: "HandBrake CLI Default" and "HandBrake GUI Default". Perhaps stating "HandBrake" is unnecessary, I don't know, but it provides a little context for the acronyms.

Selecting "HandBrake CLI Default" does what the "Default" option did -- it simply adds "--decomb" to the output query.

Selecting "HandBrake GUI Default" adds the value from the Properties.Settings.Default.decomb config file setting. If that setting is empty or doesn't meet the format requirements, the Properties.Settings.Default.default_decomb value is used instead.

I loosely defined the format requirements as:
  • 7 numbers
  • 1-2 digits per number
  • Each number separated by ":"
Regex:

Code: Select all

[0-9]{1,2}[:][0-9]{1,2}[:][0-9]{1,2}[:][0-9]{1,2}[:][0-9]{1,2}[:][0-9]{1,2}[:][0-9]{1,2}
Patch: http://handbrake.fr/pastebin/pastebin.php?show=483
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Decomb default values

Post by s55 »

There shouldn't be any option in the Tools > Options menu now. I've simply forgotten to remove it when I added decomb.cs

So there are 2 options, default and custom. That's it. Custom allows pass-thru.
We are going to be making some pretty major changes to the filters panels soon. The currently solution is only temporary. It'll probably be a set of widgets for each value but that remains to be seen.

I've knocked you out of the new members group so you should now be able to post without going through the forum validation process. Let me know if you have any issues.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGui: Preview window - Child exception dialogs

Post by s55 »

Ok, fine by me.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Decomb default values

Post by s55 »

Remove the old decomb setting in: http://trac.handbrake.fr/changeset/2239
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [PATCH] WinGUI: Queue: Re-add and multi-select queue jobs

Post by s55 »

ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

Re: [PATCH] WinGUI: Decomb default values

Post by ExDeus »

Very good, thanks. I didn't spend much time on the decomb defaults as I expected I could be working in the wrong direction. No worries there.
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

Re: [PATCH] Activate window on 'Show Queue' click

Post by ExDeus »

Calling queueWindow.Activate() is no longer necessary. It's now done in the override to the frmQueue.Show() method.

Patch: http://handbrake.fr/pastebin/pastebin.php?show=486
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGui: Correct destination filename & other cleanup

Post by ExDeus »

Three changes included. I've bundled them because really only #2 is a material change.

http://handbrake.fr/pastebin/pastebin.php?show=495

As ordered in the diff:

1. Remove a duplicate call to setQueue() before showing the Queue window - this is now done in frmQueue.Show().
2. Rather than taking the destination filename from the previous filename, take it from the filename in the destination textbox. Was this the way it was on purpose?
3. Correct reference to button name: The button is the 'Encode' button rather than the 'Encode Video' button.
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

[PATCH] WinGui: Prompt to confirm GUI closing

Post by ExDeus »

I wrote a patch to prompt the user to confirm closing the GUI if the queue is processing jobs.

http://handbrake.fr/pastebin/pastebin.php?show=496

I got so used to closing the Queue window without consequences, that sometimes I close the HB GUI when I want it to remain open to continue processing the queue.

Is this something others would want, or would find annoying? Is it worth adding a config option to enable/disable it?
ExDeus
Posts: 43
Joined: Mon Mar 02, 2009 7:13 am

WinGui: Small icon for Queue window Re-Add Current Job

Post by ExDeus »

Since 'Re-Add Current Job' in the Queue window was moved from a button to a menu item (a good change, IMO) I created a 16x16 version of the 'Add to Queue' icon to include on the menu.

Image

s55, is it something you could add to the Resources folder, Resources.resx, and Queue window menu?
Post Reply