summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2007-09-27 16:22:12 +0000
committersr55 <[email protected]>2007-09-27 16:22:12 +0000
commit00af0caeb53d4234c2120689e5cb9cc0ec2dffcd (patch)
treeca89eacd8e3e07556a4418b8104aae29e323d648 /win/C#
parente3c9a83c0fcc412d7ce0d41edd0d019e0badadfb (diff)
WinGui:
- File > Open + Save changed to buttons below the preset list. - Moved the System Requirements check to Program.cs ( Cleans things up alittle) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@996 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Functions/CLI.cs4
-rw-r--r--win/C#/Program.cs99
-rw-r--r--win/C#/frmMain.Designer.cs109
-rw-r--r--win/C#/frmMain.cs410
-rw-r--r--win/C#/frmMain.resx35
5 files changed, 300 insertions, 357 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs
index c98d64f47..30c8dd988 100644
--- a/win/C#/Functions/CLI.cs
+++ b/win/C#/Functions/CLI.cs
@@ -29,7 +29,9 @@ namespace Handbrake.Functions
hbProc.StartInfo.RedirectStandardError = stderr;
hbProc.StartInfo.UseShellExecute = useShellExec;
hbProc.StartInfo.CreateNoWindow = noWindow;
+ hbProc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; // Why doesn't this work??
hbProc.Start();
+
// Set the process Priority
switch (Properties.Settings.Default.processPriority)
@@ -53,6 +55,8 @@ namespace Handbrake.Functions
hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
break;
}
+
+
}
catch
{
diff --git a/win/C#/Program.cs b/win/C#/Program.cs
index 0a4e40b4e..87fad342d 100644
--- a/win/C#/Program.cs
+++ b/win/C#/Program.cs
@@ -1,6 +1,17 @@
using System;
using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
using System.Windows.Forms;
+using System.Net;
+using System.IO;
+using System.Diagnostics;
+using System.Threading;
+using System.Runtime.InteropServices;
+
namespace Handbrake
{
@@ -12,9 +23,91 @@ namespace Handbrake
[STAThread]
static void Main()
{
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new frmMain());
+
+ /* Some Code to allow development builds to expire.
+ *
+ * long start = DateTime.Now.Ticks;
+ * 633286573227430160 today was long end = DateTime.Now.AddDays(31).Ticks;
+ * if (start > 633286573227430160) { MessageBox.Show("Sorry, this Handbrake has expired"); return; }
+ *
+ */
+
+
+ // Check the system meets the system requirements.
+ Boolean launch = true;
+ try
+ {
+ // Make sure the screen resolution is not below 1024x768
+ System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;
+ if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 768))
+ {
+ MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Screen resolution is too Low. Must be 1024x768 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ launch = false;
+ }
+
+ // Make sure the system has enough RAM. 384MB or greater
+ uint memory = MemoryCheck.CheckMemeory();
+
+ if (memory < 319) // Set to 319 to allow for 64MB dedicated to video Memory and Windows returnig the memory figure slightly out.
+ {
+ MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Insufficient Memory. 384MB or greater required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ launch = false;
+ }
+ }
+ catch (Exception exc)
+ {
+ if (Properties.Settings.Default.GuiDebug == "Checked")
+ {
+ MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());
+ }
+ }
+
+
+ // Either Launch or Close the Application
+ if (launch == true)
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new frmMain());
+ }
+ else
+ {
+ Application.Exit();
+ }
+ }
+ }
+
+ class MemoryCheck
+ {
+ public struct MEMORYSTATUS
+ {
+ public UInt32 dwLength;
+ public UInt32 dwMemoryLoad;
+ public UInt32 dwTotalPhys; // Used
+ public UInt32 dwAvailPhys;
+ public UInt32 dwTotalPageFile;
+ public UInt32 dwAvailPageFile;
+ public UInt32 dwTotalVirtual;
+ public UInt32 dwAvailVirtual;
+ // Aditional Varibles left in for future usage (JIC)
+ }
+
+ [DllImport("kernel32.dll")]
+ public static extern void GlobalMemoryStatus
+ (
+ ref MEMORYSTATUS lpBuffer
+ );
+
+ public static uint CheckMemeory()
+ {
+ // Call the native GlobalMemoryStatus method
+ // with the defined structure.
+ MEMORYSTATUS memStatus = new MEMORYSTATUS();
+ GlobalMemoryStatus(ref memStatus);
+
+ uint MemoryInfo = memStatus.dwTotalPhys;
+
+ return MemoryInfo;
}
}
} \ No newline at end of file
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 3e9fc7b17..027a54839 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -64,9 +64,6 @@ namespace Handbrake
this.File_Open = new System.Windows.Forms.OpenFileDialog();
this.ISO_Open = new System.Windows.Forms.OpenFileDialog();
this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_open = new System.Windows.Forms.ToolStripMenuItem();
- this.mnu_save = new System.Windows.Forms.ToolStripMenuItem();
- this.ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.mnu_exit = new System.Windows.Forms.ToolStripMenuItem();
this.mnu_open3 = new System.Windows.Forms.ToolStripMenuItem();
this.ToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -175,9 +172,10 @@ namespace Handbrake
this.advancedOptions = new System.Windows.Forms.TabControl();
this.groupBox_dest = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.btn_removePreset = new System.Windows.Forms.Button();
this.ListBox_Presets = new System.Windows.Forms.ListBox();
+ this.btn_removePreset = new System.Windows.Forms.Button();
this.btn_addPreset = new System.Windows.Forms.Button();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
Label38 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();
this.frmMainMenu.SuspendLayout();
@@ -191,6 +189,7 @@ namespace Handbrake
this.advancedOptions.SuspendLayout();
this.groupBox_dest.SuspendLayout();
this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// Label38
@@ -572,7 +571,7 @@ namespace Handbrake
this.btn_setDefault.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_setDefault.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_setDefault.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_setDefault.Location = new System.Drawing.Point(113, 445);
+ this.btn_setDefault.Location = new System.Drawing.Point(110, 23);
this.btn_setDefault.Name = "btn_setDefault";
this.btn_setDefault.Size = new System.Drawing.Size(72, 22);
this.btn_setDefault.TabIndex = 107;
@@ -602,42 +601,15 @@ namespace Handbrake
// FileToolStripMenuItem
//
this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.mnu_open,
- this.mnu_save,
- this.ToolStripSeparator1,
this.mnu_exit});
this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
this.FileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
this.FileToolStripMenuItem.Text = "&File";
//
- // mnu_open
- //
- this.mnu_open.Image = ((System.Drawing.Image)(resources.GetObject("mnu_open.Image")));
- this.mnu_open.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.mnu_open.Name = "mnu_open";
- this.mnu_open.Size = new System.Drawing.Size(180, 22);
- this.mnu_open.Text = "&Open Profile";
- this.mnu_open.Click += new System.EventHandler(this.mnu_open_Click);
- //
- // mnu_save
- //
- this.mnu_save.Image = ((System.Drawing.Image)(resources.GetObject("mnu_save.Image")));
- this.mnu_save.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.mnu_save.Name = "mnu_save";
- this.mnu_save.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
- this.mnu_save.Size = new System.Drawing.Size(180, 22);
- this.mnu_save.Text = "&Save Profile";
- this.mnu_save.Click += new System.EventHandler(this.mnu_save_Click);
- //
- // ToolStripSeparator1
- //
- this.ToolStripSeparator1.Name = "ToolStripSeparator1";
- this.ToolStripSeparator1.Size = new System.Drawing.Size(177, 6);
- //
// mnu_exit
//
this.mnu_exit.Name = "mnu_exit";
- this.mnu_exit.Size = new System.Drawing.Size(180, 22);
+ this.mnu_exit.Size = new System.Drawing.Size(103, 22);
this.mnu_exit.Text = "E&xit";
this.mnu_exit.Click += new System.EventHandler(this.mnu_exit_Click);
//
@@ -1840,35 +1812,15 @@ namespace Handbrake
//
// groupBox2
//
- this.groupBox2.Controls.Add(this.btn_setDefault);
- this.groupBox2.Controls.Add(this.btn_removePreset);
this.groupBox2.Controls.Add(this.ListBox_Presets);
- this.groupBox2.Controls.Add(this.btn_addPreset);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox2.Location = new System.Drawing.Point(674, 35);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(193, 478);
+ this.groupBox2.Size = new System.Drawing.Size(193, 404);
this.groupBox2.TabIndex = 103;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Presets";
//
- // btn_removePreset
- //
- this.btn_removePreset.BackColor = System.Drawing.SystemColors.ControlLight;
- this.btn_removePreset.FlatAppearance.BorderColor = System.Drawing.Color.Black;
- this.btn_removePreset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btn_removePreset.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btn_removePreset.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_removePreset.Location = new System.Drawing.Point(52, 445);
- this.btn_removePreset.Name = "btn_removePreset";
- this.btn_removePreset.Size = new System.Drawing.Size(55, 22);
- this.btn_removePreset.TabIndex = 106;
- this.btn_removePreset.TabStop = false;
- this.btn_removePreset.Text = "Remove";
- this.btn_removePreset.UseVisualStyleBackColor = false;
- this.btn_removePreset.Visible = false;
- this.btn_removePreset.Click += new System.EventHandler(this.btn_removePreset_Click);
- //
// ListBox_Presets
//
this.ListBox_Presets.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1891,12 +1843,30 @@ namespace Handbrake
"PSP",
"QuickTime",
"Television"});
- this.ListBox_Presets.Location = new System.Drawing.Point(11, 19);
+ this.ListBox_Presets.Location = new System.Drawing.Point(11, 21);
this.ListBox_Presets.Name = "ListBox_Presets";
- this.ListBox_Presets.Size = new System.Drawing.Size(174, 420);
+ this.ListBox_Presets.Size = new System.Drawing.Size(174, 368);
this.ListBox_Presets.TabIndex = 104;
+ this.ToolTip.SetToolTip(this.ListBox_Presets, "To load a preset, simply click the preset you desire.");
this.ListBox_Presets.SelectedIndexChanged += new System.EventHandler(this.ListBox_Presets_SelectedIndexChanged);
//
+ // btn_removePreset
+ //
+ this.btn_removePreset.BackColor = System.Drawing.SystemColors.ControlLight;
+ this.btn_removePreset.FlatAppearance.BorderColor = System.Drawing.Color.Black;
+ this.btn_removePreset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btn_removePreset.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn_removePreset.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
+ this.btn_removePreset.Location = new System.Drawing.Point(59, 23);
+ this.btn_removePreset.Name = "btn_removePreset";
+ this.btn_removePreset.Size = new System.Drawing.Size(45, 22);
+ this.btn_removePreset.TabIndex = 106;
+ this.btn_removePreset.TabStop = false;
+ this.btn_removePreset.Text = "Save";
+ this.ToolTip.SetToolTip(this.btn_removePreset, "Save the current settings as a preset.");
+ this.btn_removePreset.UseVisualStyleBackColor = false;
+ this.btn_removePreset.Click += new System.EventHandler(this.btn_removePreset_Click);
+ //
// btn_addPreset
//
this.btn_addPreset.BackColor = System.Drawing.SystemColors.ControlLight;
@@ -1904,22 +1874,36 @@ namespace Handbrake
this.btn_addPreset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_addPreset.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_addPreset.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.btn_addPreset.Location = new System.Drawing.Point(11, 445);
+ this.btn_addPreset.Location = new System.Drawing.Point(8, 23);
this.btn_addPreset.Name = "btn_addPreset";
- this.btn_addPreset.Size = new System.Drawing.Size(35, 22);
+ this.btn_addPreset.Size = new System.Drawing.Size(45, 22);
this.btn_addPreset.TabIndex = 105;
this.btn_addPreset.TabStop = false;
- this.btn_addPreset.Text = "Add";
+ this.btn_addPreset.Text = "Open";
+ this.ToolTip.SetToolTip(this.btn_addPreset, "Open a preset which you have saved.");
this.btn_addPreset.UseVisualStyleBackColor = false;
- this.btn_addPreset.Visible = false;
this.btn_addPreset.Click += new System.EventHandler(this.btn_addPreset_Click);
//
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.btn_removePreset);
+ this.groupBox3.Controls.Add(this.btn_setDefault);
+ this.groupBox3.Controls.Add(this.btn_addPreset);
+ this.groupBox3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.groupBox3.Location = new System.Drawing.Point(674, 448);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(193, 61);
+ this.groupBox3.TabIndex = 108;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Preset Functions";
+ //
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.ClientSize = new System.Drawing.Size(873, 564);
+ this.Controls.Add(this.groupBox3);
this.Controls.Add(this.btn_presets);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox_dest);
@@ -1959,6 +1943,7 @@ namespace Handbrake
this.groupBox_dest.ResumeLayout(false);
this.groupBox_dest.PerformLayout();
this.groupBox2.ResumeLayout(false);
+ this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -1972,8 +1957,6 @@ namespace Handbrake
internal System.Windows.Forms.OpenFileDialog ISO_Open;
internal System.Windows.Forms.ToolStripMenuItem FileToolStripMenuItem;
internal System.Windows.Forms.ToolStripMenuItem mnu_open3;
- internal System.Windows.Forms.ToolStripMenuItem mnu_save;
- internal System.Windows.Forms.ToolStripSeparator ToolStripSeparator1;
internal System.Windows.Forms.ToolStripMenuItem mnu_exit;
internal System.Windows.Forms.ToolStripMenuItem ToolsToolStripMenuItem;
internal System.Windows.Forms.ToolStripMenuItem mnu_encode;
@@ -2087,7 +2070,6 @@ namespace Handbrake
internal System.Windows.Forms.TabControl advancedOptions;
internal System.Windows.Forms.Label Label46;
internal System.Windows.Forms.FolderBrowserDialog DVD_Open;
- private System.Windows.Forms.ToolStripMenuItem mnu_open;
private System.Windows.Forms.GroupBox groupBox_dest;
internal System.Windows.Forms.ComboBox drp_subtitle;
internal System.Windows.Forms.Label Label19;
@@ -2113,6 +2095,7 @@ namespace Handbrake
private System.Windows.Forms.ToolStripMenuItem mnu_SelectDefault;
private System.Windows.Forms.ToolStripMenuItem mnu_UpdateCheck;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
+ private System.Windows.Forms.GroupBox groupBox3;
}
} \ No newline at end of file
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index ff1ec3b67..4c3fdab13 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -29,7 +29,6 @@ namespace Handbrake
private frmQueue queueWindow = new frmQueue();
//private frmDvdInfo dvdInfoWindow = new frmDvdInfo();
-
public frmMain()
{
@@ -43,9 +42,6 @@ namespace Handbrake
//dvdInfoWindow.Hide();
// **********************************************************************************************
- // System Requirements Check
- systemCheck();
-
// Set the Version number lable to the corect version.
Version.Text = "Version " + Properties.Settings.Default.GuiVersion;
@@ -61,7 +57,6 @@ namespace Handbrake
// Enable or disable tooltips
tooltip();
-
// Hide the presets part of the window
this.Width = 590;
@@ -72,13 +67,8 @@ namespace Handbrake
myCol.AddRange(myArr);
Properties.Settings.Default.BuiltInPresets = myCol;
-
-
}
- // Functions to preform tasks required on startup.
- #region Initializeation Functions
-
private void showSplash(object sender)
{
Form splash = new frmSplashScreen();
@@ -183,7 +173,6 @@ namespace Handbrake
}
}
- // This is a re-usable function.
private Boolean updateCheck()
{
try
@@ -235,88 +224,6 @@ namespace Handbrake
}
}
- #region Memory Check
-
- public struct MEMORYSTATUS
- {
- public UInt32 dwLength;
- public UInt32 dwMemoryLoad;
- public UInt32 dwTotalPhys; // Used
- public UInt32 dwAvailPhys;
- public UInt32 dwTotalPageFile;
- public UInt32 dwAvailPageFile;
- public UInt32 dwTotalVirtual;
- public UInt32 dwAvailVirtual;
- // Aditional Varibles left in for future usage (JIC)
- }
-
- [DllImport("kernel32.dll")]
- public static extern void GlobalMemoryStatus
- (
- ref MEMORYSTATUS lpBuffer
- );
-
- public uint CheckMemeory()
- {
- // Call the native GlobalMemoryStatus method
- // with the defined structure.
- MEMORYSTATUS memStatus = new MEMORYSTATUS();
- GlobalMemoryStatus(ref memStatus);
-
- // Use a StringBuilder for the message box string.
- uint MemoryInfo = memStatus.dwTotalPhys;
-
- // Return the Ram Information
- return MemoryInfo;
-
- }
-
-
- #endregion
- Boolean preventLaunch = false;
- private void systemCheck()
- {
- try
- {
- // Make sure the screen resolution is not below 1024x768
- System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen;
- if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 768))
- {
- MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Screen resolution is too Low. Must be 1024x768 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- preventLaunch = true;
- }
-
- // Make sure the system has enough RAM. 384MB or greater
- uint memory = CheckMemeory();
-
- if (memory < 319) // Set to 319 to allow for 64MB dedicated to video Memory and Windows returnig the memory figure slightly out.
- {
- MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Insufficient Memory. 384MB or greater required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- preventLaunch = true;
- }
- }
- catch (Exception exc)
- {
- if (Properties.Settings.Default.GuiDebug == "Checked")
- {
- MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());
- }
- }
- }
-
- #endregion
-
- // Close the Application on main window load if required by the system Check
- #region Form Load
- private void frmMain_Load(object sender, EventArgs e)
- {
- if (preventLaunch == true)
- {
- Application.Exit();
- }
- }
- #endregion
-
#endregion
// --------------------------------------------------------------
@@ -325,166 +232,6 @@ namespace Handbrake
#region File Menu
- private void mnu_open_Click(object sender, EventArgs e)
- {
- string filename;
- File_Open.ShowDialog();
- filename = File_Open.FileName;
- if (filename != "")
- {
- try
- {
- // Create StreamReader & open file
- StreamReader line = new StreamReader(filename);
- string temporyLine; // Used for reading the line into a varible before processing on the checkState items below.
-
- // Read in the data and set the correct GUI component with the setting.
- text_source.Text = line.ReadLine();
- drp_dvdtitle.Text = line.ReadLine();
- drop_chapterStart.Text = line.ReadLine();
- drop_chapterFinish.Text = line.ReadLine();
- text_destination.Text = line.ReadLine();
- drp_videoEncoder.Text = line.ReadLine();
- drp_audioCodec.Text = line.ReadLine();
- text_width.Text = line.ReadLine();
- text_height.Text = line.ReadLine();
- text_top.Text = line.ReadLine();
- text_bottom.Text = line.ReadLine();
- text_left.Text = line.ReadLine();
- text_right.Text = line.ReadLine();
- drp_subtitle.Text = line.ReadLine();
- text_bitrate.Text = line.ReadLine();
- text_filesize.Text = line.ReadLine();
- slider_videoQuality.Value = int.Parse(line.ReadLine());
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_2PassEncode.CheckState = CheckState.Checked;
- }
-
- drp_deInterlace_option.Text = line.ReadLine();
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_grayscale.CheckState = CheckState.Checked;
- }
-
- drp_videoFramerate.Text = line.ReadLine();
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- Check_ChapterMarkers.CheckState = CheckState.Checked;
- }
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- CheckPixelRatio.CheckState = CheckState.Checked;
- }
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_turbo.CheckState = CheckState.Checked;
- }
-
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_largeFile.CheckState = CheckState.Checked;
- }
-
- drp_audioBitrate.Text = line.ReadLine();
- drp_audioSampleRate.Text = line.ReadLine();
- drp_audioChannels.Text = line.ReadLine();
- drp_audioMixDown.Text = line.ReadLine();
-
- // Advanced H264 Options
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- CheckCRF.CheckState = CheckState.Checked;
- }
- rtf_h264advanced.Text = line.ReadLine();
-
- // Close the stream
- line.Close();
-
-
- // Fix for SliderValue not appearing when Opening saved file
- SliderValue.Text = slider_videoQuality.Value + "%";
-
- } catch (Exception){
- MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
- }
- }
-
- private void mnu_save_Click(object sender, EventArgs e)
- {
-
- string filename;
- File_Save.ShowDialog();
- filename = File_Save.FileName;
- if (filename != "")
- {
- try
- {
- // Create a StreamWriter and open the file
- StreamWriter line = new StreamWriter(filename);
-
- //Source
- line.WriteLine(text_source.Text);
- line.WriteLine(drp_dvdtitle.Text);
- line.WriteLine(drop_chapterStart.Text);
- line.WriteLine(drop_chapterFinish.Text);
- //Destination
- line.WriteLine(text_destination.Text);
- line.WriteLine(drp_videoEncoder.Text);
- line.WriteLine(drp_audioCodec.Text);
- line.WriteLine(text_width.Text);
- line.WriteLine(text_height.Text);
- //Picture Settings Tab
- line.WriteLine(text_top.Text);
- line.WriteLine(text_bottom.Text);
- line.WriteLine(text_left.Text);
- line.WriteLine(text_right.Text);
- line.WriteLine(drp_subtitle.Text);
- //Video Settings Tab
- line.WriteLine(text_bitrate.Text);
- line.WriteLine(text_filesize.Text);
- line.WriteLine(slider_videoQuality.Value.ToString());
- line.WriteLine(check_2PassEncode.CheckState.ToString());
- line.WriteLine(drp_deInterlace_option.Text);
- line.WriteLine(check_grayscale.CheckState.ToString());
- line.WriteLine(drp_videoFramerate.Text);
- line.WriteLine(Check_ChapterMarkers.CheckState.ToString());
- line.WriteLine(CheckPixelRatio.CheckState.ToString());
- line.WriteLine(check_turbo.CheckState.ToString());
- line.WriteLine(check_largeFile.CheckState.ToString());
- //Audio Settings Tab
- line.WriteLine(drp_audioBitrate.Text);
- line.WriteLine(drp_audioSampleRate.Text);
- line.WriteLine(drp_audioChannels.Text);
- line.WriteLine(drp_audioMixDown.Text);
- //H264 Tab
- line.WriteLine(CheckCRF.CheckState.ToString());
- line.WriteLine(rtf_h264advanced.Text);
- // close the stream
- line.Close();
- MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- }
- catch(Exception)
- {
- MessageBox.Show("Unable to write to the file. Please make sure the location has the correct permissions for file writing.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
-
- }
- }
-
private void mnu_exit_Click(object sender, EventArgs e)
{
Application.Exit();
@@ -745,12 +492,163 @@ namespace Handbrake
private void btn_addPreset_Click(object sender, EventArgs e)
{
+ string filename;
+ File_Open.ShowDialog();
+ filename = File_Open.FileName;
+ if (filename != "")
+ {
+ try
+ {
+ // Create StreamReader & open file
+ StreamReader line = new StreamReader(filename);
+ string temporyLine; // Used for reading the line into a varible before processing on the checkState items below.
+
+ // Read in the data and set the correct GUI component with the setting.
+ text_source.Text = line.ReadLine();
+ drp_dvdtitle.Text = line.ReadLine();
+ drop_chapterStart.Text = line.ReadLine();
+ drop_chapterFinish.Text = line.ReadLine();
+ text_destination.Text = line.ReadLine();
+ drp_videoEncoder.Text = line.ReadLine();
+ drp_audioCodec.Text = line.ReadLine();
+ text_width.Text = line.ReadLine();
+ text_height.Text = line.ReadLine();
+ text_top.Text = line.ReadLine();
+ text_bottom.Text = line.ReadLine();
+ text_left.Text = line.ReadLine();
+ text_right.Text = line.ReadLine();
+ drp_subtitle.Text = line.ReadLine();
+ text_bitrate.Text = line.ReadLine();
+ text_filesize.Text = line.ReadLine();
+ slider_videoQuality.Value = int.Parse(line.ReadLine());
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ check_2PassEncode.CheckState = CheckState.Checked;
+ }
+
+ drp_deInterlace_option.Text = line.ReadLine();
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ check_grayscale.CheckState = CheckState.Checked;
+ }
+
+ drp_videoFramerate.Text = line.ReadLine();
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ Check_ChapterMarkers.CheckState = CheckState.Checked;
+ }
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ CheckPixelRatio.CheckState = CheckState.Checked;
+ }
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ check_turbo.CheckState = CheckState.Checked;
+ }
+
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ check_largeFile.CheckState = CheckState.Checked;
+ }
+
+ drp_audioBitrate.Text = line.ReadLine();
+ drp_audioSampleRate.Text = line.ReadLine();
+ drp_audioChannels.Text = line.ReadLine();
+ drp_audioMixDown.Text = line.ReadLine();
+
+ // Advanced H264 Options
+ temporyLine = line.ReadLine();
+ if (temporyLine == "Checked")
+ {
+ CheckCRF.CheckState = CheckState.Checked;
+ }
+ rtf_h264advanced.Text = line.ReadLine();
+
+ // Close the stream
+ line.Close();
+
+ // Fix for SliderValue not appearing when Opening saved file
+ SliderValue.Text = slider_videoQuality.Value + "%";
+
+ }
+ catch (Exception)
+ {
+ MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ }
+ }
}
private void btn_removePreset_Click(object sender, EventArgs e)
{
- ListBox_Presets.Items.Remove(ListBox_Presets.SelectedItem);
+ string filename;
+ File_Save.ShowDialog();
+ filename = File_Save.FileName;
+ if (filename != "")
+ {
+ try
+ {
+ // Create a StreamWriter and open the file
+ StreamWriter line = new StreamWriter(filename);
+
+ //Source
+ line.WriteLine(text_source.Text);
+ line.WriteLine(drp_dvdtitle.Text);
+ line.WriteLine(drop_chapterStart.Text);
+ line.WriteLine(drop_chapterFinish.Text);
+ //Destination
+ line.WriteLine(text_destination.Text);
+ line.WriteLine(drp_videoEncoder.Text);
+ line.WriteLine(drp_audioCodec.Text);
+ line.WriteLine(text_width.Text);
+ line.WriteLine(text_height.Text);
+ //Picture Settings Tab
+ line.WriteLine(text_top.Text);
+ line.WriteLine(text_bottom.Text);
+ line.WriteLine(text_left.Text);
+ line.WriteLine(text_right.Text);
+ line.WriteLine(drp_subtitle.Text);
+ //Video Settings Tab
+ line.WriteLine(text_bitrate.Text);
+ line.WriteLine(text_filesize.Text);
+ line.WriteLine(slider_videoQuality.Value.ToString());
+ line.WriteLine(check_2PassEncode.CheckState.ToString());
+ line.WriteLine(drp_deInterlace_option.Text);
+ line.WriteLine(check_grayscale.CheckState.ToString());
+ line.WriteLine(drp_videoFramerate.Text);
+ line.WriteLine(Check_ChapterMarkers.CheckState.ToString());
+ line.WriteLine(CheckPixelRatio.CheckState.ToString());
+ line.WriteLine(check_turbo.CheckState.ToString());
+ line.WriteLine(check_largeFile.CheckState.ToString());
+ //Audio Settings Tab
+ line.WriteLine(drp_audioBitrate.Text);
+ line.WriteLine(drp_audioSampleRate.Text);
+ line.WriteLine(drp_audioChannels.Text);
+ line.WriteLine(drp_audioMixDown.Text);
+ //H264 Tab
+ line.WriteLine(CheckCRF.CheckState.ToString());
+ line.WriteLine(rtf_h264advanced.Text);
+ // close the stream
+ line.Close();
+ MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show("Unable to write to the file. Please make sure the location has the correct permissions for file writing.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ }
+
+ }
}
private void btn_setDefault_Click(object sender, EventArgs e)
@@ -877,9 +775,6 @@ namespace Handbrake
}
-
-
-
// Functions - It's a bit dirty but i'll sort this out later. Simply done to reduce the amount of code above.
private void setGuiSetttings(CheckState anamorphic, string width, string height, string vencoder, string bitrate, string filesize, int quality, string qpercent, string audioBit, CheckState chpt, string audioSample, string h264, string deinterlace, CheckState twopass, string crop, CheckState turbo, string audioCodec, string preset)
{
@@ -1841,6 +1736,7 @@ namespace Handbrake
#endregion
+
// This is the END of the road ------------------------------------------------------------------------------
}
}
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx
index f8feed8cd..856138691 100644
--- a/win/C#/frmMain.resx
+++ b/win/C#/frmMain.resx
@@ -138,46 +138,13 @@
<metadata name="ISO_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>432, 15</value>
</metadata>
- <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
- <data name="mnu_open.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlpJREFUOE+tk21I
- k1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC
- TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p
- AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0
- BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr
- UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG
- CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5
- F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS
- rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt
- NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp
- 59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W
- AAAAAElFTkSuQmCC
-</value>
- </data>
- <data name="mnu_save.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAixJREFUOE+tk91L
- k3EUx/cvdN9N0EW3NTWGa7EaPOUcyqphWBG9PZEv5dJlmqhYmUYtXyBb4dJJy+kknFT4BqZIjaFMJUsz
- V7TEoabYRDD49ju/6Pm1Mi+iH5zLz+c855zvo1L9j/fsaRRUvvZltHmX8Ni9gMaGCO47ZlBb8wn22yHc
- KJ9CackECgteIy93FBfOB6H0JrC3B6ipXsVGb2V1Dca0XhxOe8JLEXhbF7mgsuLLX3mCIwsr2G1+DrVa
- huWQRwjcj+a5oLTk87qCn/D78CLiTD4UXJ7GAXOTEDjrZ7ngku3dH4Jf4ZHJCLZJXlhzxpGa4hSCurth
- LsjOGo0R/A4PBsPYrHdDlgMwmRxCUF31kQvkMwFFsB7c4/+ATYkNOHL0BZKSaoXgZuU0urvATgkcP/kK
- lmMDfNu0MJqZPps6/4D7cNDSCUmyC8HVskl0+MAyADS5vrG7f0X59Tm+VFoYzZyZEVTg5NR2GAwVQnCl
- cByeZuChc40FJwpjek5MmU/YkH6uiHdOTmHwfg/0+jIhsOWNMRiouhPlnUnAQoI4rYSht7MYm5qDnHsN
- e41tHNbucUGnKxICiqXjHpTPJgHBZ/Nv4U1oHqGZJVwstiNe72JwI+J3PYA2MV8IMjOG2dzLfOatBg+2
- 7JDQ0tEPX9cguvv8GHg5hH0mC9S6eiQweLumDhqNVQgo06dP9fN4UsIoJHRnOhVtmxZGM1NXKoJ3JmTH
- Cv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII=
-</value>
- </data>
<metadata name="frmMainMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>94, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>56</value>
</metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA