\r
[global::System.Configuration.UserScopedSettingAttribute()]\r
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
- [global::System.Configuration.DefaultSettingValueAttribute("T:\\\\Program Files\\\\VideoLAN\\\\vlc\\\\vlc.exe")]\r
+ [global::System.Configuration.DefaultSettingValueAttribute("T:\\Program Files\\VideoLAN\\vlc\\vlc.exe")]\r
public string VLC_Path {\r
get {\r
return ((string)(this["VLC_Path"]));\r
<Value Profile="(Default)" />\r
</Setting>\r
<Setting Name="VLC_Path" Type="System.String" Scope="User">\r
- <Value Profile="(Default)">T:\\Program Files\\VideoLAN\\vlc\\vlc.exe</Value>\r
+ <Value Profile="(Default)">T:\Program Files\VideoLAN\vlc\vlc.exe</Value>\r
</Setting>\r
<Setting Name="MainWindowMinimize" Type="System.String" Scope="User">\r
<Value Profile="(Default)">Checked</Value>\r
<value />\r
</setting>\r
<setting name="VLC_Path" serializeAs="String">\r
- <value>T:\\Program Files\\VideoLAN\\vlc\\vlc.exe</value>\r
+ <value>T:\Program Files\VideoLAN\vlc\vlc.exe</value>\r
</setting>\r
<setting name="MainWindowMinimize" serializeAs="String">\r
<value>Checked</value>\r
\r
public frmMain()\r
{\r
- // Load the splash screen in this thread\r
- Form splash = new frmSplashScreen();\r
- splash.Show();\r
-\r
- //Create a label that can be updated from the parent thread.\r
- Label lblStatus = new Label();\r
- lblStatus.Size = new Size(250, 20);\r
- lblStatus.Location = new Point(10, 280);\r
- splash.Controls.Add(lblStatus);\r
- InitializeComponent();\r
-\r
- // Update the users config file with the CLI version data.\r
- lblStatus.Text = "Setting Version Data ...";\r
- Application.DoEvents();\r
- ArrayList x = hb_common_func.getCliVersionData();\r
- Properties.Settings.Default.hb_build = int.Parse(x[1].ToString());\r
- Properties.Settings.Default.hb_version = x[0].ToString();\r
-\r
- // show the form, but leave disabled until preloading is complete then show the main form\r
- this.Enabled = false;\r
- this.Show();\r
- Application.DoEvents(); // Forces frmMain to draw\r
-\r
- // update the status\r
- if (Properties.Settings.Default.updateStatus == "Checked")\r
- {\r
- lblStatus.Text = "Checking for updates ...";\r
+ try\r
+ {\r
+ // Load the splash screen in this thread\r
+ Form splash = new frmSplashScreen();\r
+ splash.Show();\r
+\r
+ //Create a label that can be updated from the parent thread.\r
+ Label lblStatus = new Label();\r
+ lblStatus.Size = new Size(250, 20);\r
+ lblStatus.Location = new Point(10, 280);\r
+ splash.Controls.Add(lblStatus);\r
+ InitializeComponent();\r
+\r
+ // Update the users config file with the CLI version data.\r
+ lblStatus.Text = "Setting Version Data ...";\r
Application.DoEvents();\r
- Thread updateCheckThread = new Thread(startupUpdateCheck);\r
- updateCheckThread.Start();\r
- }\r
+ ArrayList x = hb_common_func.getCliVersionData();\r
+ Properties.Settings.Default.hb_build = int.Parse(x[1].ToString());\r
+ Properties.Settings.Default.hb_version = x[0].ToString();\r
\r
- // Setup the GUI components\r
- lblStatus.Text = "Setting up the GUI ...";\r
- Application.DoEvents();\r
- x264PanelFunctions.reset2Defaults(this); // Initialize all the x264 widgets to their default values\r
- loadPresetPanel(); // Load the Preset Panel\r
- treeView_presets.ExpandAll();\r
- lbl_encode.Text = "";\r
- queueWindow = new frmQueue(this); // Prepare the Queue\r
+ // show the form, but leave disabled until preloading is complete then show the main form\r
+ this.Enabled = false;\r
+ this.Show();\r
+ Application.DoEvents(); // Forces frmMain to draw\r
\r
- // Load the user's default settings or Normal Preset\r
- if (Properties.Settings.Default.defaultSettings == "Checked" && Properties.Settings.Default.defaultUserSettings != "")\r
- {\r
- Functions.QueryParser presetQuery = Functions.QueryParser.Parse(Properties.Settings.Default.defaultUserSettings);\r
- presetLoader.presetLoader(this, presetQuery, "User Defaults ");\r
- }\r
- else\r
- loadNormalPreset();\r
+ // update the status\r
+ if (Properties.Settings.Default.updateStatus == "Checked")\r
+ {\r
+ lblStatus.Text = "Checking for updates ...";\r
+ Application.DoEvents();\r
+ Thread updateCheckThread = new Thread(startupUpdateCheck);\r
+ updateCheckThread.Start();\r
+ }\r
\r
- // Enabled GUI tooltip's if Required\r
- if (Properties.Settings.Default.tooltipEnable == "Checked")\r
- ToolTip.Active = true;\r
+ // Setup the GUI components\r
+ lblStatus.Text = "Setting up the GUI ...";\r
+ Application.DoEvents();\r
+ x264PanelFunctions.reset2Defaults(this); // Initialize all the x264 widgets to their default values\r
+ loadPresetPanel(); // Load the Preset Panel\r
+ treeView_presets.ExpandAll();\r
+ lbl_encode.Text = "";\r
+ queueWindow = new frmQueue(this); // Prepare the Queue\r
\r
- //Finished Loading\r
- lblStatus.Text = "Loading Complete!";\r
- Application.DoEvents();\r
- splash.Close();\r
- splash.Dispose();\r
- this.Enabled = true;\r
+ // Load the user's default settings or Normal Preset\r
+ if (Properties.Settings.Default.defaultSettings == "Checked" && Properties.Settings.Default.defaultUserSettings != "")\r
+ {\r
+ Functions.QueryParser presetQuery = Functions.QueryParser.Parse(Properties.Settings.Default.defaultUserSettings);\r
+ presetLoader.presetLoader(this, presetQuery, "User Defaults ");\r
+ }\r
+ else\r
+ loadNormalPreset();\r
\r
- // Event Handlers\r
- if (Properties.Settings.Default.MainWindowMinimize == "Checked")\r
- this.Resize += new EventHandler(frmMain_Resize);\r
+ // Enabled GUI tooltip's if Required\r
+ if (Properties.Settings.Default.tooltipEnable == "Checked")\r
+ ToolTip.Active = true;\r
\r
- // Queue Recovery\r
- queueRecovery();\r
+ //Finished Loading\r
+ lblStatus.Text = "Loading Complete!";\r
+ Application.DoEvents();\r
+ splash.Close();\r
+ splash.Dispose();\r
+ this.Enabled = true;\r
+\r
+ // Event Handlers\r
+ if (Properties.Settings.Default.MainWindowMinimize == "Checked")\r
+ this.Resize += new EventHandler(frmMain_Resize);\r
+\r
+ // Queue Recovery\r
+ queueRecovery();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ MessageBox.Show("Error at startup: \n\n" + e);\r
+ }\r
}\r
\r
// Startup Functions\r
}\r
private void btn_start_Click(object sender, EventArgs e)\r
{\r
- if (text_source.Text == string.Empty || text_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 (btn_start.Text == "Stop")\r
+ {\r
+ DialogResult result = MessageBox.Show("Are you sure you wish to cancel the encode? Please note that this may break the encoded file. \nTo safely cancel your encode, press ctrl-c on your keyboard in the CLI window. This *may* allow you to preview your encoded content.", "Cancel Encode?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
+\r
+ if (result == DialogResult.Yes)\r
+ {\r
+ queueWindow.frmMain_cancelEncode();\r
+ if (!queueWindow.isEncoding())\r
+ setEncodeStatus(0);\r
+ }\r
+ }\r
else\r
{\r
- // Set the last action to encode. \r
- // This is used for tracking which file to load in the activity window\r
- lastAction = "encode";\r
+ if (encodeQueue.count() != 0 || (text_source.Text != string.Empty && text_source.Text != "Click 'Source' to continue" && text_destination.Text != string.Empty))\r
+ {\r
+ // Set the last action to encode. \r
+ // This is used for tracking which file to load in the activity window\r
+ lastAction = "encode";\r
\r
- String query;\r
- if (rtf_query.Text != "")\r
- query = rtf_query.Text;\r
- else\r
- query = queryGen.GenerateTheQuery(this);\r
+ String query;\r
+ if (rtf_query.Text != "")\r
+ query = rtf_query.Text;\r
+ else\r
+ query = queryGen.GenerateTheQuery(this);\r
\r
- if (encodeQueue.count() == 0)\r
- {\r
- encodeQueue.add(query, text_source.Text, text_destination.Text);\r
- encodeQueue.write2disk("hb_queue_recovery.xml");\r
+ if (encodeQueue.count() == 0)\r
+ {\r
+ encodeQueue.add(query, text_source.Text, text_destination.Text);\r
+ encodeQueue.write2disk("hb_queue_recovery.xml");\r
+ }\r
+ queueWindow.setQueue(encodeQueue);\r
+ if (encodeQueue.count() > 1)\r
+ queueWindow.Show();\r
+\r
+ queueWindow.frmMain_encode();\r
+\r
+ setEncodeStatus(1); // Encode is running, so setup the GUI appropriately\r
}\r
- queueWindow.setQueue(encodeQueue);\r
- queueWindow.Show();\r
- queueWindow.frmMain_encode();\r
+ else if (text_source.Text == string.Empty || text_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
\r
- setEncodeStatus(1); // Encode is running, so setup the GUI appropriately\r
}\r
}\r
private void btn_add2Queue_Click(object sender, EventArgs e)\r
\r
#endregion\r
\r
-\r
-\r
-\r
// This is the END of the road ------------------------------------------------------------------------------\r
}\r
}
\ No newline at end of file
this.Audio = new System.Windows.Forms.ColumnHeader();\r
this.statusStrip1 = new System.Windows.Forms.StatusStrip();\r
this.lbl_encodesPending = new System.Windows.Forms.ToolStripStatusLabel();\r
- this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();\r
- this.progressBar = new System.Windows.Forms.ToolStripProgressBar();\r
- this.lbl_progressValue = new System.Windows.Forms.ToolStripStatusLabel();\r
this.OpenFile = new System.Windows.Forms.OpenFileDialog();\r
this.splitContainer1 = new System.Windows.Forms.SplitContainer();\r
this.panel3 = new System.Windows.Forms.Panel();\r
this.list_queue.Location = new System.Drawing.Point(15, 0);\r
this.list_queue.MultiSelect = false;\r
this.list_queue.Name = "list_queue";\r
- this.list_queue.Size = new System.Drawing.Size(749, 210);\r
+ this.list_queue.Size = new System.Drawing.Size(749, 219);\r
this.list_queue.TabIndex = 72;\r
this.list_queue.UseCompatibleStateImageBehavior = false;\r
this.list_queue.View = System.Windows.Forms.View.Details;\r
// statusStrip1\r
// \r
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {\r
- this.lbl_encodesPending,\r
- this.toolStripStatusLabel1,\r
- this.progressBar,\r
- this.lbl_progressValue});\r
- this.statusStrip1.Location = new System.Drawing.Point(0, 359);\r
+ this.lbl_encodesPending});\r
+ this.statusStrip1.Location = new System.Drawing.Point(0, 368);\r
this.statusStrip1.Name = "statusStrip1";\r
- this.statusStrip1.Size = new System.Drawing.Size(779, 31);\r
+ this.statusStrip1.Size = new System.Drawing.Size(779, 22);\r
this.statusStrip1.TabIndex = 73;\r
this.statusStrip1.Text = "statusStrip1";\r
// \r
this.lbl_encodesPending.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\r
this.lbl_encodesPending.Margin = new System.Windows.Forms.Padding(0, 3, 10, 2);\r
this.lbl_encodesPending.Name = "lbl_encodesPending";\r
- this.lbl_encodesPending.Size = new System.Drawing.Size(122, 26);\r
+ this.lbl_encodesPending.Size = new System.Drawing.Size(122, 17);\r
this.lbl_encodesPending.Text = "0 encode(s) pending";\r
// \r
- // toolStripStatusLabel1\r
- // \r
- this.toolStripStatusLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;\r
- this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";\r
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(57, 26);\r
- this.toolStripStatusLabel1.Text = "Progress:";\r
- // \r
- // progressBar\r
- // \r
- this.progressBar.Name = "progressBar";\r
- this.progressBar.Size = new System.Drawing.Size(500, 25);\r
- this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;\r
- // \r
- // lbl_progressValue\r
- // \r
- this.lbl_progressValue.Name = "lbl_progressValue";\r
- this.lbl_progressValue.Size = new System.Drawing.Size(34, 26);\r
- this.lbl_progressValue.Text = " 0 %";\r
- // \r
// OpenFile\r
// \r
this.OpenFile.Filter = "HandBrake Queue|*.queue";\r
this.splitContainer1.Panel2.Controls.Add(this.panel3);\r
this.splitContainer1.Panel2.Controls.Add(this.panel2);\r
this.splitContainer1.Panel2.Controls.Add(this.panel1);\r
- this.splitContainer1.Size = new System.Drawing.Size(779, 320);\r
+ this.splitContainer1.Size = new System.Drawing.Size(779, 329);\r
this.splitContainer1.SplitterDistance = 94;\r
this.splitContainer1.SplitterWidth = 1;\r
this.splitContainer1.TabIndex = 74;\r
// panel3\r
// \r
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;\r
- this.panel3.Location = new System.Drawing.Point(15, 210);\r
+ this.panel3.Location = new System.Drawing.Point(15, 219);\r
this.panel3.Name = "panel3";\r
this.panel3.Size = new System.Drawing.Size(749, 15);\r
this.panel3.TabIndex = 77;\r
this.panel2.Dock = System.Windows.Forms.DockStyle.Right;\r
this.panel2.Location = new System.Drawing.Point(764, 0);\r
this.panel2.Name = "panel2";\r
- this.panel2.Size = new System.Drawing.Size(15, 225);\r
+ this.panel2.Size = new System.Drawing.Size(15, 234);\r
this.panel2.TabIndex = 76;\r
// \r
// panel1\r
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;\r
this.panel1.Location = new System.Drawing.Point(0, 0);\r
this.panel1.Name = "panel1";\r
- this.panel1.Size = new System.Drawing.Size(15, 225);\r
+ this.panel1.Size = new System.Drawing.Size(15, 234);\r
this.panel1.TabIndex = 75;\r
// \r
// frmQueue\r
private System.Windows.Forms.ColumnHeader EncoderVideo;\r
private System.Windows.Forms.ColumnHeader Audio;\r
private System.Windows.Forms.StatusStrip statusStrip1;\r
- private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;\r
- private System.Windows.Forms.ToolStripProgressBar progressBar;\r
- private System.Windows.Forms.ToolStripStatusLabel lbl_progressValue;\r
private System.Windows.Forms.ToolStripDropDownButton drop_button_queue;\r
private System.Windows.Forms.ToolStripMenuItem mnu_batch;\r
private System.Windows.Forms.ToolStripMenuItem mnu_import;\r
queue = qw;\r
redrawQueue();\r
lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
-\r
- // Recalculate the progress bar, but only if the queue has already started. \r
- if (progressBar.Value != 0)\r
- {\r
- progressBar.Value = 0;\r
- if (queue.count() == 0)\r
- progressBar.Step = 100;\r
- else\r
- progressBar.Step = 100 / queue.count();\r
- progressBar.PerformStep();\r
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);\r
- }\r
}\r
\r
/// <summary>\r
// Setup or reset some values\r
btn_encode.Enabled = false;\r
btn_stop.Visible = true;\r
- progressBar.Value = 0;\r
- lbl_progressValue.Text = "0 %";\r
- if (queue.count() == 0)\r
- progressBar.Step = 100;\r
- else\r
- progressBar.Step = 100 / queue.count();\r
+\r
Thread theQ = new Thread(startProc);\r
theQ.IsBackground = true;\r
theQ.Start();\r
}\r
}\r
\r
+ public void frmMain_cancelEncode()\r
+ {\r
+ Process[] aProc = Process.GetProcessesByName("HandBrakeCLI");\r
+ Process HandBrakeCLI;\r
+ if (aProc.Length > 0)\r
+ {\r
+ HandBrakeCLI = aProc[0];\r
+ HandBrakeCLI.Kill();\r
+ }\r
+ }\r
+\r
// Redraw's the queue with the latest data from the Queue class\r
private void redrawQueue()\r
{\r
// Setup or reset some values\r
btn_encode.Enabled = false;\r
btn_stop.Visible = true;\r
- progressBar.Value = 0;\r
- lbl_progressValue.Text = "0 %";\r
- if (queue.count() == 0)\r
- progressBar.Step = 100;\r
- else\r
- progressBar.Step = 100 / queue.count();\r
+\r
Thread theQ = new Thread(startProc);\r
theQ.IsBackground = true;\r
theQ.Start();\r
btn_stop.Visible = false;\r
btn_encode.Enabled = true;\r
\r
- if (cancel == true)\r
- {\r
- lbl_progressValue.Text = "Encode Queue Cancelled!";\r
- }\r
- else\r
- {\r
- lbl_progressValue.Text = "Encode Queue Completed!";\r
- }\r
-\r
- progressBar.Value = 0;\r
-\r
lbl_source.Text = "-";\r
lbl_dest.Text = "-";\r
lbl_vEnc.Text = "-";\r
}\r
\r
redrawQueue();\r
-\r
- progressBar.PerformStep();\r
- lbl_progressValue.Text = string.Format("{0} %", progressBar.Value);\r
lbl_encodesPending.Text = list_queue.Items.Count + " encode(s) pending";\r
}\r
catch (Exception exc)\r