summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrianmario <[email protected]>2007-07-15 21:05:49 +0000
committerbrianmario <[email protected]>2007-07-15 21:05:49 +0000
commite8c438e0573761f14af481d07615072babf94951 (patch)
treee838061f82cd0b6335c51810e78aaacb3eef341a
parentc1b0482386b3d1c8d4dc0b21ac140d0e09ac2ef3 (diff)
WinGui: added initial CLI call managment class (work in progress)
updated frmQueue window to work properly with cross-thread calls and updating proper UI elements updated ToString override in Parsing.Title to display leading zeros in duration git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@691 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/C#/CLI/Manager.cs20
-rw-r--r--win/C#/HandBrakeCS.csproj1
-rw-r--r--win/C#/Parsing/Title.cs2
-rw-r--r--win/C#/frmQueue.cs29
4 files changed, 34 insertions, 18 deletions
diff --git a/win/C#/CLI/Manager.cs b/win/C#/CLI/Manager.cs
new file mode 100644
index 000000000..ac20609a3
--- /dev/null
+++ b/win/C#/CLI/Manager.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Diagnostics;
+
+namespace Handbrake.CLI
+{
+ /// <summary>
+ /// still workin on this
+ /// </summary>
+ class Manager
+ {
+ private static Queue<Process> m_processQueue = new Queue<Process>();
+
+ public static void Enqueue(object s)
+ {
+ //TODO: create new Process object from passed
+ }
+ }
+}
diff --git a/win/C#/HandBrakeCS.csproj b/win/C#/HandBrakeCS.csproj
index 6dc73b4ff..235cf2762 100644
--- a/win/C#/HandBrakeCS.csproj
+++ b/win/C#/HandBrakeCS.csproj
@@ -37,6 +37,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="CLI\Manager.cs" />
<Compile Include="frmAbout.cs">
<SubType>Form</SubType>
</Compile>
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs
index fab287b18..d1ccd8a04 100644
--- a/win/C#/Parsing/Title.cs
+++ b/win/C#/Parsing/Title.cs
@@ -135,7 +135,7 @@ namespace Handbrake.Parsing
public override string ToString()
{
- return string.Format("{0} ({1}:{2}:{3})", this.m_titleNumber, this.m_duration.Hours,
+ return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.m_titleNumber, this.m_duration.Hours,
this.m_duration.Minutes, this.m_duration.Seconds);
}
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 8d9157609..f9f59fee3 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -12,7 +12,7 @@ namespace Handbrake
{
public partial class frmQueue : Form
{
- private delegate void ProgressUpdateHandler(int progressSplit);
+ private delegate void ProgressUpdateHandler();
public frmQueue()
{
@@ -66,21 +66,16 @@ namespace Handbrake
{
progressBar.Value = 0;
lbl_progressValue.Text = "0 %";
+ progressBar.Step = 100 / list_queue.Items.Count;
progressBar.Update();
ThreadPool.QueueUserWorkItem(startProc);
}
private void startProc(object state)
{
- int listSize = list_queue.Items.Count;
- listSize--;
- int counter = 0;
- int progressSplit = listSize / 100;
-
- while (counter <= listSize)
+ for (int i = 0; i < list_queue.Items.Count; i++)
{
- String query = list_queue.Items[0].ToString();
-
+ string query = list_queue.Items[i] as string;
Process hbProc = new Process();
hbProc.StartInfo.FileName = "hbcli.exe";
hbProc.StartInfo.Arguments = query;
@@ -88,8 +83,8 @@ namespace Handbrake
hbProc.Start();
// Set the process Priority
- string priority = Properties.Settings.Default.processPriority;
- switch (priority)
+
+ switch (Properties.Settings.Default.processPriority)
{
case "Realtime":
hbProc.PriorityClass = ProcessPriorityClass.RealTime;
@@ -113,22 +108,22 @@ namespace Handbrake
hbProc.WaitForExit();
hbProc.Close();
- counter++;
- updateUIElements(progressSplit);
+ updateUIElements();
}
}
- private void updateUIElements(int progressSplit)
+ private void updateUIElements()
{
if (this.InvokeRequired)
{
- this.BeginInvoke(new ProgressUpdateHandler(updateUIElements), new object[] { progressSplit });
+ this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
return;
}
- this.list_queue.Items.Remove(0);
- progressBar.Value = progressBar.Value + progressSplit;
+ this.list_queue.Items.RemoveAt(0);
+ progressBar.PerformStep();
+ lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
progressBar.Update();
}
}