summaryrefslogtreecommitdiffstats
path: root/win/C#/frmQueue.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2008-09-14 16:54:19 +0000
committersr55 <[email protected]>2008-09-14 16:54:19 +0000
commitb4e47744bb7cbcfcb3b14cc9b2fbffd1919861d7 (patch)
tree66998e2619aac4d49b2be0cae881faa49f36fd9c /win/C#/frmQueue.cs
parente407a68f9e6c11f107760a36134aa8dff51a2fcb (diff)
WinGui:
- Delete key can now be used to delete presets & queue items. - Queued items now have job id's. this isn't used for anything yet, however will be useful for editing current queue items. - Moved batch script code to Queue.cs git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1696 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r--win/C#/frmQueue.cs86
1 files changed, 37 insertions, 49 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 670153c96..7c52305a8 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
+using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
@@ -58,9 +59,10 @@ namespace Handbrake
private void redrawQueue()
{
list_queue.Items.Clear();
- foreach (string queue_item in queue.getQueue())
+ foreach (ArrayList queue_item in queue.getQueue())
{
- Functions.QueryParser parsed = Functions.QueryParser.Parse(queue_item);
+ string q_item = queue_item[1].ToString();
+ Functions.QueryParser parsed = Functions.QueryParser.Parse(q_item);
// Get the DVD Title
string title = "";
@@ -306,59 +308,16 @@ namespace Handbrake
}
}
-
- // Hide's the window from the users view.
- private void btn_Close_Click(object sender, EventArgs e)
- {
- this.Hide();
- }
-
- // Hide's the window when the user tries to "x" out of the window instead of closing it.
- protected override void OnClosing(CancelEventArgs e)
- {
- e.Cancel = true;
- this.Hide();
- base.OnClosing(e);
- }
-
+ // Generate a Saveable batch script on the users request
private void mnu_batch_Click(object sender, EventArgs e)
{
- string queries = "";
- foreach (string query_item in queue.getQueue())
- {
- string fullQuery = '"' + Application.StartupPath.ToString() + "\\HandBrakeCLI.exe" + '"' + query_item;
-
- if (queries == string.Empty)
- queries = queries + fullQuery;
- else
- queries = queries + " && " + fullQuery;
- }
- string strCmdLine = queries;
-
SaveFile.Filter = "Batch|.bat";
SaveFile.ShowDialog();
- string filename = SaveFile.FileName;
-
- if (filename != "")
- {
- try
- {
- // Create a StreamWriter and open the file, Write the batch file query to the file and
- // Close the stream
- StreamWriter line = new StreamWriter(filename);
- line.WriteLine(strCmdLine);
- line.Close();
-
- MessageBox.Show("Your batch script has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch (Exception)
- {
- MessageBox.Show("Unable to write to the file. Please make sure that the location has the correct permissions for file writing.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
-
- }
+ if (SaveFile.FileName != String.Empty)
+ queue.writeBatchScript(SaveFile.FileName);
}
+ // Export the HandBrake Queue to a file.
private void mnu_export_Click(object sender, EventArgs e)
{
SaveFile.Filter = "HandBrake Queue|*.queue";
@@ -367,6 +326,7 @@ namespace Handbrake
queue.write2disk(SaveFile.FileName);
}
+ // Import an exported queue
private void mnu_import_Click(object sender, EventArgs e)
{
OpenFile.ShowDialog();
@@ -375,6 +335,34 @@ namespace Handbrake
redrawQueue();
}
+ // Delete a selected item on the queue, if the delete key is pressed.
+ 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.dat"); // Update the queue recovery file
+ redrawQueue();
+ }
+ }
+ }
+
+ // Hide's the window from the users view.
+ private void btn_Close_Click(object sender, EventArgs e)
+ {
+ this.Hide();
+ }
+
+ // Hide's the window when the user tries to "x" out of the window instead of closing it.
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ e.Cancel = true;
+ this.Hide();
+ base.OnClosing(e);
+ }
+
}
} \ No newline at end of file