OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 3 Jul 2007 11:41:41 +0000 (11:41 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 3 Jul 2007 11:41:41 +0000 (11:41 +0000)
- Re-wrote bits of frmReadDVD to fix a bug where DVD's with only 1 title would not be listed in the DVD title dropdown. Also cleaned the code up a bit. Hopefully this re-write doesn't have too many bugs. Initial testing shows it appears to work fine.WinGui:
- Changed shell() to System.Diagnostics.Process.Start()
Appears to work a bit better than shell()

- Removed Advanced Settings Tab. Processor selection is now in Tools > Options.

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

win/Handbrake/My Project/Settings.Designer.vb
win/Handbrake/My Project/Settings.settings
win/Handbrake/app.config
win/Handbrake/frmMain.Designer.vb
win/Handbrake/frmMain.resx
win/Handbrake/frmMain.vb
win/Handbrake/frmOptions.Designer.vb
win/Handbrake/frmOptions.vb
win/Handbrake/frmReadDVD.vb

index 7c1a128..7cb65f9 100644 (file)
@@ -368,7 +368,7 @@ Namespace My
         \r
         <Global.System.Configuration.UserScopedSettingAttribute(),  _\r
          Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _\r
-         Global.System.Configuration.DefaultSettingValueAttribute("")>  _\r
+         Global.System.Configuration.DefaultSettingValueAttribute("Automatic")>  _\r
         Public Property Processors() As String\r
             Get\r
                 Return CType(Me("Processors"),String)\r
index c8afbbd..1195a26 100644 (file)
@@ -81,7 +81,7 @@
       <Value Profile="(Default)" />\r
     </Setting>\r
     <Setting Name="Processors" Type="System.String" Scope="User">\r
-      <Value Profile="(Default)" />\r
+      <Value Profile="(Default)">Automatic</Value>\r
     </Setting>\r
     <Setting Name="Subtitles" Type="System.String" Scope="User">\r
       <Value Profile="(Default)" />\r
index 2943498..6f69f12 100644 (file)
                 <value />\r
             </setting>\r
             <setting name="Processors" serializeAs="String">\r
-                <value />\r
+                <value>Automatic</value>\r
             </setting>\r
             <setting name="Subtitles" serializeAs="String">\r
                 <value />\r
index 2fb8178..43cdc25 100644 (file)
@@ -90,10 +90,6 @@ Partial Class frmMain
         Me.Label90 = New System.Windows.Forms.Label\r
         Me.rtf_h264advanced = New System.Windows.Forms.RichTextBox\r
         Me.Label92 = New System.Windows.Forms.Label\r
-        Me.TabPage4 = New System.Windows.Forms.TabPage\r
-        Me.drp_processors = New System.Windows.Forms.ComboBox\r
-        Me.Label6 = New System.Windows.Forms.Label\r
-        Me.Label11 = New System.Windows.Forms.Label\r
         Me.TabPage2 = New System.Windows.Forms.TabPage\r
         Me.Label29 = New System.Windows.Forms.Label\r
         Me.drp_audioMixDown = New System.Windows.Forms.ComboBox\r
@@ -237,7 +233,6 @@ Partial Class frmMain
         Me.GroupBox4.SuspendLayout()\r
         Me.GroupBox1.SuspendLayout()\r
         Me.h264Tab.SuspendLayout()\r
-        Me.TabPage4.SuspendLayout()\r
         Me.TabPage2.SuspendLayout()\r
         Me.TabPage3.SuspendLayout()\r
         CType(Me.slider_videoQuality, System.ComponentModel.ISupportInitialize).BeginInit()\r
@@ -898,51 +893,6 @@ Partial Class frmMain
         Me.Label92.Text = "Specify advanced x264 options in the same style as mencoder:" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "option1=value1:opti" & _\r
             "on2=value2"\r
         '\r
-        'TabPage4\r
-        '\r
-        Me.TabPage4.BackColor = System.Drawing.SystemColors.Control\r
-        Me.TabPage4.Controls.Add(Me.drp_processors)\r
-        Me.TabPage4.Controls.Add(Me.Label6)\r
-        Me.TabPage4.Controls.Add(Me.Label11)\r
-        Me.TabPage4.Location = New System.Drawing.Point(4, 22)\r
-        Me.TabPage4.Name = "TabPage4"\r
-        Me.TabPage4.Padding = New System.Windows.Forms.Padding(3)\r
-        Me.TabPage4.Size = New System.Drawing.Size(639, 268)\r
-        Me.TabPage4.TabIndex = 4\r
-        Me.TabPage4.Text = "Advanced Settings"\r
-        '\r
-        'drp_processors\r
-        '\r
-        Me.drp_processors.FlatStyle = System.Windows.Forms.FlatStyle.Flat\r
-        Me.drp_processors.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
-        Me.drp_processors.FormattingEnabled = True\r
-        Me.drp_processors.Items.AddRange(New Object() {"Automatic", "1", "2", "3", "4", "5", "6", "7", "8"})\r
-        Me.drp_processors.Location = New System.Drawing.Point(117, 38)\r
-        Me.drp_processors.Name = "drp_processors"\r
-        Me.drp_processors.Size = New System.Drawing.Size(111, 21)\r
-        Me.drp_processors.TabIndex = 39\r
-        Me.drp_processors.Text = "Automatic"\r
-        '\r
-        'Label6\r
-        '\r
-        Me.Label6.AutoSize = True\r
-        Me.Label6.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
-        Me.Label6.Location = New System.Drawing.Point(13, 13)\r
-        Me.Label6.Name = "Label6"\r
-        Me.Label6.Size = New System.Drawing.Size(138, 13)\r
-        Me.Label6.TabIndex = 37\r
-        Me.Label6.Text = "Processor Detection"\r
-        '\r
-        'Label11\r
-        '\r
-        Me.Label11.AutoSize = True\r
-        Me.Label11.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
-        Me.Label11.Location = New System.Drawing.Point(13, 41)\r
-        Me.Label11.Name = "Label11"\r
-        Me.Label11.Size = New System.Drawing.Size(97, 13)\r
-        Me.Label11.TabIndex = 14\r
-        Me.Label11.Text = "No. Processors:"\r
-        '\r
         'TabPage2\r
         '\r
         Me.TabPage2.BackColor = System.Drawing.SystemColors.Control\r
@@ -1575,7 +1525,6 @@ Partial Class frmMain
         Me.advancedOptions.Controls.Add(Me.TabPage1)\r
         Me.advancedOptions.Controls.Add(Me.TabPage3)\r
         Me.advancedOptions.Controls.Add(Me.TabPage2)\r
-        Me.advancedOptions.Controls.Add(Me.TabPage4)\r
         Me.advancedOptions.Controls.Add(Me.h264Tab)\r
         Me.advancedOptions.Controls.Add(Me.TabPage6)\r
         Me.advancedOptions.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
@@ -1616,10 +1565,11 @@ Partial Class frmMain
         Me.Label39.AutoSize = True\r
         Me.Label39.Location = New System.Drawing.Point(13, 34)\r
         Me.Label39.Name = "Label39"\r
-        Me.Label39.Size = New System.Drawing.Size(331, 26)\r
+        Me.Label39.Size = New System.Drawing.Size(403, 39)\r
         Me.Label39.TabIndex = 40\r
         Me.Label39.Text = "Here you can alter the query generated by the program." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Click the ""Generate Query" & _\r
-            " Now"" button to continue."\r
+            " Now"" button to continue." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Remember to re-generate the query each time you chang" & _\r
+            "e a setting!"\r
         '\r
         'btn_ClearQuery\r
         '\r
@@ -1627,7 +1577,7 @@ Partial Class frmMain
         Me.btn_ClearQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat\r
         Me.btn_ClearQuery.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
         Me.btn_ClearQuery.ForeColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(0, Byte), Integer))\r
-        Me.btn_ClearQuery.Location = New System.Drawing.Point(542, 73)\r
+        Me.btn_ClearQuery.Location = New System.Drawing.Point(542, 84)\r
         Me.btn_ClearQuery.Name = "btn_ClearQuery"\r
         Me.btn_ClearQuery.Size = New System.Drawing.Size(79, 23)\r
         Me.btn_ClearQuery.TabIndex = 39\r
@@ -1640,7 +1590,7 @@ Partial Class frmMain
         Me.GenerateQuery.FlatStyle = System.Windows.Forms.FlatStyle.Flat\r
         Me.GenerateQuery.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
         Me.GenerateQuery.ForeColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(0, Byte), Integer))\r
-        Me.GenerateQuery.Location = New System.Drawing.Point(16, 73)\r
+        Me.GenerateQuery.Location = New System.Drawing.Point(16, 84)\r
         Me.GenerateQuery.Name = "GenerateQuery"\r
         Me.GenerateQuery.Size = New System.Drawing.Size(176, 23)\r
         Me.GenerateQuery.TabIndex = 38\r
@@ -1650,9 +1600,9 @@ Partial Class frmMain
         'QueryEditorText\r
         '\r
         Me.QueryEditorText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle\r
-        Me.QueryEditorText.Location = New System.Drawing.Point(16, 102)\r
+        Me.QueryEditorText.Location = New System.Drawing.Point(16, 114)\r
         Me.QueryEditorText.Name = "QueryEditorText"\r
-        Me.QueryEditorText.Size = New System.Drawing.Size(605, 139)\r
+        Me.QueryEditorText.Size = New System.Drawing.Size(605, 127)\r
         Me.QueryEditorText.TabIndex = 41\r
         Me.QueryEditorText.Text = ""\r
         '\r
@@ -2383,8 +2333,6 @@ Partial Class frmMain
         Me.GroupBox1.PerformLayout()\r
         Me.h264Tab.ResumeLayout(False)\r
         Me.h264Tab.PerformLayout()\r
-        Me.TabPage4.ResumeLayout(False)\r
-        Me.TabPage4.PerformLayout()\r
         Me.TabPage2.ResumeLayout(False)\r
         Me.TabPage2.PerformLayout()\r
         Me.TabPage3.ResumeLayout(False)\r
@@ -2429,8 +2377,6 @@ Partial Class frmMain
     Friend WithEvents btn_encode As System.Windows.Forms.Button\r
     Friend WithEvents btn_queue As System.Windows.Forms.Button\r
     Friend WithEvents h264Tab As System.Windows.Forms.TabPage\r
-    Friend WithEvents TabPage4 As System.Windows.Forms.TabPage\r
-    Friend WithEvents Label11 As System.Windows.Forms.Label\r
     Friend WithEvents TabPage2 As System.Windows.Forms.TabPage\r
     Friend WithEvents Label35 As System.Windows.Forms.Label\r
     Friend WithEvents Label32 As System.Windows.Forms.Label\r
@@ -2465,7 +2411,6 @@ Partial Class frmMain
     Friend WithEvents advancedOptions As System.Windows.Forms.TabControl\r
     Friend WithEvents RadioDVD As System.Windows.Forms.RadioButton\r
     Friend WithEvents RadioISO As System.Windows.Forms.RadioButton\r
-    Friend WithEvents Label6 As System.Windows.Forms.Label\r
     Friend WithEvents Label5 As System.Windows.Forms.Label\r
     Friend WithEvents Label2 As System.Windows.Forms.Label\r
     Friend WithEvents Label1 As System.Windows.Forms.Label\r
@@ -2574,7 +2519,6 @@ Partial Class frmMain
     Friend WithEvents mnu_options As System.Windows.Forms.ToolStripMenuItem\r
     Friend WithEvents ToolStripSeparator4 As System.Windows.Forms.ToolStripSeparator\r
     Friend WithEvents mnu_ProgramDefaultOptions As System.Windows.Forms.ToolStripMenuItem\r
-    Friend WithEvents drp_processors As System.Windows.Forms.ComboBox\r
     Friend WithEvents drp_audioBitrate As System.Windows.Forms.ComboBox\r
     Friend WithEvents drp_dvdtitle As System.Windows.Forms.ComboBox\r
     Friend WithEvents ToolStripSeparator5 As System.Windows.Forms.ToolStripSeparator\r
index 7253445..752b751 100644 (file)
   <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>639, 17</value>\r
   </metadata>\r
-  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>639, 17</value>\r
-  </metadata>\r
-  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
-    <value>639, 17</value>\r
-  </metadata>\r
   <metadata name="File_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>136, 17</value>\r
   </metadata>\r
   <metadata name="File_Save.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>234, 18</value>\r
   </metadata>\r
+  <metadata name="ToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>639, 17</value>\r
+  </metadata>\r
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
     <value>\r
         AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA\r
index aca6840..546d1ee 100644 (file)
@@ -80,8 +80,6 @@ Public Class frmMain
                 drp_audioBitrate.Text = My.Settings.AudioBitrate\r
                 drp_audioSampleRate.Text = My.Settings.AudioSampleRate\r
                 drp_audioChannels.Text = My.Settings.AudioChannels\r
-                'Advanced Settings Tab\r
-                drp_processors.Text = My.Settings.Processors\r
                 'H264 Tab\r
                 CheckCRF.CheckState = My.Settings.CRF\r
                 rtf_h264advanced.Text = My.Settings.H264\r
@@ -145,8 +143,6 @@ Public Class frmMain
         Dim audioSampleRate As String = drp_audioSampleRate.Text\r
         Dim audioChannels As String = drp_audioChannels.Text\r
         Dim AudioMixDown As String = drp_audioMixDown.Text\r
-        'Advanced Settings Tab\r
-        Dim processors As String = drp_processors.Text\r
         'H264 Tab\r
         Dim CRF As String = CheckCRF.CheckState\r
         Dim advH264 As String = rtf_h264advanced.Text\r
@@ -187,7 +183,6 @@ Public Class frmMain
                 StreamWriter.WriteLine(audioSampleRate)\r
                 StreamWriter.WriteLine(audioChannels)\r
                 StreamWriter.WriteLine(AudioMixDown)\r
-                StreamWriter.WriteLine(processors)\r
                 StreamWriter.WriteLine(CRF)\r
                 StreamWriter.WriteLine(advH264)\r
                 StreamWriter.Close()\r
@@ -235,7 +230,6 @@ Public Class frmMain
                 drp_audioSampleRate.Text = inputStream.ReadLine()\r
                 drp_audioChannels.Text = inputStream.ReadLine()\r
                 drp_audioMixDown.Text = inputStream.ReadLine()\r
-                drp_processors.Text = inputStream.ReadLine()\r
 \r
                 'Advanced H264 Options\r
                 CheckCRF.CheckState = inputStream.ReadLine()\r
@@ -298,8 +292,6 @@ Public Class frmMain
         My.Settings.AudioBitrate = drp_audioBitrate.Text\r
         My.Settings.AudioSampleRate = drp_audioSampleRate.Text\r
         My.Settings.AudioChannels = drp_audioChannels.Text\r
-        'Advanced Settings Tab\r
-        My.Settings.Processors = drp_processors.Text\r
         'H264 Tab\r
         My.Settings.CRF = CheckCRF.CheckState\r
         My.Settings.H264 = rtf_h264advanced.Text\r
@@ -565,8 +557,6 @@ Public Class frmMain
         QueryEditorText.Text = "" ' Just clearing the quert editor box. Users may forget\r
         Dim chapterFinish As Integer = drop_chapterFinish.Text\r
         Dim chapterStart As Integer = drop_chapterStart.Text\r
-\r
-\r
         Try\r
             If (chapterStart > chapterFinish) Then\r
                 MessageBox.Show("Invalid Chapter Range! - Start chapter can not be larger than the Final chapter.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)\r
@@ -1209,8 +1199,8 @@ Public Class frmMain
         Dim h264Settings As String = CRF + h264Advanced\r
         '----------------------------------------------------------------------\r
 \r
-        'Advanced Settings Tab\r
-        Dim processors As String = drp_processors.Text\r
+        'Processors (Program Settings)\r
+        Dim processors As String = My.Settings.Processors\r
 \r
         ' Number of Processors Handler\r
         If (processors = "Automatic") Then\r
@@ -1222,7 +1212,7 @@ Public Class frmMain
         Dim queryAdvancedSettings As String = processors\r
         '----------------------------------------------------------------------\r
 \r
-        ' Verbose option\r
+        ' Verbose option (Program Settings)\r
         Dim verbose As String = ""\r
         If My.Settings.verbose = 1 Then\r
             verbose = " -v "\r
index 0527802..7af2053 100644 (file)
@@ -31,8 +31,12 @@ Partial Class frmOptions
         Me.check_verbose = New System.Windows.Forms.CheckBox\r
         Me.GroupBox2 = New System.Windows.Forms.GroupBox\r
         Me.File_Save = New System.Windows.Forms.SaveFileDialog\r
+        Me.GroupBox3 = New System.Windows.Forms.GroupBox\r
+        Me.drp_processors = New System.Windows.Forms.ComboBox\r
+        Me.Label11 = New System.Windows.Forms.Label\r
         Me.GroupBox1.SuspendLayout()\r
         Me.GroupBox2.SuspendLayout()\r
+        Me.GroupBox3.SuspendLayout()\r
         Me.SuspendLayout()\r
         '\r
         'Label1\r
@@ -62,7 +66,7 @@ Partial Class frmOptions
         Me.btn_close.FlatStyle = System.Windows.Forms.FlatStyle.Flat\r
         Me.btn_close.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
         Me.btn_close.ForeColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(0, Byte), Integer))\r
-        Me.btn_close.Location = New System.Drawing.Point(292, 287)\r
+        Me.btn_close.Location = New System.Drawing.Point(292, 387)\r
         Me.btn_close.Name = "btn_close"\r
         Me.btn_close.Size = New System.Drawing.Size(107, 22)\r
         Me.btn_close.TabIndex = 45\r
@@ -115,7 +119,7 @@ Partial Class frmOptions
         '\r
         Me.GroupBox1.Controls.Add(Me.check_verbose)\r
         Me.GroupBox1.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
-        Me.GroupBox1.Location = New System.Drawing.Point(12, 211)\r
+        Me.GroupBox1.Location = New System.Drawing.Point(12, 306)\r
         Me.GroupBox1.Name = "GroupBox1"\r
         Me.GroupBox1.Size = New System.Drawing.Size(386, 70)\r
         Me.GroupBox1.TabIndex = 50\r
@@ -154,11 +158,45 @@ Partial Class frmOptions
         Me.File_Save.DefaultExt = "hb"\r
         Me.File_Save.Filter = "txt|*.txt"\r
         '\r
+        'GroupBox3\r
+        '\r
+        Me.GroupBox3.Controls.Add(Me.drp_processors)\r
+        Me.GroupBox3.Controls.Add(Me.Label11)\r
+        Me.GroupBox3.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
+        Me.GroupBox3.Location = New System.Drawing.Point(13, 211)\r
+        Me.GroupBox3.Name = "GroupBox3"\r
+        Me.GroupBox3.Size = New System.Drawing.Size(386, 89)\r
+        Me.GroupBox3.TabIndex = 52\r
+        Me.GroupBox3.TabStop = False\r
+        Me.GroupBox3.Text = "Processor Detection"\r
+        '\r
+        'drp_processors\r
+        '\r
+        Me.drp_processors.FlatStyle = System.Windows.Forms.FlatStyle.Flat\r
+        Me.drp_processors.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
+        Me.drp_processors.FormattingEnabled = True\r
+        Me.drp_processors.Items.AddRange(New Object() {"Automatic", "1", "2", "3", "4", "5", "6", "7", "8"})\r
+        Me.drp_processors.Location = New System.Drawing.Point(19, 50)\r
+        Me.drp_processors.Name = "drp_processors"\r
+        Me.drp_processors.Size = New System.Drawing.Size(111, 21)\r
+        Me.drp_processors.TabIndex = 41\r
+        '\r
+        'Label11\r
+        '\r
+        Me.Label11.AutoSize = True\r
+        Me.Label11.Font = New System.Drawing.Font("Verdana", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))\r
+        Me.Label11.Location = New System.Drawing.Point(16, 27)\r
+        Me.Label11.Name = "Label11"\r
+        Me.Label11.Size = New System.Drawing.Size(142, 13)\r
+        Me.Label11.TabIndex = 40\r
+        Me.Label11.Text = "Number of processors: "\r
+        '\r
         'frmOptions\r
         '\r
         Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 13.0!)\r
         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\r
-        Me.ClientSize = New System.Drawing.Size(411, 320)\r
+        Me.ClientSize = New System.Drawing.Size(411, 421)\r
+        Me.Controls.Add(Me.GroupBox3)\r
         Me.Controls.Add(Me.GroupBox2)\r
         Me.Controls.Add(Me.GroupBox1)\r
         Me.Controls.Add(Me.btn_close)\r
@@ -170,6 +208,8 @@ Partial Class frmOptions
         Me.GroupBox1.PerformLayout()\r
         Me.GroupBox2.ResumeLayout(False)\r
         Me.GroupBox2.PerformLayout()\r
+        Me.GroupBox3.ResumeLayout(False)\r
+        Me.GroupBox3.PerformLayout()\r
         Me.ResumeLayout(False)\r
 \r
     End Sub\r
@@ -184,4 +224,7 @@ Partial Class frmOptions
     Friend WithEvents check_verbose As System.Windows.Forms.CheckBox\r
     Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox\r
     Friend WithEvents File_Save As System.Windows.Forms.SaveFileDialog\r
+    Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox\r
+    Friend WithEvents drp_processors As System.Windows.Forms.ComboBox\r
+    Friend WithEvents Label11 As System.Windows.Forms.Label\r
 End Class\r
index 297945e..a3158e8 100644 (file)
@@ -10,8 +10,6 @@ Public Class frmOptions
 \r
     ' Set the check boxes to the correct state. Checked or unchecked\r
     Private Sub frmOptions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load\r
-        Dim file_path As String = Application.StartupPath\r
-\r
         Try\r
             If My.Settings.StartupUpdate = 1 Then\r
                 check_updateCheck.CheckState = CheckState.Checked\r
@@ -37,6 +35,8 @@ Public Class frmOptions
                 check_verbose.CheckState = CheckState.Unchecked\r
             End If\r
 \r
+            drp_processors.Text = My.Settings.Processors\r
+\r
         Catch ex As Exception\r
             MessageBox.Show("ERROR:  " & ex.ToString)\r
         End Try\r
@@ -79,7 +79,6 @@ Public Class frmOptions
         End If\r
     End Sub\r
 \r
-\r
     Private Sub check_readDVDWindow_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles check_readDVDWindow.CheckedChanged\r
         If check_readDVDWindow.CheckState = 1 Then\r
             Try\r
@@ -96,7 +95,6 @@ Public Class frmOptions
         End If\r
     End Sub\r
 \r
-\r
     Private Sub check_verbose_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles check_verbose.CheckedChanged\r
         If check_verbose.CheckState = 1 Then\r
             Try\r
@@ -114,4 +112,7 @@ Public Class frmOptions
     End Sub\r
 \r
 \r
+    Private Sub drp_processors_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drp_processors.SelectedIndexChanged\r
+        My.Settings.Processors = drp_processors.Text\r
+    End Sub\r
 End Class
\ No newline at end of file
index f6b350c..b03ae79 100644 (file)
@@ -10,11 +10,10 @@ Public Class frmReadDVD
     '# Write the output to dvdinfo.dat\r
     '#\r
     Private Sub frmStatus_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load\r
-        Me.Show()\r
-        Dim ApplicationPath As String = Application.StartupPath\r
+        Dim applicationPath As String = Application.StartupPath\r
 \r
         Try\r
-            Shell("cmd /c """"" + ApplicationPath + "\hbcli.exe"" -i """ + frmMain.text_source.Text + """" & " -t0 >" + """" + ApplicationPath + "\dvdinfo.dat""" + " 2>&1""")\r
+            Shell("cmd /c """"" + applicationPath + "\hbcli.exe"" -i """ + frmMain.text_source.Text + """" & " -t0 >" + """" + applicationPath + "\dvdinfo.dat""" + " 2>&1""")\r
         Catch ex As Exception\r
             MessageBox.Show("Unable to launch the CLI encoder.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)\r
             MessageBox.Show(ex.ToString)\r
@@ -22,17 +21,9 @@ Public Class frmReadDVD
 \r
     End Sub\r
 \r
-    '#\r
-    '#\r
-    '# Ok Button Handler\r
-    '# Stage 1 - Wait til hbcli.exe has finished writing data out to file dvdinfo.dat\r
-    '# Stage 2 - Parse the dvdinfo.dat file\r
-    '# Stage 3 - output the parsed version to dvd.dat or handle errors if any\r
-    '#\r
-    '# This all needs re-written. It's a real mess. Should really dump all the info into an array so external files are not required.\r
 \r
     Private Sub btn_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ok.Click\r
-        '# Stage 1 - Wait til the hbcli exe has finished\r
+        'Wait til the hbcli process finishes but do this on another thread so the readDVD window doesn't lock up.\r
         Dim isRunning As Integer\r
         Dim process2 As Process = New Process\r
         Dim running As Boolean = True\r
@@ -54,155 +45,157 @@ Public Class frmReadDVD
         End While\r
         isRunning = 0\r
 \r
+        ' Once hbcli.exe has finished. appened --end-- to the end of the file. This will be our EOF marker.\r
+        Dim applicationPath As String = Application.StartupPath\r
+        Dim fileWriter As System.IO.StreamWriter\r
+        fileWriter = File.AppendText(applicationPath & "\dvdinfo.dat")\r
+        fileWriter.WriteLine("--end--")\r
+        fileWriter.Flush()\r
+        fileWriter.Close()\r
 \r
-        '# Stage 2 - Parse the dvdinfo.dat file\r
-        '# This involves creating a string for each title and putting it into an array.\r
-        '# This array is called dvdData()\r
-\r
-\r
-        ' Lets clean any previous contents out of the DVD Title dropdown.\r
+        ' Clean the dvd title dropdown menu so it does not contain any of the previos items\r
         frmMain.drp_dvdtitle.Items.Clear()\r
 \r
-        Dim file_path As String = Application.StartupPath\r
-        Dim errStatus As Integer = 0\r
-        Dim dvdData(150) As String\r
-        Dim break As Boolean = False\r
-        Dim titleError As Boolean = False\r
+\r
+        ' Open dvdinfo.dat for reading and parse its contents. Place parsed contents in dvd.dat\r
+        ' Firstly we need to declare the storage array outside the try/catch statments so it can be used elsewhere.\r
+        Dim dvdInfoArray(150) As String\r
 \r
         Try\r
-            ' Parse the Data into a Single String with ~ Sepeartor\r
-            Dim RlineFile As StreamReader = File.OpenText(file_path & "\dvdinfo.dat")\r
-            Dim RLine As String\r
+            ' File and Line contents varibles\r
+            Dim ReadLine As StreamReader = File.OpenText(applicationPath & "\dvdinfo.dat")\r
+            Dim LineContents As String = ""\r
+\r
+            ' DVD info stroage varibles\r
             Dim titleData As String = ""\r
-            Dim ChaptStatus As Integer = 0\r
-            Dim AudioTrackStatus As Integer = 0\r
-            Dim SubtitleStatus As Integer = 0\r
+            Dim duationData As String = ""\r
+            Dim sizeData As String = ""\r
+            Dim cropdata As String = ""\r
+            Dim chatperData As String = ""\r
+            Dim audioData As String = ""\r
+            Dim subtitleData As String = ""\r
+\r
+            Dim fullTitleData As String = ""\r
+\r
+            ' Position Pointers\r
+            Dim chapterPointer As Boolean = False\r
+            Dim audioPointer As Boolean = False\r
+            Dim subtitlePointer As Boolean = False\r
             Dim counter As Integer = 0\r
-            Dim counter2 As String = 0\r
-            Dim ErrorCounter As Integer = 0\r
-            RLine = "---"\r
-            dvdData(counter2) = "---Start---"\r
-\r
-            While RLine <> Nothing\r
-                If (RLine.Contains("+ title")) Then\r
-                    If (titleData <> "") Then\r
-                        dvdData(counter2) = titleData\r
-                        add(titleData)\r
-                        counter2 = counter2 + 1\r
-                    End If\r
-                    ChaptStatus = 0\r
-                    AudioTrackStatus = 0\r
-                    SubtitleStatus = 0\r
-                    titleData = RLine.Trim\r
-                ElseIf (RLine.Contains("exited.")) Then\r
-                    add(titleData)\r
-                    dvdData(counter2) = titleData\r
-                    counter2 = counter2 + 1\r
-                    ChaptStatus = 0\r
-                    AudioTrackStatus = 0\r
-                    SubtitleStatus = 0\r
-                    break = True\r
-                ElseIf (RLine.Contains("***")) Then\r
-                    errStatus = 1\r
-                ElseIf (RLine.Contains("No title")) Then\r
-                    titleError = True\r
-                    break = True\r
-                ElseIf (RLine.Contains("+ duration")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                ElseIf (RLine.Contains("+ size")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                ElseIf (RLine.Contains("+ autocrop")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                ElseIf (RLine.Contains("+ chapters")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                    ChaptStatus = 1\r
-                    AudioTrackStatus = 0\r
-                    SubtitleStatus = 0\r
-                ElseIf (RLine.Contains("+ audio")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                    ChaptStatus = 0\r
-                    AudioTrackStatus = 1\r
-                    SubtitleStatus = 0\r
-                ElseIf (RLine.Contains("+ subtitle tracks")) Then\r
-                    titleData = titleData & " ~ " & RLine.Trim\r
-                    ChaptStatus = 0\r
-                    AudioTrackStatus = 0\r
-                    SubtitleStatus = 1\r
-\r
-                ElseIf (ChaptStatus = 1) Then\r
-                    ' This IF statment is here incase no chapters appear.\r
-                    If (RLine.Contains("+ audio")) Then\r
-                        ChaptStatus = 0\r
-                        AudioTrackStatus = 1\r
-                        SubtitleStatus = 0\r
-                    End If\r
-                    titleData = titleData & " & " & RLine.Trim\r
-\r
-                ElseIf (AudioTrackStatus = 1) Then\r
-                    'This if statment is here incase there was no audio tracks\r
-                    If (RLine.Contains("+ subtitle tracks")) Then\r
-                        ChaptStatus = 0\r
-                        AudioTrackStatus = 1\r
-                        SubtitleStatus = 0\r
+\r
+            ' Error handling varibles\r
+            Dim titleError As Boolean = False\r
+            Dim readError As Boolean = False\r
+\r
+            ' Read every line of the file and place the contents in the approiate varible.\r
+            While Not LineContents.Equals("--end--")\r
+                ' Get all the 1 liner data and set chaper potiner to true when done\r
+                If (LineContents.Contains("exited.")) Then\r
+                    subtitlePointer = False\r
+                    fullTitleData = titleData.Trim + " ~ " + duationData.Trim + " ~ " + sizeData.Trim + " ~ " + cropdata.Trim + " ~ " + chatperData.Trim + " ~ " + audioData.Trim + " ~ " + subtitleData.Trim\r
+                    dvdInfoArray(counter) = fullTitleData\r
+                    add(fullTitleData)\r
+                    counter = counter + 1\r
+                ElseIf (LineContents.Contains("+ title")) Then\r
+                    If (titleData <> Nothing) Then\r
+                        subtitlePointer = False\r
+                        fullTitleData = titleData.Trim + " ~ " + duationData.Trim + " ~ " + sizeData.Trim + " ~ " + cropdata.Trim + " ~ " + chatperData.Trim + " ~ " + audioData.Trim + " ~ " + subtitleData.Trim\r
+                        dvdInfoArray(counter) = fullTitleData\r
+                        add(fullTitleData)\r
+                        counter = counter + 1\r
                     End If\r
-                    titleData = titleData & " & " & RLine.Trim\r
+                    titleData = LineContents\r
+                ElseIf (LineContents.Contains("+ duration")) Then\r
+                    duationData = LineContents\r
+                ElseIf (LineContents.Contains("+ size")) Then\r
+                    sizeData = LineContents\r
+                ElseIf (LineContents.Contains("+ autocrop")) Then\r
+                    cropdata = LineContents\r
+                ElseIf (LineContents.Contains("+ chapters")) Then\r
+                    chatperData = LineContents\r
+                    chapterPointer = True\r
+                End If\r
 \r
-                ElseIf (SubtitleStatus = 1) Then\r
-                    If (RLine.Contains("+ title")) Then\r
-                        If (titleData <> "") Then\r
-                            dvdData(counter2) = titleData\r
-                            counter2 = counter2 + 1\r
+                ' Get all the chapter information in 1 varible\r
+                If chapterPointer = True Then\r
+                    If LineContents.Contains("+ audio") Then\r
+                        chapterPointer = False\r
+                        audioPointer = True\r
+                        audioData = LineContents\r
+                    Else\r
+                        If Not chatperData.Equals(LineContents) Then\r
+                            chatperData = chatperData & " & " & LineContents.Trim\r
                         End If\r
-                        ChaptStatus = 0\r
-                        AudioTrackStatus = 0\r
-                        SubtitleStatus = 0\r
-                        titleData = RLine.Trim\r
+                    End If\r
+                End If\r
+\r
+                ' Get all the audio channel information in 1 varible\r
+                If audioPointer = True Then\r
+                    If LineContents.Contains("+ subtitle") Then\r
+                        audioPointer = False\r
+                        subtitlePointer = True\r
+                        subtitleData = LineContents\r
                     Else\r
-                        titleData = titleData & " & " & RLine.Trim\r
+                        If Not audioData.Equals(LineContents) Then\r
+                            audioData = audioData & " & " & LineContents.Trim\r
+                        End If\r
                     End If\r
                 End If\r
-                RLine = RlineFile.ReadLine()\r
-\r
-                If break = True Then\r
-                    RLine = Nothing\r
-                ElseIf RLine = "" Then\r
-                    RLine = " "\r
-                    ErrorCounter = ErrorCounter + 1\r
-                    If ErrorCounter = 50 Then\r
-                        RLine = Nothing\r
+\r
+                ' Get all the subtitle data into 1 varible\r
+                If subtitlePointer = True Then\r
+                    If LineContents.Contains("+ subtitle") Then\r
+                        subtitleData = LineContents\r
+                    Else\r
+                        If Not subtitleData.Equals(LineContents) Then\r
+                            subtitleData = subtitleData & " & " & LineContents.Trim\r
+                        End If\r
                     End If\r
                 End If\r
 \r
-                counter = counter + 1\r
+                ' Handle some of Handbrakes Error outputs if they occur.\r
+                If (LineContents.Contains("No title")) Then\r
+                    titleError = True\r
+                End If\r
+\r
+                If (LineContents.Contains("***")) Then\r
+                    readError = True\r
+                End If\r
+\r
+                ' Read the next line of the file\r
+                LineContents = ReadLine.ReadLine\r
             End While\r
-            '# Close the file. Its no longer needed here.\r
-            RlineFile.Close()\r
+\r
+            ' Close the file as it is no longer required\r
+            ReadLine.Close()\r
+\r
+\r
+            ' Display error messages for errors detected above.\r
+            If readError = True Then\r
+                MessageBox.Show("Some DVD Title information may be missing however you may still be able to select your required title for encoding!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)\r
+            End If\r
+\r
+            If titleError = True Then\r
+                MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)\r
+            End If\r
 \r
         Catch ex As Exception\r
-            MessageBox.Show(ex.ToString) ' Debug\r
+            MessageBox.Show("DEBUG: " & ex.ToString)\r
         End Try\r
 \r
-        '# Stage 4 - Write the parsed data out into a file. \r
-        '# But, if theres a problem, display an error message instead\r
-        If errStatus = 1 Then\r
-            MessageBox.Show("Some DVD Title information may be missing however you may still be able to select your required title for encoding!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)\r
-        End If\r
 \r
-        If titleError = True Then\r
-            MessageBox.Show("No Title(s) found. Please make sure you have selected a valid, non-copy protected source.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)\r
-\r
-        End If\r
 \r
+        ' Take the information from dvdInfoArray and output each item in the array to a seperate line in the file.\r
         Try\r
-            Dim DataWriter As StreamWriter = New StreamWriter(file_path & "\dvd.dat")\r
-            Dim dvdCount As Integer = dvdData.Length\r
+            Dim outputWriter As StreamWriter = New StreamWriter(applicationPath & "\dvd.dat")\r
+            Dim dvdCount As Integer = dvdInfoArray.Length\r
             Dim counter As String = 0\r
 \r
             While counter <> dvdCount\r
-                DataWriter.WriteLine(dvdData(counter))\r
+                outputWriter.WriteLine(dvdInfoArray(counter))\r
                 counter = counter + 1\r
             End While\r
-            DataWriter.Close()\r
+            outputWriter.Close()\r
 \r
         Catch ex As Exception\r
             MessageBox.Show("Unable to write Data file. Please make sure the application has admin privileges.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)\r
@@ -211,6 +204,8 @@ Public Class frmReadDVD
         Me.Close()\r
     End Sub\r
 \r
+\r
+\r
     '# A function to Add data to frmSelects Select Title Tab and also populate frmMains dvdTitle Tab\r
     Function add(ByVal titleData)\r
         Dim titleInfo() As String\r
@@ -222,7 +217,6 @@ Public Class frmReadDVD
             str(0) = titleInfo(0).Trim.Substring(8).Replace(":", "") 'Title\r
             str(1) = titleInfo(1).Trim.Substring(12) ' Duration\r
         Catch ex As Exception\r
-            MessageBox.Show(ex.ToString)\r
             MessageBox.Show("ERROR: Incomplete DVD data found. Please copy the data on the View DVD Information tab and report this error.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand)\r
         End Try\r
 \r