using System;\r
using System.Collections.Generic;\r
using System.Drawing;\r
+using System.Globalization;\r
using System.Windows.Forms;\r
using System.IO;\r
using System.Diagnostics;\r
public partial class frmMain : Form\r
{\r
// Objects which may be used by one or more other objects *************\r
- QueueHandler encodeQueue = new QueueHandler();\r
+ EncodeAndQueueHandler encodeQueue = new EncodeAndQueueHandler();\r
PresetsHandler presetHandler = new PresetsHandler();\r
QueryGenerator queryGen = new QueryGenerator();\r
\r
// Globals: Mainly used for tracking. *********************************\r
- private Title selectedTitle;\r
+ public Title selectedTitle;\r
private DVD thisDVD;\r
private frmQueue queueWindow;\r
private frmPreview qtpreview;\r
+ private frmActivityWindow ActivityWindow;\r
private Form splash;\r
public string sourcePath;\r
+ private string lastAction;\r
\r
// Delegates **********************************************************\r
private delegate void UpdateWindowHandler();\r
- private delegate void UpdateStatusChanger();\r
\r
// Applicaiton Startup ************************************************\r
\r
{\r
// Load and setup the splash screen in this thread\r
splash = new frmSplashScreen();\r
- splash.Show();\r
+ splash.Show(this);\r
Label lblStatus = new Label { Size = new Size(150, 20), Location = new Point(182, 102) };\r
splash.Controls.Add(lblStatus);\r
\r
lblStatus.Text = "Checking for updates ...";\r
Application.DoEvents();\r
\r
- Thread updateCheckThread = new Thread(startupUpdateCheck);\r
- updateCheckThread.Start();\r
+ Main.BeginCheckForUpdates(new AsyncCallback(UpdateCheckDone), false);\r
}\r
}\r
\r
if (Properties.Settings.Default.tooltipEnable)\r
ToolTip.Active = true;\r
\r
+ // Register with Growl (if not using Growl for the encoding completion action, this wont hurt anything)\r
+ GrowlCommunicator.Register();\r
+\r
//Finished Loading\r
lblStatus.Text = "Loading Complete!";\r
Application.DoEvents();\r
queueRecovery();\r
}\r
\r
- // Startup Functions \r
- private void startupUpdateCheck()\r
+ private void UpdateCheckDone(IAsyncResult result)\r
{\r
+ if (InvokeRequired)\r
+ {\r
+ Invoke(new MethodInvoker(() => UpdateCheckDone(result)));\r
+ return;\r
+ }\r
+\r
+ UpdateCheckInformation info;\r
+\r
try\r
{\r
- if (InvokeRequired)\r
- {\r
- BeginInvoke(new UpdateStatusChanger(startupUpdateCheck));\r
- return;\r
- }\r
+ info = Main.EndCheckForUpdates(result);\r
\r
- Boolean update = Main.updateCheck(false);\r
- if (update)\r
+ if (info.NewVersionAvailable)\r
{\r
- frmUpdater updateWindow = new frmUpdater();\r
- updateWindow.Show();\r
+ frmUpdater updateWindow = new frmUpdater(info.BuildInformation);\r
+ updateWindow.ShowDialog();\r
}\r
}\r
- catch (Exception exc)\r
+ catch (Exception ex)\r
{\r
- MessageBox.Show(splash, "Unable to perform update check. If this problem persists, you can turn of update checking in the program options. \nError Information: \n\n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ if ((bool)result.AsyncState)\r
+ MessageBox.Show("Unable to check for updates, Please try again later. \n" + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
+\r
+ // Startup Functions \r
private void queueRecovery()\r
{\r
if (Main.check_queue_recovery())\r
DialogResult result = MessageBox.Show("HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?", "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
\r
if (result == DialogResult.Yes)\r
- encodeQueue.recoverQueue("hb_queue_recovery.xml"); // Start Recovery\r
+ encodeQueue.LoadQueueFromFile("hb_queue_recovery.xml"); // Start Recovery\r
else\r
{\r
// Remove the Queue recovery file if the user doesn't want to recovery the last queue.\r
// Encoding Events for setting up the GUI\r
private void events()\r
{\r
+ // Handle Widget changes when preset is selected.\r
+ registerPresetEventHandler();\r
+\r
// Handle Window Resize\r
if (Properties.Settings.Default.MainWindowMinimize)\r
this.Resize += new EventHandler(frmMain_Resize);\r
\r
// Handle Encode Start / Finish / Pause\r
- encodeQueue.OnEncodeEnded += new EventHandler(encodeEnded);\r
- encodeQueue.OnPaused += new EventHandler(encodePaused);\r
- encodeQueue.OnEncodeStart += new EventHandler(encodeStarted);\r
+ encodeQueue.CurrentJobCompleted += new EventHandler(encodeEnded);\r
+ encodeQueue.QueuePauseRequested += new EventHandler(encodePaused);\r
+ encodeQueue.NewJobStarted += new EventHandler(encodeStarted);\r
\r
// Handle a file being draged onto the GUI.\r
this.DragEnter += new DragEventHandler(frmMain_DragEnter);\r
this.DragDrop += new DragEventHandler(frmMain_DragDrop);\r
}\r
\r
+ // Change the preset label to custom when a user changes a setting. Don't want to give the impression that users can change settings and still be using a preset\r
+ public void registerPresetEventHandler()\r
+ {\r
+ // Output Settings\r
+ drop_format.SelectedIndexChanged += new EventHandler(changePresetLabel);\r
+ check_largeFile.CheckedChanged += new EventHandler(changePresetLabel);\r
+ check_iPodAtom.CheckedChanged += new EventHandler(changePresetLabel);\r
+ check_optimiseMP4.CheckedChanged += new EventHandler(changePresetLabel);\r
+\r
+ // Picture Settings\r
+ //PictureSettings.PictureSettingsChanged += new EventHandler(changePresetLabel);\r
+\r
+ // Filter Settings\r
+ Filters.FilterSettingsChanged += new EventHandler(changePresetLabel);\r
+\r
+ // Video Tab\r
+ drp_videoEncoder.SelectedIndexChanged += new EventHandler(changePresetLabel);\r
+ check_2PassEncode.CheckedChanged += new EventHandler(changePresetLabel);\r
+ check_turbo.CheckedChanged += new EventHandler(changePresetLabel);\r
+ text_filesize.TextChanged += new EventHandler(changePresetLabel);\r
+ text_bitrate.TextChanged += new EventHandler(changePresetLabel);\r
+ slider_videoQuality.ValueChanged += new EventHandler(changePresetLabel);\r
+\r
+ // Audio Panel\r
+ AudioSettings.AudioListChanged += new EventHandler(changePresetLabel);\r
+\r
+ // Advanced Tab\r
+ x264Panel.rtf_x264Query.TextChanged += new EventHandler(changePresetLabel);\r
+ }\r
+ public void unRegisterPresetEventHandler()\r
+ {\r
+ // Output Settings \r
+ drop_format.SelectedIndexChanged -= new EventHandler(changePresetLabel);\r
+ check_largeFile.CheckedChanged -= new EventHandler(changePresetLabel);\r
+ check_iPodAtom.CheckedChanged -= new EventHandler(changePresetLabel);\r
+ check_optimiseMP4.CheckedChanged -= new EventHandler(changePresetLabel);\r
+\r
+ // Picture Settings\r
+ //PictureSettings.PictureSettingsChanged -= new EventHandler(changePresetLabel);\r
+\r
+ // Filter Settings\r
+ Filters.FilterSettingsChanged -= new EventHandler(changePresetLabel);\r
+\r
+ // Video Tab\r
+ drp_videoEncoder.SelectedIndexChanged -= new EventHandler(changePresetLabel);\r
+ check_2PassEncode.CheckedChanged -= new EventHandler(changePresetLabel);\r
+ check_turbo.CheckedChanged -= new EventHandler(changePresetLabel);\r
+ text_filesize.TextChanged -= new EventHandler(changePresetLabel);\r
+ text_bitrate.TextChanged -= new EventHandler(changePresetLabel);\r
+ slider_videoQuality.ValueChanged -= new EventHandler(changePresetLabel);\r
+\r
+ // Audio Panel\r
+ AudioSettings.AudioListChanged -= new EventHandler(changePresetLabel);\r
+\r
+ // Advanced Tab\r
+ x264Panel.rtf_x264Query.TextChanged -= new EventHandler(changePresetLabel);\r
+ }\r
+ private void changePresetLabel(object sender, EventArgs e)\r
+ {\r
+ labelPreset.Text = "Output Settings (Preset: Custom)";\r
+ }\r
+\r
private static void frmMain_DragEnter(object sender, DragEventArgs e)\r
{\r
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))\r
private void frmMain_DragDrop(object sender, DragEventArgs e)\r
{\r
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];\r
+ sourcePath = string.Empty;\r
+\r
if (fileList != null)\r
{\r
if (fileList[0].StartsWith("\\"))\r
- 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);\r
+ {\r
+ MessageBox.Show(\r
+ "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",\r
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ UpdateSourceLabel();\r
+ }\r
else\r
{\r
if (fileList[0] != "")\r
- {\r
- setupGUIforScan(fileList[0]);\r
startScan(fileList[0]);\r
- }\r
else\r
- lbl_source.Text = "Click 'Source' to continue";\r
+ UpdateSourceLabel();\r
}\r
}\r
+ else\r
+ UpdateSourceLabel();\r
}\r
private void encodeStarted(object sender, EventArgs e)\r
{\r
presetHandler.updateBuiltInPresets();\r
loadPresetPanel();\r
if (treeView_presets.Nodes.Count == 0)\r
- MessageBox.Show("Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("Unable to load the presets.xml file. Please select \"Update Built-in Presets\" from the Presets Menu. \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
else\r
MessageBox.Show("Presets have been updated!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
\r
}\r
private void mnu_delete_preset_Click(object sender, EventArgs e)\r
{\r
- // Empty the preset file\r
- string presetsFile = Application.StartupPath + "\\presets.xml";\r
- if (File.Exists(presetsFile))\r
- File.Delete(presetsFile);\r
-\r
- try\r
- {\r
- FileStream strm = new FileStream(presetsFile, FileMode.Create, FileAccess.Write);\r
- strm.Close();\r
- strm.Dispose();\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("An error has occured during the preset removal process.\n If you are using Windows Vista, you may need to run under Administrator Mode to complete this task. \n" + exc);\r
- }\r
-\r
- // Reload the preset panel\r
- loadPresetPanel();\r
+ presetHandler.removeBuiltInPresets();\r
+ loadPresetPanel(); // Reload the preset panel\r
}\r
private void mnu_SelectDefault_Click(object sender, EventArgs e)\r
{\r
loadNormalPreset();\r
}\r
+ private void mnu_importMacPreset_Click(object sender, EventArgs e)\r
+ {\r
+ Import imp = new Import();\r
+ if (openPreset.ShowDialog() == DialogResult.OK)\r
+ {\r
+ QueryParser parsed = imp.importMacPreset(openPreset.FileName);\r
+ if (presetHandler.checkIfUserPresetExists(parsed.PresetName + " (Imported)"))\r
+ {\r
+ DialogResult result = MessageBox.Show("This preset appears to already exist. Would you like to overwrite it?", "Overwrite preset?",\r
+ MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
+ if (result == DialogResult.Yes)\r
+ {\r
+ PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
+ presetHandler.updatePreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null),\r
+ parsed.UsesPictureSettings);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ PresetLoader.presetLoader(this, parsed, parsed.PresetName, parsed.UsesPictureSettings);\r
+ presetHandler.addPreset(parsed.PresetName, queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings);\r
+\r
+ if (presetHandler.addPreset(parsed.PresetName + " (Imported)", queryGen.generateCLIQuery(this, 0, null), parsed.UsesPictureSettings))\r
+ {\r
+ TreeNode preset_treeview = new TreeNode(parsed.PresetName + " (Imported)") { ForeColor = Color.Black };\r
+ treeView_presets.Nodes.Add(preset_treeview);\r
+ }\r
+ }\r
+ }\r
+ }\r
private void btn_new_preset_Click(object sender, EventArgs e)\r
{\r
- Form preset = new frmAddPreset(this, queryGen.generateTheQuery(this), presetHandler);\r
+ Form preset = new frmAddPreset(this, queryGen.generateCLIQuery(this, 0, null), presetHandler);\r
preset.ShowDialog();\r
}\r
#endregion\r
}\r
private void mnu_UpdateCheck_Click(object sender, EventArgs e)\r
{\r
- Boolean update = Main.updateCheck(true);\r
- if (update)\r
+ lbl_updateCheck.Visible = true;\r
+ Main.BeginCheckForUpdates(new AsyncCallback(updateCheckDoneMenu), false);\r
+ }\r
+ private void updateCheckDoneMenu(IAsyncResult result)\r
+ {\r
+ // Make sure it's running on the calling thread\r
+ if (InvokeRequired)\r
{\r
- frmUpdater updateWindow = new frmUpdater();\r
- updateWindow.Show();\r
+ Invoke(new MethodInvoker(() => updateCheckDoneMenu(result)));\r
+ return;\r
+ }\r
+ UpdateCheckInformation info;\r
+ try\r
+ {\r
+ // Get the information about the new build, if any, and close the window\r
+ info = Main.EndCheckForUpdates(result);\r
+\r
+ if (info.NewVersionAvailable && info.BuildInformation != null)\r
+ {\r
+ frmUpdater updateWindow = new frmUpdater(info.BuildInformation);\r
+ updateWindow.ShowDialog();\r
+ }\r
+ else\r
+ MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
+ lbl_updateCheck.Visible = false;\r
+ return;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ if ((bool)result.AsyncState)\r
+ MessageBox.Show("Unable to check for updates, Please try again later. \n" + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
- else\r
- MessageBox.Show("There are no new updates at this time.", "Update Check", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
}\r
private void mnu_about_Click(object sender, EventArgs e)\r
{\r
- Form About = new frmAbout();\r
- About.ShowDialog();\r
+ using (frmAbout About = new frmAbout())\r
+ {\r
+ About.ShowDialog();\r
+ }\r
}\r
#endregion\r
\r
if (treeView_presets.SelectedNode != null)\r
{\r
presetHandler.remove(treeView_presets.SelectedNode.Text);\r
- treeView_presets.Nodes.Remove(treeView_presets.SelectedNode); \r
+ treeView_presets.Nodes.Remove(treeView_presets.SelectedNode);\r
}\r
treeView_presets.Select();\r
}\r
{\r
if (treeView_presets.GetNodeAt(e.Location) != null)\r
{\r
- if (groupBox_output.Text.Contains(treeView_presets.GetNodeAt(e.Location).Text))\r
+ if (labelPreset.Text.Contains(treeView_presets.GetNodeAt(e.Location).Text))\r
selectPreset();\r
}\r
}\r
}\r
}\r
}\r
- } \r
+ }\r
private void loadNormalPreset()\r
{\r
foreach (TreeNode treenode in treeView_presets.Nodes)\r
if (result == DialogResult.Yes)\r
{\r
// Pause The Queue\r
- encodeQueue.pauseEncodeQueue();\r
+ encodeQueue.RequestPause();\r
\r
// Allow the CLI to exit cleanly\r
- Win32.SetForegroundWindow((int)encodeQueue.encodeHandler.processHandle);\r
+ Win32.SetForegroundWindow((int)encodeQueue.processHandle);\r
SendKeys.Send("^C");\r
\r
// Update the GUI\r
}\r
else\r
{\r
- if (encodeQueue.count() != 0 || (lbl_source.Text != string.Empty && lbl_source.Text != "Click 'Source' to continue" && text_destination.Text != string.Empty))\r
+ if (encodeQueue.Count != 0 || (!string.IsNullOrEmpty(sourcePath) && !string.IsNullOrEmpty(text_destination.Text)))\r
{\r
- String query = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateTheQuery(this);\r
+ string generatedQuery = queryGen.generateCLIQuery(this, 0, null);\r
+ string specifiedQuery = rtf_query.Text != "" ? rtf_query.Text : queryGen.generateCLIQuery(this, 0, null);\r
+ string query = string.Empty;\r
+\r
+ // Check to make sure the generated query matches the GUI settings\r
+ if (Properties.Settings.Default.PromptOnUnmatchingQueries && !string.IsNullOrEmpty(specifiedQuery) && generatedQuery != specifiedQuery)\r
+ {\r
+ DialogResult result = MessageBox.Show("The query under the \"Query Editor\" tab " +\r
+ "does not match the current GUI settings. Because the manual query takes " +\r
+ "priority over the GUI, your recently updated settings will not be taken " +\r
+ "into account when encoding this job." + Environment.NewLine + Environment.NewLine +\r
+ "Do you want to replace the manual query with the GUI-generated query?",\r
+ "Manual Query does not Match GUI",\r
+ MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk,\r
+ MessageBoxDefaultButton.Button3);\r
+\r
+ switch (result)\r
+ {\r
+ case DialogResult.Yes:\r
+ // Replace the manual query with the generated one\r
+ query = generatedQuery;\r
+ rtf_query.Text = generatedQuery;\r
+ break;\r
+ case DialogResult.No:\r
+ // Use the manual query\r
+ query = specifiedQuery;\r
+ break;\r
+ case DialogResult.Cancel:\r
+ // Don't start the encode\r
+ return;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ query = generatedQuery;\r
+ }\r
\r
DialogResult overwrite = DialogResult.Yes;\r
if (text_destination.Text != "")\r
\r
if (overwrite == DialogResult.Yes)\r
{\r
- if (encodeQueue.count() == 0)\r
- encodeQueue.add(query, lbl_source.Text, text_destination.Text);\r
+ if (encodeQueue.Count == 0)\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
\r
queueWindow.setQueue();\r
- if (encodeQueue.count() > 1)\r
+ if (encodeQueue.Count > 1)\r
queueWindow.Show(false);\r
\r
setEncodeStarted(); // Encode is running, so setup the GUI appropriately\r
- encodeQueue.startEncode(); // Start The Queue Encoding Process\r
+ if (ActivityWindow != null)\r
+ ActivityWindow.setLogView(false);\r
+ encodeQueue.StartEncodeQueue(); // Start The Queue Encoding Process\r
lastAction = "encode"; // Set the last action to encode - Used for activity window.\r
}\r
this.Focus();\r
}\r
- else if (lbl_source.Text == string.Empty || lbl_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)\r
- MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ else if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
+ MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
}\r
}\r
private void btn_add2Queue_Click(object sender, EventArgs e)\r
{\r
-\r
- if (lbl_source.Text == string.Empty || lbl_source.Text == "Click 'Source' to continue" || text_destination.Text == string.Empty)\r
- MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
+ MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
- String query = queryGen.generateTheQuery(this);\r
+ String query = queryGen.generateCLIQuery(this, 0, null);\r
if (rtf_query.Text != "")\r
query = rtf_query.Text;\r
\r
- if (encodeQueue.checkDestinationPath(text_destination.Text))\r
+ if (encodeQueue.CheckForDestinationDuplicate(text_destination.Text))\r
{\r
DialogResult result = MessageBox.Show("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?",\r
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);\r
if (result == DialogResult.Yes)\r
- encodeQueue.add(query, lbl_source.Text, text_destination.Text);\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
\r
}\r
else\r
- encodeQueue.add(query, lbl_source.Text, text_destination.Text);\r
+ encodeQueue.AddJob(query, sourcePath, text_destination.Text);\r
\r
queueWindow.Show();\r
}\r
}\r
private void tb_preview_Click(object sender, EventArgs e)\r
{\r
- if (lbl_source.Text == "" || lbl_source.Text == "Click 'Source' to continue" || text_destination.Text == "")\r
- MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ if (string.IsNullOrEmpty(sourcePath) || string.IsNullOrEmpty(text_destination.Text))\r
+ MessageBox.Show("No source or destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
else\r
{\r
if (qtpreview == null)\r
private void btn_ActivityWindow_Click(object sender, EventArgs e)\r
{\r
String file = lastAction == "scan" ? "last_scan_log.txt" : "last_encode_log.txt";\r
+ if (ActivityWindow == null)\r
+ ActivityWindow = new frmActivityWindow(file, encodeQueue, this);\r
\r
- frmActivityWindow ActivityWindow = new frmActivityWindow(file, encodeQueue, this);\r
ActivityWindow.Show();\r
}\r
#endregion\r
//Source\r
private void btn_dvd_source_Click(object sender, EventArgs e)\r
{\r
- // Enable the creation of chapter markers.\r
- Check_ChapterMarkers.Enabled = true;\r
-\r
- // Set the last action to scan. \r
- // This is used for tracking which file to load in the activity window\r
- lastAction = "scan";\r
- lbl_source.Text = "";\r
-\r
if (DVD_Open.ShowDialog() == DialogResult.OK)\r
- {\r
- String filename = DVD_Open.SelectedPath;\r
-\r
- if (filename.StartsWith("\\"))\r
- 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);\r
- else\r
- {\r
- if (filename != "")\r
- {\r
- lbl_source.Text = Path.GetFullPath(filename);\r
- setupGUIforScan(filename);\r
- startScan(filename);\r
- }\r
- else\r
- lbl_source.Text = "Click 'Source' to continue";\r
- }\r
- }\r
+ selectSource(DVD_Open.SelectedPath, 1);\r
else\r
- lbl_source.Text = "Click 'Source' to continue";\r
+ UpdateSourceLabel();\r
}\r
private void btn_file_source_Click(object sender, EventArgs e)\r
{\r
- // Set the last action to scan. \r
- // This is used for tracking which file to load in the activity window\r
- lastAction = "scan";\r
- lbl_source.Text = "";\r
-\r
if (ISO_Open.ShowDialog() == DialogResult.OK)\r
- {\r
- String filename = ISO_Open.FileName;\r
- if (filename.StartsWith("\\"))\r
- MessageBox.Show(\r
- "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",\r
- "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- else\r
- {\r
- if (filename != "")\r
- {\r
- lbl_source.Text = Path.GetFileName(filename);\r
- setupGUIforScan(filename);\r
- startScan(filename);\r
- }\r
- else\r
- lbl_source.Text = "Click 'Source' to continue";\r
- }\r
- }\r
+ selectSource(ISO_Open.FileName, 2);\r
else\r
- lbl_source.Text = "Click 'Source' to continue";\r
+ UpdateSourceLabel();\r
}\r
private void mnu_dvd_drive_Click(object sender, EventArgs e)\r
{\r
- // Enable the creation of chapter markers.\r
+ if (!mnu_dvd_drive.Text.Contains("VIDEO_TS")) return;\r
+ string[] path = mnu_dvd_drive.Text.Split(' ');\r
+ selectSource(path[0], 3);\r
+ }\r
+ private void selectSource(string file, int type)\r
+ {\r
Check_ChapterMarkers.Enabled = true;\r
-\r
- // Set the last action to scan. \r
- // This is used for tracking which file to load in the activity window\r
lastAction = "scan";\r
+ sourcePath = string.Empty;\r
\r
- if (mnu_dvd_drive.Text.Contains("VIDEO_TS"))\r
+ if (file == string.Empty) // Must have a file or path\r
{\r
- string[] path = mnu_dvd_drive.Text.Split(' ');\r
- String filename = path[0];\r
- lbl_source.Text = Path.GetFullPath(filename);\r
- setupGUIforScan(filename);\r
- startScan(filename);\r
+ UpdateSourceLabel();\r
+ return;\r
}\r
\r
- // If there are no titles in the dropdown menu then the scan has obviously failed. Display an error message explaining to the user.\r
- if (drp_dvdtitle.Items.Count == 0)\r
- 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);\r
+ if (file.StartsWith("\\")) // NO UNC Paths\r
+ {\r
+ MessageBox.Show(\r
+ "Sorry, HandBrake does not support UNC file paths. \nTry mounting the share as a network drive in My Computer",\r
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
+ UpdateSourceLabel();\r
+ return;\r
+ }\r
\r
- lbl_encode.Text = "";\r
+ switch (type) // Start the scan\r
+ {\r
+ case 1: // btn_dvd_source_Click()\r
+ case 3: // mnu_dvd_drive_Click()\r
+ sourcePath = Path.GetFullPath(file);\r
+ startScan(file);\r
+ break;\r
+ case 2: // btn_file_source_Click()\r
+ sourcePath = Path.GetFileName(file);\r
+ startScan(file);\r
+ break;\r
+ }\r
}\r
private void drp_dvdtitle_Click(object sender, EventArgs e)\r
{\r
}\r
private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
- // Reset some values on the form\r
- PictureSettings.lbl_Aspect.Text = "Select a Title";\r
- //lbl_RecomendedCrop.Text = "Select a Title";\r
+ unRegisterPresetEventHandler();\r
+\r
+ PictureSettings.lbl_Aspect.Text = "Select a Title"; // Reset some values on the form\r
drop_chapterStart.Items.Clear();\r
drop_chapterFinish.Items.Clear();\r
\r
{\r
selectedTitle = drp_dvdtitle.SelectedItem as Title;\r
lbl_duration.Text = selectedTitle.Duration.ToString();\r
- PictureSettings.setComponentsAfterScan(selectedTitle); // Setup Picture Settings Tab Control\r
+ PictureSettings.Source = selectedTitle; // Setup Picture Settings Tab Control\r
\r
// Populate the Angles dropdown\r
drop_angle.Items.Clear();\r
Subtitles.drp_subtitleTracks.Items.Add("Foreign Audio Search (Bitmap)");\r
Subtitles.drp_subtitleTracks.Items.AddRange(selectedTitle.Subtitles.ToArray());\r
Subtitles.drp_subtitleTracks.SelectedIndex = 0;\r
+ Subtitles.setSubtitleTrackAuto();\r
}\r
\r
// Run the autoName & chapterNaming functions\r
if (Properties.Settings.Default.autoNaming)\r
{\r
- string autoPath = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, lbl_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
+ string autoPath = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, sourcePath, text_destination.Text, drop_format.SelectedIndex);\r
if (autoPath != null)\r
text_destination.Text = autoPath;\r
else\r
// Hack to force the redraw of the scrollbars which don't resize properly when the control is disabled.\r
data_chpt.Columns[0].Width = 166;\r
data_chpt.Columns[0].Width = 165;\r
+\r
+ registerPresetEventHandler();\r
}\r
- private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)\r
+ private void chapersChanged(object sender, EventArgs e)\r
{\r
- int c_start, c_end;\r
-\r
- if (drop_chapterFinish.Text == "Auto" && drop_chapterFinish.Items.Count != 0)\r
- drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;\r
-\r
- int.TryParse(drop_chapterStart.Text, out c_start);\r
- int.TryParse(drop_chapterFinish.Text, out c_end);\r
+ Control ctl = (Control) sender;\r
+ int chapterStart, chapterEnd;\r
+ int.TryParse(drop_chapterStart.Text, out chapterStart);\r
+ int.TryParse(drop_chapterFinish.Text, out chapterEnd);\r
\r
- if (c_end != 0)\r
+ switch (ctl.Name)\r
{\r
- if (c_start > c_end)\r
- drop_chapterFinish.Text = c_start.ToString();\r
- }\r
-\r
- lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
+ case "drop_chapterStart":\r
+ if (drop_chapterFinish.SelectedIndex == -1 && drop_chapterFinish.Items.Count != 0)\r
+ drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;\r
\r
- // Run the Autonaming function\r
- if (Properties.Settings.Default.autoNaming)\r
- text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, lbl_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
-\r
- // Disable chapter markers if only 1 chapter is selected.\r
- if (c_start == c_end)\r
- {\r
- Check_ChapterMarkers.Checked = false;\r
- Check_ChapterMarkers.Enabled = false;\r
- }\r
- else\r
- Check_ChapterMarkers.Enabled = true;\r
- }\r
- private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)\r
- {\r
- int c_start, c_end;\r
+ if (chapterEnd != 0)\r
+ if (chapterStart > chapterEnd)\r
+ drop_chapterFinish.Text = chapterStart.ToString();\r
+ break;\r
+ case "drop_chapterFinish":\r
+ if (drop_chapterStart.Items.Count >= 1 && drop_chapterStart.SelectedIndex == -1)\r
+ drop_chapterStart.SelectedIndex = 0;\r
\r
- if (drop_chapterStart.Text == "Auto" && drop_chapterStart.Items.Count >= 1)\r
- drop_chapterStart.SelectedIndex = 1;\r
+ if (chapterStart != 0)\r
+ if (chapterEnd < chapterStart)\r
+ drop_chapterFinish.Text = chapterStart.ToString();\r
\r
- int.TryParse(drop_chapterStart.Text, out c_start);\r
- int.TryParse(drop_chapterFinish.Text, out c_end);\r
+ // Add more rows to the Chapter menu if needed.\r
+ if (Check_ChapterMarkers.Checked)\r
+ {\r
+ int i = data_chpt.Rows.Count, finish = 0;\r
+ int.TryParse(drop_chapterFinish.Text, out finish);\r
\r
- if (c_start != 0)\r
- {\r
- if (c_end < c_start)\r
- drop_chapterFinish.Text = c_start.ToString();\r
+ while (i < finish)\r
+ {\r
+ int n = data_chpt.Rows.Add();\r
+ data_chpt.Rows[n].Cells[0].Value = (i + 1);\r
+ data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
+ data_chpt.Rows[n].Cells[0].ValueType = typeof(int);\r
+ data_chpt.Rows[n].Cells[1].ValueType = typeof(string);\r
+ i++;\r
+ }\r
+ }\r
+ break;\r
}\r
\r
- lbl_duration.Text = Main.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
+ // Update the Duration\r
+ lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();\r
\r
// Run the Autonaming function\r
if (Properties.Settings.Default.autoNaming)\r
- text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, lbl_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
-\r
- // Add more rows to the Chapter menu if needed.\r
- if (Check_ChapterMarkers.Checked)\r
- {\r
- int i = data_chpt.Rows.Count, finish = 0;\r
-\r
- if (drop_chapterFinish.Text != "Auto")\r
- int.TryParse(drop_chapterFinish.Text, out finish);\r
-\r
- while (i < finish)\r
- {\r
- int n = data_chpt.Rows.Add();\r
- data_chpt.Rows[n].Cells[0].Value = (i + 1);\r
- data_chpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);\r
- data_chpt.Rows[n].Cells[0].ValueType = typeof(int);\r
- data_chpt.Rows[n].Cells[1].ValueType = typeof(string);\r
- i++;\r
- }\r
- }\r
+ text_destination.Text = Main.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, sourcePath, text_destination.Text, drop_format.SelectedIndex);\r
\r
// Disable chapter markers if only 1 chapter is selected.\r
- if (c_start == c_end)\r
+ if (chapterStart == chapterEnd)\r
{\r
Check_ChapterMarkers.Checked = false;\r
Check_ChapterMarkers.Enabled = false;\r
}\r
else\r
- Check_ChapterMarkers.Enabled = true;\r
+ Check_ChapterMarkers.Enabled = true; \r
}\r
\r
//Destination\r
DVD_Save.FilterIndex = 1;\r
else if (drop_format.SelectedIndex.Equals(1))\r
DVD_Save.FilterIndex = 2;\r
- else if (drop_format.SelectedIndex.Equals(2))\r
- DVD_Save.FilterIndex = 3;\r
\r
if (DVD_Save.ShowDialog() == DialogResult.OK)\r
{\r
{\r
case 1:\r
if (!Path.GetExtension(DVD_Save.FileName).Equals(".mp4", StringComparison.InvariantCultureIgnoreCase))\r
- DVD_Save.FileName += ".mp4";\r
+ if (Properties.Settings.Default.useM4v)\r
+ DVD_Save.FileName += ".m4v";\r
+ else\r
+ DVD_Save.FileName += ".mp4";\r
break;\r
case 2:\r
- if (!Path.GetExtension(DVD_Save.FileName).Equals(".m4v", StringComparison.InvariantCultureIgnoreCase))\r
- DVD_Save.FileName += ".m4v";\r
- break;\r
- case 3:\r
if (!Path.GetExtension(DVD_Save.FileName).Equals(".mkv", StringComparison.InvariantCultureIgnoreCase))\r
DVD_Save.FileName += ".mkv";\r
break;\r
text_destination.Text = DVD_Save.FileName;\r
\r
// Quicktime requires .m4v file for chapter markers to work. If checked, change the extension to .m4v (mp4 and m4v are the same thing)\r
- if (Check_ChapterMarkers.Checked)\r
- drop_format.SelectedIndex = 1;\r
+ if (Check_ChapterMarkers.Checked && DVD_Save.FilterIndex != 2)\r
+ setExtension(".m4v");\r
}\r
}\r
}\r
private void text_destination_TextChanged(object sender, EventArgs e)\r
{\r
string path = text_destination.Text;\r
- if (path.EndsWith(".mp4"))\r
+ if (path.EndsWith(".mp4") || path.EndsWith(".m4v"))\r
drop_format.SelectedIndex = 0;\r
- else if (path.EndsWith(".m4v"))\r
- drop_format.SelectedIndex = 1;\r
else if (path.EndsWith(".mkv"))\r
- drop_format.SelectedIndex = 2;\r
+ drop_format.SelectedIndex = 1;\r
}\r
\r
// Output Settings\r
switch (drop_format.SelectedIndex)\r
{\r
case 0:\r
- setExtension(".mp4");\r
+ if (Properties.Settings.Default.useM4v)\r
+ setExtension(".m4v");\r
+ else\r
+ setExtension(".mp4");\r
break;\r
case 1:\r
- setExtension(".m4v");\r
- break;\r
- case 2:\r
setExtension(".mkv");\r
break;\r
}\r
slider_videoQuality.Minimum = 0;\r
slider_videoQuality.TickFrequency = 1;\r
\r
+ CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
double multiplier = 1.0 / Properties.Settings.Default.x264cqstep;\r
- double value = slider_videoQuality.Value*multiplier;\r
- \r
- switch (Properties.Settings.Default.x264cqstep.ToString())\r
+ double value = slider_videoQuality.Value * multiplier;\r
+\r
+ switch (Properties.Settings.Default.x264cqstep.ToString(culture))\r
{\r
case "0.20":\r
slider_videoQuality.Maximum = 255;\r
SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);\r
break;\r
case "H.264 (x264)":\r
- double divided = Properties.Settings.Default.x264cqstep;\r
- rfValue = 51.0 - slider_videoQuality.Value * divided;\r
- max = slider_videoQuality.Maximum * divided;\r
+ rfValue = 51.0 - slider_videoQuality.Value * Properties.Settings.Default.x264cqstep;\r
+ max = slider_videoQuality.Maximum * Properties.Settings.Default.x264cqstep;\r
min = slider_videoQuality.Minimum;\r
val = ((max - min) - (rfValue - min)) / (max - min);\r
rfValue = Math.Round(rfValue, 2);\r
{\r
if (Check_ChapterMarkers.Checked)\r
{\r
- drop_format.SelectedIndex = 1;\r
+ if (drop_format.SelectedIndex != 1)\r
+ setExtension(".m4v");\r
data_chpt.Rows.Clear();\r
data_chpt.Enabled = true;\r
+ btn_importChapters.Enabled = true;\r
DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text);\r
if (chapterGridView != null)\r
data_chpt = chapterGridView;\r
}\r
else\r
{\r
- drop_format.SelectedIndex = 0;\r
+ if (drop_format.SelectedIndex != 1 && !Properties.Settings.Default.useM4v)\r
+ setExtension(".mp4");\r
data_chpt.Rows.Clear();\r
data_chpt.Enabled = false;\r
+ btn_importChapters.Enabled = false;\r
+ }\r
+ }\r
+ private void btn_importChapters_Click(object sender, EventArgs e)\r
+ {\r
+ if (File_ChapterImport.ShowDialog() == DialogResult.OK)\r
+ {\r
+ String filename = File_ChapterImport.FileName;\r
+ DataGridView imported = Main.importChapterNames(data_chpt, filename);\r
+ if (imported != null)\r
+ data_chpt = imported;\r
}\r
}\r
\r
// Query Editor Tab\r
private void btn_generate_Query_Click(object sender, EventArgs e)\r
{\r
- rtf_query.Text = queryGen.generateTheQuery(this);\r
+ rtf_query.Text = queryGen.generateCLIQuery(this, 0, null);\r
}\r
private void btn_clear_Click(object sender, EventArgs e)\r
{\r
#region Source Scan\r
public Boolean isScanning { get; set; }\r
private static int scanProcessID { get; set; }\r
- private void setupGUIforScan(String filename)\r
+ private void startScan(String filename)\r
{\r
+ // Setup the GUI components for the scan.\r
sourcePath = filename;\r
foreach (Control ctrl in Controls)\r
{\r
}\r
lbl_encode.Visible = true;\r
lbl_encode.Text = "Scanning ...";\r
- //gb_source.Text = "Source: Scanning ...";\r
btn_source.Enabled = false;\r
btn_start.Enabled = false;\r
btn_showQueue.Enabled = false;\r
btn_add2Queue.Enabled = false;\r
tb_preview.Enabled = false;\r
mnu_killCLI.Visible = true;\r
- }\r
- private void startScan(String filename)\r
- {\r
+\r
+ // Start hte Scan Thread\r
try\r
{\r
- lbl_encode.Visible = true;\r
- lbl_encode.Text = "Scanning...";\r
+ if (ActivityWindow != null)\r
+ ActivityWindow.setLogView(true);\r
isScanning = true;\r
- ThreadPool.QueueUserWorkItem(scanProcess, filename);\r
+ ThreadPool.QueueUserWorkItem(scanProcess);\r
}\r
catch (Exception exc)\r
{\r
{\r
try\r
{\r
- string inputFile = (string)state;\r
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");\r
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
string dvdInfoPath = Path.Combine(logDir, "last_scan_log.txt");\r
String dvdnav = string.Empty;\r
if (Properties.Settings.Default.dvdnav)\r
dvdnav = " --dvdnav";\r
- string strCmdLine = String.Format(@"cmd /c """"{0}"" -i ""{1}"" -t0 {2} -v >""{3}"" 2>&1""", handbrakeCLIPath, inputFile, dvdnav, dvdInfoPath);\r
+ string strCmdLine = String.Format(@"cmd /c """"{0}"" -i ""{1}"" -t0 {2} -v >""{3}"" 2>&1""", handbrakeCLIPath, sourcePath, dvdnav, dvdInfoPath);\r
\r
ProcessStartInfo hbParseDvd = new ProcessStartInfo("CMD.exe", strCmdLine) { WindowStyle = ProcessWindowStyle.Hidden };\r
\r
using (hbproc = Process.Start(hbParseDvd))\r
{\r
Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
- scanProcessID = Main.getCliProcess(before); \r
+ scanProcessID = Main.getCliProcess(before);\r
hbproc.WaitForExit();\r
if (hbproc.ExitCode != 0)\r
cleanExit = false;\r
if (cleanExit) // If 0 exit code, CLI exited cleanly.\r
{\r
if (!File.Exists(dvdInfoPath))\r
- {\r
- throw new Exception(\r
- "Unable to retrieve the DVD Info. last_scan_log.txt is missing. \nExpected location of last_scan_log.txt: \n" +\r
- dvdInfoPath);\r
- }\r
+ throw new Exception("Unable to retrieve the DVD Info. last_scan_log.txt is missing. \nExpected location of last_scan_log.txt: \n"\r
+ + dvdInfoPath);\r
\r
using (StreamReader sr = new StreamReader(dvdInfoPath))\r
{\r
drp_dvdtitle.Items.Clear();\r
if (thisDVD.Titles.Count != 0)\r
drp_dvdtitle.Items.AddRange(thisDVD.Titles.ToArray());\r
- drp_dvdtitle.Text = "Automatic";\r
- drop_chapterFinish.Text = "Auto";\r
- drop_chapterStart.Text = "Auto";\r
\r
// Now select the longest title\r
if (thisDVD.Titles.Count != 0)\r
- drp_dvdtitle.SelectedItem = Main.selectLongestTitle(drp_dvdtitle);\r
+ drp_dvdtitle.SelectedItem = Main.selectLongestTitle(thisDVD);\r
\r
// Enable the creation of chapter markers if the file is an image of a dvd.\r
- if (lbl_source.Text.ToLower().Contains(".iso") || lbl_source.Text.ToLower().Contains("VIDEO_TS"))\r
+ if (sourcePath.ToLower().Contains(".iso") || sourcePath.Contains("VIDEO_TS"))\r
Check_ChapterMarkers.Enabled = true;\r
else\r
{\r
\r
// If no titles were found, Display an error message\r
if (drp_dvdtitle.Items.Count == 0)\r
- 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).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+ {\r
+ MessageBox.Show(\r
+ "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).",\r
+ "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+ sourcePath = string.Empty;\r
+ }\r
+ UpdateSourceLabel();\r
\r
// Enable the GUI components and enable any disabled components\r
enableGUI();\r
if (InvokeRequired)\r
BeginInvoke(new UpdateWindowHandler(enableGUI));\r
lbl_encode.Text = "Scan Completed";\r
- //gb_source.Text = "Source";\r
foreach (Control ctrl in Controls)\r
ctrl.Enabled = true;\r
btn_start.Enabled = true;\r
private void resetGUI()\r
{\r
drp_dvdtitle.Items.Clear();\r
- drp_dvdtitle.Text = "Automatic";\r
drop_chapterStart.Items.Clear();\r
- drop_chapterStart.Text = "Auto";\r
drop_chapterFinish.Items.Clear();\r
- drop_chapterFinish.Text = "Auto";\r
lbl_duration.Text = "Select a Title";\r
PictureSettings.lbl_src_res.Text = "Select a Title";\r
PictureSettings.lbl_Aspect.Text = "Select a Title";\r
- lbl_source.Text = "Click 'Source' to continue";\r
- text_destination.Text = "";\r
+ sourcePath = String.Empty;\r
+ text_destination.Text = String.Empty;\r
thisDVD = null;\r
selectedTitle = null;\r
isScanning = false;\r
}\r
+ private void UpdateSourceLabel()\r
+ {\r
+ labelSource.Text = string.IsNullOrEmpty(sourcePath) ? "Select \"Source\" to continue." : Path.GetFileName(sourcePath);\r
+ }\r
#endregion\r
\r
#region GUI\r
#endregion\r
\r
#region DVD Drive Detection\r
- private delegate void ProgressUpdateHandler();\r
private void getDriveInfoThread()\r
{\r
try\r
{\r
if (InvokeRequired)\r
{\r
- BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));\r
+ BeginInvoke(new UpdateWindowHandler(getDriveInfoThread));\r
return;\r
}\r
\r
{\r
if (presetHandler.checkIfPresetsAreOutOfDate())\r
if (!Properties.Settings.Default.presetNotification)\r
- MessageBox.Show(this,\r
+ MessageBox.Show(splash,\r
"HandBrake has determined your built-in presets are out of date... These presets will now be updated.",\r
"Preset Update", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
\r
presetHandler.getPresetPanel(ref treeView_presets);\r
treeView_presets.Update();\r
}\r
-\r
- /// <summary>\r
- /// Either Encode or Scan was last performed.\r
- /// </summary>\r
- public string lastAction { get; set; }\r
#endregion\r
\r
#region Overrides\r
protected override void OnFormClosing(FormClosingEventArgs e)\r
{\r
// If currently encoding, the queue isn't paused, and there are queue items to process, prompt to confirm close.\r
- if ((encodeQueue.isEncoding) && (!encodeQueue.isPaused) && (encodeQueue.count() > 0))\r
+ if ((encodeQueue.isEncoding) && (!encodeQueue.PauseRequested) && (encodeQueue.Count > 0))\r
{\r
DialogResult result = MessageBox.Show("HandBrake has queue items to process. Closing HandBrake will not stop the current encoding, but will stop processing the queue.\n\nDo you want to close HandBrake?",\r
"Close HandBrake?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
#endregion\r
\r
#region In-GUI Encode Status (Experimental)\r
- \r
private void encodeMonitorThread()\r
{\r
try\r
{\r
- Parser encode = new Parser(encodeQueue.encodeHandler.hbProcess.StandardOutput.BaseStream);\r
+ Parser encode = new Parser(encodeQueue.hbProcess.StandardOutput.BaseStream);\r
encode.OnEncodeProgress += encodeOnEncodeProgress;\r
while (!encode.EndOfStream)\r
- {\r
encode.readEncodeStatus();\r
- }\r
}\r
catch (Exception exc)\r
{\r
- MessageBox.Show(exc.ToString());\r
+ MessageBox.Show(exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
private void encodeOnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)\r