summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Model/Job.cs5
-rw-r--r--win/C#/Services/Queue.cs5
-rw-r--r--win/C#/Services/Scan.cs39
-rw-r--r--win/C#/frmMain.cs33
-rw-r--r--win/C#/frmQueue.Designer.cs52
-rw-r--r--win/C#/frmQueue.cs60
6 files changed, 117 insertions, 77 deletions
diff --git a/win/C#/Model/Job.cs b/win/C#/Model/Job.cs
index bd8888e58..a2ccc00bf 100644
--- a/win/C#/Model/Job.cs
+++ b/win/C#/Model/Job.cs
@@ -17,6 +17,11 @@ namespace Handbrake.Model
public int Id { get; set; }
/// <summary>
+ /// Gets or sets the selected Title.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
/// Gets or sets the query string.
/// </summary>
public string Query { get; set; }
diff --git a/win/C#/Services/Queue.cs b/win/C#/Services/Queue.cs
index 59b1437d5..525fd7598 100644
--- a/win/C#/Services/Queue.cs
+++ b/win/C#/Services/Queue.cs
@@ -94,11 +94,12 @@ namespace Handbrake.Services
/// <param name="customJob">
/// Custom job
/// </param>
- public void Add(string query, string source, string destination, bool customJob)
+ public void Add(string query, int title, string source, string destination, bool customJob)
{
Job newJob = new Job
{
- Id = this.nextJobId++,
+ Id = this.nextJobId++,
+ Title = title,
Query = query,
Source = source,
Destination = destination,
diff --git a/win/C#/Services/Scan.cs b/win/C#/Services/Scan.cs
index aae87a0d1..abecfec2b 100644
--- a/win/C#/Services/Scan.cs
+++ b/win/C#/Services/Scan.cs
@@ -33,7 +33,10 @@ namespace Handbrake.Services
/// </summary>
private StringBuilder logBuffer;
- static object locker = new object();
+ /// <summary>
+ /// A Lock object
+ /// </summary>
+ private static object locker = new object();
/// <summary>
/// The line number thats been read to in the log file
@@ -140,30 +143,34 @@ namespace Handbrake.Services
ResetLogReader();
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
+ "\\HandBrake\\logs";
string dvdInfoPath = Path.Combine(logDir, "last_scan_log.txt");
// Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)
if (File.Exists(dvdInfoPath))
File.Delete(dvdInfoPath);
- string dvdnav = string.Empty;
+ string extraArguments = string.Empty;
if (Properties.Settings.Default.noDvdNav)
- dvdnav = " --no-dvdnav";
+ extraArguments = " --no-dvdnav";
+
+ if (title > 0)
+ extraArguments += " --scan ";
this.hbProc = new Process
- {
- StartInfo =
- {
- FileName = handbrakeCLIPath,
- Arguments =
- String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- UseShellExecute = false,
- CreateNoWindow = true
- }
- };
+ {
+ StartInfo =
+ {
+ FileName = handbrakeCLIPath,
+ Arguments =
+ String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, extraArguments),
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ }
+ };
// Start the Scan
this.hbProc.Start();
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 42f0cd4ee..6c4a2ed93 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -856,7 +856,7 @@ namespace Handbrake
if (overwrite == DialogResult.Yes)
{
if (encodeQueue.Count == 0)
- encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
+ encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
queueWindow.SetQueue();
if (encodeQueue.Count > 1)
@@ -895,10 +895,10 @@ namespace Handbrake
"There is already a queue item for this destination path. \n\n If you continue, the encode will be overwritten. Do you wish to continue?",
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
- encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
+ encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
}
else
- encodeQueue.Add(query, sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
+ encodeQueue.Add(query, getTitle(), sourcePath, text_destination.Text, (rtf_query.Text != string.Empty));
lbl_encode.Text = encodeQueue.Count + " encode(s) pending in the queue";
@@ -1436,8 +1436,8 @@ namespace Handbrake
double cqStep = Properties.Settings.Default.x264cqstep;
double multiplier = 1.0 / cqStep;
double value = slider_videoQuality.Value * multiplier;
-
- slider_videoQuality.Maximum = (int)(51/Properties.Settings.Default.x264cqstep);
+
+ slider_videoQuality.Maximum = (int)(51 / Properties.Settings.Default.x264cqstep);
if (value < slider_videoQuality.Maximum)
slider_videoQuality.Value = slider_videoQuality.Maximum - (int)value;
@@ -1703,7 +1703,7 @@ namespace Handbrake
// Enable the creation of chapter markers if the file is an image of a dvd.
int start, end;
int.TryParse(drop_chapterStart.Items[0].ToString(), out start);
- int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count -1].ToString(), out end);
+ int.TryParse(drop_chapterFinish.Items[drop_chapterFinish.Items.Count - 1].ToString(), out end);
if (end > start)
Check_ChapterMarkers.Enabled = true;
else
@@ -1803,8 +1803,7 @@ namespace Handbrake
public void RecievingJob(Job job)
{
string query = job.Query;
- StartScan(job.Source, 0);
-
+ StartScan(job.Source, job.Title);
if (query != null)
{
@@ -1938,6 +1937,24 @@ namespace Handbrake
treeView_presets.Update();
}
+ /// <summary>
+ /// Get the title from the selected item in the title dropdown.
+ /// </summary>
+ /// <returns>
+ /// The title.
+ /// </returns>
+ private int getTitle()
+ {
+ int title = 0;
+ if (drp_dvdtitle.SelectedItem != null)
+ {
+ string[] titleInfo = drp_dvdtitle.SelectedItem.ToString().Split(' ');
+ int.TryParse(titleInfo[0], out title);
+ }
+
+ return title;
+ }
+
#endregion
#region Overrides
diff --git a/win/C#/frmQueue.Designer.cs b/win/C#/frmQueue.Designer.cs
index 73d3146bc..12a5bccfa 100644
--- a/win/C#/frmQueue.Designer.cs
+++ b/win/C#/frmQueue.Designer.cs
@@ -58,7 +58,6 @@ namespace Handbrake
this.mnu_export = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_readd = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_reconfigureJob = new System.Windows.Forms.ToolStripMenuItem();
this.SaveFile = new System.Windows.Forms.SaveFileDialog();
this.list_queue = new System.Windows.Forms.ListView();
this.Title = new System.Windows.Forms.ColumnHeader();
@@ -71,6 +70,8 @@ namespace Handbrake
this.mnu_up = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_Down = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
+ this.mnu_edit = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_delete = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lbl_encodesPending = new System.Windows.Forms.ToolStripStatusLabel();
@@ -282,8 +283,7 @@ namespace Handbrake
this.mnu_import,
this.mnu_export,
this.toolStripSeparator2,
- this.mnu_readd,
- this.mnu_reconfigureJob});
+ this.mnu_readd});
this.drop_button_queue.Image = global::Handbrake.Properties.Resources.ActivityWindow;
this.drop_button_queue.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.drop_button_queue.ImageTransparentColor = System.Drawing.Color.Magenta;
@@ -295,7 +295,7 @@ namespace Handbrake
//
this.mnu_batch.Image = global::Handbrake.Properties.Resources.Output_Small;
this.mnu_batch.Name = "mnu_batch";
- this.mnu_batch.Size = new System.Drawing.Size(238, 22);
+ this.mnu_batch.Size = new System.Drawing.Size(235, 22);
this.mnu_batch.Text = "Generate Batch Script";
this.mnu_batch.Click += new System.EventHandler(this.MnuBatchClick);
//
@@ -303,7 +303,7 @@ namespace Handbrake
//
this.mnu_import.Image = global::Handbrake.Properties.Resources.folder;
this.mnu_import.Name = "mnu_import";
- this.mnu_import.Size = new System.Drawing.Size(238, 22);
+ this.mnu_import.Size = new System.Drawing.Size(235, 22);
this.mnu_import.Text = "Import Queue";
this.mnu_import.Click += new System.EventHandler(this.MnuImportClick);
//
@@ -311,34 +311,25 @@ namespace Handbrake
//
this.mnu_export.Image = global::Handbrake.Properties.Resources.save;
this.mnu_export.Name = "mnu_export";
- this.mnu_export.Size = new System.Drawing.Size(238, 22);
+ this.mnu_export.Size = new System.Drawing.Size(235, 22);
this.mnu_export.Text = "Export Queue";
this.mnu_export.Click += new System.EventHandler(this.MnuExportClick);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(235, 6);
+ this.toolStripSeparator2.Size = new System.Drawing.Size(232, 6);
//
// mnu_readd
//
this.mnu_readd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.mnu_readd.Image = global::Handbrake.Properties.Resources.AddToQueue_small;
this.mnu_readd.Name = "mnu_readd";
- this.mnu_readd.Size = new System.Drawing.Size(238, 22);
+ this.mnu_readd.Size = new System.Drawing.Size(235, 22);
this.mnu_readd.Text = "Re-Add Currently Running Job";
this.mnu_readd.ToolTipText = "Readds the currently encoding job back onto the queue.";
this.mnu_readd.Click += new System.EventHandler(this.MnuReaddClick);
//
- // mnu_reconfigureJob
- //
- this.mnu_reconfigureJob.Name = "mnu_reconfigureJob";
- this.mnu_reconfigureJob.Size = new System.Drawing.Size(238, 22);
- this.mnu_reconfigureJob.Text = "Reconfigure Job (Experimental)";
- this.mnu_reconfigureJob.ToolTipText = "Removes the job from the queue and sends it back to the main window.\r\nFrom there," +
- " you can change settings then re-add it to the queue";
- this.mnu_reconfigureJob.Click += new System.EventHandler(this.MnuReconfigureJobClick);
- //
// SaveFile
//
this.SaveFile.Filter = "Batch|.bat";
@@ -402,33 +393,47 @@ namespace Handbrake
this.mnu_up,
this.mnu_Down,
this.toolStripSeparator3,
+ this.mnu_edit,
+ this.toolStripSeparator4,
this.mnu_delete});
this.mnu_queue.Name = "mnu_queue";
- this.mnu_queue.Size = new System.Drawing.Size(139, 76);
+ this.mnu_queue.Size = new System.Drawing.Size(153, 126);
//
// mnu_up
//
this.mnu_up.Name = "mnu_up";
- this.mnu_up.Size = new System.Drawing.Size(138, 22);
+ this.mnu_up.Size = new System.Drawing.Size(152, 22);
this.mnu_up.Text = "Move Up";
this.mnu_up.Click += new System.EventHandler(this.MnuUpClick);
//
// mnu_Down
//
this.mnu_Down.Name = "mnu_Down";
- this.mnu_Down.Size = new System.Drawing.Size(138, 22);
+ this.mnu_Down.Size = new System.Drawing.Size(152, 22);
this.mnu_Down.Text = "Move Down";
this.mnu_Down.Click += new System.EventHandler(this.MnuDownClick);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
- this.toolStripSeparator3.Size = new System.Drawing.Size(135, 6);
+ this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
+ //
+ // mnu_edit
+ //
+ this.mnu_edit.Name = "mnu_edit";
+ this.mnu_edit.Size = new System.Drawing.Size(152, 22);
+ this.mnu_edit.Text = "Edit";
+ this.mnu_edit.Click += new System.EventHandler(this.MnuEditClick);
+ //
+ // toolStripSeparator4
+ //
+ this.toolStripSeparator4.Name = "toolStripSeparator4";
+ this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
//
// mnu_delete
//
this.mnu_delete.Name = "mnu_delete";
- this.mnu_delete.Size = new System.Drawing.Size(138, 22);
+ this.mnu_delete.Size = new System.Drawing.Size(152, 22);
this.mnu_delete.Text = "Delete";
this.mnu_delete.Click += new System.EventHandler(this.MnuDeleteClick);
//
@@ -614,6 +619,7 @@ namespace Handbrake
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem mnu_delete;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
- private System.Windows.Forms.ToolStripMenuItem mnu_reconfigureJob;
+ private System.Windows.Forms.ToolStripMenuItem mnu_edit;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
}
}
diff --git a/win/C#/frmQueue.cs b/win/C#/frmQueue.cs
index 8bb0e1910..b6d19045e 100644
--- a/win/C#/frmQueue.cs
+++ b/win/C#/frmQueue.cs
@@ -397,6 +397,32 @@ namespace Handbrake
}
/// <summary>
+ /// Edit a job
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ private void MnuEditClick(object sender, EventArgs e)
+ {
+ if (list_queue.SelectedIndices != null)
+ {
+ lock (queue)
+ {
+ lock (list_queue)
+ {
+ int index = list_queue.SelectedIndices[0];
+ mainWindow.RecievingJob(queue.GetJob(index));
+ queue.Remove(index);
+ RedrawQueue();
+ }
+ }
+ }
+ }
+
+ /// <summary>
/// Handle the delete Menu Item
/// </summary>
/// <param name="sender">
@@ -596,39 +622,17 @@ namespace Handbrake
{
if (!queue.LastEncode.IsEmpty)
{
- queue.Add(queue.LastEncode.Query, queue.LastEncode.Source, queue.LastEncode.Destination,
- queue.LastEncode.CustomQuery);
+ queue.Add(
+ queue.LastEncode.Query,
+ queue.LastEncode.Title,
+ queue.LastEncode.Source,
+ queue.LastEncode.Destination,
+ queue.LastEncode.CustomQuery);
UpdateUiElements();
}
}
/// <summary>
- /// Edit Job
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void MnuReconfigureJobClick(object sender, EventArgs e)
- {
- if (list_queue.SelectedIndices != null)
- {
- lock (queue)
- {
- lock (list_queue)
- {
- int index = list_queue.SelectedIndices[0];
- mainWindow.RecievingJob(queue.GetJob(index));
- queue.Remove(index);
- RedrawQueue();
- }
- }
- }
- }
-
- /// <summary>
/// Hide's the window when the user tries to "x" out of the window instead of closing it.
/// </summary>
/// <param name="e">