diff options
author | sr55 <[email protected]> | 2007-07-15 21:52:57 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-07-15 21:52:57 +0000 |
commit | 29036b449c87ca64e425e405fe81c450a65a081e (patch) | |
tree | 8d044a2609858ae2ea26ebf13bde3069d6205a26 /win | |
parent | e8c438e0573761f14af481d07615072babf94951 (diff) |
WinGui:
- Fixed Queue bug where it selecting the wrong item.
- changed Invalid chapter messagebox to onscreen text alert. (less irritating)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@692 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/Parsing/Title.cs | 59 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 15 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 26 | ||||
-rw-r--r-- | win/C#/frmQueue.cs | 6 |
4 files changed, 65 insertions, 41 deletions
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs index d1ccd8a04..245adfcdb 100644 --- a/win/C#/Parsing/Title.cs +++ b/win/C#/Parsing/Title.cs @@ -147,32 +147,39 @@ namespace Handbrake.Parsing * This will be converted to use Regex soon, I promise ;)
* brianmario - 7/9/07
*/
-
- string curLine = output.ReadLine();
- thisTitle.m_titleNumber = int.Parse(curLine.Substring(curLine.Length - 2, 1));
- curLine = output.ReadLine();
- string[] splitter = curLine.Split(',');
- //thisTitle.m_vts = int.Parse(splitter[0].Substring(8));
- //thisTitle.m_ttn = int.Parse(splitter[1].Substring(5));
- splitter = splitter[2].Trim().Split(' ', '(', ')');
- //thisTitle.m_blockCount = int.Parse(splitter[3]);
- splitter = splitter[1].Split('-', '>');
- //thisTitle.m_cellRange[0] = int.Parse(splitter[0]);
- //thisTitle.m_cellRange[1] = int.Parse(splitter[2]);
- curLine = output.ReadLine();
- splitter = curLine.Split(new string[] { " + duration: " }, StringSplitOptions.RemoveEmptyEntries);
- thisTitle.m_duration = TimeSpan.Parse(splitter[0]);
- curLine = output.ReadLine();
- splitter = curLine.Split(new string[] { " + size: ", "aspect: ", ", ", " fps", "x" }, StringSplitOptions.RemoveEmptyEntries);
- thisTitle.m_resolution = new Size(int.Parse(splitter[0]), int.Parse(splitter[1]));
- thisTitle.m_aspectRatio = float.Parse(splitter[2].ToString());
- //thisTitle.m_fps = float.Parse(splitter[3].ToString());
- curLine = output.ReadLine();
- splitter = curLine.Split(new string[] { " + autocrop: ", "/" }, StringSplitOptions.RemoveEmptyEntries);
- thisTitle.m_autoCrop = new int[4] { int.Parse(splitter[0]), int.Parse(splitter[1]), int.Parse(splitter[2]), int.Parse(splitter[3]) };
- thisTitle.m_chapters.AddRange(Chapter.ParseList(output));
- thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));
- thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));
+ try
+ {
+ string curLine = output.ReadLine();
+ thisTitle.m_titleNumber = int.Parse(curLine.Substring(curLine.Length - 2, 1));
+ curLine = output.ReadLine();
+ string[] splitter = curLine.Split(',');
+ //thisTitle.m_vts = int.Parse(splitter[0].Substring(8));
+ //thisTitle.m_ttn = int.Parse(splitter[1].Substring(5));
+ splitter = splitter[2].Trim().Split(' ', '(', ')');
+ //thisTitle.m_blockCount = int.Parse(splitter[3]);
+ splitter = splitter[1].Split('-', '>');
+ //thisTitle.m_cellRange[0] = int.Parse(splitter[0]);
+ //thisTitle.m_cellRange[1] = int.Parse(splitter[2]);
+ curLine = output.ReadLine();
+ splitter = curLine.Split(new string[] { " + duration: " }, StringSplitOptions.RemoveEmptyEntries);
+ thisTitle.m_duration = TimeSpan.Parse(splitter[0]);
+ curLine = output.ReadLine();
+ splitter = curLine.Split(new string[] { " + size: ", "aspect: ", ", ", " fps", "x" }, StringSplitOptions.RemoveEmptyEntries);
+ thisTitle.m_resolution = new Size(int.Parse(splitter[0]), int.Parse(splitter[1]));
+ thisTitle.m_aspectRatio = float.Parse(splitter[2].ToString());
+ //thisTitle.m_fps = float.Parse(splitter[3].ToString());
+ curLine = output.ReadLine();
+ splitter = curLine.Split(new string[] { " + autocrop: ", "/" }, StringSplitOptions.RemoveEmptyEntries);
+ thisTitle.m_autoCrop = new int[4] { int.Parse(splitter[0]), int.Parse(splitter[1]), int.Parse(splitter[2]), int.Parse(splitter[3]) };
+ thisTitle.m_chapters.AddRange(Chapter.ParseList(output));
+ thisTitle.m_audioTracks.AddRange(AudioTrack.ParseList(output));
+ thisTitle.m_subtitles.AddRange(Subtitle.ParseList(output));
+ }
+ catch (Exception)
+ {
+ // hbcli crashed caused an exception here. Just threw this in to prevent a program error.
+ // Can be debuged later.
+ }
return thisTitle;
}
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index a090c9c68..31933559f 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -169,6 +169,7 @@ namespace Handbrake this.btn_queue = new System.Windows.Forms.Button();
this.btn_encode = new System.Windows.Forms.Button();
this.Version = new System.Windows.Forms.Label();
+ this.lbl_chptWarn = new System.Windows.Forms.Label();
Label38 = new System.Windows.Forms.Label();
this.frmMainMenu.SuspendLayout();
this.GroupBox1.SuspendLayout();
@@ -195,7 +196,7 @@ namespace Handbrake // DVD_Save
//
this.DVD_Save.DefaultExt = "mp4";
- this.DVD_Save.Filter = "mp4|*.mp4 |m4v|*.m4v |avi|*.avi |ogm|*.ogm";
+ this.DVD_Save.Filter = "mp4|*.mp4 |m4v|*.m4v |avi|*.avi |ogm|*.ogm |mkv|*.mkv";
//
// File_Save
//
@@ -549,6 +550,7 @@ namespace Handbrake // GroupBox1
//
this.GroupBox1.BackColor = System.Drawing.SystemColors.Control;
+ this.GroupBox1.Controls.Add(this.lbl_chptWarn);
this.GroupBox1.Controls.Add(this.Label13);
this.GroupBox1.Controls.Add(this.drop_chapterFinish);
this.GroupBox1.Controls.Add(this.drop_chapterStart);
@@ -1699,6 +1701,16 @@ namespace Handbrake this.Version.TabIndex = 415;
this.Version.Text = "Version 2.3";
//
+ // lbl_chptWarn
+ //
+ this.lbl_chptWarn.AutoSize = true;
+ this.lbl_chptWarn.Location = new System.Drawing.Point(287, 85);
+ this.lbl_chptWarn.Name = "lbl_chptWarn";
+ this.lbl_chptWarn.Size = new System.Drawing.Size(77, 13);
+ this.lbl_chptWarn.TabIndex = 43;
+ this.lbl_chptWarn.Text = "{Warning}";
+ this.lbl_chptWarn.Visible = false;
+ //
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1880,6 +1892,7 @@ namespace Handbrake internal System.Windows.Forms.Button btn_queue;
internal System.Windows.Forms.Button btn_encode;
internal System.Windows.Forms.Label Version;
+ private System.Windows.Forms.Label lbl_chptWarn;
}
}
\ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 825a64d50..c3ccc3ec9 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -141,7 +141,6 @@ namespace Handbrake }
#region The Menu Bar
-
#region File Menu
private void mnu_open_Click(object sender, EventArgs e)
@@ -499,7 +498,6 @@ namespace Handbrake }
#endregion
-
#endregion
// --------------------------------------------------------------
@@ -655,6 +653,7 @@ namespace Handbrake private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)
{
+ lbl_chptWarn.Visible = false;
QueryEditorText.Text = "";
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
{
@@ -665,12 +664,14 @@ namespace Handbrake if (chapterFinish < chapterStart)
{
- MessageBox.Show("Invalid Chapter Range! - Final chapter can not be smaller than the starting chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ lbl_chptWarn.Visible = true;
+ lbl_chptWarn.Text = "Invalid Chapter Range!";
}
}
catch (Exception)
{
- MessageBox.Show("Invalid Character Entered!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ lbl_chptWarn.Visible = true;
+ lbl_chptWarn.Text = "Invalid Chapter Range!";
}
}
@@ -679,6 +680,7 @@ namespace Handbrake private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
{
+ lbl_chptWarn.Visible = false;
QueryEditorText.Text = "";
if ((drop_chapterFinish.Text != "Auto") && (drop_chapterStart.Text != "Auto"))
{
@@ -689,12 +691,14 @@ namespace Handbrake if (chapterFinish < chapterStart)
{
- MessageBox.Show("Invalid Chapter Range! - Start chapter can not be larger than the Final chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ lbl_chptWarn.Visible = true;
+ lbl_chptWarn.Text = "Invalid Chapter Range!";
}
}
catch (Exception)
{
- MessageBox.Show("Invalid Character Entered!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ lbl_chptWarn.Visible = true;
+ lbl_chptWarn.Text = "Invalid Chapter Range!";
}
}
}
@@ -1022,12 +1026,10 @@ namespace Handbrake }
}
- /// <summary>
- /// The Query Generation Function
- /// This function was imported from old vb.net version of this application.
- /// It could probably do with being cleaned up a good deal at some point
- /// </summary>
- /// <returns></returns>
+ // The Query Generation Function
+ // This function was imported from old vb.net version of this application.
+ // It could probably do with being cleaned up a good deal at some point
+
public string GenerateTheQuery()
{
string source = text_source.Text;
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs index f9f59fee3..67251ccfd 100644 --- a/win/C#/frmQueue.cs +++ b/win/C#/frmQueue.cs @@ -73,9 +73,10 @@ namespace Handbrake private void startProc(object state)
{
+ // Reminder: There is still a bug here where the loop suddenly halts for no good reson. UpdateUIelements runs, then the loop finishes several items early.
for (int i = 0; i < list_queue.Items.Count; i++)
{
- string query = list_queue.Items[i] as string;
+ string query = list_queue.Items[0] as string;
Process hbProc = new Process();
hbProc.StartInfo.FileName = "hbcli.exe";
hbProc.StartInfo.Arguments = query;
@@ -108,6 +109,8 @@ namespace Handbrake hbProc.WaitForExit();
hbProc.Close();
+ hbProc.Dispose();
+
updateUIElements();
}
@@ -120,7 +123,6 @@ namespace Handbrake this.BeginInvoke(new ProgressUpdateHandler(updateUIElements));
return;
}
-
this.list_queue.Items.RemoveAt(0);
progressBar.PerformStep();
lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);
|