summaryrefslogtreecommitdiffstats
path: root/win/C#/frmMain.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-07-03 14:41:32 +0000
committersr55 <[email protected]>2010-07-03 14:41:32 +0000
commited057cf5f804bb497910aac61040e3ba6325147b (patch)
tree71f83c3efedccc3c9f05c5213ed2c89142092010 /win/C#/frmMain.cs
parente71a5fc9de03802003f9c683b84367fee14e43a5 (diff)
WinGui:
- Improve the way Custom queries are handled form the query editor. It's now hooked up so that the "Add to Queue" feature can warn of duplicates and it will now also display the correct source and destination in the queue window when encoding a custom job. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3421 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmMain.cs')
-rw-r--r--win/C#/frmMain.cs59
1 files changed, 35 insertions, 24 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index d1d721d81..1827ddd60 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -1130,36 +1130,47 @@ namespace Handbrake
/// </param>
private void btn_add2Queue_Click(object sender, EventArgs e)
{
+ // Note, don't currently do checks for custom queries. Only GUI components.
+ // Make sure we have a Source and Destination.
if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))
- MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- else
{
- if (!Directory.Exists(Path.GetDirectoryName(text_destination.Text)))
- {
- MessageBox.Show("Destination Path does not exist.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
+ MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
- string query = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null);
- if (rtf_query.Text != string.Empty)
- query = rtf_query.Text;
+ // Make sure the destination path exists.
+ if (!Directory.Exists(Path.GetDirectoryName(text_destination.Text)))
+ {
+ MessageBox.Show("Destination Path does not exist.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
- if (encodeQueue.CheckForDestinationDuplicate(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, this.GetTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
- }
- else
- encodeQueue.Add(query, this.GetTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
+ // Get the CLI query or use the query editor if it's not empty.
+ string query = QueryGenerator.GenerateCliQuery(this, drop_mode.SelectedIndex, 0, null);
+ if (!string.IsNullOrEmpty(rtf_query.Text ))
+ query = rtf_query.Text;
- lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";
+ // If we have a custom query, then we'll want to figure out what the new source and destination is, otherwise we'll just use the gui components.
+ string jobSourcePath = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetSourceFromQuery(rtf_query.Text) : sourcePath;
+ string jobDestination = !string.IsNullOrEmpty(rtf_query.Text) ? Main.GetDestinationFromQuery(rtf_query.Text): text_destination.Text;
- queueWindow.Show();
+ // Make sure we don't have a duplciate on the queue.
+ if (encodeQueue.CheckForDestinationDuplicate(jobDestination))
+ {
+ 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, this.GetTitle(), jobSourcePath, jobDestination, (rtf_query.Text != string.Empty));
}
+ else
+ encodeQueue.Add(query, this.GetTitle(), jobSourcePath, jobDestination, (rtf_query.Text != string.Empty));
+
+ lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";
+
+ queueWindow.Show();
+
}
/// <summary>
@@ -1765,7 +1776,7 @@ namespace Handbrake
{
this.checkMaximumFramerate.Visible = false;
this.checkMaximumFramerate.CheckState = CheckState.Unchecked;
- }
+ }
else
{
this.checkMaximumFramerate.Visible = true;