summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-08-03 15:26:14 +0000
committersr55 <[email protected]>2009-08-03 15:26:14 +0000
commitbd7f9d53243dde4bd44d50004e0022151b0a2af3 (patch)
tree29e660b4faaf20a350bf5c91d71ade0315122686 /win/C#
parent30e5a9e1a2a09f134db33d7779e21cea05203087 (diff)
WinGui:
- Mostly just code re-factoring. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2748 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Functions/QueryGenerator.cs74
-rw-r--r--win/C#/frmMain.Designer.cs4
-rw-r--r--win/C#/frmMain.cs271
-rw-r--r--win/C#/frmOptions.Designer.cs10
-rw-r--r--win/C#/frmOptions.resx3
-rw-r--r--win/C#/frmPreview.cs8
6 files changed, 136 insertions, 234 deletions
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index 248ee188e..42b962541 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -15,13 +15,14 @@ namespace Handbrake.Functions
class QueryGenerator
{
/// <summary>
- /// Generates a CLI query based on the GUI widgets.
+ /// Generates a full CLI query for either encoding or previe encoeds if duration and preview are defined.
/// </summary>
/// <param name="mainWindow"></param>
- /// <returns>The CLI String</returns>
- public string generateTheQuery(frmMain mainWindow)
+ /// <param name="duration"></param>
+ /// <param name="preview"></param>
+ /// <returns></returns>
+ public string generateCLIQuery(frmMain mainWindow, int duration, string preview)
{
- // Source tab
string query = "";
if (!string.IsNullOrEmpty(mainWindow.sourcePath))
@@ -38,58 +39,30 @@ namespace Handbrake.Functions
if (mainWindow.drop_angle.Items.Count != 0)
query += " --angle " + mainWindow.drop_angle.SelectedItem;
- if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != "")
- query += " -c " + mainWindow.drop_chapterStart.Text;
- else if (mainWindow.drop_chapterStart.Text == "Auto" && mainWindow.drop_chapterFinish.Text != "Auto")
- query += " -c " + "0-" + mainWindow.drop_chapterFinish.Text;
- else if (mainWindow.drop_chapterStart.Text != "Auto" && mainWindow.drop_chapterFinish.Text != "Auto" && mainWindow.drop_chapterStart.Text != "")
- query += " -c " + mainWindow.drop_chapterStart.Text + "-" + mainWindow.drop_chapterFinish.Text;
-
- // Destination tab
- if (mainWindow.text_destination.Text != "")
- query += " -o " + '"' + mainWindow.text_destination.Text + '"';
-
- query += generateTabbedComponentsQuery(mainWindow);
- return query;
- }
-
- /// <summary>
- /// Generates a CLI query for the preview function.
- /// This basically forces a shortened version of the encdode.
- /// </summary>
- /// <param name="mainWindow"></param>
- /// <param name="duration">Duration</param>
- /// <param name="preview">Start at preview</param>
- /// <returns>Returns a CLI query String.</returns>
- public string generatePreviewQuery(frmMain mainWindow, string duration, string preview)
- {
- int seconds;
- int.TryParse(duration, out seconds);
-
- // Source tab
- string query = "";
- if (!string.IsNullOrEmpty(mainWindow.sourcePath))
- if (mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")
- query = " -i " + '"' + mainWindow.sourcePath + '"';
+ if (duration != 0 && preview != null) // Preivew Query
+ {
+ query += " --start-at-preview " + preview;
+ query += " --stop-at duration:" + duration + " ";
- if (mainWindow.drp_dvdtitle.Text != "Automatic")
+ if (mainWindow.text_destination.Text != "")
+ query += " -o " + '"' + mainWindow.text_destination.Text.Replace(".m", "_sample.m") + '"';
+ }
+ else // Non Preview Query
{
- string[] titleInfo = mainWindow.drp_dvdtitle.Text.Split(' ');
- query += " -t " + titleInfo[0];
+ if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != "")
+ query += " -c " + mainWindow.drop_chapterStart.Text;
+ else if (mainWindow.drop_chapterStart.Text == "Auto" && mainWindow.drop_chapterFinish.Text != "Auto")
+ query += " -c " + "0-" + mainWindow.drop_chapterFinish.Text;
+ else if (mainWindow.drop_chapterStart.Text != "Auto" && mainWindow.drop_chapterFinish.Text != "Auto" && mainWindow.drop_chapterStart.Text != "")
+ query += " -c " + mainWindow.drop_chapterStart.Text + "-" + mainWindow.drop_chapterFinish.Text;
+
+ if (mainWindow.text_destination.Text != "")
+ query += " -o " + '"' + mainWindow.text_destination.Text + '"';
}
- if (mainWindow.drop_angle.SelectedIndex != 0)
- query += " --angle " + mainWindow.drop_angle.SelectedItem;
-
- query += " --start-at-preview " + preview;
- query += " --stop-at duration:" + duration + " ";
-
- // Destination tab
- if (mainWindow.text_destination.Text != "")
- query += " -o " + '"' + mainWindow.text_destination.Text.Replace(".m", "_sample.m") + '"';
-
query += generateTabbedComponentsQuery(mainWindow);
+
return query;
}
@@ -606,7 +579,6 @@ namespace Handbrake.Functions
file.Close();
file.Dispose();
return true;
-
}
catch (Exception exc)
{
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 0ecb055ca..cca451404 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -463,7 +463,7 @@ namespace Handbrake
this.drop_chapterFinish.Size = new System.Drawing.Size(69, 21);
this.drop_chapterFinish.TabIndex = 10;
this.ToolTip.SetToolTip(this.drop_chapterFinish, "Select the chapter range you would like to enocde. (default: All Chapters)");
- this.drop_chapterFinish.SelectedIndexChanged += new System.EventHandler(this.drop_chapterFinish_SelectedIndexChanged);
+ this.drop_chapterFinish.SelectedIndexChanged += new System.EventHandler(this.chapersChanged);
//
// drop_chapterStart
//
@@ -474,7 +474,7 @@ namespace Handbrake
this.drop_chapterStart.Size = new System.Drawing.Size(69, 21);
this.drop_chapterStart.TabIndex = 9;
this.ToolTip.SetToolTip(this.drop_chapterStart, "Select the chapter range you would like to enocde. (default: All Chapters)");
- this.drop_chapterStart.SelectedIndexChanged += new System.EventHandler(this.drop_chapterStart_SelectedIndexChanged);
+ this.drop_chapterStart.SelectedIndexChanged += new System.EventHandler(this.chapersChanged);
//
// drop_angle
//
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index a28597c55..b6b156cbb 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -286,10 +286,7 @@ namespace Handbrake
else
{
if (fileList[0] != "")
- {
- setupGUIforScan(fileList[0]);
startScan(fileList[0]);
- }
else
UpdateSourceLabel();
}
@@ -380,21 +377,21 @@ namespace Handbrake
QueryParser parsed = imp.importMacPreset(openPreset.FileName);
if (presetHandler.checkIfUserPresetExists(parsed.PresetName + " (Imported)"))
{
- DialogResult result = MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?", "Overwrite preset?",
+ DialogResult result = MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?", "Overwrite preset?",
MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
- presetHandler.updatePreset(parsed.PresetName + " (Imported)", queryGen.generateTheQuery(this),
+ presetHandler.updatePreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null),
parsed.UsesPictureSettings);
}
}
else
{
PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);
- presetHandler.addPreset(parsed.PresetName, queryGen.generateTheQuery(this), parsed.UsesPictureSettings);
+ presetHandler.addPreset(parsed.PresetName, queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings);
- if (presetHandler.addPreset(parsed.PresetName + " (Imported)", queryGen.generateTheQuery(this), parsed.UsesPictureSettings))
+ if (presetHandler.addPreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings))
{
TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)") { ForeColor = Color.Black };
treeView_presets.Nodes.Add(preset_treeview);
@@ -404,7 +401,7 @@ namespace Handbrake
}
private void btn_new_preset_Click(object sender, EventArgs e)
{
- Form preset = new frmAddPreset(this, queryGen.generateTheQuery(this), presetHandler);
+ Form preset = new frmAddPreset(this, queryGen.generateCLIQuery(this, 0, null), presetHandler);
preset.ShowDialog();
}
#endregion
@@ -440,7 +437,7 @@ namespace Handbrake
{
// Get the information about the new build, if any, and close the window
info = Main.EndCheckForUpdates(result);
-
+
if (info.NewVersionAvailable && info.BuildInformation != null)
{
frmUpdater updateWindow = new frmUpdater(info.BuildInformation);
@@ -666,8 +663,8 @@ namespace Handbrake
{
if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))
{
- string generatedQuery = queryGen.generateTheQuery(this);
- string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateTheQuery(this);
+ string generatedQuery = queryGen.generateCLIQuery(this, 0, null);
+ string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateCLIQuery(this, 0, null);
string query = string.Empty;
// Check to make sure the generated query matches the GUI settings
@@ -735,7 +732,7 @@ namespace Handbrake
MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
{
- String query = queryGen.generateTheQuery(this);
+ String query = queryGen.generateCLIQuery(this, 0, null);
if (rtf_query.Text != "")
query = rtf_query.Text;
@@ -782,7 +779,7 @@ namespace Handbrake
String file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";
if (ActivityWindow == null)
ActivityWindow = new frmActivityWindow(file, encodeQueue, this);
-
+
ActivityWindow.Show();
}
#endregion
@@ -819,92 +816,57 @@ namespace Handbrake
//Source
private void btn_dvd_source_Click(object sender, EventArgs e)
{
- // Enable the creation of chapter markers.
- Check_ChapterMarkers.Enabled = true;
-
- // Set the last action to scan.
- // This is used for tracking which file to load in the activity window
- lastAction = "scan";
- sourcePath = string.Empty;
-
if (DVD_Open.ShowDialog() == DialogResult.OK)
- {
- String filename = DVD_Open.SelectedPath;
-
- if (filename.StartsWith("\\"))
- {
- MessageBox.Show(
- "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",
- "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- UpdateSourceLabel();
- }
- else
- {
- if (filename != "")
- {
- sourcePath = Path.GetFullPath(filename);
- setupGUIforScan(filename);
- startScan(filename);
- } else
- UpdateSourceLabel();
- }
- }
+ selectSource(DVD_Open.SelectedPath, 1);
else
UpdateSourceLabel();
}
private void btn_file_source_Click(object sender, EventArgs e)
{
- // Set the last action to scan.
- // This is used for tracking which file to load in the activity window
- lastAction = "scan";
- sourcePath = string.Empty;
-
if (ISO_Open.ShowDialog() == DialogResult.OK)
- {
- String filename = ISO_Open.FileName;
- if (filename.StartsWith("\\"))
- MessageBox.Show(
- "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",
- "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- else
- {
- if (filename != "")
- {
- sourcePath = Path.GetFileName(filename);
- setupGUIforScan(filename);
- startScan(filename);
- } else
- UpdateSourceLabel();
- }
- }
- UpdateSourceLabel();
+ selectSource(ISO_Open.FileName, 2);
+ else
+ UpdateSourceLabel();
}
private void mnu_dvd_drive_Click(object sender, EventArgs e)
{
- // Enable the creation of chapter markers.
+ if (!mnu_dvd_drive.Text.Contains("VIDEO_TS")) return;
+ string[] path = mnu_dvd_drive.Text.Split(' ');
+ selectSource(path[0], 3);
+ }
+ private void selectSource(string file, int type)
+ {
Check_ChapterMarkers.Enabled = true;
-
- // Set the last action to scan.
- // This is used for tracking which file to load in the activity window
lastAction = "scan";
sourcePath = string.Empty;
- if (mnu_dvd_drive.Text.Contains("VIDEO_TS"))
+ if (file == string.Empty) // Must have a file or path
{
- string[] path = mnu_dvd_drive.Text.Split(' ');
- String filename = path[0];
- sourcePath = Path.GetFullPath(filename);
- setupGUIforScan(filename);
- startScan(filename);
+ UpdateSourceLabel();
+ return;
}
- // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.
- if (drp_dvdtitle.Items.Count == 0)
- MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.\nYour Source may be copy protected, badly mastered or a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
-
- UpdateSourceLabel();
+ if (file.StartsWith("\\")) // NO UNC Paths
+ {
+ MessageBox.Show(
+ "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ UpdateSourceLabel();
+ return;
+ }
- lbl_encode.Text = "";
+ switch (type) // Start the scan
+ {
+ case 1: // btn_dvd_source_Click()
+ case 3: // mnu_dvd_drive_Click()
+ sourcePath = Path.GetFullPath(file);
+ startScan(file);
+ break;
+ case 2: // btn_file_source_Click()
+ sourcePath = Path.GetFileName(file);
+ startScan(file);
+ break;
+ }
}
private void drp_dvdtitle_Click(object sender, EventArgs e)
{
@@ -914,9 +876,8 @@ namespace Handbrake
private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)
{
unRegisterPresetEventHandler();
- // Reset some values on the form
- PictureSettings.lbl_Aspect.Text = "Select a Title";
- //lbl_RecomendedCrop.Text = "Select a Title";
+
+ PictureSettings.lbl_Aspect.Text = "Select a Title"; // Reset some values on the form
drop_chapterStart.Items.Clear();
drop_chapterFinish.Items.Clear();
@@ -996,86 +957,65 @@ namespace Handbrake
registerPresetEventHandler();
}
- private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)
+ private void chapersChanged(object sender, EventArgs e)
{
- int c_start, c_end;
-
- if (drop_chapterFinish.Text == "Auto" && drop_chapterFinish.Items.Count != 0)
- drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;
+ Control ctl = (Control) sender;
+ int chapterStart, chapterEnd;
+ int.TryParse(drop_chapterStart.Text, out chapterStart);
+ int.TryParse(drop_chapterFinish.Text, out chapterEnd);
- int.TryParse(drop_chapterStart.Text, out c_start);
- int.TryParse(drop_chapterFinish.Text, out c_end);
-
- if (c_end != 0)
+ switch (ctl.Name)
{
- if (c_start > c_end)
- drop_chapterFinish.Text = c_start.ToString();
- }
-
- lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();
+ case "drop_chapterStart":
+ if (drop_chapterFinish.SelectedIndex == -1 && drop_chapterFinish.Items.Count != 0)
+ drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;
- // Run the Autonaming function
- if (Properties.Settings.Default.autoNaming)
- text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, sourcePath, text_destination.Text, drop_format.SelectedIndex);
-
- // Disable chapter markers if only 1 chapter is selected.
- if (c_start == c_end)
- {
- Check_ChapterMarkers.Checked = false;
- Check_ChapterMarkers.Enabled = false;
- }
- else
- Check_ChapterMarkers.Enabled = true;
- }
- private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
- {
- int c_start, c_end;
+ if (chapterEnd != 0)
+ if (chapterStart > chapterEnd)
+ drop_chapterFinish.Text = chapterStart.ToString();
+ break;
+ case "drop_chapterFinish":
+ if (drop_chapterStart.Items.Count >= 1 && drop_chapterStart.SelectedIndex == -1)
+ drop_chapterStart.SelectedIndex = 0;
- if (drop_chapterStart.Text == "Auto" && drop_chapterStart.Items.Count >= 1)
- drop_chapterStart.SelectedIndex = 1;
+ if (chapterStart != 0)
+ if (chapterEnd < chapterStart)
+ drop_chapterFinish.Text = chapterStart.ToString();
- int.TryParse(drop_chapterStart.Text, out c_start);
- int.TryParse(drop_chapterFinish.Text, out c_end);
+ // Add more rows to the Chapter menu if needed.
+ if (Check_ChapterMarkers.Checked)
+ {
+ int i = data_chpt.Rows.Count, finish = 0;
+ int.TryParse(drop_chapterFinish.Text, out finish);
- if (c_start != 0)
- {
- if (c_end < c_start)
- drop_chapterFinish.Text = c_start.ToString();
+ while (i < finish)
+ {
+ int n = data_chpt.Rows.Add();
+ data_chpt.Rows[n].Cells[0].Value = (i + 1);
+ data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);
+ data_chpt.Rows[n].Cells[0].ValueType = typeof(int);
+ data_chpt.Rows[n].Cells[1].ValueType = typeof(string);
+ i++;
+ }
+ }
+ break;
}
+ // Update the Duration
lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();
// Run the Autonaming function
if (Properties.Settings.Default.autoNaming)
text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, sourcePath, text_destination.Text, drop_format.SelectedIndex);
- // Add more rows to the Chapter menu if needed.
- if (Check_ChapterMarkers.Checked)
- {
- int i = data_chpt.Rows.Count, finish = 0;
-
- if (drop_chapterFinish.Text != "Auto")
- int.TryParse(drop_chapterFinish.Text, out finish);
-
- while (i < finish)
- {
- int n = data_chpt.Rows.Add();
- data_chpt.Rows[n].Cells[0].Value = (i + 1);
- data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);
- data_chpt.Rows[n].Cells[0].ValueType = typeof(int);
- data_chpt.Rows[n].Cells[1].ValueType = typeof(string);
- i++;
- }
- }
-
// Disable chapter markers if only 1 chapter is selected.
- if (c_start == c_end)
+ if (chapterStart == chapterEnd)
{
Check_ChapterMarkers.Checked = false;
Check_ChapterMarkers.Enabled = false;
}
else
- Check_ChapterMarkers.Enabled = true;
+ Check_ChapterMarkers.Enabled = true;
}
//Destination
@@ -1369,7 +1309,7 @@ namespace Handbrake
// Query Editor Tab
private void btn_generate_Query_Click(object sender, EventArgs e)
{
- rtf_query.Text = queryGen.generateTheQuery(this);
+ rtf_query.Text = queryGen.generateCLIQuery(this, 0, null);
}
private void btn_clear_Click(object sender, EventArgs e)
{
@@ -1382,8 +1322,9 @@ namespace Handbrake
#region Source Scan
public Boolean isScanning { get; set; }
private static int scanProcessID { get; set; }
- private void setupGUIforScan(String filename)
+ private void startScan(String filename)
{
+ // Setup the GUI components for the scan.
sourcePath = filename;
foreach (Control ctrl in Controls)
{
@@ -1392,24 +1333,20 @@ namespace Handbrake
}
lbl_encode.Visible = true;
lbl_encode.Text = "Scanning ...";
- //gb_source.Text = "Source: Scanning ...";
btn_source.Enabled = false;
btn_start.Enabled = false;
btn_showQueue.Enabled = false;
btn_add2Queue.Enabled = false;
tb_preview.Enabled = false;
mnu_killCLI.Visible = true;
- }
- private void startScan(String filename)
- {
+
+ // Start hte Scan Thread
try
{
- lbl_encode.Visible = true;
- lbl_encode.Text = "Scanning...";
if (ActivityWindow != null)
ActivityWindow.setLogView(true);
isScanning = true;
- ThreadPool.QueueUserWorkItem(scanProcess, filename);
+ ThreadPool.QueueUserWorkItem(scanProcess);
}
catch (Exception exc)
{
@@ -1420,7 +1357,6 @@ namespace Handbrake
{
try
{
- string inputFile = (string)state;
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
string dvdInfoPath = Path.Combine(logDir, "last_scan_log.txt");
@@ -1432,7 +1368,7 @@ namespace Handbrake
String dvdnav = string.Empty;
if (Properties.Settings.Default.dvdnav)
dvdnav = " --dvdnav";
- string strCmdLine = String.Format(@"cmd /c """"{0}"" -i ""{1}"" -t0 {2} -v >""{3}"" 2>&1""", handbrakeCLIPath, inputFile, dvdnav, dvdInfoPath);
+ string strCmdLine = String.Format(@"cmd /c """"{0}"" -i ""{1}"" -t0 {2} -v >""{3}"" 2>&1""", handbrakeCLIPath, sourcePath, dvdnav, dvdInfoPath);
ProcessStartInfo hbParseDvd = new ProcessStartInfo("CMD.exe", strCmdLine) { WindowStyle = ProcessWindowStyle.Hidden };
@@ -1449,11 +1385,8 @@ namespace Handbrake
if (cleanExit) // If 0 exit code, CLI exited cleanly.
{
if (!File.Exists(dvdInfoPath))
- {
- throw new Exception(
- "Unable to retrieve the DVD Info. last_scan_log.txt is missing. \nExpected location of last_scan_log.txt: \n" +
- dvdInfoPath);
- }
+ throw new Exception("Unable to retrieve the DVD Info. last_scan_log.txt is missing. \nExpected location of last_scan_log.txt: \n"
+ + dvdInfoPath);
using (StreamReader sr = new StreamReader(dvdInfoPath))
{
@@ -1485,9 +1418,6 @@ namespace Handbrake
drp_dvdtitle.Items.Clear();
if (thisDVD.Titles.Count != 0)
drp_dvdtitle.Items.AddRange(thisDVD.Titles.ToArray());
- drp_dvdtitle.Text = "Automatic";
- drop_chapterFinish.Text = "Auto";
- drop_chapterStart.Text = "Auto";
// Now select the longest title
if (thisDVD.Titles.Count != 0)
@@ -1507,7 +1437,7 @@ namespace Handbrake
if (drp_dvdtitle.Items.Count == 0)
{
MessageBox.Show(
- "No Title(s) found. \n\nYour Source may be copy protected, badly mastered or a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).",
+ "No Title(s) found. \n\nYour Source may be copy protected, badly mastered or in a format which HandBrake does not support. \nPlease refer to the Documentation and FAQ (see Help Menu).",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
sourcePath = string.Empty;
}
@@ -1529,7 +1459,6 @@ namespace Handbrake
if (InvokeRequired)
BeginInvoke(new UpdateWindowHandler(enableGUI));
lbl_encode.Text = "Scan Completed";
- //gb_source.Text = "Source";
foreach (Control ctrl in Controls)
ctrl.Enabled = true;
btn_start.Enabled = true;
@@ -1570,26 +1499,21 @@ namespace Handbrake
private void resetGUI()
{
drp_dvdtitle.Items.Clear();
- drp_dvdtitle.Text = "Automatic";
drop_chapterStart.Items.Clear();
- drop_chapterStart.Text = "Auto";
drop_chapterFinish.Items.Clear();
- drop_chapterFinish.Text = "Auto";
lbl_duration.Text = "Select a Title";
PictureSettings.lbl_src_res.Text = "Select a Title";
PictureSettings.lbl_Aspect.Text = "Select a Title";
- sourcePath = "Source";
- text_destination.Text = "";
+ sourcePath = String.Empty;
+ text_destination.Text = String.Empty;
thisDVD = null;
selectedTitle = null;
isScanning = false;
}
-
private void UpdateSourceLabel()
{
labelSource.Text = string.IsNullOrEmpty(sourcePath) ? "Select \"Source\" to continue." : Path.GetFileName(sourcePath);
}
-
#endregion
#region GUI
@@ -1652,14 +1576,13 @@ namespace Handbrake
#endregion
#region DVD Drive Detection
- private delegate void ProgressUpdateHandler();
private void getDriveInfoThread()
{
try
{
if (InvokeRequired)
{
- BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));
+ BeginInvoke(new UpdateWindowHandler(getDriveInfoThread));
return;
}
@@ -1702,7 +1625,7 @@ namespace Handbrake
presetHandler.getPresetPanel(ref treeView_presets);
treeView_presets.Update();
- }
+ }
#endregion
#region Overrides
diff --git a/win/C#/frmOptions.Designer.cs b/win/C#/frmOptions.Designer.cs
index ff14b8a89..231a23d69 100644
--- a/win/C#/frmOptions.Designer.cs
+++ b/win/C#/frmOptions.Designer.cs
@@ -1018,7 +1018,7 @@ namespace Handbrake
"0.50",
"0.25",
"0.20"});
- this.drop_x264step.Location = new System.Drawing.Point(266, 184);
+ this.drop_x264step.Location = new System.Drawing.Point(358, 184);
this.drop_x264step.Name = "drop_x264step";
this.drop_x264step.Size = new System.Drawing.Size(85, 21);
this.drop_x264step.TabIndex = 86;
@@ -1033,9 +1033,9 @@ namespace Handbrake
this.tableLayoutPanel4.SetColumnSpan(this.label30, 2);
this.label30.Location = new System.Drawing.Point(67, 188);
this.label30.Name = "label30";
- this.label30.Size = new System.Drawing.Size(193, 13);
+ this.label30.Size = new System.Drawing.Size(285, 13);
this.label30.TabIndex = 87;
- this.label30.Text = "Constant quality fractional granularity:\r\n";
+ this.label30.Text = "Constant quality fractional granularity (Requires Restart):\r\n";
//
// btn_drive_detect
//
@@ -1088,9 +1088,9 @@ namespace Handbrake
this.tableLayoutPanel4.SetColumnSpan(this.check_queryEditorTab, 4);
this.check_queryEditorTab.Location = new System.Drawing.Point(67, 72);
this.check_queryEditorTab.Name = "check_queryEditorTab";
- this.check_queryEditorTab.Size = new System.Drawing.Size(149, 17);
+ this.check_queryEditorTab.Size = new System.Drawing.Size(241, 17);
this.check_queryEditorTab.TabIndex = 84;
- this.check_queryEditorTab.Text = "Enable \"Query Editor\" tab";
+ this.check_queryEditorTab.Text = "Enable \"Query Editor\" tab (Requires Restart)";
this.ToolTip.SetToolTip(this.check_queryEditorTab, "Enables the Query Editor tab on the main window. Requires program restart to take" +
" effect.");
this.check_queryEditorTab.UseVisualStyleBackColor = false;
diff --git a/win/C#/frmOptions.resx b/win/C#/frmOptions.resx
index 139d8245b..427cdd964 100644
--- a/win/C#/frmOptions.resx
+++ b/win/C#/frmOptions.resx
@@ -120,6 +120,9 @@
<metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 18</value>
</metadata>
+ <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 18</value>
+ </metadata>
<metadata name="pathFinder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs
index 96ef4a87d..6d68dda6d 100644
--- a/win/C#/frmPreview.cs
+++ b/win/C#/frmPreview.cs
@@ -57,7 +57,9 @@ namespace Handbrake
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (VLC) ...";
- String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
+ int duration;
+ int.TryParse(cb_duration.Text, out duration);
+ String query = hb_common_func.generateCLIQuery(mainWindow, duration, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}
private void btn_playQT_Click(object sender, EventArgs e)
@@ -85,7 +87,9 @@ namespace Handbrake
btn_playQT.Enabled = false;
btn_playVLC.Enabled = false;
lbl_status.Text = "Encoding Sample for (QT) ...";
- String query = hb_common_func.generatePreviewQuery(mainWindow, cb_duration.Text, cb_preview.Text);
+ int duration;
+ int.TryParse(cb_duration.Text, out duration);
+ String query = hb_common_func.generateCLIQuery(mainWindow, duration, cb_preview.Text);
ThreadPool.QueueUserWorkItem(procMonitor, query);
}