summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2007-07-31 18:31:06 +0000
committersr55 <[email protected]>2007-07-31 18:31:06 +0000
commite4fa3517465a1a7018c825b77e6a9a578c69f6c2 (patch)
tree620ab9aeae1faa921cd9442c693558ccfd94ce0f /win/C#
parent6c47d7e338ac4de8f826338783fab2f983646d76 (diff)
WinGui:
- Few queue bugs fixed. - Active queueing now works properly. Items can be added on the fly. DVD's can be scanned on the fly while the there is an encode process already going etc. - Fixed a potential unhandled exception in the DVD information window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@770 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/frmDvdInfo.cs27
-rw-r--r--win/C#/frmMain.Designer.cs8
-rw-r--r--win/C#/frmMain.cs11
-rw-r--r--win/C#/frmQueue.cs131
4 files changed, 112 insertions, 65 deletions
diff --git a/win/C#/frmDvdInfo.cs b/win/C#/frmDvdInfo.cs
index 7f503227d..3b2cfd87d 100644
--- a/win/C#/frmDvdInfo.cs
+++ b/win/C#/frmDvdInfo.cs
@@ -20,18 +20,25 @@ namespace Handbrake
InitializeComponent();
this.rtf_dvdInfo.Text = string.Empty;
- string appPath = Application.StartupPath.ToString();
- appPath = appPath + "\\";
- StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");
-
- string line = sr.ReadLine();
-
- while (line != null)
+ try
{
- this.rtf_dvdInfo.AppendText(line + System.Environment.NewLine);
- line = sr.ReadLine();
+ string appPath = Application.StartupPath.ToString();
+ appPath = appPath + "\\";
+ StreamReader sr = new StreamReader(appPath + "dvdinfo.dat");
+
+ string line = sr.ReadLine();
+
+ while (line != null)
+ {
+ this.rtf_dvdInfo.AppendText(line + System.Environment.NewLine);
+ line = sr.ReadLine();
+ }
+ sr.Close();
+ }
+ catch (Exception)
+ {
+ // Don't do anything
}
- sr.Close();
}
/*public void HandleParsedData(object Sender, string Data)
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 69864827a..fc0c3f50b 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -1075,7 +1075,7 @@ namespace Handbrake
this.TabPage3.Location = new System.Drawing.Point(4, 22);
this.TabPage3.Name = "TabPage3";
this.TabPage3.Padding = new System.Windows.Forms.Padding(3);
- this.TabPage3.Size = new System.Drawing.Size(639, 242);
+ this.TabPage3.Size = new System.Drawing.Size(622, 242);
this.TabPage3.TabIndex = 2;
this.TabPage3.Text = "Video Settings";
//
@@ -1317,7 +1317,7 @@ namespace Handbrake
this.TabPage2.Location = new System.Drawing.Point(4, 22);
this.TabPage2.Name = "TabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.TabPage2.Size = new System.Drawing.Size(639, 242);
+ this.TabPage2.Size = new System.Drawing.Size(622, 242);
this.TabPage2.TabIndex = 3;
this.TabPage2.Text = "Audio Settings";
//
@@ -1470,7 +1470,7 @@ namespace Handbrake
this.h264Tab.Location = new System.Drawing.Point(4, 22);
this.h264Tab.Name = "h264Tab";
this.h264Tab.Padding = new System.Windows.Forms.Padding(3);
- this.h264Tab.Size = new System.Drawing.Size(639, 242);
+ this.h264Tab.Size = new System.Drawing.Size(622, 242);
this.h264Tab.TabIndex = 5;
this.h264Tab.Text = "H.264";
//
@@ -1557,7 +1557,7 @@ namespace Handbrake
this.TabPage6.Location = new System.Drawing.Point(4, 22);
this.TabPage6.Name = "TabPage6";
this.TabPage6.Padding = new System.Windows.Forms.Padding(3);
- this.TabPage6.Size = new System.Drawing.Size(639, 242);
+ this.TabPage6.Size = new System.Drawing.Size(622, 242);
this.TabPage6.TabIndex = 6;
this.TabPage6.Text = "Query Editor";
//
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 1e84ef1f3..59e31c531 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -638,8 +638,15 @@ namespace Handbrake
{
if (text_destination.Text != "" && text_source.Text != "")
{
-
- String query = GenerateTheQuery();
+ string query;
+ if (QueryEditorText.Text == "")
+ {
+ query = GenerateTheQuery();
+ }
+ else
+ {
+ query = QueryEditorText.Text;
+ }
queueWindow.list_queue.Items.Add(query);
queueWindow.Show();
}
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index c0c0a8c84..ee6301aec 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -19,24 +19,90 @@ namespace Handbrake
InitializeComponent();
}
- private void btn_Close_Click(object sender, EventArgs e)
+ int initialListCount = 0;
+ bool started = false;
+
+
+ private void btn_q_encoder_Click(object sender, EventArgs e)
{
- this.Hide();
+ progressBar.Value = 0;
+ lbl_progressValue.Text = "0 %";
+ progressBar.Step = 100 / list_queue.Items.Count;
+ progressBar.Update();
+ ThreadPool.QueueUserWorkItem(startProc);
}
- private void btn_delete_Click(object sender, EventArgs e)
+ /*
+ *
+ * Code to Handle the CLI and updating of the UI as each process is completed.
+ *
+ */
+ private void startProc(object state)
{
- list_queue.Items.Remove(list_queue.SelectedItem);
+ started = true;
+ initialListCount = list_queue.Items.Count;
+ for (int i = 0; i < initialListCount; i++)
+ {
+ string query = list_queue.Items[0].ToString();
+
+ Functions.CLI process = new Functions.CLI();
+ Process hbProc = process.runCli(this, query, false, false, false, false);
+
+ hbProc.WaitForExit();
+ hbProc.Close();
+ hbProc.Dispose();
+ updateUIElements();
+
+ if ((initialListCount - i) != (list_queue.Items.Count))
+ {
+ MessageBox.Show("Added an Item");
+ initialListCount++;
+ }
+ }
+ started = false;
+ resetQueue();
+ MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+ }
+
+ private void updateUIElements()
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
+ return;
+ }
+ this.list_queue.Items.RemoveAt(0);
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
+ progressBar.Update();
}
+ private void resetQueue()
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new ProgressUpdateHandler(resetQueue));
+ return;
+ }
+ lbl_progressValue.Text = "0 %";
+ progressBar.Value = 0;
+ progressBar.Update();
+ }
+
+ /*
+ *
+ * Code to Re-arrange / Delete items from the Queue
+ *
+ */
private void btn_up_Click(object sender, EventArgs e)
{
int count = list_queue.Items.Count;
int itemToMove = list_queue.SelectedIndex;
- int previousItemint = 0;
+ int previousItemint = 0;
String previousItem = "";
- if (itemToMove > 0){
+ if (itemToMove > 0)
+ {
previousItemint = itemToMove - 1;
previousItem = list_queue.Items[previousItemint].ToString();
list_queue.Items[previousItemint] = list_queue.Items[itemToMove];
@@ -49,7 +115,7 @@ namespace Handbrake
{
int count = list_queue.Items.Count;
int itemToMove = list_queue.SelectedIndex;
- int itemAfterInt = 0;
+ int itemAfterInt = 0;
String itemAfter = "";
if (itemToMove < (count - 1))
@@ -62,52 +128,19 @@ namespace Handbrake
}
}
- private void btn_q_encoder_Click(object sender, EventArgs e)
- {
- progressBar.Value = 0;
- lbl_progressValue.Text = "0 %";
- progressBar.Step = 100 / list_queue.Items.Count;
- progressBar.Update();
- ThreadPool.QueueUserWorkItem(startProc);
- }
-
- private void startProc(object state)
+ private void btn_delete_Click(object sender, EventArgs e)
{
- int initialListCount = list_queue.Items.Count;
- for (int i = 0; i < initialListCount; i++)
- {
- string query = list_queue.Items[0].ToString();
-
- Functions.CLI process = new Functions.CLI();
- Process hbProc = process.runCli(this, query, false, false, false, false);
-
- hbProc.WaitForExit();
- hbProc.Close();
- hbProc.Dispose();
-
- updateUIElements();
- }
+ list_queue.Items.Remove(list_queue.SelectedItem);
+ if (started == true)
+ initialListCount--;
}
- private void updateUIElements()
+ /*
+ * Hide the Queue Window
+ */
+ private void btn_Close_Click(object sender, EventArgs e)
{
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
- return;
- }
- this.list_queue.Items.RemoveAt(0);
- progressBar.PerformStep();
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
- progressBar.Update();
-
- if (progressBar.Value == 100)
- {
- MessageBox.Show("Encode Queue Completed!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- progressBar.Value = 0;
- progressBar.Update();
- lbl_progressValue.Text = "0 %";
- }
+ this.Hide();
}
}
} \ No newline at end of file