OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 9 Jul 2007 18:41:29 +0000 (18:41 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Mon, 9 Jul 2007 18:41:29 +0000 (18:41 +0000)
- Just a few updated files.

git-svn-id: svn://localhost/HandBrake/trunk@662 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/HandBrakeCS.suo
win/C#/Properties/Settings.Designer.cs
win/C#/Properties/Settings.settings
win/C#/app.config
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmReadDVD.cs
win/Handbrake.suo

index 627f73a..410d6a7 100644 (file)
Binary files a/win/C#/HandBrakeCS.suo and b/win/C#/HandBrakeCS.suo differ
index 9a1c37c..a96ed9d 100644 (file)
@@ -489,5 +489,17 @@ namespace Handbrake.Properties {
                 this["VideoQuality"] = value;\r
             }\r
         }\r
+        \r
+        [global::System.Configuration.UserScopedSettingAttribute()]\r
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
+        public string FullDVDInfo {\r
+            get {\r
+                return ((string)(this["FullDVDInfo"]));\r
+            }\r
+            set {\r
+                this["FullDVDInfo"] = value;\r
+            }\r
+        }\r
     }\r
 }\r
index 312a010..ed164b9 100644 (file)
     <Setting Name="VideoQuality" Type="System.Int32" Scope="User">\r
       <Value Profile="(Default)" />\r
     </Setting>\r
+    <Setting Name="FullDVDInfo" Type="System.String" Scope="User">\r
+      <Value Profile="(Default)" />\r
+    </Setting>\r
   </Settings>\r
 </SettingsFile>
\ No newline at end of file
index f2ae737..bf268b6 100644 (file)
             <setting name="H264" serializeAs="String">\r
                 <value />\r
             </setting>\r
+            <setting name="FullDVDInfo" serializeAs="String">\r
+                <value />\r
+            </setting>\r
         </Handbrake.Properties.Settings>\r
     </userSettings>\r
 </configuration>
\ No newline at end of file
index 80c5d4b..cf31aec 100644 (file)
@@ -242,6 +242,7 @@ namespace Handbrake
             this.drp_dvdtitle.Text = "Automatic";\r
             this.ToolTip.SetToolTip(this.drp_dvdtitle, "The title number you wish to encode.");\r
             this.drp_dvdtitle.SelectedIndexChanged += new System.EventHandler(this.drp_dvdtitle_SelectedIndexChanged);\r
+            this.drp_dvdtitle.Click += new System.EventHandler(this.drp_dvdtitle_Click);\r
             // \r
             // RadioISO\r
             // \r
index 2abc7c7..70b8c48 100644 (file)
@@ -6,6 +6,7 @@ using System.Drawing;
 using System.Text;\r
 using System.Windows.Forms;\r
 using System.Net;\r
+using System.IO;\r
 \r
 namespace Handbrake\r
 {\r
@@ -139,12 +140,200 @@ namespace Handbrake
         // FILE MENU --------------------------------------------------------------\r
         private void mnu_open_Click(object sender, EventArgs e)\r
         {\r
+            string filename;\r
             File_Open.ShowDialog();\r
+            filename = File_Open.FileName;\r
+            if (filename != "")\r
+            {\r
+                try\r
+                {\r
+                    // Create StreamReader & open file\r
+                    StreamReader line = new StreamReader(filename);\r
+                    string temporyLine; // Used for reading the line into a varible before processing on the checkState items below.\r
+                    \r
+                    // Read in the data and set the correct GUI component with the setting.\r
+                    text_source.Text = line.ReadLine();\r
+                    drp_dvdtitle.Text = line.ReadLine();\r
+                    drop_chapterStart.Text = line.ReadLine();\r
+                    drop_chapterFinish.Text = line.ReadLine();\r
+                    text_destination.Text = line.ReadLine();\r
+                    drp_videoEncoder.Text = line.ReadLine();\r
+                    drp_audioCodec.Text = line.ReadLine();\r
+                    text_width.Text = line.ReadLine();\r
+                    text_height.Text = line.ReadLine();\r
+                    text_top.Text = line.ReadLine();\r
+                    text_bottom.Text = line.ReadLine();\r
+                    text_left.Text = line.ReadLine();\r
+                    text_right.Text = line.ReadLine();\r
+                    drp_subtitle.Text = line.ReadLine();\r
+                    text_bitrate.Text = line.ReadLine();\r
+                    text_filesize.Text = line.ReadLine();\r
+                    slider_videoQuality.Value = int.Parse(line.ReadLine());\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        check_2PassEncode.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        check_DeInterlace.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        check_grayscale.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    drp_videoFramerate.Text = line.ReadLine();\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        Check_ChapterMarkers.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        CheckPixelRatio.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        check_turbo.CheckState = CheckState.Checked;\r
+                    }\r
+\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        check_largeFile.CheckState = CheckState.Checked;\r
+                    }\r
+   \r
+                    drp_audioBitrate.Text = line.ReadLine();\r
+                    drp_audioSampleRate.Text = line.ReadLine();\r
+                    drp_audioChannels.Text = line.ReadLine();\r
+                    drp_audioMixDown.Text = line.ReadLine();\r
+                    \r
+                    // Advanced H264 Options\r
+                    temporyLine = line.ReadLine();\r
+                    if (temporyLine == "Checked")\r
+                    {\r
+                        CheckCRF.CheckState = CheckState.Checked;\r
+                    }\r
+                    rtf_h264advanced.Text = line.ReadLine();\r
+\r
+                    // Close the stream\r
+                    line.Close();\r
+\r
+\r
+                    // Fix for SliderValue not appearing when Opening saved file\r
+                    SliderValue.Text = slider_videoQuality.Value + "%";\r
+\r
+                } catch (Exception){\r
+                    MessageBox.Show("Unable to load profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
+                }\r
+            }\r
         }\r
 \r
         private void mnu_save_Click(object sender, EventArgs e)\r
         {\r
+            // Note : All these declarations are not really needed and should be removed at some point.\r
+            // The values can simply be added directly to the WriteLine statments.\r
+                \r
+            //Source\r
+            string source = text_source.Text;\r
+            string dvdTitle = drp_dvdtitle.Text;\r
+            string ChapterStart = drop_chapterStart.Text;\r
+            string ChapterFinish = drop_chapterFinish.Text;\r
+            //Destination\r
+            string destination = text_destination.Text;\r
+            string videoEncoder = drp_videoEncoder.Text;\r
+            string audioEncoder = drp_audioCodec.Text;\r
+            string width = text_width.Text;\r
+            string height = text_height.Text;\r
+            //Picture Settings Tab\r
+            string cropTop = text_top.Text;\r
+            string cropBottom = text_bottom.Text;\r
+            string cropLeft = text_left.Text;\r
+            string cropRight = text_right.Text;\r
+            string subtitles = drp_subtitle.Text;\r
+            //Video Settings Tab\r
+            string videoBitrate = text_bitrate.Text;\r
+            string videoFilesize = text_filesize.Text;\r
+            string videoQuality = slider_videoQuality.Value.ToString();\r
+            string twoPassEncoding = check_2PassEncode.CheckState.ToString();\r
+            string deinterlace = check_DeInterlace.CheckState.ToString();\r
+            string grayscale = check_grayscale.CheckState.ToString();\r
+            string videoFramerate = drp_videoFramerate.Text;\r
+            string pixelRation = CheckPixelRatio.CheckState.ToString();\r
+            string ChapterMarkers = Check_ChapterMarkers.CheckState.ToString();\r
+            string turboH264 = check_turbo.CheckState.ToString();\r
+            string largeFile = check_largeFile.CheckState.ToString();\r
+            //Audio Settings Tab\r
+            string audioBitrate = drp_audioBitrate.Text;\r
+            string audioSampleRate = drp_audioSampleRate.Text;\r
+            string audioChannels = drp_audioChannels.Text;\r
+            string AudioMixDown = drp_audioMixDown.Text;\r
+            //H264 Tab\r
+            string CRF = CheckCRF.CheckState.ToString();\r
+            string advH264 = rtf_h264advanced.Text;\r
+\r
+            string filename;\r
             File_Save.ShowDialog();\r
+            filename = File_Save.FileName;\r
+            if (filename != "")\r
+            {\r
+                try\r
+                {\r
+                    // Create a StreamWriter and open the file\r
+                    StreamWriter line = new StreamWriter(filename);\r
+\r
+                   line.WriteLine(source);\r
+                   line.WriteLine(dvdTitle);\r
+                   line.WriteLine(ChapterStart);\r
+                   line.WriteLine(ChapterFinish);\r
+                   line.WriteLine(destination);\r
+                   line.WriteLine(videoEncoder);\r
+                   line.WriteLine(audioEncoder);\r
+                   line.WriteLine(width);\r
+                   line.WriteLine(height);\r
+                   line.WriteLine(cropTop);\r
+                   line.WriteLine(cropBottom);\r
+                   line.WriteLine(cropLeft);\r
+                   line.WriteLine(cropRight);\r
+                   line.WriteLine(subtitles);\r
+                   line.WriteLine(videoBitrate);\r
+                   line.WriteLine(videoFilesize);\r
+                   line.WriteLine(videoQuality);\r
+                   line.WriteLine(twoPassEncoding);\r
+                   line.WriteLine(deinterlace);\r
+                   line.WriteLine(grayscale);\r
+                   line.WriteLine(videoFramerate);\r
+                   line.WriteLine(ChapterMarkers);\r
+                   line.WriteLine(pixelRation);\r
+                   line.WriteLine(turboH264);\r
+                   line.WriteLine(largeFile);\r
+                   line.WriteLine(audioBitrate);\r
+                   line.WriteLine(audioSampleRate);\r
+                   line.WriteLine(audioChannels);\r
+                   line.WriteLine(AudioMixDown);\r
+                   line.WriteLine(CRF);\r
+                   line.WriteLine(advH264);\r
+                   // close the stream\r
+                   line.Close();\r
+                   MessageBox.Show("Your profile has been sucessfully saved.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
+                }\r
+                catch(Exception)\r
+                {\r
+                    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);\r
+                }\r
+                \r
+            }\r
         }\r
 \r
         private void mnu_update_Click(object sender, EventArgs e)\r
@@ -613,7 +802,7 @@ namespace Handbrake
             text_height.BackColor = Color.White;\r
         }\r
 \r
-        private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)\r
+        private void drp_dvdtitle_Click(object sender, EventArgs e)\r
         {\r
             if (drp_dvdtitle.Items.Count == 1)\r
             {\r
@@ -747,6 +936,11 @@ namespace Handbrake
             }\r
         }\r
 \r
+        private void drp_dvdtitle_SelectedIndexChanged(object sender, EventArgs e)\r
+        {\r
+            //TODO: Convert the Parsing Code.\r
+        } \r
+\r
         //\r
         // The Query Generation Function\r
         //\r
@@ -1183,8 +1377,7 @@ namespace Handbrake
             // ----------------------------------------------------------------------\r
 \r
             return querySource+ queryDestination+ queryPictureSettings+ queryVideoSettings+ h264Settings+ queryAudioSettings+ queryAdvancedSettings+ verbose;\r
-        }     \r
-\r
+        }\r
 \r
         // This is the END of the road ------------------------------------------------------------------------------\r
     }\r
index 378642d..23be024 100644 (file)
@@ -75,13 +75,13 @@ namespace Handbrake
                 if (line.Contains("exited.")){\r
                     subtitlePointer = false;\r
                     fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim();\r
-                    add(fullTitleData);\r
+                    add(fullTitleData, titleData, duationData);\r
                     counter++;\r
                 }else if (line.Contains("+ title")){\r
                     if (titleData != "") {\r
                         subtitlePointer = true;\r
                         fullTitleData = titleData.Trim() + " ~ " + duationData.Trim() + " ~ " + sizeData.Trim() + " ~ " + cropdata.Trim() + " ~ " + chatperData.Trim() + " ~ " + audioData.Trim() + " ~ " + subtitleData.Trim();\r
-                        add(fullTitleData);\r
+                        add(fullTitleData, titleData, duationData);\r
                         counter = counter + 1;\r
                     }\r
                     titleData = line;\r
@@ -172,30 +172,31 @@ namespace Handbrake
             }\r
         }\r
 \r
-        public void add(string titleData)\r
+        public void add(string fullTitleData, string titleData, string durationData)\r
         {\r
-            string[] titleInfo = new string[10];\r
-            string[] str = new string[1];\r
 \r
-            string title;\r
-            string t ="";\r
-            string d ="";\r
-\r
-            titleInfo = titleData.Split('~');\r
             try\r
             {\r
-                t = titleInfo[0].Trim().Substring(8).Replace(":", ""); // Title\r
-                d = titleInfo[1].Trim().Substring(12); //Duration\r
-            } catch(Exception){\r
-                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);\r
-            }\r
+                string t = titleData.Trim().Substring(8).Replace(":", "");\r
+                string d = durationData.Trim().Substring(12);\r
+\r
+                // Lets store the captured full title data as a string in the programs settings file.\r
+                // This can then be used by the DVD title dropdown menu to populate other fields.\r
+\r
+                Properties.Settings.Default.FullDVDInfo = Properties.Settings.Default.FullDVDInfo + " \n " + fullTitleData;\r
 \r
-            //Now lets add the info to the main form dropdowns\r
-           frmMain form = (frmMain)frmMain.ActiveForm;\r
-           title = t + " " + " " + d + " ";\r
-           form.drp_dvdtitle.Items.Add(title);\r
+                //Now lets add the info to the main form dropdowns\r
+                frmMain form = (frmMain)frmMain.ActiveForm;\r
+                string title = t + " " + " " + d + " ";\r
+                form.drp_dvdtitle.Items.Add(title);\r
+            }\r
+            catch (Exception)\r
+            {\r
+                // Don't really need to do anything about it.\r
+            }\r
         }\r
 \r
+\r
         private void btn_ok_Click(object sender, EventArgs e)\r
         {\r
             scan(inputFile);\r
index 985af5d..69e3c52 100644 (file)
Binary files a/win/Handbrake.suo and b/win/Handbrake.suo differ