diff options
author | sr55 <[email protected]> | 2007-07-14 15:57:19 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-07-14 15:57:19 +0000 |
commit | c4990502668af79ecb5ac2c2b859526027299eef (patch) | |
tree | f443651d5b0aa469fc842fd388405a22d0aa5f78 /win | |
parent | a42691848dda319293e43b5d0e97514705a78870 (diff) |
Win Gui:
- Fixed bug with chapter drop downs throwing errors when they shouldn't.
- Chapter down down menus are now populated on title selection. (Audio and Subtitles still need to be done)
- Process priority option now works. All encodes both single and queue will use the defined priority.
- A few other small things.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@682 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/frmMain.cs | 81 | ||||
-rw-r--r-- | win/C#/frmQueue.Designer.cs | 4 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 26 |
3 files changed, 98 insertions, 13 deletions
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 80900e522..556d8c692 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using System.Net;
using System.IO;
using System.Diagnostics;
+using System.Threading;
namespace Handbrake
{
@@ -316,7 +317,7 @@ namespace Handbrake // TOOLS MENU --------------------------------------------------------------
private void mnu_encode_Click(object sender, EventArgs e)
{
- //Queue.ShowDialog();
+ showQueue();
}
private void mnu_viewDVDdata_Click(object sender, EventArgs e)
@@ -549,9 +550,6 @@ namespace Handbrake QueryEditorText.Text = "";
}
-
-
-
private frmQueue queueWindow = (frmQueue)new frmQueue();
private void btn_queue_Click(object sender, EventArgs e)
{
@@ -560,6 +558,11 @@ namespace Handbrake queueWindow.Show();
}
+ private void showQueue()
+ {
+ queueWindow.Show();
+ }
+
private void btn_encode_Click(object sender, EventArgs e)
{
String query = "";
@@ -578,14 +581,50 @@ namespace Handbrake hbProc.StartInfo.Arguments = query;
hbProc.StartInfo.UseShellExecute = false;
hbProc.Start();
+
+ // Set the process Priority
+ string priority = Properties.Settings.Default.processPriority;
+ switch (priority)
+ {
+ case "Realtime":
+ hbProc.PriorityClass = ProcessPriorityClass.RealTime;
+ break;
+ case "High":
+ hbProc.PriorityClass = ProcessPriorityClass.High;
+ break;
+ case "Above Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
+ break;
+ case "Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.Normal;
+ break;
+ case "Low":
+ hbProc.PriorityClass = ProcessPriorityClass.Idle;
+ break;
+ default:
+ hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
+ break;
+ }
+ //hbProc.WaitForExit;
+ //hbProc.Close;
+ ThreadPool.QueueUserWorkItem(procMonitor);
+
- MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+
// TODO: Need to write a bit of code here to do process monitoring.
// Note: hbProc.waitForExit will freeze the app, meaning one cannot add additional items to the queue during an encode.
}
+ private void procMonitor(object state)
+ {
+ MessageBox.Show("The encode process has now started.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+ }
+
+
+
+
// --------------------------------------------------------------
// Items that require actions on frmMain
// --------------------------------------------------------------
@@ -625,7 +664,7 @@ namespace Handbrake int chapterFinish = int.Parse(drop_chapterFinish.Text);
int chapterStart = int.Parse(drop_chapterStart.Text);
- if (chapterFinish > chapterStart)
+ if (chapterFinish < chapterStart)
{
MessageBox.Show("Invalid Chapter Range! - Start chapter can not be larger than the Final chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
@@ -679,15 +718,17 @@ namespace Handbrake }
}
+ // There is a bug here *******************************************************************
if (!lbl_Aspect.Text.Equals("Select a Title")){
int height = int.Parse(text_width.Text) / int.Parse(lbl_Aspect.Text);
+ MessageBox.Show("test");
int mod16 = height % 16;
height = height - mod16;
text_height.Text = height.ToString();
}
} catch(Exception){
-
+ // No need to alert the user if there is a problem here.
}
}
@@ -917,6 +958,8 @@ namespace Handbrake // Reset some values on the form
lbl_Aspect.Text = "Select a Title";
lbl_RecomendedCrop.Text = "Select a Title";
+ drop_chapterStart.Items.Clear();
+ drop_chapterFinish.Items.Clear();
QueryEditorText.Text = "";
// If the dropdown is set to automatic nothing else needs to be done.
@@ -938,10 +981,28 @@ namespace Handbrake {
lbl_Aspect.Text = thisDVD.Titles[counter].AspectRatio.ToString();
lbl_RecomendedCrop.Text = thisDVD.Titles[counter].AutoCropDimensions[0] + "/" + thisDVD.Titles[counter].AutoCropDimensions[1] + "/" + thisDVD.Titles[counter].AutoCropDimensions[2] + "/" + thisDVD.Titles[counter].AutoCropDimensions[3];
+
+ // Chapter Dropdown Menus
+ int chapterCount = thisDVD.Titles[counter].Chapters.Count;
+ int loopCouter = 1;
+ while (loopCouter <= chapterCount)
+ {
+ drop_chapterStart.Items.Add(loopCouter);
+ drop_chapterFinish.Items.Add(loopCouter);
+
+ drop_chapterStart.Text = "1";
+ drop_chapterFinish.Text = loopCouter.ToString();
+ loopCouter++;
+ }
+
+ // Audio Drop down Menu.
+ //thisDVD.Titles[counter].AudioTracks[0].ToString()
+
+ // Subtitle Dropdown Menu.
+
// Still need to set these up.
- MessageBox.Show(thisDVD.Titles[counter].AudioTracks[0].ToString());
- MessageBox.Show(thisDVD.Titles[counter].Chapters.ToString());
- MessageBox.Show(thisDVD.Titles[counter].Subtitles.ToString());
+ //thisDVD.Titles[counter].Subtitles.ToString()
+
}
counter++;
}
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs index ccef85ce0..3e170d95f 100644 --- a/win/C#/frmQueue.Designer.cs +++ b/win/C#/frmQueue.Designer.cs @@ -149,7 +149,7 @@ namespace Handbrake // label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(12, 336);
+ this.label2.Location = new System.Drawing.Point(7, 337);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 13);
this.label2.TabIndex = 35;
@@ -158,7 +158,7 @@ namespace Handbrake // lbl_progressValue
//
this.lbl_progressValue.AutoSize = true;
- this.lbl_progressValue.Location = new System.Drawing.Point(593, 337);
+ this.lbl_progressValue.Location = new System.Drawing.Point(605, 337);
this.lbl_progressValue.Name = "lbl_progressValue";
this.lbl_progressValue.Size = new System.Drawing.Size(24, 13);
this.lbl_progressValue.TabIndex = 36;
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index 143533196..f555ffeaf 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -86,6 +86,30 @@ namespace Handbrake hbProc.StartInfo.Arguments = query;
hbProc.StartInfo.UseShellExecute = false;
hbProc.Start();
+ // Set the process Priority
+ string priority = Properties.Settings.Default.processPriority;
+ switch (priority)
+ {
+ case "Realtime":
+ hbProc.PriorityClass = ProcessPriorityClass.RealTime;
+ break;
+ case "High":
+ hbProc.PriorityClass = ProcessPriorityClass.High;
+ break;
+ case "Above Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
+ break;
+ case "Normal":
+ hbProc.PriorityClass = ProcessPriorityClass.Normal;
+ break;
+ case "Low":
+ hbProc.PriorityClass = ProcessPriorityClass.Idle;
+ break;
+ default:
+ hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
+ break;
+ }
+
hbProc.WaitForExit();
hbProc.Close();
counter++;
@@ -95,7 +119,7 @@ namespace Handbrake private void updateUIElements(int progressSplit)
{
- // This needs to be written so there is no cross-thread problems
+ // This needs to be written so there is no cross-thread problems ********************
thisWindow.list_queue.Items.Remove(0);
progressBar.Value = progressBar.Value + progressSplit;
progressBar.Update();
|