diff options
author | sr55 <[email protected]> | 2007-11-10 17:37:22 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2007-11-10 17:37:22 +0000 |
commit | 176b1d21a5696f80d2d064e3a157225b7c46b841 (patch) | |
tree | c09e489e5436ad3707e75b6e795ef1d8ee605605 /win | |
parent | 49d08a1765428483f4d3d45fe1d9b386f8d6aed2 (diff) |
WinGui:
- New PresetLoader function / Query parser completed.
- Splash screen now has text status label ( Thanks to xGraphite)
- Fixed a localisation issue. (thanks sun)
- Removed a bit of redundant code in Functions.CLI
- Fixed small issue with presets not setting mp4 extension when required.
- Misc other small changes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1054 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/Functions/CLI.cs | 29 | ||||
-rw-r--r-- | win/C#/Functions/QueryParser.cs | 288 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 117 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 677 |
4 files changed, 667 insertions, 444 deletions
diff --git a/win/C#/Functions/CLI.cs b/win/C#/Functions/CLI.cs index b3ba60175..548148517 100644 --- a/win/C#/Functions/CLI.cs +++ b/win/C#/Functions/CLI.cs @@ -29,34 +29,7 @@ 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)
- {
- case "Realtime":
- hbProc.PriorityClass = ProcessPriorityClass.RealTime;
- break;
- case "High":
- hbProc.PriorityClass = ProcessPriorityClass.High;
- break;
- case "Above Normal":
- hbProc.PriorityClass = ProcessPriorityClass.AboveNormal;
- break;
- case "Normal":
- hbProc.PriorityClass = ProcessPriorityClass.Normal;
- break;
- case "Low":
- hbProc.PriorityClass = ProcessPriorityClass.Idle;
- break;
- default:
- hbProc.PriorityClass = ProcessPriorityClass.BelowNormal;
- break;
- }
-
-
+ hbProc.Start();
}
catch
{
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 8e4469b02..a6044b2ab 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -51,12 +51,12 @@ namespace Handbrake.Functions }
}
- private string q_chaptersStart;
+ private int q_chaptersStart;
/// <summary>
- /// Returns an String
+ /// Returns an Int
/// DVD Chapter number or chapter range.
/// </summary>
- public string DVDChapterStart
+ public int DVDChapterStart
{
get
{
@@ -64,12 +64,12 @@ namespace Handbrake.Functions }
}
- private string q_chaptersFinish;
+ private int q_chaptersFinish;
/// <summary>
- /// Returns an String
+ /// Returns an Int
/// DVD Chapter number or chapter range.
/// </summary>
- public string DVDChapterFinish
+ public int DVDChapterFinish
{
get
{
@@ -105,7 +105,7 @@ namespace Handbrake.Functions private int q_videoWidth;
/// <summary>
- /// Returns an Integer
+ /// Returns an Int
/// The selected Width for the encoding.
/// </summary>
public int Width
@@ -118,7 +118,7 @@ namespace Handbrake.Functions private int q_videoHeight;
/// <summary>
- /// Returns an Integer
+ /// Returns an Int
/// The selected Height for the encoding.
/// </summary>
public int Height
@@ -463,14 +463,13 @@ namespace Handbrake.Functions {
QueryParser thisQuery = new QueryParser();
+ #region reg exp
//Source
Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");
Match source = r1.Match(input.Replace('"', '\"'));
Match title = Regex.Match(input, @"-t ([0-9]*)");
Match chapters = Regex.Match(input, @"-c ([0-9-]*)");
-
-
//Destination
Regex r2 = new Regex(@"(-o)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");
Match destination = r2.Match(input.Replace('"', '\"'));
@@ -480,8 +479,8 @@ namespace Handbrake.Functions Match audioEncoder = Regex.Match(input, @"-E ([a-zA-Z0-9]*)");
//Picture Settings Tab
- Match deinterlace = Regex.Match(input, @"--deinterlace=([0-9:-]*)"); // DOES NOT WORK. Needs Fixed
- Match denoise = Regex.Match(input, @"--denoise=([0-9:]*)");
+ Match deinterlace = Regex.Match(input, @"--deinterlace=([a-z]*)");
+ Match denoise = Regex.Match(input, @"--denoise=([a-z]*)");
Match deblock = Regex.Match(input, @"--deblock");
Match detelecine = Regex.Match(input, @"--detelecine");
Match anamorphic = Regex.Match(input, @"-p ");
@@ -503,7 +502,7 @@ namespace Handbrake.Functions Match subtitles = Regex.Match(input, @"-s ([0-9]*)");
Match audioBitrate = Regex.Match(input, @"-B ([0-9]*)");
Match audioSampleRate = Regex.Match(input, @"-R ([0-9.]*)");
- Match audioChannelsMix = Regex.Match(input, @"-6 ([a-zA-Z0-9]*)");
+ Match audioChannelsMix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)"); // 1 -6 dpl2 // Broken
Match audioChannel = Regex.Match(input, @"-a ([0-9]*)");
//H264 Tab
@@ -511,80 +510,247 @@ namespace Handbrake.Functions //Program Options
Match verbose = Regex.Match(input, @"-v");
-
-
- // ### NOTES ###
- // May be an idea to add additional options such as CPU etc later.
- // Need to remove all the tags e.g -x -w etc
- // Need to split up crop options + chapters into seperate items
+ #endregion
try
{
-
+ //
+ // Source
+ //
+ #region Source Tab
+
thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", "");
- if (title.ToString() != "")
- thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));
-
- string[] actTitles = new string[2];
- actTitles = chapters.ToString().Replace("-c ", "").Split('-');
-
- thisQuery.q_chaptersStart = actTitles[0];
- thisQuery.q_chaptersFinish = actTitles[1];
-
- //Destination
- thisQuery.q_destination = destination.ToString().Replace("-o ","").Replace("\"", "");
- thisQuery.q_videoEncoder = videoEncoder.ToString().Replace("-e ", "");
- thisQuery.q_audioEncoder = audioEncoder.ToString().Replace("-E ", "");
- if (width.ToString() != "")
+ if (title.Success != false)
+ {
+ thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));
+ }
+
+ if (chapters.Success != false)
+ {
+ string[] actTitles = new string[2];
+ actTitles = chapters.ToString().Replace("-c ", "").Split('-');
+ thisQuery.q_chaptersStart = int.Parse(actTitles[0]);
+ thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);
+ }
+ #endregion
+
+ //
+ // Destination
+ //
+ #region Destination
+ thisQuery.q_destination = destination.ToString().Replace("-o ","").Replace("\"", "");
+
+ string videoEncoderConvertion;
+ string audioEncoderConvertion;
+
+ videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");
+ switch (videoEncoderConvertion)
+ {
+ case "ffmpeg":
+ videoEncoderConvertion = "Mpeg 4";
+ break;
+ case "xvid":
+ videoEncoderConvertion = "Xvid";
+ break;
+ case "x264":
+ videoEncoderConvertion = "H.264";
+ break;
+ case "x264b13":
+ videoEncoderConvertion = "H.264 Baseline 1.3";
+ break;
+ case "x264b30":
+ videoEncoderConvertion = "H.264 (iPod)";
+ break;
+ default:
+ videoEncoderConvertion = "H.264";
+ break;
+ }
+ thisQuery.q_videoEncoder = videoEncoderConvertion;
+
+ audioEncoderConvertion = audioEncoder.ToString().Replace("-E ", "");
+ switch (audioEncoderConvertion)
+ {
+ case "faac":
+ audioEncoderConvertion = "AAC";
+ break;
+ case "lame":
+ audioEncoderConvertion = "MP3";
+ break;
+ case "vorbis":
+ audioEncoderConvertion = "Vorbis";
+ break;
+ case "ac3":
+ audioEncoderConvertion = "AC3";
+ break;
+ default:
+ audioEncoderConvertion = "AAC";
+ break;
+ }
+ thisQuery.q_audioEncoder =audioEncoderConvertion;
+
+
+ if (width.Success != false)
+ {
thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));
- if (height.ToString() != "")
+ }
+ if (height.Success != false)
+ {
thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));
+ }
+ #endregion
+ //
//Picture Settings Tab
- thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
- string[] actCropValues = new string[3];
- actCropValues = thisQuery.q_cropValues.Split(':');
- thisQuery.q_croptop = actCropValues[0];
- thisQuery.q_cropbottom = actCropValues[3];
- thisQuery.q_cropLeft = actCropValues[2];
- thisQuery.q_cropRight = actCropValues[1];
-
-
- thisQuery.q_detelecine = detelecine.Success;
- thisQuery.q_deBlock = deblock.Success;
- thisQuery.q_deinterlace = deinterlace.ToString().Replace("--deinterlace=","").Replace("\"", "");
- thisQuery.q_denoise = denoise.ToString().Replace("--denoise=","");
- thisQuery.q_anamorphic = anamorphic.Success;
- thisQuery.q_chapterMarkers = chapterMarkers.Success;
-
+ //
+ #region Picture Tab
+ if (crop.Success != false)
+ {
+ thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
+ string[] actCropValues = new string[3];
+ actCropValues = thisQuery.q_cropValues.Split(':');
+ thisQuery.q_croptop = actCropValues[0];
+ thisQuery.q_cropbottom = actCropValues[1];
+ thisQuery.q_cropLeft = actCropValues[2];
+ thisQuery.q_cropRight = actCropValues[3];
+ }
+
+ thisQuery.q_detelecine = detelecine.Success;
+ thisQuery.q_deBlock = deblock.Success;
+
+ if (deinterlace.Success != false)
+ {
+ switch (deinterlace.ToString().Replace("--deinterlace=", ""))
+ {
+ case "fast":
+ thisQuery.q_deinterlace = "Original (Fast)";
+ break;
+ case "slow":
+ thisQuery.q_deinterlace = "yadif (Slow)";
+ break;
+ case "slower":
+ thisQuery.q_deinterlace = "yadif + mcdeint (Slower)";
+ break;
+ case "slowest":
+ thisQuery.q_deinterlace = "yadif + mcdeint (Slowest)";
+ break;
+ default:
+ thisQuery.q_deinterlace = "None";
+ break;
+ }
+ }
+
+ if (denoise.Success != false)
+ {
+ switch (denoise.ToString().Replace("--denoise=", ""))
+ {
+ case "weak":
+ thisQuery.q_denoise = "Weak";
+ break;
+ case "medium":
+ thisQuery.q_denoise = "Medium";
+ break;
+ case "strong":
+ thisQuery.q_denoise = "Strong";
+ break;
+ default:
+ thisQuery.q_denoise = "None";
+ break;
+ }
+
+ }
+ thisQuery.q_anamorphic = anamorphic.Success;
+ thisQuery.q_chapterMarkers = chapterMarkers.Success;
+ #endregion
+
+ //
//Video Settings Tab
+ //
+ #region Video
thisQuery.q_grayscale = grayscale.Success;
thisQuery.q_twoPass = twoPass.Success;
thisQuery.q_turboFirst = turboFirstPass.Success;
thisQuery.q_largeMp4 = largerMp4.Success;
- thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ","");
- thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ","");
- thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ","");
+ if (videoFramerate.Success != false)
+ {
+ thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");
+ }
+ if (videoBitrate.Success != false)
+ {
+ thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");
+ }
+ if (videoFilesize.Success != false)
+ {
+ thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");
+ }
double qConvert = 0;
- if (videoQuality.ToString().Replace("-q ", "") != null)
+ if (videoQuality.Success != false)
{
qConvert = double.Parse(videoQuality.ToString().Replace("-q ", "")) * 100;
thisQuery.q_videoQuality = int.Parse(qConvert.ToString());
}
thisQuery.q_crf = CRF.Success;
+ #endregion
+ //
//Audio Settings Tab
- thisQuery.q_audioBitrate = audioBitrate.ToString().Replace("-B ", "");
- thisQuery.q_audioSamplerate = audioSampleRate.ToString().Replace("-R ","");
- thisQuery.q_audioTrack1 = audioChannel.ToString().Replace("-a ", "");
- thisQuery.q_audioTrackMix = audioChannelsMix.ToString().Replace("-6 ", "");
- thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
+ //
+ #region Audio
+ if (audioBitrate.Success != false)
+ {
+ thisQuery.q_audioBitrate = audioBitrate.ToString().Replace("-B ", "");
+ }
+ if (audioSampleRate.Success != false)
+ {
+ thisQuery.q_audioSamplerate = audioSampleRate.ToString().Replace("-R ", "");
+ }
+ if (audioChannel.Success != false)
+ {
+ thisQuery.q_audioTrack1 = audioChannel.ToString().Replace("-a ", "");
+ }
+
+ if (audioChannelsMix.Success != false)
+ {
+ switch (audioChannelsMix.ToString().Replace("-6 ", "").Replace(" ",""))
+ {
+ case "mono":
+ thisQuery.q_audioTrackMix = "Mono";
+ break;
+ case "stereo":
+ thisQuery.q_audioTrackMix = "Stereo";
+ break;
+ case "dpl1":
+ thisQuery.q_audioTrackMix = "Dolby Surround";
+ break;
+ case "dpl2":
+ thisQuery.q_audioTrackMix = "Dolby Pro Logic II";
+ break;
+ case "6ch":
+ thisQuery.q_audioTrackMix = "6 Channel Discrete";
+ break;
+ default:
+ thisQuery.q_audioTrackMix = "Automatic2";
+ break;
+ }
+
+ }
+ if (subtitles.Success != false)
+ {
+ thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
+ }
+ #endregion
+ //
//H264 Tab
- thisQuery.q_h264 = x264.ToString().Replace("-x ", "");
+ //
+ if (x264.Success != false)
+ {
+ thisQuery.q_h264 = x264.ToString().Replace("-x ", "");
+ }
+ //
//Progam Options
+ //
thisQuery.q_verbose = verbose.Success;
}
catch (Exception exc)
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index de110b92c..08201d07d 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -60,7 +60,6 @@ namespace Handbrake this.drp_subtitle = new System.Windows.Forms.ComboBox();
this.btn_presets = new System.Windows.Forms.Button();
this.btn_setDefault = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
this.DVD_Open = new System.Windows.Forms.FolderBrowserDialog();
this.File_Open = new System.Windows.Forms.OpenFileDialog();
this.ISO_Open = new System.Windows.Forms.OpenFileDialog();
@@ -176,9 +175,6 @@ namespace Handbrake this.text_right = new System.Windows.Forms.TextBox();
this.text_left = new System.Windows.Forms.TextBox();
this.advancedOptions = new System.Windows.Forms.TabControl();
- this.tabPage4 = new System.Windows.Forms.TabPage();
- this.label26 = new System.Windows.Forms.Label();
- this.label25 = new System.Windows.Forms.Label();
this.groupBox_dest = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listview_presets = new System.Windows.Forms.ListView();
@@ -194,7 +190,6 @@ namespace Handbrake this.TabPage3.SuspendLayout();
this.TabPage1.SuspendLayout();
this.advancedOptions.SuspendLayout();
- this.tabPage4.SuspendLayout();
this.groupBox_dest.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
@@ -202,6 +197,7 @@ namespace Handbrake // Label38
//
Label38.AutoSize = true;
+ Label38.BackColor = System.Drawing.Color.Transparent;
Label38.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
Label38.Location = new System.Drawing.Point(304, 67);
Label38.Name = "Label38";
@@ -392,6 +388,7 @@ namespace Handbrake // CheckCRF
//
this.CheckCRF.AutoSize = true;
+ this.CheckCRF.BackColor = System.Drawing.Color.Transparent;
this.CheckCRF.Enabled = false;
this.CheckCRF.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.CheckCRF.Location = new System.Drawing.Point(446, 133);
@@ -400,7 +397,7 @@ namespace Handbrake this.CheckCRF.TabIndex = 67;
this.CheckCRF.Text = "Constant Rate Factor";
this.ToolTip.SetToolTip(this.CheckCRF, "Constant Rate Factor");
- this.CheckCRF.UseVisualStyleBackColor = true;
+ this.CheckCRF.UseVisualStyleBackColor = false;
//
// QueryEditorText
//
@@ -466,6 +463,7 @@ namespace Handbrake // check_largeFile
//
this.check_largeFile.AutoSize = true;
+ this.check_largeFile.BackColor = System.Drawing.Color.Transparent;
this.check_largeFile.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.check_largeFile.Location = new System.Drawing.Point(16, 107);
this.check_largeFile.Name = "check_largeFile";
@@ -473,12 +471,13 @@ namespace Handbrake this.check_largeFile.TabIndex = 56;
this.check_largeFile.Text = "Larger mp4 Files (> 4GB)";
this.ToolTip.SetToolTip(this.check_largeFile, "Allows creation of mp4 files greater than 4GB.");
- this.check_largeFile.UseVisualStyleBackColor = true;
+ this.check_largeFile.UseVisualStyleBackColor = false;
this.check_largeFile.CheckedChanged += new System.EventHandler(this.check_largeFile_CheckedChanged);
//
// check_turbo
//
this.check_turbo.AutoSize = true;
+ this.check_turbo.BackColor = System.Drawing.Color.Transparent;
this.check_turbo.Enabled = false;
this.check_turbo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.check_turbo.Location = new System.Drawing.Point(37, 84);
@@ -487,7 +486,7 @@ namespace Handbrake this.check_turbo.TabIndex = 55;
this.check_turbo.Text = "Turbo 1st Pass";
this.ToolTip.SetToolTip(this.check_turbo, "Makes the first pass of a 2 pass encode faster.");
- this.check_turbo.UseVisualStyleBackColor = true;
+ this.check_turbo.UseVisualStyleBackColor = false;
//
// drp_videoFramerate
//
@@ -590,23 +589,6 @@ namespace Handbrake this.btn_setDefault.UseVisualStyleBackColor = false;
this.btn_setDefault.Click += new System.EventHandler(this.btn_setDefault_Click);
//
- // button1
- //
- this.button1.BackColor = System.Drawing.SystemColors.ControlLight;
- this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Black;
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.button1.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
- this.button1.Location = new System.Drawing.Point(16, 78);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(114, 22);
- this.button1.TabIndex = 112;
- this.button1.TabStop = false;
- this.button1.Text = "Test Query Parser";
- this.ToolTip.SetToolTip(this.button1, "Open a preset which you have saved.");
- this.button1.UseVisualStyleBackColor = false;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
// DVD_Open
//
this.DVD_Open.Description = "Select the \"VIDEO_TS\" folder from your DVD Drvie.";
@@ -1138,10 +1120,10 @@ namespace Handbrake this.TabPage6.Size = new System.Drawing.Size(639, 215);
this.TabPage6.TabIndex = 6;
this.TabPage6.Text = "Query Editor";
- this.TabPage6.UseVisualStyleBackColor = true;
//
// btn_copy
//
+ this.btn_copy.BackColor = System.Drawing.SystemColors.ControlLight;
this.btn_copy.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_copy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_copy.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1151,12 +1133,13 @@ namespace Handbrake this.btn_copy.Size = new System.Drawing.Size(134, 23);
this.btn_copy.TabIndex = 92;
this.btn_copy.Text = "Copy to Clipboard";
- this.btn_copy.UseVisualStyleBackColor = true;
+ this.btn_copy.UseVisualStyleBackColor = false;
this.btn_copy.Click += new System.EventHandler(this.btn_copy_Click);
//
// label23
//
this.label23.AutoSize = true;
+ this.label23.BackColor = System.Drawing.Color.Transparent;
this.label23.Location = new System.Drawing.Point(13, 186);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(403, 13);
@@ -1166,6 +1149,7 @@ namespace Handbrake // Label7
//
this.Label7.AutoSize = true;
+ this.Label7.BackColor = System.Drawing.Color.Transparent;
this.Label7.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label7.Location = new System.Drawing.Point(13, 13);
this.Label7.Name = "Label7";
@@ -1176,6 +1160,7 @@ namespace Handbrake // Label39
//
this.Label39.AutoSize = true;
+ this.Label39.BackColor = System.Drawing.Color.Transparent;
this.Label39.Location = new System.Drawing.Point(13, 34);
this.Label39.Name = "Label39";
this.Label39.Size = new System.Drawing.Size(331, 13);
@@ -1184,6 +1169,7 @@ namespace Handbrake //
// btn_ClearQuery
//
+ this.btn_ClearQuery.BackColor = System.Drawing.SystemColors.ControlLight;
this.btn_ClearQuery.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_ClearQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_ClearQuery.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1193,11 +1179,12 @@ namespace Handbrake this.btn_ClearQuery.Size = new System.Drawing.Size(79, 23);
this.btn_ClearQuery.TabIndex = 95;
this.btn_ClearQuery.Text = "Clear";
- this.btn_ClearQuery.UseVisualStyleBackColor = true;
+ this.btn_ClearQuery.UseVisualStyleBackColor = false;
this.btn_ClearQuery.Click += new System.EventHandler(this.btn_ClearQuery_Click);
//
// GenerateQuery
//
+ this.GenerateQuery.BackColor = System.Drawing.SystemColors.ControlLight;
this.GenerateQuery.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.GenerateQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.GenerateQuery.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1207,7 +1194,7 @@ namespace Handbrake this.GenerateQuery.Size = new System.Drawing.Size(154, 23);
this.GenerateQuery.TabIndex = 91;
this.GenerateQuery.Text = "Generate Query Now";
- this.GenerateQuery.UseVisualStyleBackColor = true;
+ this.GenerateQuery.UseVisualStyleBackColor = false;
this.GenerateQuery.Click += new System.EventHandler(this.GenerateQuery_Click);
//
// h264Tab
@@ -1226,11 +1213,11 @@ namespace Handbrake this.h264Tab.Size = new System.Drawing.Size(639, 215);
this.h264Tab.TabIndex = 5;
this.h264Tab.Text = "H.264";
- this.h264Tab.UseVisualStyleBackColor = true;
//
// Label43
//
this.Label43.AutoSize = true;
+ this.Label43.BackColor = System.Drawing.Color.Transparent;
this.Label43.Location = new System.Drawing.Point(78, 187);
this.Label43.Name = "Label43";
this.Label43.Size = new System.Drawing.Size(158, 13);
@@ -1251,6 +1238,7 @@ namespace Handbrake // Label95
//
this.Label95.AutoSize = true;
+ this.Label95.BackColor = System.Drawing.Color.Transparent;
this.Label95.Location = new System.Drawing.Point(13, 168);
this.Label95.Name = "Label95";
this.Label95.Size = new System.Drawing.Size(387, 13);
@@ -1259,6 +1247,7 @@ namespace Handbrake //
// btn_h264Clear
//
+ this.btn_h264Clear.BackColor = System.Drawing.SystemColors.ControlLight;
this.btn_h264Clear.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.btn_h264Clear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_h264Clear.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1268,12 +1257,13 @@ namespace Handbrake this.btn_h264Clear.Size = new System.Drawing.Size(79, 23);
this.btn_h264Clear.TabIndex = 88;
this.btn_h264Clear.Text = "Clear";
- this.btn_h264Clear.UseVisualStyleBackColor = true;
+ this.btn_h264Clear.UseVisualStyleBackColor = false;
this.btn_h264Clear.Click += new System.EventHandler(this.btn_h264Clear_Click);
//
// Label90
//
this.Label90.AutoSize = true;
+ this.Label90.BackColor = System.Drawing.Color.Transparent;
this.Label90.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label90.Location = new System.Drawing.Point(13, 13);
this.Label90.Name = "Label90";
@@ -1284,6 +1274,7 @@ namespace Handbrake // Label92
//
this.Label92.AutoSize = true;
+ this.Label92.BackColor = System.Drawing.Color.Transparent;
this.Label92.Location = new System.Drawing.Point(13, 41);
this.Label92.Name = "Label92";
this.Label92.Size = new System.Drawing.Size(370, 26);
@@ -1315,11 +1306,11 @@ namespace Handbrake this.TabPage2.Size = new System.Drawing.Size(639, 215);
this.TabPage2.TabIndex = 3;
this.TabPage2.Text = "Audio && Subtitles";
- this.TabPage2.UseVisualStyleBackColor = true;
//
// Label19
//
this.Label19.AutoSize = true;
+ this.Label19.BackColor = System.Drawing.Color.Transparent;
this.Label19.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label19.Location = new System.Drawing.Point(339, 13);
this.Label19.Name = "Label19";
@@ -1330,6 +1321,7 @@ namespace Handbrake // Label21
//
this.Label21.AutoSize = true;
+ this.Label21.BackColor = System.Drawing.Color.Transparent;
this.Label21.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label21.Location = new System.Drawing.Point(403, 63);
this.Label21.Name = "Label21";
@@ -1340,6 +1332,7 @@ namespace Handbrake // Label20
//
this.Label20.AutoSize = true;
+ this.Label20.BackColor = System.Drawing.Color.Transparent;
this.Label20.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label20.Location = new System.Drawing.Point(339, 39);
this.Label20.Name = "Label20";
@@ -1350,6 +1343,7 @@ namespace Handbrake // Label29
//
this.Label29.AutoSize = true;
+ this.Label29.BackColor = System.Drawing.Color.Transparent;
this.Label29.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label29.Location = new System.Drawing.Point(135, 151);
this.Label29.Name = "Label29";
@@ -1390,6 +1384,7 @@ namespace Handbrake // Label14
//
this.Label14.AutoSize = true;
+ this.Label14.BackColor = System.Drawing.Color.Transparent;
this.Label14.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label14.Location = new System.Drawing.Point(13, 130);
this.Label14.Name = "Label14";
@@ -1400,6 +1395,7 @@ namespace Handbrake // Label5
//
this.Label5.AutoSize = true;
+ this.Label5.BackColor = System.Drawing.Color.Transparent;
this.Label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label5.Location = new System.Drawing.Point(13, 13);
this.Label5.Name = "Label5";
@@ -1418,6 +1414,7 @@ namespace Handbrake // Label16
//
this.Label16.AutoSize = true;
+ this.Label16.BackColor = System.Drawing.Color.Transparent;
this.Label16.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label16.Location = new System.Drawing.Point(13, 40);
this.Label16.Name = "Label16";
@@ -1428,6 +1425,7 @@ namespace Handbrake // Label32
//
this.Label32.AutoSize = true;
+ this.Label32.BackColor = System.Drawing.Color.Transparent;
this.Label32.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label32.Location = new System.Drawing.Point(13, 100);
this.Label32.Name = "Label32";
@@ -1438,6 +1436,7 @@ namespace Handbrake // Label18
//
this.Label18.AutoSize = true;
+ this.Label18.BackColor = System.Drawing.Color.Transparent;
this.Label18.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label18.Location = new System.Drawing.Point(13, 70);
this.Label18.Name = "Label18";
@@ -1471,22 +1470,23 @@ namespace Handbrake this.TabPage3.Size = new System.Drawing.Size(639, 215);
this.TabPage3.TabIndex = 2;
this.TabPage3.Text = "Video Settings";
- this.TabPage3.UseVisualStyleBackColor = true;
//
// check_grayscale
//
this.check_grayscale.AutoSize = true;
+ this.check_grayscale.BackColor = System.Drawing.Color.Transparent;
this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.check_grayscale.Location = new System.Drawing.Point(16, 38);
this.check_grayscale.Name = "check_grayscale";
this.check_grayscale.Size = new System.Drawing.Size(138, 17);
this.check_grayscale.TabIndex = 53;
this.check_grayscale.Text = "Grayscale Encoding";
- this.check_grayscale.UseVisualStyleBackColor = true;
+ this.check_grayscale.UseVisualStyleBackColor = false;
//
// lbl_largeMp4Warning
//
this.lbl_largeMp4Warning.AutoSize = true;
+ this.lbl_largeMp4Warning.BackColor = System.Drawing.Color.Transparent;
this.lbl_largeMp4Warning.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 127);
this.lbl_largeMp4Warning.Name = "lbl_largeMp4Warning";
@@ -1497,6 +1497,7 @@ namespace Handbrake // Label22
//
this.Label22.AutoSize = true;
+ this.Label22.BackColor = System.Drawing.Color.Transparent;
this.Label22.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label22.Location = new System.Drawing.Point(13, 13);
this.Label22.Name = "Label22";
@@ -1507,18 +1508,20 @@ namespace Handbrake // check_2PassEncode
//
this.check_2PassEncode.AutoSize = true;
+ this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;
this.check_2PassEncode.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.check_2PassEncode.Location = new System.Drawing.Point(16, 61);
this.check_2PassEncode.Name = "check_2PassEncode";
this.check_2PassEncode.Size = new System.Drawing.Size(119, 17);
this.check_2PassEncode.TabIndex = 54;
this.check_2PassEncode.Text = "2-Pass Encoding";
- this.check_2PassEncode.UseVisualStyleBackColor = true;
+ this.check_2PassEncode.UseVisualStyleBackColor = false;
this.check_2PassEncode.CheckedChanged += new System.EventHandler(this.check_2PassEncode_CheckedChanged);
//
// Label2
//
this.Label2.AutoSize = true;
+ this.Label2.BackColor = System.Drawing.Color.Transparent;
this.Label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label2.Location = new System.Drawing.Point(304, 13);
this.Label2.Name = "Label2";
@@ -1529,6 +1532,7 @@ namespace Handbrake // Label42
//
this.Label42.AutoSize = true;
+ this.Label42.BackColor = System.Drawing.Color.Transparent;
this.Label42.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label42.Location = new System.Drawing.Point(304, 38);
this.Label42.Name = "Label42";
@@ -1549,6 +1553,7 @@ namespace Handbrake // Label46
//
this.Label46.AutoSize = true;
+ this.Label46.BackColor = System.Drawing.Color.Transparent;
this.Label46.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label46.Location = new System.Drawing.Point(13, 152);
this.Label46.Name = "Label46";
@@ -1559,6 +1564,7 @@ namespace Handbrake // Label40
//
this.Label40.AutoSize = true;
+ this.Label40.BackColor = System.Drawing.Color.Transparent;
this.Label40.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Label40.Location = new System.Drawing.Point(304, 96);
this.Label40.Name = "Label40";
@@ -1876,7 +1882,6 @@ namespace Handbrake this.advancedOptions.Controls.Add(this.TabPage2);
this.advancedOptions.Controls.Add(this.h264Tab);
this.advancedOptions.Controls.Add(this.TabPage6);
- this.advancedOptions.Controls.Add(this.tabPage4);
this.advancedOptions.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.advancedOptions.Location = new System.Drawing.Point(14, 276);
this.advancedOptions.Name = "advancedOptions";
@@ -1885,40 +1890,6 @@ namespace Handbrake this.advancedOptions.TabIndex = 27;
this.advancedOptions.TabStop = false;
//
- // tabPage4
- //
- this.tabPage4.BackColor = System.Drawing.SystemColors.ControlLight;
- this.tabPage4.Controls.Add(this.label26);
- this.tabPage4.Controls.Add(this.label25);
- this.tabPage4.Controls.Add(this.button1);
- this.tabPage4.Location = new System.Drawing.Point(4, 22);
- this.tabPage4.Name = "tabPage4";
- this.tabPage4.Size = new System.Drawing.Size(639, 215);
- this.tabPage4.TabIndex = 7;
- this.tabPage4.Text = "Development";
- this.tabPage4.UseVisualStyleBackColor = true;
- //
- // label26
- //
- this.label26.AutoSize = true;
- this.label26.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label26.Location = new System.Drawing.Point(13, 35);
- this.label26.Name = "label26";
- this.label26.Size = new System.Drawing.Size(372, 26);
- this.label26.TabIndex = 111;
- this.label26.Text = "This tab is used for testing of new features. You can ignore this.\r\nIt will not b" +
- "e a user visible tab on release.";
- //
- // label25
- //
- this.label25.AutoSize = true;
- this.label25.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label25.Location = new System.Drawing.Point(13, 13);
- this.label25.Name = "label25";
- this.label25.Size = new System.Drawing.Size(93, 13);
- this.label25.TabIndex = 110;
- this.label25.Text = "Development";
- //
// groupBox_dest
//
this.groupBox_dest.Controls.Add(this.Label3);
@@ -2017,8 +1988,6 @@ namespace Handbrake this.TabPage1.ResumeLayout(false);
this.TabPage1.PerformLayout();
this.advancedOptions.ResumeLayout(false);
- this.tabPage4.ResumeLayout(false);
- this.tabPage4.PerformLayout();
this.groupBox_dest.ResumeLayout(false);
this.groupBox_dest.PerformLayout();
this.groupBox2.ResumeLayout(false);
@@ -2168,10 +2137,6 @@ namespace Handbrake private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
private System.Windows.Forms.ToolStripMenuItem mnu_quickStart;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
- internal System.Windows.Forms.Button button1;
- private System.Windows.Forms.TabPage tabPage4;
- internal System.Windows.Forms.Label label26;
- internal System.Windows.Forms.Label label25;
private System.Windows.Forms.SaveFileDialog DVD_Save;
private System.Windows.Forms.OpenFileDialog File_Open;
private System.Windows.Forms.OpenFileDialog ISO_Open;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 3a58827b5..8f0374a52 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -11,11 +11,11 @@ using System.IO; using System.Diagnostics;
using System.Threading;
using System.Runtime.InteropServices;
+using System.Globalization;
namespace Handbrake
{
-
public partial class frmMain : Form
{
// --------------------------------------------------------------
@@ -26,53 +26,95 @@ namespace Handbrake // Some stuff that needs to be Initialized.
private Process hbProc;
- private Parsing.DVD thisDVD;
- private frmQueue queueWindow = new frmQueue();
+ private Parsing.DVD thisDVD;
+ private frmQueue queueWindow = new frmQueue();
// The main window beings here...
public frmMain()
{
+ // Load the splash screen in this thread
+ Form splash = new frmSplashScreen();
+ splash.Show();
+
+ //Create a label that can be updated from the parent thread.
+ Label lblStatus = new Label();
+
+ //Size the label
+ lblStatus.Size = new Size(250, 20);
+
+ //Position the label
+ lblStatus.Location = new Point(10, 280);
+
+ //Put the label on the splash form
+ splash.Controls.Add(lblStatus);
- // Load the splash screen on another thread. Once completed wait for 1 second.
- ThreadPool.QueueUserWorkItem(showSplash);
- Thread.Sleep(1000);
+ //Fire a thread to wait for 2 seconds. The splash screen will exit when the time expires
+ Thread timer = new Thread(splashTimer);
+ timer.Start();
InitializeComponent();
- // This is a quick Hack fix for the cross-thread problem with frmDvdIndo ************************
- //dvdInfoWindow.Show();
- //dvdInfoWindow.Hide();
- // **********************************************************************************************
+ // show the form, but leave disabled until preloading is complete
+ this.Enabled = false;
+
+ // Show the main form
+ this.Show();
+
+ // Forces frmMain to draw
+ Application.DoEvents();
// Set the Version number lable to the corect version.
Version.Text = "Version " + Properties.Settings.Default.CliVersion;
+ // update the status
+ lblStatus.Text = "Checking for updates ...";
+ // redraw the splash screen
+ Application.DoEvents();
// Run the update checker.
updateCheck();
+ Thread.Sleep(300);
// Now load the users default if required. (Will overide the above setting)
+ lblStatus.Text = "Loading User Default Settings...";
+ Application.DoEvents();
loadUserDefaults();
+ Thread.Sleep(300);
// Enable or disable tooltips
+ lblStatus.Text = "Loading Tooltips ...";
+ Application.DoEvents();
tooltip();
+ Thread.Sleep(300);
+
+ // Update the presets
+ lblStatus.Text = "Updaing Presets ...";
+ Application.DoEvents();
+ updatePresets();
+ Thread.Sleep(300);
- // Hide the preset bar should the user have the option enabled.
+ // Hide the preset bar if required.
hidePresetBar();
- // Load in all the presets
- updatePresets();
+ //Finished Loading
+ lblStatus.Text = "Loading Complete!";
+ Application.DoEvents();
+ Thread.Sleep(300);
+
+ // Wait until splash screen is done
+ while (timer.IsAlive)
+ { Thread.Sleep(100); }
- /*
- * This code can be used for storing preset and preset name information in future versions.
- * Please ignore it for the moment.
- // Create and initialize a new StringCollection.
- StringCollection myCol = new StringCollection();
- // Add a range of elements from an array to the end of the StringCollection.
- String[] myArr = new String[] { "RED", "orange", "yellow", "RED", "green", "blue", "RED", "indigo", "violet", "RED" };
- myCol.AddRange(myArr);
- Properties.Settings.Default.BuiltInPresets = myCol;
- MessageBox.Show(Properties.Settings.Default.BuiltInPresets.ToString());
- */
+ //Close the splash screen
+ splash.Close();
+ splash.Dispose();
+
+ // Turn the interface back to the user
+ this.Enabled = true;
+ }
+
+ private void splashTimer(object sender)
+ {
+ Thread.Sleep(2000); //sit for 2 seconds then exit
}
private void showSplash(object sender)
@@ -80,12 +122,12 @@ namespace Handbrake // Display splash screen for 1.5 Seconds
Form splash = new frmSplashScreen();
splash.Show();
- Thread.Sleep(1500);
+ Thread.Sleep(1500);
splash.Close(); // Then close.
}
private void loadUserDefaults()
- {
+ {
try
{
// Load the users default settings or if the user has not got this option enabled, load the normal preset.
@@ -160,7 +202,7 @@ namespace Handbrake {
Check_ChapterMarkers.CheckState = CheckState.Checked;
}
-
+
// Audio Settings Tab
drp_audioBitrate.Text = Properties.Settings.Default.AudioBitrate;
drp_audioSampleRate.Text = Properties.Settings.Default.AudioSampleRate;
@@ -209,10 +251,10 @@ namespace Handbrake int cliversion = int.Parse(Properties.Settings.Default.CliVersion.Replace(".", ""));
Boolean update = ((verdata > vergui) || (verd1 > cliversion));
-
+
lbl_update.Visible = update;
- return update;
+ return update;
}
else
{
@@ -251,105 +293,39 @@ 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;
- }
+ // Some things that need to be done to reset some gui components:
+ CheckPixelRatio.CheckState = CheckState.Unchecked;
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_turbo.CheckState = CheckState.Checked;
- }
+ //---------------------------
+ // Get the Preset
+ // ---------------------------
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- check_largeFile.CheckState = CheckState.Checked;
- }
+ // Create StreamReader & open file
+ StreamReader line = new StreamReader(filename);
- drp_audioBitrate.Text = line.ReadLine();
- drp_audioSampleRate.Text = line.ReadLine();
- drp_audioChannels.Text = line.ReadLine();
- drp_audioMixDown.Text = line.ReadLine();
+ // Send the query from the file to the Query Parser class
+ Functions.QueryParser presetQuery = Functions.QueryParser.Parse(line.ReadLine());
- // Advanced H264 Options
- temporyLine = line.ReadLine();
- if (temporyLine == "Checked")
- {
- CheckCRF.CheckState = CheckState.Checked;
- }
- rtf_h264advanced.Text = line.ReadLine();
+ // Now load the preset
+ presetLoader(presetQuery, filename);
// Close the stream
line.Close();
-
-
- // Fix for SliderValue not appearing when Opening saved file
- SliderValue.Text = slider_videoQuality.Value + "%";
-
}
- catch (Exception)
+ catch (Exception exc)
{
MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ MessageBox.Show(exc.ToString());
}
}
}
@@ -366,43 +342,10 @@ namespace Handbrake // 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);
+ // Generate and write the query string to the file
+ String query = GenerateTheQuery();
+ line.WriteLine(query);
+
// close the stream
line.Close();
MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
@@ -428,7 +371,7 @@ namespace Handbrake {
showQueue();
}
-
+
private void mnu_viewDVDdata_Click(object sender, EventArgs e)
{
frmDvdInfo dvdInfoWindow = new frmDvdInfo();
@@ -483,7 +426,7 @@ namespace Handbrake private void mnu_wiki_Click(object sender, EventArgs e)
{
- Process.Start("http://handbrake.m0k.org/trac");
+ Process.Start("http://handbrake.m0k.org/trac");
}
private void mnu_faq_Click(object sender, EventArgs e)
@@ -498,7 +441,7 @@ namespace Handbrake private void mnu_homepage_Click(object sender, EventArgs e)
{
- Process.Start("http://handbrake.m0k.org");
+ Process.Start("http://handbrake.m0k.org");
}
private void mnu_forum_Click(object sender, EventArgs e)
@@ -521,7 +464,7 @@ namespace Handbrake private void mnu_about_Click(object sender, EventArgs e)
{
- Form About = new frmAbout();
+ Form About = new frmAbout();
About.ShowDialog();
}
@@ -535,44 +478,44 @@ namespace Handbrake private void btn_Browse_Click(object sender, EventArgs e)
{
- String filename = "";
- text_source.Text = "";
+ String filename = "";
+ text_source.Text = "";
frmDvdInfo dvdInfoWindow = new frmDvdInfo();
-
- if (RadioDVD.Checked)
- {
- DVD_Open.ShowDialog();
- filename = DVD_Open.SelectedPath;
- if (filename != "")
- {
- Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
- text_source.Text = filename;
- frmRD.ShowDialog();
- }
- }
- else
- {
- ISO_Open.ShowDialog();
- filename = ISO_Open.FileName;
- if (filename != "")
- {
- Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
- text_source.Text = filename;
- frmRD.ShowDialog();
- }
- }
-
- // Check if there was titles in the dvd title dropdown
- if (filename == "")
- {
- text_source.Text = "Click 'Browse' to continue";
- }
-
- // 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. Please refer to the FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
- }
+
+ if (RadioDVD.Checked)
+ {
+ DVD_Open.ShowDialog();
+ filename = DVD_Open.SelectedPath;
+ if (filename != "")
+ {
+ Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
+ text_source.Text = filename;
+ frmRD.ShowDialog();
+ }
+ }
+ else
+ {
+ ISO_Open.ShowDialog();
+ filename = ISO_Open.FileName;
+ if (filename != "")
+ {
+ Form frmRD = new frmReadDVD(filename, this, dvdInfoWindow);
+ text_source.Text = filename;
+ frmRD.ShowDialog();
+ }
+ }
+
+ // Check if there was titles in the dvd title dropdown
+ if (filename == "")
+ {
+ text_source.Text = "Click 'Browse' to continue";
+ }
+
+ // 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. Please refer to the FAQ (see Help Menu).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
+ }
}
private void btn_destBrowse_Click(object sender, EventArgs e)
@@ -581,7 +524,7 @@ namespace Handbrake // It's daft but some users don't realise that typing an extension overrides the dropdown extension selected.
// Should be a nicer way to do this.
DVD_Save.FileName = DVD_Save.FileName.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "").Replace(".ogm", "").Replace(".avi", "");
-
+
// Show the dialog and set the main form file path
DVD_Save.ShowDialog();
text_destination.Text = DVD_Save.FileName;
@@ -613,7 +556,7 @@ namespace Handbrake private void btn_queue_Click(object sender, EventArgs e)
{
-
+
if (text_source.Text == "" || text_source.Text == "Click 'Browse' to continue" || text_destination.Text == "")
MessageBox.Show("No source OR destination selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
@@ -629,9 +572,9 @@ namespace Handbrake }
queueWindow.list_queue.Items.Add(query);
queueWindow.Show();
- }
+ }
}
-
+
private void btn_copy_Click(object sender, EventArgs e)
{
if (QueryEditorText.Text != "")
@@ -682,7 +625,7 @@ namespace Handbrake preset_listview = new ListViewItem(presetList);
// Now Fill Out List View with Items
- listview_presets.Items.Add(preset_listview);
+ listview_presets.Items.Add(preset_listview);
}
}
@@ -775,24 +718,30 @@ namespace Handbrake break;
case "AppleTV":
+ setmp4();
setGuiSetttings(CheckState.Checked, "", "", "H.264", "2500", "", 0, "0%", "160", CheckState.Checked, "48", "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2:cabac=0", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Apple TV)");
break;
case "Bedlam":
+ setmp4();
setGuiSetttings(CheckState.Checked, "", "", "H.264", "1800", "", 0, "0%", "160", CheckState.Checked, "48", "ref=16:mixed-refs:bframes=6:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:me-range=64:analyse=all:8x8dct:trellis=2:no-fast-pskip:no-dct-decimate:filter=-2,-1", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AC3", "Output Settings (Preset: Bedlam)");
- setMkv();
break;
case "Blind":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "512", "", "Mpeg 4", "512", "", 0, "0%", "128", CheckState.Checked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Blind)");
break;
case "Broke":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "640", "", "H.264", "", "695", 0, "0%", "128", CheckState.Checked, "48", "ref=3:mixed-refs:bframes=6:bime:weightb:b-rdo:b-pyramid::direct=auto:me=umh:subme=6:trellis=1:analyse=all:8x8dct:no-fast-pskip", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Broke)");
break;
+
case "Classic":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "", "", "Mpeg 4", "1000", "", 0, "0%", "160", CheckState.Unchecked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: Classic)");
+
break;
case "Constant Quality Rate":
@@ -811,30 +760,37 @@ namespace Handbrake break;
case "iPhone / iPod Touch":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "480", "", "H.264 (iPod)", "960", "", 0, "0%", "128", CheckState.Checked, "48", "cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPhone)");
break;
case "iPod High-Rez":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "640", "", "H.264 (iPod)", "1500", "", 0, "0%", "160", CheckState.Checked, "48", "keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPod High Rez)");
break;
case "iPod Low-Rez":
setGuiSetttings(CheckState.Unchecked, "320", "", "H.264 (iPod)", "700", "", 0, "0%", "160", CheckState.Checked, "48", "keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: iPod Low Rez)");
+ setmp4();
break;
case "Normal":
setGuiSetttings(CheckState.Checked, "", "", "H.264", "1500", "", 0, "0%", "160", CheckState.Checked, "48", "ref=2:bframes=2:subme=5:me=umh", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Normal)");
+ setmp4();
break;
case "PS3":
+ setmp4();
setGuiSetttings(CheckState.Checked, "", "", "H.264", "2500", "", 0, "0%", "160", CheckState.Checked, "48", "level=41:subme=5:me=umh", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: PS3)");
break;
case "PSP":
+ setmp4();
setGuiSetttings(CheckState.Unchecked, "368", "208", "Mpeg 4", "1024", "", 0, "0%", "160", CheckState.Checked, "48", "", "None", CheckState.Unchecked, "No Crop", CheckState.Unchecked, "AAC", "Output Settings (Preset: PSP)");
break;
case "QuickTime":
+ setmp4();
setGuiSetttings(CheckState.Checked, "", "", "H.264", "2000", "", 0, "0%", "160", CheckState.Checked, "48", "ref=3:mixed-refs:bframes=3:bime:weightb:b-rdo:direct=auto:me=umh:subme=5:analyse=all:8x8dct:trellis=1:no-fast-pskip", "None", CheckState.Checked, "No Crop", CheckState.Checked, "AAC", "Output Settings (Preset: Quicktime)");
break;
@@ -883,6 +839,16 @@ namespace Handbrake destination = destination.Replace(".ogm", ".mkv");
text_destination.Text = destination;
}
+ private void setmp4()
+ {
+ // Set file extension to MKV
+ string destination = text_destination.Text;
+ destination = destination.Replace(".m4v", ".mp4");
+ destination = destination.Replace(".avi", ".mp4");
+ destination = destination.Replace(".mkv", ".mp4");
+ destination = destination.Replace(".ogm", ".mp4");
+ text_destination.Text = destination;
+ }
#endregion
@@ -928,7 +894,7 @@ namespace Handbrake [DllImport("user32.dll")]
public static extern void LockWorkStation();
[DllImport("user32.dll")]
- public static extern int ExitWindowsEx(int uFlags, int dwReason);
+ public static extern int ExitWindowsEx(int uFlags, int dwReason);
private void procMonitor(object state)
{
@@ -963,7 +929,7 @@ namespace Handbrake hbProc.WaitForExit();
process.closeCLI();
*/
-
+
}
catch (Exception exc)
{
@@ -982,7 +948,7 @@ namespace Handbrake System.Diagnostics.Process.Start("Shutdown", "-s -t 60");
break;
case "Log Off":
- ExitWindowsEx(0, 0);
+ ExitWindowsEx(0, 0);
break;
case "Suspend":
Application.SetSuspendState(PowerState.Suspend, true, true);
@@ -1016,7 +982,7 @@ namespace Handbrake private void encode_OnEncodeProgress(object Sender, int CurrentTask, int TaskCount, float PercentComplete, float CurrentFps, float AverageFps, TimeSpan TimeRemaining)
{
-
+
if (this.InvokeRequired)
{
this.BeginInvoke(new Parsing.EncodeProgressEventHandler(encode_OnEncodeProgress),
@@ -1056,7 +1022,7 @@ namespace Handbrake }
}
-
+
}
private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)
@@ -1122,7 +1088,7 @@ namespace Handbrake text_width.Text = "";
text_width.BackColor = Color.LightCoral;
CheckPixelRatio.BackColor = Color.LightCoral;
-
+
}
else
{
@@ -1151,15 +1117,15 @@ namespace Handbrake {
text_height.Text = height.ToString();
}
- }
+ }
}
catch (Exception)
{
// No need to throw an error here.
// Note on non english systems, this will throw an error because of double.Parse(lbl_Aspect.Text); not working.
}
-
-
+
+
}
private void text_height_TextChanged(object sender, EventArgs e)
@@ -1167,24 +1133,26 @@ namespace Handbrake try
{
if (CheckPixelRatio.Checked)
- {
- text_height.Text = "";
- text_height.BackColor = Color.LightCoral;
- CheckPixelRatio.BackColor = Color.LightCoral;
+ {
+ text_height.Text = "";
+ text_height.BackColor = Color.LightCoral;
+ CheckPixelRatio.BackColor = Color.LightCoral;
}
else
{
if ((int.Parse(text_height.Text) % 16) != 0)
{
- text_height.BackColor = Color.LightCoral;
+ text_height.BackColor = Color.LightCoral;
}
else
{
- text_height.BackColor = Color.LightGreen;
+ text_height.BackColor = Color.LightGreen;
}
}
- } catch(Exception){
+ }
+ catch (Exception)
+ {
// No need to alert the user.
}
}
@@ -1193,10 +1161,10 @@ namespace Handbrake {
if ((string)drp_crop.SelectedItem == "Manual")
{
- text_left.Enabled = true;
- text_right.Enabled = true;
- text_top.Enabled = true;
- text_bottom.Enabled = true;
+ text_left.Enabled = true;
+ text_right.Enabled = true;
+ text_top.Enabled = true;
+ text_bottom.Enabled = true;
}
if ((string)drp_crop.SelectedItem == "Auto Crop")
@@ -1234,7 +1202,7 @@ namespace Handbrake }
}
-
+
private void CheckPixelRatio_CheckedChanged(object sender, EventArgs e)
{
text_width.Text = "";
@@ -1298,7 +1266,7 @@ namespace Handbrake drp_audioMixDown.Items.Add("Dolby Surround");
drp_audioMixDown.Items.Add("Dolby Pro Logic II");
drp_audioMixDown.Items.Add("6 Channel Discrete");
-
+
drp_audioBitrate.Items.Clear();
drp_audioBitrate.Items.Add("32");
drp_audioBitrate.Items.Add("40");
@@ -1380,8 +1348,6 @@ namespace Handbrake }
}
-
-
private void drp_videoEncoder_SelectedIndexChanged(object sender, EventArgs e)
{
//Turn off some options which are H.264 only when the user selects a non h.264 encoder
@@ -1431,7 +1397,7 @@ namespace Handbrake // Set the Recommended Cropping values
lbl_RecomendedCrop.Text = string.Format("{0}/{1}/{2}/{3}", selectedTitle.AutoCropDimensions[0], selectedTitle.AutoCropDimensions[1], selectedTitle.AutoCropDimensions[2], selectedTitle.AutoCropDimensions[3]);
-
+
// Populate the Start chapter Dropdown
drop_chapterStart.Items.Clear();
drop_chapterStart.Items.AddRange(selectedTitle.Chapters.ToArray());
@@ -1477,6 +1443,7 @@ namespace Handbrake #region Program Functions
+ // Generate a CLI Query String
public string GenerateTheQuery()
{
string source = text_source.Text;
@@ -1486,14 +1453,14 @@ namespace Handbrake int totalChapters = drop_chapterFinish.Items.Count - 1;
string dvdChapter = "";
- source = " -i " + '"' + source+ '"';
+ source = " -i " + '"' + source + '"';
- if (dvdTitle == "Automatic")
+ if (dvdTitle == "Automatic")
dvdTitle = "";
else
{
string[] titleInfo = dvdTitle.Split(' ');
- dvdTitle = " -t "+ titleInfo[0];
+ dvdTitle = " -t " + titleInfo[0];
}
if (chapterFinish.Equals("Auto") && chapterStart.Equals("Auto"))
@@ -1503,7 +1470,7 @@ namespace Handbrake else
dvdChapter = " -c " + chapterStart + "-" + chapterFinish;
- string querySource = source+ dvdTitle+ dvdChapter;
+ string querySource = source + dvdTitle + dvdChapter;
// ----------------------------------------------------------------------
// Destination
@@ -1514,7 +1481,7 @@ namespace Handbrake string width = text_width.Text;
string height = text_height.Text;
- if (destination == "")
+ if (destination == "")
MessageBox.Show("No destination has been selected.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
destination = " -o " + '"' + destination + '"'; //'"'+
@@ -1541,7 +1508,7 @@ namespace Handbrake videoEncoder = " -e x264";
break;
}
-
+
switch (audioEncoder)
{
case "AAC":
@@ -1561,8 +1528,8 @@ namespace Handbrake break;
}
- if (width != "")
- width = " -w "+ width;
+ if (width != "")
+ width = " -w " + width;
if (height == "Auto")
@@ -1573,9 +1540,9 @@ namespace Handbrake {
height = " -l " + height;
}
-
- string queryDestination = destination+ videoEncoder+ audioEncoder+ width+ height;
+
+ string queryDestination = destination + videoEncoder + audioEncoder + width + height;
// ----------------------------------------------------------------------
// Picture Settings Tab
@@ -1612,15 +1579,15 @@ namespace Handbrake cropOut = " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
}
- if (subtitles == "None")
+ if (subtitles == "None")
subtitles = "";
- else if (subtitles == "")
+ else if (subtitles == "")
subtitles = "";
else
{
string[] tempSub;
tempSub = subtitles.Split(' ');
- subtitles = " -s "+ tempSub[0];
+ subtitles = " -s " + tempSub[0];
}
switch (deInterlace_Option)
@@ -1629,16 +1596,16 @@ namespace Handbrake deinterlace = "";
break;
case "Original (Fast)":
- deinterlace = " --deinterlace=" + '"' + "-1" + '"';
+ deinterlace = " --deinterlace=fast";
break;
case "yadif (Slow)":
- deinterlace = " --deinterlace=" + '"' + "0" + '"';
+ deinterlace = " --deinterlace=slow";
break;
case "yadif + mcdeint (Slower)":
- deinterlace = " --deinterlace=" + '"' + "2:-1:1" + '"';
+ deinterlace = " --deinterlace=slower";
break;
case "yadif + mcdeint (Slowest)":
- deinterlace = " --deinterlace=" + '"' + "1:-1:1" + '"';
+ deinterlace = " --deinterlace=slowest";
break;
default:
deinterlace = "";
@@ -1677,34 +1644,33 @@ namespace Handbrake else
CRF = "";
- if (videoBitrate != "")
- videoBitrate = " -b "+ videoBitrate;
+ if (videoBitrate != "")
+ videoBitrate = " -b " + videoBitrate;
- if (videoFilesize != "")
- videoFilesize = " -S "+ videoFilesize;
+ if (videoFilesize != "")
+ videoFilesize = " -S " + videoFilesize;
// Video Quality Setting
- if ((videoQuality == 0))
+ if ((videoQuality == 0))
vidQSetting = "";
else
{
videoQuality = videoQuality / 100;
- if (videoQuality == 1)
+ if (videoQuality == 1)
{
vidQSetting = "1.0";
}
-
- vidQSetting = " -q " + videoQuality.ToString();
+ vidQSetting = " -q " + videoQuality.ToString(new CultureInfo("en-US"));
}
if (check_2PassEncode.Checked)
twoPassEncoding = " -2 ";
- if (videoFramerate == "Automatic")
+ if (videoFramerate == "Automatic")
videoFramerate = "";
else
- videoFramerate = " -r "+ videoFramerate;
+ videoFramerate = " -r " + videoFramerate;
if (check_turbo.Checked)
turboH264 = " -T ";
@@ -1724,13 +1690,13 @@ namespace Handbrake denoise = "";
break;
case "Weak":
- denoise = " --denoise=2:1:2:3";
+ denoise = " --denoise=weak";
break;
case "Medium":
- denoise = " --denoise=3:2:2:3";
+ denoise = " --denoise=medium";
break;
case "Strong":
- denoise = " --denoise=7:7:5:5";
+ denoise = " --denoise=strong";
break;
default:
denoise = "";
@@ -1748,21 +1714,21 @@ namespace Handbrake string Mixdown = drp_audioMixDown.Text;
string SixChannelAudio = "";
- if (audioBitrate != "")
- audioBitrate = " -B "+ audioBitrate;
+ if (audioBitrate != "")
+ audioBitrate = " -B " + audioBitrate;
- if (audioSampleRate != "")
- audioSampleRate = " -R "+ audioSampleRate;
+ if (audioSampleRate != "")
+ audioSampleRate = " -R " + audioSampleRate;
- if (audioChannels == "Automatic")
+ if (audioChannels == "Automatic")
audioChannels = "";
- else if (audioChannels == "")
+ else if (audioChannels == "")
audioChannels = "";
else
{
string[] tempSub;
tempSub = audioChannels.Split(' ');
- audioChannels = " -a "+ tempSub[0];
+ audioChannels = " -a " + tempSub[0];
}
switch (Mixdown)
@@ -1790,24 +1756,24 @@ namespace Handbrake break;
}
- if (Mixdown != "")
- SixChannelAudio = " -6 "+ Mixdown;
+ if (Mixdown != "")
+ SixChannelAudio = " -6 " + Mixdown;
else
SixChannelAudio = "";
- string queryAudioSettings = audioBitrate+ audioSampleRate+ audioChannels+ SixChannelAudio;
+ string queryAudioSettings = audioBitrate + audioSampleRate + audioChannels + SixChannelAudio;
// ----------------------------------------------------------------------
// H.264 Tab
-
+
string h264Advanced = rtf_h264advanced.Text;
-
- if ((h264Advanced == ""))
+
+ if ((h264Advanced == ""))
h264Advanced = "";
else
- h264Advanced = " -x "+ h264Advanced;
-
+ h264Advanced = " -x " + h264Advanced;
+
string h264Settings = h264Advanced;
// ----------------------------------------------------------------------
@@ -1817,10 +1783,10 @@ namespace Handbrake string processors = Properties.Settings.Default.Processors;
// Number of Processors Handler
- if (processors == "Automatic")
+ if (processors == "Automatic")
processors = "";
else
- processors = " -C "+ processors+ " ";
+ processors = " -C " + processors + " ";
string queryAdvancedSettings = processors;
@@ -1829,35 +1795,188 @@ namespace Handbrake // Verbose option (Program Settings)
string verbose = "";
- if (Properties.Settings.Default.verbose == "Checked")
+ if (Properties.Settings.Default.verbose == "Checked")
verbose = " -v ";
// ----------------------------------------------------------------------
- return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose;
+ return querySource + queryDestination + queryPictureSettings + queryVideoSettings + h264Settings + queryAudioSettings + queryAdvancedSettings + verbose;
}
- #endregion
+ // Load a Preset
+ private void presetLoader(Functions.QueryParser presetQuery, string name)
+ {
+ // ---------------------------
+ // Setup the GUI
+ // ---------------------------
+
+ // Source tab
+ #region source
+ text_source.Text = presetQuery.Source;
+ if (presetQuery.DVDTitle != 0)
+ drp_dvdtitle.Text = presetQuery.DVDTitle.ToString();
+
+ if (presetQuery.DVDChapterStart != 0)
+ drop_chapterStart.Text = presetQuery.DVDChapterStart.ToString();
+
+ if (presetQuery.DVDChapterFinish != 0)
+ drop_chapterFinish.Text = presetQuery.DVDChapterFinish.ToString();
+ #endregion
+
+ // Destination tab
+ #region destination
+
+ text_destination.Text = presetQuery.Destination;
+ drp_videoEncoder.Text = presetQuery.VideoEncoder;
+ drp_audioCodec.Text = presetQuery.AudioEncoder;
+ if (presetQuery.Width != 0)
+ {
+ text_width.Text = presetQuery.Width.ToString();
+ }
+ else
+ {
+ text_width.Text = "";
+ text_width.BackColor = Color.White;
+ }
+ if (presetQuery.Height != 0)
+ {
+ text_height.Text = presetQuery.Height.ToString();
+ }
+ else
+ {
+ text_height.Text = "";
+ text_width.BackColor = Color.White;
+ }
+ #endregion
+ // Picture Settings Tab
+ #region Picture
+ drp_crop.Text = "Manual";
+ text_top.Text = presetQuery.CropTop;
+ text_bottom.Text = presetQuery.CropBottom;
+ text_left.Text = presetQuery.CropLeft;
+ text_right.Text = presetQuery.CropRight;
+ drp_deInterlace_option.Text = presetQuery.DeInterlace;
+ drp_deNoise.Text = presetQuery.DeNoise;
- private Functions.QueryParser thisQuery;
- private void button1_Click(object sender, EventArgs e)
- {
- String query = "";
- if (QueryEditorText.Text == "")
+ if (presetQuery.DeTelecine == true)
+ {
+ check_detelecine.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_detelecine.CheckState = CheckState.Unchecked;
+ }
+
+
+ if (presetQuery.DeBlock == true)
+ {
+ check_deblock.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_deblock.CheckState = CheckState.Unchecked;
+ }
+
+ if (presetQuery.ChapterMarkers == true)
{
- query = GenerateTheQuery();
+ Check_ChapterMarkers.CheckState = CheckState.Checked;
}
else
{
- query = QueryEditorText.Text;
+ Check_ChapterMarkers.CheckState = CheckState.Unchecked;
}
- thisQuery = Functions.QueryParser.Parse(query);
- MessageBox.Show(thisQuery.Source.ToString());
- MessageBox.Show(thisQuery.Destination.ToString());
+
+ if (presetQuery.Anamorphic == true)
+ {
+ CheckPixelRatio.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ CheckPixelRatio.CheckState = CheckState.Unchecked;
+ }
+ #endregion
+
+ // Video Settings Tab
+ #region video
+ text_bitrate.Text = presetQuery.AverageVideoBitrate;
+ text_filesize.Text = presetQuery.VideoTargetSize;
+ slider_videoQuality.Value = presetQuery.VideoQuality;
+ if (slider_videoQuality.Value != 0)
+ {
+ CheckCRF.Enabled = true;
+ int ql = presetQuery.VideoQuality;
+ SliderValue.Text = ql.ToString() + "%";
+ }
+
+ if (presetQuery.TwoPass == true)
+ {
+ check_2PassEncode.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_2PassEncode.CheckState = CheckState.Unchecked;
+ }
+
+ if (presetQuery.Grayscale == true)
+ {
+ check_grayscale.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_grayscale.CheckState = CheckState.Unchecked;
+ }
+
+ drp_videoFramerate.Text = presetQuery.VideoFramerate;
+
+ if (presetQuery.TurboFirstPass == true)
+ {
+ check_turbo.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_turbo.CheckState = CheckState.Unchecked;
+ }
+
+ if (presetQuery.LargeMP4 == true)
+ {
+ check_largeFile.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ check_largeFile.CheckState = CheckState.Unchecked;
+ }
+ if (presetQuery.CRF == true)
+ {
+ CheckCRF.CheckState = CheckState.Checked;
+ }
+ else
+ {
+ CheckCRF.CheckState = CheckState.Unchecked;
+ }
+ #endregion
+
+ // Audio Settings Tab
+ #region audio
+ drp_audioBitrate.Text = presetQuery.AudioBitrate;
+ drp_audioSampleRate.Text = presetQuery.AudioSampleBitrate;
+ drp_audioChannels.Text = presetQuery.AudioTrack1;
+ drp_audioMixDown.Text = presetQuery.AudioTrackMix;
+ drp_subtitle.Text = presetQuery.Subtitles;
+ #endregion
+
+ // H264 Tab & Preset Name
+ #region other
+ rtf_h264advanced.Text = presetQuery.H264Query;
+
+ // Set the preset name
+ groupBox_output.Text = "Output Settings (Preset: " + name + ")";
+ #endregion
}
+ #endregion
+
// This is the END of the road ------------------------------------------------------------------------------
}
-}
+}
\ No newline at end of file |