From: sr55 Date: Sat, 1 Dec 2007 18:41:27 +0000 (+0000) Subject: WinGui: X-Git-Tag: 0.9.2~210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=282203512f88da3130ec11ebcc575d83db6a2c74;p=handbrake WinGui: - Optimize MP3 and iPod Atom check boxes implemented. - Cleaned up a few if statements by removing unneeded brackets. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1093 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 40731273f..bbd6a718e 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -351,6 +351,30 @@ namespace Handbrake.Functions } } + private Boolean q_ipodAtom; + /// + /// Returns a boolean to indicate wither Larger MP4 files is on or off. + /// + public Boolean IpodAtom + { + get + { + return this.q_ipodAtom; + } + } + + private Boolean q_optimizeMp4; + /// + /// Returns a boolean to indicate wither Larger MP4 files is on or off. + /// + public Boolean OptimizeMP4 + { + get + { + return this.q_optimizeMp4; + } + } + private string q_videoFramerate; /// /// Returns a string with the video Framerate @@ -537,7 +561,9 @@ namespace Handbrake.Functions Match turboFirstPass = Regex.Match(input, @"-T"); Match grayscale = Regex.Match(input, @"-g"); Match largerMp4 = Regex.Match(input, @"-4"); - + Match ipodAtom = Regex.Match(input, @"-I"); + Match optimizeMP4 = Regex.Match(input, @"-O"); + //Audio Settings Tab Match subtitles = Regex.Match(input, @"-s ([0-9]*)"); Match audioBitrate = Regex.Match(input, @"-B ([0-9]*)"); @@ -561,9 +587,7 @@ namespace Handbrake.Functions thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", ""); if (title.Success != false) - { thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", "")); - } if (chapters.Success != false) { @@ -574,10 +598,8 @@ namespace Handbrake.Functions } if (format.Success != false) - { - thisQuery.q_format = format.ToString().Replace("-f ", ""); - } + #endregion // @@ -636,13 +658,11 @@ namespace Handbrake.Functions if (width.Success != false) - { thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", "")); - } + if (height.Success != false) - { thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", "")); - } + #endregion // @@ -722,21 +742,14 @@ namespace Handbrake.Functions thisQuery.q_turboFirst = turboFirstPass.Success; thisQuery.q_largeMp4 = largerMp4.Success; if (videoFramerate.Success != false) - { thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", ""); - } else - { thisQuery.q_videoFramerate = "Automatic"; - } + 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.Success != false) @@ -746,6 +759,9 @@ namespace Handbrake.Functions thisQuery.q_videoQuality = int.Parse(qConvert.ToString()); } thisQuery.q_crf = CRF.Success; + thisQuery.q_ipodAtom = ipodAtom.Success; + thisQuery.q_optimizeMp4 = optimizeMP4.Success; + #endregion // @@ -753,21 +769,15 @@ namespace Handbrake.Functions // #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 ", ""); - } else - { thisQuery.q_audioTrack1 = "Automatic"; - } thisQuery.q_audioTrackMix = "Automatic"; if (audioChannelsMix.Success != false) @@ -796,13 +806,10 @@ namespace Handbrake.Functions } if (subtitles.Success != false) - { thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", ""); - } else - { thisQuery.q_subtitles = "None"; - } + #endregion // diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index c148ef030..f0c40e8bf 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -140,6 +140,9 @@ namespace Handbrake this.Label32 = new System.Windows.Forms.Label(); this.Label18 = new System.Windows.Forms.Label(); this.TabPage3 = new System.Windows.Forms.TabPage(); + this.lbl_ipodAtom = new System.Windows.Forms.Label(); + this.label25 = new System.Windows.Forms.Label(); + this.lbl_vfr = new System.Windows.Forms.Label(); this.check_iPodAtom = new System.Windows.Forms.CheckBox(); this.check_optimiseMP4 = new System.Windows.Forms.CheckBox(); this.check_grayscale = new System.Windows.Forms.CheckBox(); @@ -181,7 +184,7 @@ namespace Handbrake this.groupBox_dest = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.treeView_presets = new System.Windows.Forms.TreeView(); - this.lbl_vfr = new System.Windows.Forms.Label(); + this.lbl_optimize = new System.Windows.Forms.Label(); Label38 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit(); this.frmMainMenu.SuspendLayout(); @@ -505,7 +508,7 @@ namespace Handbrake "24", "25", "29.97"}); - this.drp_videoFramerate.Location = new System.Drawing.Point(133, 189); + this.drp_videoFramerate.Location = new System.Drawing.Point(446, 185); this.drp_videoFramerate.Name = "drp_videoFramerate"; this.drp_videoFramerate.Size = new System.Drawing.Size(81, 21); this.drp_videoFramerate.TabIndex = 7; @@ -1433,6 +1436,9 @@ namespace Handbrake // TabPage3 // this.TabPage3.BackColor = System.Drawing.SystemColors.ControlLight; + this.TabPage3.Controls.Add(this.lbl_optimize); + this.TabPage3.Controls.Add(this.lbl_ipodAtom); + this.TabPage3.Controls.Add(this.label25); this.TabPage3.Controls.Add(this.lbl_vfr); this.TabPage3.Controls.Add(this.check_iPodAtom); this.TabPage3.Controls.Add(this.check_optimiseMP4); @@ -1460,10 +1466,46 @@ namespace Handbrake this.TabPage3.TabIndex = 2; this.TabPage3.Text = "Video Settings"; // + // lbl_ipodAtom + // + this.lbl_ipodAtom.AutoSize = true; + this.lbl_ipodAtom.BackColor = System.Drawing.Color.Transparent; + this.lbl_ipodAtom.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_ipodAtom.ForeColor = System.Drawing.Color.Red; + this.lbl_ipodAtom.Location = new System.Drawing.Point(132, 169); + this.lbl_ipodAtom.Name = "lbl_ipodAtom"; + this.lbl_ipodAtom.Size = new System.Drawing.Size(91, 12); + this.lbl_ipodAtom.TabIndex = 29; + this.lbl_ipodAtom.Text = "x264 && mp4 only"; + this.lbl_ipodAtom.Visible = false; + // + // label25 + // + this.label25.AutoSize = true; + this.label25.BackColor = System.Drawing.Color.Transparent; + 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(304, 164); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(76, 13); + this.label25.TabIndex = 28; + this.label25.Text = "Framerate"; + // + // lbl_vfr + // + this.lbl_vfr.AutoSize = true; + this.lbl_vfr.BackColor = System.Drawing.Color.Transparent; + this.lbl_vfr.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_vfr.Location = new System.Drawing.Point(533, 189); + this.lbl_vfr.Name = "lbl_vfr"; + this.lbl_vfr.Size = new System.Drawing.Size(52, 12); + this.lbl_vfr.TabIndex = 27; + this.lbl_vfr.Text = "(VFR On)"; + this.lbl_vfr.Visible = false; + // // check_iPodAtom // this.check_iPodAtom.AutoSize = true; - this.check_iPodAtom.BackColor = System.Drawing.Color.DarkRed; + this.check_iPodAtom.BackColor = System.Drawing.Color.Transparent; this.check_iPodAtom.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.check_iPodAtom.Location = new System.Drawing.Point(16, 167); this.check_iPodAtom.Name = "check_iPodAtom"; @@ -1471,11 +1513,12 @@ namespace Handbrake this.check_iPodAtom.TabIndex = 26; this.check_iPodAtom.Text = "Add iPod Atom"; this.check_iPodAtom.UseVisualStyleBackColor = false; + this.check_iPodAtom.CheckedChanged += new System.EventHandler(this.check_iPodAtom_CheckedChanged); // // check_optimiseMP4 // this.check_optimiseMP4.AutoSize = true; - this.check_optimiseMP4.BackColor = System.Drawing.Color.DarkRed; + this.check_optimiseMP4.BackColor = System.Drawing.Color.Transparent; this.check_optimiseMP4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.check_optimiseMP4.Location = new System.Drawing.Point(16, 144); this.check_optimiseMP4.Name = "check_optimiseMP4"; @@ -1483,6 +1526,7 @@ namespace Handbrake this.check_optimiseMP4.TabIndex = 25; this.check_optimiseMP4.Text = "Optimize MP4 for streaming"; this.check_optimiseMP4.UseVisualStyleBackColor = false; + this.check_optimiseMP4.CheckedChanged += new System.EventHandler(this.check_optimiseMP4_CheckedChanged); // // check_grayscale // @@ -1568,7 +1612,7 @@ namespace Handbrake 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, 192); + this.Label46.Location = new System.Drawing.Point(304, 188); this.Label46.Name = "Label46"; this.Label46.Size = new System.Drawing.Size(107, 13); this.Label46.TabIndex = 6; @@ -1972,17 +2016,18 @@ namespace Handbrake this.treeView_presets.TabIndex = 2; this.treeView_presets.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_presets_AfterSelect); // - // lbl_vfr + // lbl_optimize // - this.lbl_vfr.AutoSize = true; - this.lbl_vfr.BackColor = System.Drawing.Color.Transparent; - this.lbl_vfr.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbl_vfr.Location = new System.Drawing.Point(220, 193); - this.lbl_vfr.Name = "lbl_vfr"; - this.lbl_vfr.Size = new System.Drawing.Size(52, 12); - this.lbl_vfr.TabIndex = 27; - this.lbl_vfr.Text = "(VFR On)"; - this.lbl_vfr.Visible = false; + this.lbl_optimize.AutoSize = true; + this.lbl_optimize.BackColor = System.Drawing.Color.Transparent; + this.lbl_optimize.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbl_optimize.ForeColor = System.Drawing.Color.Red; + this.lbl_optimize.Location = new System.Drawing.Point(206, 146); + this.lbl_optimize.Name = "lbl_optimize"; + this.lbl_optimize.Size = new System.Drawing.Size(91, 12); + this.lbl_optimize.TabIndex = 30; + this.lbl_optimize.Text = "x264 && mp4 only"; + this.lbl_optimize.Visible = false; // // frmMain // @@ -2188,6 +2233,9 @@ namespace Handbrake internal System.Windows.Forms.CheckBox check_iPodAtom; private System.Windows.Forms.CheckBox check_optimiseMP4; internal System.Windows.Forms.Label lbl_vfr; + internal System.Windows.Forms.Label lbl_ipodAtom; + internal System.Windows.Forms.Label label25; + internal System.Windows.Forms.Label lbl_optimize; } } \ No newline at end of file diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index dd6b4325e..999309ca3 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -787,6 +787,32 @@ namespace Handbrake } } + private void check_iPodAtom_CheckedChanged(object sender, EventArgs e) + { + if (!text_destination.Text.Contains(".mp4")) + { + lbl_ipodAtom.Visible = true; + check_iPodAtom.CheckState = CheckState.Unchecked; + } + else + { + lbl_ipodAtom.Visible = false; + } + } + + private void check_optimiseMP4_CheckedChanged(object sender, EventArgs e) + { + if (!text_destination.Text.Contains(".mp4")) + { + lbl_optimize.Visible = true; + check_optimiseMP4.CheckState = CheckState.Unchecked; + } + else + { + lbl_optimize.Visible = false; + } + } + private void drp_dvdtitle_Click(object sender, EventArgs e) { if (drp_dvdtitle.Items.Count == 0) @@ -894,6 +920,9 @@ namespace Handbrake check_turbo.Enabled = false; h264Tab.Enabled = false; rtf_h264advanced.Text = ""; + check_iPodAtom.Enabled = false; + check_iPodAtom.Checked = false; + lbl_ipodAtom.Visible = false; } else { @@ -903,6 +932,8 @@ namespace Handbrake check_turbo.Enabled = true; } h264Tab.Enabled = true; + check_iPodAtom.Enabled = true; + lbl_ipodAtom.Visible = false; } } @@ -1419,9 +1450,11 @@ namespace Handbrake string turboH264 = ""; string largeFile = ""; string denoise = ""; - string CRF = CheckCRF.CheckState.ToString(); + string CRF = ""; + string ipodAtom = ""; + string optimizeMP4 = ""; - if (CRF == "Checked") + if (CheckCRF.Checked) CRF = " -Q "; else CRF = ""; @@ -1480,7 +1513,14 @@ namespace Handbrake break; } - string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + CRF + twoPassEncoding + videoFramerate + turboH264 + largeFile + denoise; + if (check_iPodAtom.Checked) + ipodAtom = " -I "; + + if (check_optimiseMP4.Checked) + optimizeMP4 = " -O "; + + + string queryVideoSettings = videoBitrate + videoFilesize + vidQSetting + CRF + twoPassEncoding + videoFramerate + turboH264 + ipodAtom + optimizeMP4 + largeFile + denoise; #endregion // Audio Settings Tab @@ -1620,10 +1660,7 @@ namespace Handbrake drp_videoEncoder.Text = presetQuery.VideoEncoder; drp_audioCodec.Text = presetQuery.AudioEncoder; if (presetQuery.Width != 0) - { text_width.Text = presetQuery.Width.ToString(); - - } else { text_width.Text = ""; @@ -1631,9 +1668,7 @@ namespace Handbrake } if (presetQuery.Height != 0) - { text_height.Text = presetQuery.Height.ToString(); - } else { text_height.Text = ""; @@ -1653,59 +1688,35 @@ namespace Handbrake drp_deNoise.Text = presetQuery.DeNoise; 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) - { Check_ChapterMarkers.CheckState = CheckState.Checked; - } else - { Check_ChapterMarkers.CheckState = CheckState.Unchecked; - } if (presetQuery.Anamorphic == true) - { CheckPixelRatio.CheckState = CheckState.Checked; - } else - { CheckPixelRatio.CheckState = CheckState.Unchecked; - } if (presetQuery.LooseAnamorphic == true) - { check_lAnamorphic.CheckState = CheckState.Checked; - } else - { check_lAnamorphic.CheckState = CheckState.Unchecked; - } if (presetQuery.VFR == true) - { check_vfr.CheckState = CheckState.Checked; - } else - { check_vfr.CheckState = CheckState.Unchecked; - } #endregion // Video Settings Tab @@ -1721,50 +1732,42 @@ namespace Handbrake } 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; - } + + if (presetQuery.IpodAtom == true) + check_iPodAtom.CheckState = CheckState.Checked; + else + check_iPodAtom.CheckState = CheckState.Unchecked; + + if (presetQuery.OptimizeMP4 == true) + check_optimiseMP4.CheckState = CheckState.Checked; + else + check_optimiseMP4.CheckState = CheckState.Unchecked; + #endregion // Audio Settings Tab @@ -1822,6 +1825,7 @@ namespace Handbrake #endregion + // This is the END of the road ------------------------------------------------------------------------------ } } \ No newline at end of file