diff options
author | sr55 <[email protected]> | 2008-06-27 14:42:17 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-06-27 14:42:17 +0000 |
commit | 45ce65f74863a7ee8d3ccf8978608794f2c91f42 (patch) | |
tree | d0ea243d7b678484994c22a66027008d93e12e21 /win/C#/frmQueue.cs | |
parent | 345c583574d3db3a664347304b8eb0495369ea69 (diff) |
WinGui:
- Added: Resolution calculation for non anamorphic encodes in the GUI.
- Added: Ability to minimize to the system tray. Includes popup notifications of encoding status.
- Added: Duration calculation based on Title and selected chapters.
- Added: Some more code comments and summaries
- Change: Activity window now only refreshes if there is an active HandBrakeCLI.exe running.
- Change: Browse button/ File mode checkbox for Source Selection Removed. Replaced with a Source Dropdown button in the main toolbar. (works a bit like the magui but still uses the 2 different dialog boxes)
- Change: Removed "Recommended Crop" label and simply let the dropdown set the cropping values. Added DVD resolution Label.
- Fixed: Preset loader now selects longest title and set's chapters to Auto. Before it would load in the last setting used which is bad.
- Fixed bug in the presetLoader() function with the 2nd audio channel track selection.
Final Note: Quite a bit of code has been moved around in this checkin to clear things up a bit.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1541 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmQueue.cs')
-rw-r--r-- | win/C#/frmQueue.cs | 128 |
1 files changed, 53 insertions, 75 deletions
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 280d48bed..37c646256 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -22,14 +22,25 @@ namespace Handbrake {
private delegate void ProgressUpdateHandler();
private delegate void setEncoding();
+ Functions.CLI cliObj = new Functions.CLI();
+ Boolean cancel = false;
+ Process hbProc = null;
public frmQueue()
{
- InitializeComponent();
+ InitializeComponent();
}
- #region Queue Handling
- Boolean cancel = false;
+
+ #region Queue / Handling
+
+ public Boolean isEncoding()
+ {
+ if (hbProc == null)
+ return false;
+ else
+ return true;
+ }
private void btn_encode_Click(object sender, EventArgs e)
{
@@ -73,27 +84,24 @@ namespace Handbrake MessageBox.Show("No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode Video' when you wish to continue encoding the queue.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
- [DllImport("user32.dll")]
- public static extern void LockWorkStation();
- [DllImport("user32.dll")]
- public static extern int ExitWindowsEx(int uFlags, int dwReason);
-
private void startProc(object state)
{
try
{
+
while (list_queue.Items.Count != 0)
{
string query = list_queue.Items[0].ToString();
setEncValue();
updateUIElements();
-
- Functions.CLI process = new Functions.CLI();
- Process hbProc = process.runCli(this, query, false, false, false, false);
+
+
+ hbProc = cliObj.runCli(this, query);
hbProc.WaitForExit();
hbProc.Close();
hbProc.Dispose();
+ hbProc = null;
query = "";
@@ -104,31 +112,10 @@ namespace Handbrake }
resetQueue();
-
- // Do something whent he encode ends.
- switch (Properties.Settings.Default.CompletionOption)
- {
- case "Shutdown":
- System.Diagnostics.Process.Start("Shutdown", "-s -t 60");
- break;
- case "Log Off":
- ExitWindowsEx(0, 0);
- break;
- case "Suspend":
- Application.SetSuspendState(PowerState.Suspend, true, true);
- break;
- case "Hibernate":
- Application.SetSuspendState(PowerState.Hibernate, true, true);
- break;
- case "Lock System":
- LockWorkStation();
- break;
- case "Quit HandBrake":
- Application.Exit();
- break;
- default:
- break;
- }
+
+
+ // After the encode is done, we may want to shutdown, suspend etc.
+ cliObj.afterEncodeAction();
}
catch (Exception exc)
{
@@ -244,9 +231,17 @@ namespace Handbrake }
}
+ private void list_queue_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (list_queue.SelectedItem != null)
+ text_edit.Text = list_queue.SelectedItem.ToString();
+
+ listCount = list_queue.Items.Count;
+ }
+
#endregion
- #region Queue Management
+ #region Buttons
private void btn_up_Click(object sender, EventArgs e)
{
@@ -287,47 +282,13 @@ namespace Handbrake list_queue.Items.Remove(list_queue.SelectedItem);
}
- #endregion
-
- #region Queue Item Modification
-
- int listCount = 0;
-
- private void btn_updateQuery_Click(object sender, EventArgs e)
- {
- if (text_edit.Text != "")
- {
- if (list_queue.Items.Count != listCount)
- {
- MessageBox.Show("Unable to modify the selected item. The number of items on the list has changed. \nPlease avoid modifying an item when a new encode is about to start!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- if (list_queue.SelectedItem != null)
- list_queue.Items[list_queue.SelectedIndex] = text_edit.Text;
-
- }
- }
- }
-
- private void list_queue_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (list_queue.SelectedItem != null)
- text_edit.Text = list_queue.SelectedItem.ToString();
-
- listCount = list_queue.Items.Count;
- }
-
- #endregion
-
- #region Queue Save & Batch Script
private void btn_batch_Click(object sender, EventArgs e)
{
string queries = "";
for (int i = 0; i < list_queue.Items.Count; i++)
{
string query = list_queue.Items[i].ToString();
- string fullQuery = '"' + Application.StartupPath.ToString()+ "\\HandBrakeCLI.exe"+ '"' + query;
+ string fullQuery = '"' + Application.StartupPath.ToString() + "\\HandBrakeCLI.exe" + '"' + query;
if (queries == "")
queries = queries + fullQuery;
@@ -362,20 +323,37 @@ namespace Handbrake }
}
- #endregion
+ int listCount = 0;
+ private void btn_updateQuery_Click(object sender, EventArgs e)
+ {
+ if (text_edit.Text != "")
+ {
+ if (list_queue.Items.Count != listCount)
+ {
+ MessageBox.Show("Unable to modify the selected item. The number of items on the list has changed. \nPlease avoid modifying an item when a new encode is about to start!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ else
+ {
+ if (list_queue.SelectedItem != null)
+ list_queue.Items[list_queue.SelectedIndex] = text_edit.Text;
+
+ }
+ }
+ }
- #region other
private void btn_Close_Click(object sender, EventArgs e)
{
this.Hide();
}
+ #endregion
+
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel = true;
this.Hide();
base.OnClosing(e);
}
- #endregion
+
}
}
\ No newline at end of file |