From ddae4f32fada185444bebd4c4dbd2f38f7ed81d0 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 9 Jul 2007 18:41:29 +0000 Subject: [PATCH] WinGui: - Just a few updated files. git-svn-id: svn://localhost/HandBrake/trunk@662 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/HandBrakeCS.suo | Bin 32256 -> 32256 bytes win/C#/Properties/Settings.Designer.cs | 12 ++ win/C#/Properties/Settings.settings | 3 + win/C#/app.config | 3 + win/C#/frmMain.Designer.cs | 1 + win/C#/frmMain.cs | 199 ++++++++++++++++++++++++++++++++- win/C#/frmReadDVD.cs | 39 +++---- win/Handbrake.suo | Bin 32768 -> 32768 bytes 8 files changed, 235 insertions(+), 22 deletions(-) diff --git a/win/C#/HandBrakeCS.suo b/win/C#/HandBrakeCS.suo index 627f73aff6758ba51bbbb35706446e6365d66406..410d6a7aa1595666dd0bbc6f0830a6ac38a14038 100644 GIT binary patch delta 1540 zcmYjReN0nV6u-B9eeent`e`Ge#cB~O*z%{CPy1 z&40jkSu$qKe*DeaDjZ(e|M;+c7_)56<46}ZAn2oWM^qgQD=&500R>#(}5NQRgXVt8hRgqOg z>ssV3IC>vw`s_L5gU(T3Un`LHToHO=-Tz6!m0yB<9 z_9jkgah}M25UxpWDhdI@-_!Lxcgu5`a zf2THGIL=c`!d#E_t5#!V$t!9dls0qJvjm9daLxk;9~tLyY-tNZZhy`kkxqaRltha$ zo-C>t{8qAKtbrw1j5s>LhR7Nvu7-#OKk?!t|40U}WV;Dxtb{az32zgoicL`a$Mtk# zT2qOn6XzmVk-NvF9e1DB@vY$fn_-H}+>Gnt_c_N!R~%P7>!6n2649THtmLvNVA!G^ zFOwzQ*l|Lp9UNsr+=yG1E(>FC1Uo`LB>k^rZ?y&Oby3RNmPz{Dd zM}~LzV|C1dxgE<;7Ar!kxpZ>F6qiI+L3QpZ8D}#23Gl`2_%+dk>E^0bWHGiyn(@T5 z0cxEWmpn2b1uySJW7LC!(r&FUdWEMp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+;}7MH}*xg;D-VaUfKOTE;PG!FR}etIgkOd^&)zj%rNhDsqv;b z*B|PM26Ipu$>N(Z-R#BbmJHmE=EPbQq_h=7Hl`rnB4Z|Z1KzB5p>yvEln7?rX!RrR z8%9^ugY%wT$WKV{chd;@sI}}G-vQK^o0v> zy)6?{1r_2T+s|OOPZ&E`C+lUevH|?q;l;JX0j;n9ZMsBbJ?_h-DC=YWtXGxWM|jc! zq8+R|vC1{s$pxf2yoR-wO{^A7TFYjuN>^M5#WDWBgdtOL$u?@C|MoHtJ3hyw7kjj) zq_V42z4Nj|7t8dmmb|bh6=#Y>)RyHZF1}rTr{|mzRj$qSFxXV(=!gzi9d){ctn+bE R$=X{|T(b6>kmRs~{{#K)xlRB8 diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs index 9a1c37c2..a96ed9de 100644 --- a/win/C#/Properties/Settings.Designer.cs +++ b/win/C#/Properties/Settings.Designer.cs @@ -489,5 +489,17 @@ namespace Handbrake.Properties { this["VideoQuality"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string FullDVDInfo { + get { + return ((string)(this["FullDVDInfo"])); + } + set { + this["FullDVDInfo"] = value; + } + } } } diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings index 312a0106..ed164b9a 100644 --- a/win/C#/Properties/Settings.settings +++ b/win/C#/Properties/Settings.settings @@ -119,5 +119,8 @@ + + + \ No newline at end of file diff --git a/win/C#/app.config b/win/C#/app.config index f2ae7378..bf268b66 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -121,6 +121,9 @@ + + + \ No newline at end of file diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 80c5d4bc..cf31aecf 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -242,6 +242,7 @@ namespace Handbrake this.drp_dvdtitle.Text = "Automatic"; this.ToolTip.SetToolTip(this.drp_dvdtitle, "The title number you wish to encode."); this.drp_dvdtitle.SelectedIndexChanged += new System.EventHandler(this.drp_dvdtitle_SelectedIndexChanged); + this.drp_dvdtitle.Click += new System.EventHandler(this.drp_dvdtitle_Click); // // RadioISO // diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 2abc7c7b..70b8c48e 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; using System.Net; +using System.IO; namespace Handbrake { @@ -139,12 +140,200 @@ namespace Handbrake // 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; + } + + temporyLine = line.ReadLine(); + if (temporyLine == "Checked") + { + check_DeInterlace.CheckState = CheckState.Checked; + } + + 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) { + // Note : All these declarations are not really needed and should be removed at some point. + // The values can simply be added directly to the WriteLine statments. + + //Source + string source = text_source.Text; + string dvdTitle = drp_dvdtitle.Text; + string ChapterStart = drop_chapterStart.Text; + string ChapterFinish = drop_chapterFinish.Text; + //Destination + string destination = text_destination.Text; + string videoEncoder = drp_videoEncoder.Text; + string audioEncoder = drp_audioCodec.Text; + string width = text_width.Text; + string height = text_height.Text; + //Picture Settings Tab + string cropTop = text_top.Text; + string cropBottom = text_bottom.Text; + string cropLeft = text_left.Text; + string cropRight = text_right.Text; + string subtitles = drp_subtitle.Text; + //Video Settings Tab + string videoBitrate = text_bitrate.Text; + string videoFilesize = text_filesize.Text; + string videoQuality = slider_videoQuality.Value.ToString(); + string twoPassEncoding = check_2PassEncode.CheckState.ToString(); + string deinterlace = check_DeInterlace.CheckState.ToString(); + string grayscale = check_grayscale.CheckState.ToString(); + string videoFramerate = drp_videoFramerate.Text; + string pixelRation = CheckPixelRatio.CheckState.ToString(); + string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString(); + string turboH264 = check_turbo.CheckState.ToString(); + string largeFile = check_largeFile.CheckState.ToString(); + //Audio Settings Tab + string audioBitrate = drp_audioBitrate.Text; + string audioSampleRate = drp_audioSampleRate.Text; + string audioChannels = drp_audioChannels.Text; + string AudioMixDown = drp_audioMixDown.Text; + //H264 Tab + string CRF = CheckCRF.CheckState.ToString(); + string advH264 = rtf_h264advanced.Text; + + string filename; File_Save.ShowDialog(); + filename = File_Save.FileName; + if (filename != "") + { + try + { + // Create a StreamWriter and open the file + StreamWriter line = new StreamWriter(filename); + + line.WriteLine(source); + line.WriteLine(dvdTitle); + line.WriteLine(ChapterStart); + line.WriteLine(ChapterFinish); + line.WriteLine(destination); + line.WriteLine(videoEncoder); + line.WriteLine(audioEncoder); + line.WriteLine(width); + line.WriteLine(height); + line.WriteLine(cropTop); + line.WriteLine(cropBottom); + line.WriteLine(cropLeft); + line.WriteLine(cropRight); + line.WriteLine(subtitles); + line.WriteLine(videoBitrate); + line.WriteLine(videoFilesize); + line.WriteLine(videoQuality); + line.WriteLine(twoPassEncoding); + line.WriteLine(deinterlace); + line.WriteLine(grayscale); + line.WriteLine(videoFramerate); + line.WriteLine(ChapterMarkers); + line.WriteLine(pixelRation); + line.WriteLine(turboH264); + line.WriteLine(largeFile); + line.WriteLine(audioBitrate); + line.WriteLine(audioSampleRate); + line.WriteLine(audioChannels); + line.WriteLine(AudioMixDown); + line.WriteLine(CRF); + line.WriteLine(advH264); + // 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_update_Click(object sender, EventArgs e) @@ -613,7 +802,7 @@ namespace Handbrake text_height.BackColor = Color.White; } - private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e) + private void drp_dvdtitle_Click(object sender, EventArgs e) { if (drp_dvdtitle.Items.Count == 1) { @@ -747,6 +936,11 @@ namespace Handbrake } } + private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e) + { + //TODO: Convert the Parsing Code. + } + // // The Query Generation Function // @@ -1183,8 +1377,7 @@ namespace Handbrake // ---------------------------------------------------------------------- return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose; - } - + } // This is the END of the road ------------------------------------------------------------------------------ } diff --git a/win/C#/frmReadDVD.cs b/win/C#/frmReadDVD.cs index 378642d0..23be024b 100644 --- a/win/C#/frmReadDVD.cs +++ b/win/C#/frmReadDVD.cs @@ -75,13 +75,13 @@ namespace Handbrake if (line.Contains("exited.")){ subtitlePointer = false; fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim(); - add(fullTitleData); + add(fullTitleData, titleData, duationData); counter++; }else if (line.Contains("+ title")){ if (titleData != "") { subtitlePointer = true; fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim(); - add(fullTitleData); + add(fullTitleData, titleData, duationData); counter = counter + 1; } titleData = line; @@ -172,30 +172,31 @@ namespace Handbrake } } - public void add(string titleData) + public void add(string fullTitleData, string titleData, string durationData) { - string[] titleInfo = new string[10]; - string[] str = new string[1]; - string title; - string t =""; - string d =""; - - titleInfo = titleData.Split('~'); try { - t = titleInfo[0].Trim().Substring(8).Replace(":", ""); // Title - d = titleInfo[1].Trim().Substring(12); //Duration - } catch(Exception){ - MessageBox.Show("Incomplete DVD data found. Please copy the data on the View DVD Information tab and report this error.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); - } + string t = titleData.Trim().Substring(8).Replace(":", ""); + string d = durationData.Trim().Substring(12); + + // Lets store the captured full title data as a string in the programs settings file. + // This can then be used by the DVD title dropdown menu to populate other fields. + + Properties.Settings.Default.FullDVDInfo = Properties.Settings.Default.FullDVDInfo + " \n " + fullTitleData; - //Now lets add the info to the main form dropdowns - frmMain form = (frmMain)frmMain.ActiveForm; - title = t + " " + " " + d + " "; - form.drp_dvdtitle.Items.Add(title); + //Now lets add the info to the main form dropdowns + frmMain form = (frmMain)frmMain.ActiveForm; + string title = t + " " + " " + d + " "; + form.drp_dvdtitle.Items.Add(title); + } + catch (Exception) + { + // Don't really need to do anything about it. + } } + private void btn_ok_Click(object sender, EventArgs e) { scan(inputFile); diff --git a/win/Handbrake.suo b/win/Handbrake.suo index 985af5d0b31cf78ab0d4bb290d7670783123d9fa..69e3c52546b4595b74d194759c5676231f03ce0d 100644 GIT binary patch delta 311 zcmZo@U}|V!+K|J->L9m`chBZR7Js(M7i07%Kj0Fad{9Sha)651WF2mi$q$1hCVO&c zY(Bu}>Lr&uJ@9jtmppoNbxQ!MUA*f#EU`3v7Pqn8e1*C;?=v z0P%kyn4HL=vbn@#3(I7uV2RBRzATJ9%0MX*6lp&nmdR1U>XS8mB_=2M2u!{Zq&c}H zCStNjwD4quSb@p^VvHv91WQbQpei}J-^YBiT}bif10ltXll^rqHfM+3VB%$vff@+2 zb8<=KnaPSFvYY*))R-n~#|Q%rFxz}4rd$N%k;x^6{=AHGKs`#x4*618&y3=|)uktx Lz?Q782xSKV+!=4& delta 312 zcmZo@U}|V!+K|J-nou%ZxOsCSi$B}s3sDM_`GXZEAJh?>9H1gLS%+I>vOjm>WP=d? z%?G%fl_nq7H{4vJx1VeB`+C9230l85+gr_K=j3N#U;tsB%?}-u*mxO~fNT{Y{tpC` z6FF2imw0SpnfyFRVzYxU3nLFmSOi7d&xd95{~*iBRx!epqkSYMuZxkJtl=v$xqzE@ zvO