summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/C#/Parsing/Chapter.cs8
-rw-r--r--win/C#/Parsing/Title.cs24
-rw-r--r--win/C#/frmMain.cs20
-rw-r--r--win/C#/frmQueue.Designer.cs42
-rw-r--r--win/C#/frmQueue.cs86
-rw-r--r--win/C#/frmReadDVD.cs2
6 files changed, 140 insertions, 42 deletions
diff --git a/win/C#/Parsing/Chapter.cs b/win/C#/Parsing/Chapter.cs
index 630ab0905..0715e0cc5 100644
--- a/win/C#/Parsing/Chapter.cs
+++ b/win/C#/Parsing/Chapter.cs
@@ -16,7 +16,7 @@ namespace Handbrake.Parsing
}
}
- private int[] m_cellRange;
+ /*private int[] m_cellRange;
public int[] CellRange
{
get
@@ -32,7 +32,7 @@ namespace Handbrake.Parsing
{
return this.m_blocks;
}
- }
+ }*/
private TimeSpan m_duration;
public TimeSpan Duration
@@ -51,8 +51,8 @@ namespace Handbrake.Parsing
Chapter thisChapter = new Chapter();
string[] splitter = curLine.Split(new string[] { " + ", ": cells ", ", ", " blocks, duration ", "->" }, StringSplitOptions.RemoveEmptyEntries);
thisChapter.m_chapterNumber = int.Parse(splitter[0]);
- thisChapter.m_cellRange = new int[2] { int.Parse(splitter[1]), int.Parse(splitter[2]) };
- thisChapter.m_blocks = int.Parse(splitter[3]);
+ //thisChapter.m_cellRange = new int[2] { int.Parse(splitter[1]), int.Parse(splitter[2]) };
+ //thisChapter.m_blocks = int.Parse(splitter[3]);
thisChapter.m_duration = TimeSpan.Parse(splitter[4]);
return thisChapter;
}
diff --git a/win/C#/Parsing/Title.cs b/win/C#/Parsing/Title.cs
index 99b32cd70..fab287b18 100644
--- a/win/C#/Parsing/Title.cs
+++ b/win/C#/Parsing/Title.cs
@@ -35,7 +35,7 @@ namespace Handbrake.Parsing
}
}
- private int m_vts;
+ /*private int m_vts;
public int Vts
{
get
@@ -69,7 +69,7 @@ namespace Handbrake.Parsing
{
return this.m_blockCount;
}
- }
+ }*/
private int m_titleNumber;
public int TitleNumber
@@ -107,14 +107,14 @@ namespace Handbrake.Parsing
}
}
- private float m_fps;
+ /*private float m_fps;
public float Fps
{
get
{
return this.m_fps;
}
- }
+ }*/
private int[] m_autoCrop;
public int[] AutoCropDimensions
@@ -130,12 +130,12 @@ namespace Handbrake.Parsing
this.m_audioTracks = new List<AudioTrack>();
this.m_chapters = new List<Chapter>();
this.m_subtitles = new List<Subtitle>();
- this.m_cellRange = new int[2];
+ //this.m_cellRange = new int[2];
}
public override string ToString()
{
- return string.Format("{0} - {1}h{2}m{3}s", this.m_titleNumber, this.m_duration.Hours,
+ return string.Format("{0} ({1}:{2}:{3})", this.m_titleNumber, this.m_duration.Hours,
this.m_duration.Minutes, this.m_duration.Seconds);
}
@@ -152,13 +152,13 @@ namespace Handbrake.Parsing
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));
+ //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]);
+ //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]);
+ //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]);
@@ -166,7 +166,7 @@ namespace Handbrake.Parsing
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());
+ //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]) };
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 504179e0e..80900e522 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -133,7 +133,6 @@ namespace Handbrake
}
-
// --------------------------------------------------------------
// The Menu Bar
// --------------------------------------------------------------
@@ -317,9 +316,7 @@ namespace Handbrake
// TOOLS MENU --------------------------------------------------------------
private void mnu_encode_Click(object sender, EventArgs e)
{
- string query = ""; // temp fix for bug here.
- Form Queue = new frmQueue(query);
- Queue.ShowDialog();
+ //Queue.ShowDialog();
}
private void mnu_viewDVDdata_Click(object sender, EventArgs e)
@@ -507,7 +504,6 @@ namespace Handbrake
Form frmReadDVD = new frmReadDVD(filename, this);
frmReadDVD.ShowDialog();
}
-
}
else
{
@@ -519,10 +515,7 @@ namespace Handbrake
Form frmReadDVD = new frmReadDVD(filename, this);
frmReadDVD.ShowDialog();
}
-
- }
-
-
+ }
}
private void btn_destBrowse_Click(object sender, EventArgs e)
@@ -556,12 +549,15 @@ namespace Handbrake
QueryEditorText.Text = "";
}
+
+
+
+ private frmQueue queueWindow = (frmQueue)new frmQueue();
private void btn_queue_Click(object sender, EventArgs e)
{
String query = GenerateTheQuery();
- MessageBox.Show(query);
- Form Queue = new frmQueue(query);
- Queue.Show();
+ queueWindow.list_queue.Items.Add(query);
+ queueWindow.Show();
}
private void btn_encode_Click(object sender, EventArgs e)
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs
index cfa3e6451..ccef85ce0 100644
--- a/win/C#/frmQueue.Designer.cs
+++ b/win/C#/frmQueue.Designer.cs
@@ -36,6 +36,9 @@ namespace Handbrake
this.btn_q_encoder = new System.Windows.Forms.Button();
this.list_queue = new System.Windows.Forms.ListBox();
this.btn_Close = new System.Windows.Forms.Button();
+ this.progressBar = new System.Windows.Forms.ProgressBar();
+ this.label2 = new System.Windows.Forms.Label();
+ this.lbl_progressValue = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btn_down
@@ -52,6 +55,7 @@ namespace Handbrake
this.btn_down.TabStop = false;
this.btn_down.Text = "Move Down";
this.btn_down.UseVisualStyleBackColor = false;
+ this.btn_down.Click += new System.EventHandler(this.btn_down_Click);
//
// btn_up
//
@@ -67,6 +71,7 @@ namespace Handbrake
this.btn_up.TabStop = false;
this.btn_up.Text = "Move Up";
this.btn_up.UseVisualStyleBackColor = false;
+ this.btn_up.Click += new System.EventHandler(this.btn_up_Click);
//
// btn_delete
//
@@ -82,6 +87,7 @@ namespace Handbrake
this.btn_delete.TabStop = false;
this.btn_delete.Text = "Delete Item";
this.btn_delete.UseVisualStyleBackColor = false;
+ this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click);
//
// Label1
//
@@ -106,6 +112,7 @@ namespace Handbrake
this.btn_q_encoder.TabStop = false;
this.btn_q_encoder.Text = "Encode Video(s)";
this.btn_q_encoder.UseVisualStyleBackColor = false;
+ this.btn_q_encoder.Click += new System.EventHandler(this.btn_q_encoder_Click);
//
// list_queue
//
@@ -113,7 +120,7 @@ namespace Handbrake
this.list_queue.FormattingEnabled = true;
this.list_queue.Location = new System.Drawing.Point(10, 37);
this.list_queue.Name = "list_queue";
- this.list_queue.Size = new System.Drawing.Size(630, 327);
+ this.list_queue.Size = new System.Drawing.Size(630, 288);
this.list_queue.TabIndex = 28;
//
// btn_Close
@@ -132,11 +139,40 @@ namespace Handbrake
this.btn_Close.UseVisualStyleBackColor = false;
this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);
//
+ // progressBar
+ //
+ this.progressBar.Location = new System.Drawing.Point(74, 331);
+ this.progressBar.Name = "progressBar";
+ this.progressBar.Size = new System.Drawing.Size(513, 23);
+ this.progressBar.TabIndex = 34;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 336);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(51, 13);
+ this.label2.TabIndex = 35;
+ this.label2.Text = "Progress:";
+ //
+ // lbl_progressValue
+ //
+ this.lbl_progressValue.AutoSize = true;
+ this.lbl_progressValue.Location = new System.Drawing.Point(593, 337);
+ this.lbl_progressValue.Name = "lbl_progressValue";
+ this.lbl_progressValue.Size = new System.Drawing.Size(24, 13);
+ this.lbl_progressValue.TabIndex = 36;
+ this.lbl_progressValue.Text = "0 %";
+ //
// frmQueue
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(651, 404);
+ this.ControlBox = false;
+ this.Controls.Add(this.lbl_progressValue);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.progressBar);
this.Controls.Add(this.btn_down);
this.Controls.Add(this.btn_up);
this.Controls.Add(this.btn_delete);
@@ -148,7 +184,6 @@ namespace Handbrake
this.Name = "frmQueue";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Queue";
- this.Load += new System.EventHandler(this.frmQueue_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -163,5 +198,8 @@ namespace Handbrake
internal System.Windows.Forms.Button btn_q_encoder;
internal System.Windows.Forms.ListBox list_queue;
internal System.Windows.Forms.Button btn_Close;
+ private System.Windows.Forms.ProgressBar progressBar;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label lbl_progressValue;
}
} \ No newline at end of file
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index e806ad879..143533196 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -5,36 +5,100 @@ using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using System.Threading;
+using System.Diagnostics;
namespace Handbrake
{
public partial class frmQueue : Form
{
- private string query = "";
+ private frmQueue thisWindow;
- public frmQueue(string query)
+ public frmQueue()
{
InitializeComponent();
- this.query = query;
}
- public void addItem(String item)
+ private void btn_Close_Click(object sender, EventArgs e)
{
- list_queue.Items.Add(item);
- MessageBox.Show("test");
+ this.Hide();
}
- private void btn_Close_Click(object sender, EventArgs e)
+ private void btn_delete_Click(object sender, EventArgs e)
+ {
+ list_queue.Items.Remove(list_queue.SelectedItem);
+ }
+
+ private void btn_up_Click(object sender, EventArgs e)
+ {
+ int count = list_queue.Items.Count;
+ int itemToMove = list_queue.SelectedIndex;
+ int previousItemint = 0;
+ String previousItem = "";
+
+ if (itemToMove > 0){
+ previousItemint = itemToMove - 1;
+ previousItem = list_queue.Items[previousItemint].ToString();
+ list_queue.Items[previousItemint] = list_queue.Items[itemToMove];
+ list_queue.Items[itemToMove] = previousItem;
+ list_queue.SelectedIndex = list_queue.SelectedIndex - 1;
+ }
+ }
+
+ private void btn_down_Click(object sender, EventArgs e)
{
- this.Close();
+ int count = list_queue.Items.Count;
+ int itemToMove = list_queue.SelectedIndex;
+ int itemAfterInt = 0;
+ String itemAfter = "";
+
+ if (itemToMove < (count - 1))
+ {
+ itemAfterInt = itemToMove + 1;
+ itemAfter = list_queue.Items[itemAfterInt].ToString();
+ list_queue.Items[itemAfterInt] = list_queue.Items[itemToMove];
+ list_queue.Items[itemToMove] = itemAfter;
+ list_queue.SelectedIndex = list_queue.SelectedIndex + 1;
+ }
}
- private void frmQueue_Load(object sender, EventArgs e)
+ private void btn_q_encoder_Click(object sender, EventArgs e)
{
- addItem(query);
- MessageBox.Show("test");
+ progressBar.Value = 0;
+ lbl_progressValue.Text = "0 %";
+ 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)
+ {
+ String query = list_queue.Items[0].ToString();
+ Process hbProc = new Process();
+ hbProc.StartInfo.FileName = "hbcli.exe";
+ hbProc.StartInfo.Arguments = query;
+ hbProc.StartInfo.UseShellExecute = false;
+ hbProc.Start();
+ hbProc.WaitForExit();
+ hbProc.Close();
+ counter++;
+ //updateUIElements(progressSplit);
+ }
+ }
+
+ private void updateUIElements(int progressSplit)
+ {
+ // 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();
+ }
}
} \ No newline at end of file
diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs
index 1c18ce7a2..070cb5421 100644
--- a/win/C#/frmReadDVD.cs
+++ b/win/C#/frmReadDVD.cs
@@ -33,7 +33,7 @@ namespace Handbrake
// throw cli call and parsing on it's own thread
ThreadPool.QueueUserWorkItem(startProc);
}
-
+
private void updateUIElements()
{
if (this.InvokeRequired)