OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 11 Sep 2008 21:34:05 +0000 (21:34 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 11 Sep 2008 21:34:05 +0000 (21:34 +0000)
- Slider control for deblock.
- Fix: Load normal preset if userdefault setting string is empty.

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

win/C#/Functions/Common.cs
win/C#/Functions/Presets.cs
win/C#/Functions/QueryParser.cs
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#/frmMain.resx

index 96c56a8..7b3e36f 100644 (file)
@@ -135,11 +135,17 @@ namespace Handbrake.Functions
             else\r
                 mainWindow.check_detelecine.CheckState = CheckState.Unchecked;\r
 \r
-\r
-            if (presetQuery.DeBlock == true)\r
-                mainWindow.check_deblock.CheckState = CheckState.Checked;\r
+            if (presetQuery.DeBlock != 0)\r
+            {\r
+                mainWindow.slider_deblock.Value = presetQuery.DeBlock;\r
+                mainWindow.lbl_deblockVal.Text = presetQuery.DeBlock.ToString();\r
+            }\r
             else\r
-                mainWindow.check_deblock.CheckState = CheckState.Unchecked;\r
+            {\r
+                mainWindow.slider_deblock.Value = 0;\r
+                mainWindow.lbl_deblockVal.Text = "0";\r
+            }\r
+\r
 \r
 \r
             if (presetQuery.Anamorphic == true)\r
@@ -573,8 +579,8 @@ namespace Handbrake.Functions
             else if (mainWindow.drp_anamorphic.SelectedIndex == 2)\r
                 query += " -P ";\r
 \r
-            if (mainWindow.check_deblock.Checked)\r
-                query += " --deblock";\r
+            if (mainWindow.slider_deblock.Value != 0)\r
+                query += " --deblock=" + mainWindow.slider_deblock.Value;\r
 \r
             if (mainWindow.check_detelecine.Checked)\r
                 query += " --detelecine";\r
index 0e176b1..9c23aef 100644 (file)
@@ -207,13 +207,11 @@ namespace Handbrake.Functions
                 // close the stream\r
                 line.Close();\r
                 line.Dispose();\r
-                MessageBox.Show("Your profile has been sucessfully added.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
             }\r
             catch (Exception exc)\r
             {\r
                 MessageBox.Show("Unable to write to the file. Please make sure the location has the correct permissions for file writing.\n Error Information: \n\n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
             }\r
-\r
         }\r
 \r
         // Check if a preset already exists in either the built in or user presets\r
index 80fe989..347e3f9 100644 (file)
@@ -231,11 +231,11 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        private Boolean q_deBlock;\r
+        private int q_deBlock;\r
         /// <summary>\r
         /// Returns a boolean to indicate wither DeBlock is on or off.\r
         /// </summary>\r
-        public Boolean DeBlock\r
+        public int DeBlock\r
         {\r
             get\r
             {\r
@@ -814,7 +814,7 @@ namespace Handbrake.Functions
             Match height = Regex.Match(input, @"-l ([0-9]*)");\r
             Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z]*)\""");\r
             Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z]*)\""");\r
-            Match deblock = Regex.Match(input, @"--deblock");\r
+            Match deblock = Regex.Match(input, @"--deblock=([0-9]*)");\r
             Match detelecine = Regex.Match(input, @"--detelecine");\r
             Match anamorphic = Regex.Match(input, @" -p ");\r
             Match chapterMarkers = Regex.Match(input, @" -m");\r
@@ -953,8 +953,16 @@ namespace Handbrake.Functions
                     thisQuery.q_cropRight = actCropValues[3];\r
                 }\r
 \r
+                // Deblock Slider\r
+                string deblockValue = "";\r
+                thisQuery.q_deBlock = 0;\r
+                if (deblock.Success != false)\r
+                    deblockValue = deblock.ToString().Replace("--deblock=", "");\r
+\r
+                if (deblockValue != "")\r
+                    int.TryParse(deblockValue, out thisQuery.q_deBlock);\r
+\r
                 thisQuery.q_detelecine = detelecine.Success;\r
-                thisQuery.q_deBlock = deblock.Success;\r
                 thisQuery.q_decomb = decomb.Success;\r
 \r
                 thisQuery.q_deinterlace = "None";\r
index 0ce64f3..f1ce04b 100644 (file)
@@ -109,7 +109,7 @@ namespace Handbrake.Properties {
         \r
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
-        [global::System.Configuration.DefaultSettingValueAttribute("Checked")]\r
+        [global::System.Configuration.DefaultSettingValueAttribute("")]\r
         public string defaultUserSettings {\r
             get {\r
                 return ((string)(this["defaultUserSettings"]));\r
index c7e206e..6069416 100644 (file)
@@ -24,7 +24,7 @@
       <Value Profile="(Default)">Do Nothing</Value>\r
     </Setting>\r
     <Setting Name="defaultUserSettings" Type="System.String" Scope="User">\r
-      <Value Profile="(Default)">Checked</Value>\r
+      <Value Profile="(Default)" />\r
     </Setting>\r
     <Setting Name="hb_build" Type="System.Int32" Scope="User">\r
       <Value Profile="(Default)">0</Value>\r
index e36dca9..ce66d92 100644 (file)
@@ -29,7 +29,7 @@
                 <value>Do Nothing</value>\r
             </setting>\r
             <setting name="defaultUserSettings" serializeAs="String">\r
-                <value>Checked</value>\r
+                <value />\r
             </setting>\r
             <setting name="hb_build" serializeAs="String">\r
                 <value>0</value>\r
index 768db11..6867232 100644 (file)
@@ -38,7 +38,7 @@ namespace Handbrake
             System.Windows.Forms.Label Label38;\r
             System.Windows.Forms.ContextMenuStrip notifyIconMenu;\r
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
             this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();\r
             this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
             this.File_Save = new System.Windows.Forms.SaveFileDialog();\r
@@ -165,6 +165,8 @@ namespace Handbrake
             this.Label46 = new System.Windows.Forms.Label();\r
             this.Label40 = new System.Windows.Forms.Label();\r
             this.TabPage1 = new System.Windows.Forms.TabPage();\r
+            this.lbl_deblockVal = new System.Windows.Forms.Label();\r
+            this.slider_deblock = new System.Windows.Forms.TrackBar();\r
             this.check_customCrop = new System.Windows.Forms.RadioButton();\r
             this.check_autoCrop = new System.Windows.Forms.RadioButton();\r
             this.check_decomb = new System.Windows.Forms.CheckBox();\r
@@ -183,7 +185,6 @@ namespace Handbrake
             this.label24 = new System.Windows.Forms.Label();\r
             this.drp_deNoise = new System.Windows.Forms.ComboBox();\r
             this.label11 = new System.Windows.Forms.Label();\r
-            this.check_deblock = new System.Windows.Forms.CheckBox();\r
             this.check_detelecine = new System.Windows.Forms.CheckBox();\r
             this.label4 = new System.Windows.Forms.Label();\r
             this.drp_deInterlace_option = new System.Windows.Forms.ComboBox();\r
@@ -258,6 +259,7 @@ namespace Handbrake
             this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);\r
             this.StatusStrip = new System.Windows.Forms.StatusStrip();\r
             this.lbl_encode = new System.Windows.Forms.ToolStripStatusLabel();\r
+            this.label8 = new System.Windows.Forms.Label();\r
             Label38 = new System.Windows.Forms.Label();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
@@ -273,6 +275,7 @@ namespace Handbrake
             ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();\r
             this.TabPage3.SuspendLayout();\r
             this.TabPage1.SuspendLayout();\r
+            ((System.ComponentModel.ISupportInitialize)(this.slider_deblock)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_bottom)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_top)).BeginInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_left)).BeginInit();\r
@@ -643,9 +646,9 @@ namespace Handbrake
             // \r
             // number\r
             // \r
-            dataGridViewCellStyle1.Format = "N0";\r
-            dataGridViewCellStyle1.NullValue = null;\r
-            this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
+            dataGridViewCellStyle2.Format = "N0";\r
+            dataGridViewCellStyle2.NullValue = null;\r
+            this.number.DefaultCellStyle = dataGridViewCellStyle2;\r
             this.number.HeaderText = "Chapter Number";\r
             this.number.MaxInputLength = 3;\r
             this.number.Name = "number";\r
@@ -1851,6 +1854,9 @@ namespace Handbrake
             // TabPage1\r
             // \r
             this.TabPage1.BackColor = System.Drawing.Color.Transparent;\r
+            this.TabPage1.Controls.Add(this.label8);\r
+            this.TabPage1.Controls.Add(this.lbl_deblockVal);\r
+            this.TabPage1.Controls.Add(this.slider_deblock);\r
             this.TabPage1.Controls.Add(this.check_customCrop);\r
             this.TabPage1.Controls.Add(this.check_autoCrop);\r
             this.TabPage1.Controls.Add(this.check_decomb);\r
@@ -1873,7 +1879,6 @@ namespace Handbrake
             this.TabPage1.Controls.Add(this.label24);\r
             this.TabPage1.Controls.Add(this.drp_deNoise);\r
             this.TabPage1.Controls.Add(this.label11);\r
-            this.TabPage1.Controls.Add(this.check_deblock);\r
             this.TabPage1.Controls.Add(this.check_detelecine);\r
             this.TabPage1.Controls.Add(this.label4);\r
             this.TabPage1.Controls.Add(this.drp_deInterlace_option);\r
@@ -1889,6 +1894,26 @@ namespace Handbrake
             this.TabPage1.TabIndex = 0;\r
             this.TabPage1.Text = "Picture Settings";\r
             // \r
+            // lbl_deblockVal\r
+            // \r
+            this.lbl_deblockVal.AutoSize = true;\r
+            this.lbl_deblockVal.BackColor = System.Drawing.Color.Transparent;\r
+            this.lbl_deblockVal.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.lbl_deblockVal.Location = new System.Drawing.Point(586, 213);\r
+            this.lbl_deblockVal.Name = "lbl_deblockVal";\r
+            this.lbl_deblockVal.Size = new System.Drawing.Size(14, 13);\r
+            this.lbl_deblockVal.TabIndex = 36;\r
+            this.lbl_deblockVal.Text = "0";\r
+            // \r
+            // slider_deblock\r
+            // \r
+            this.slider_deblock.Location = new System.Drawing.Point(406, 204);\r
+            this.slider_deblock.Maximum = 15;\r
+            this.slider_deblock.Name = "slider_deblock";\r
+            this.slider_deblock.Size = new System.Drawing.Size(174, 42);\r
+            this.slider_deblock.TabIndex = 35;\r
+            this.slider_deblock.Scroll += new System.EventHandler(this.slider_deblock_Scroll);\r
+            // \r
             // check_customCrop\r
             // \r
             this.check_customCrop.AutoSize = true;\r
@@ -1918,7 +1943,7 @@ namespace Handbrake
             this.check_decomb.AutoSize = true;\r
             this.check_decomb.BackColor = System.Drawing.Color.Transparent;\r
             this.check_decomb.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.check_decomb.Location = new System.Drawing.Point(314, 215);\r
+            this.check_decomb.Location = new System.Drawing.Point(314, 188);\r
             this.check_decomb.Name = "check_decomb";\r
             this.check_decomb.Size = new System.Drawing.Size(73, 17);\r
             this.check_decomb.TabIndex = 32;\r
@@ -2065,7 +2090,7 @@ namespace Handbrake
             this.check_vfr.AutoSize = true;\r
             this.check_vfr.BackColor = System.Drawing.Color.Transparent;\r
             this.check_vfr.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.check_vfr.Location = new System.Drawing.Point(413, 169);\r
+            this.check_vfr.Location = new System.Drawing.Point(413, 165);\r
             this.check_vfr.Name = "check_vfr";\r
             this.check_vfr.Size = new System.Drawing.Size(48, 17);\r
             this.check_vfr.TabIndex = 24;\r
@@ -2078,7 +2103,7 @@ namespace Handbrake
             this.label24.AutoSize = true;\r
             this.label24.BackColor = System.Drawing.Color.Transparent;\r
             this.label24.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label24.Location = new System.Drawing.Point(311, 146);\r
+            this.label24.Location = new System.Drawing.Point(311, 142);\r
             this.label24.Name = "label24";\r
             this.label24.Size = new System.Drawing.Size(49, 13);\r
             this.label24.TabIndex = 22;\r
@@ -2094,7 +2119,7 @@ namespace Handbrake
             "Weak",\r
             "Medium",\r
             "Strong"});\r
-            this.drp_deNoise.Location = new System.Drawing.Point(413, 266);\r
+            this.drp_deNoise.Location = new System.Drawing.Point(413, 277);\r
             this.drp_deNoise.Name = "drp_deNoise";\r
             this.drp_deNoise.Size = new System.Drawing.Size(161, 21);\r
             this.drp_deNoise.TabIndex = 29;\r
@@ -2104,30 +2129,18 @@ namespace Handbrake
             this.label11.AutoSize = true;\r
             this.label11.BackColor = System.Drawing.Color.Transparent;\r
             this.label11.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label11.Location = new System.Drawing.Point(311, 269);\r
+            this.label11.Location = new System.Drawing.Point(311, 280);\r
             this.label11.Name = "label11";\r
             this.label11.Size = new System.Drawing.Size(58, 13);\r
             this.label11.TabIndex = 28;\r
             this.label11.Text = "Denoise:";\r
             // \r
-            // check_deblock\r
-            // \r
-            this.check_deblock.AutoSize = true;\r
-            this.check_deblock.BackColor = System.Drawing.Color.Transparent;\r
-            this.check_deblock.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.check_deblock.Location = new System.Drawing.Point(314, 192);\r
-            this.check_deblock.Name = "check_deblock";\r
-            this.check_deblock.Size = new System.Drawing.Size(72, 17);\r
-            this.check_deblock.TabIndex = 25;\r
-            this.check_deblock.Text = "Deblock";\r
-            this.check_deblock.UseVisualStyleBackColor = false;\r
-            // \r
             // check_detelecine\r
             // \r
             this.check_detelecine.AutoSize = true;\r
             this.check_detelecine.BackColor = System.Drawing.Color.Transparent;\r
             this.check_detelecine.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.check_detelecine.Location = new System.Drawing.Point(314, 169);\r
+            this.check_detelecine.Location = new System.Drawing.Point(314, 165);\r
             this.check_detelecine.Name = "check_detelecine";\r
             this.check_detelecine.Size = new System.Drawing.Size(86, 17);\r
             this.check_detelecine.TabIndex = 23;\r
@@ -2139,7 +2152,7 @@ namespace Handbrake
             this.label4.AutoSize = true;\r
             this.label4.BackColor = System.Drawing.Color.Transparent;\r
             this.label4.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.label4.Location = new System.Drawing.Point(311, 241);\r
+            this.label4.Location = new System.Drawing.Point(311, 252);\r
             this.label4.Name = "label4";\r
             this.label4.Size = new System.Drawing.Size(77, 13);\r
             this.label4.TabIndex = 26;\r
@@ -2155,7 +2168,7 @@ namespace Handbrake
             "Fast",\r
             "Slow",\r
             "Slower"});\r
-            this.drp_deInterlace_option.Location = new System.Drawing.Point(413, 238);\r
+            this.drp_deInterlace_option.Location = new System.Drawing.Point(413, 249);\r
             this.drp_deInterlace_option.Name = "drp_deInterlace_option";\r
             this.drp_deInterlace_option.Size = new System.Drawing.Size(161, 21);\r
             this.drp_deInterlace_option.TabIndex = 27;\r
@@ -3154,6 +3167,17 @@ namespace Handbrake
             this.lbl_encode.Size = new System.Drawing.Size(31, 17);\r
             this.lbl_encode.Text = "{0}";\r
             // \r
+            // label8\r
+            // \r
+            this.label8.AutoSize = true;\r
+            this.label8.BackColor = System.Drawing.Color.Transparent;\r
+            this.label8.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.label8.Location = new System.Drawing.Point(311, 213);\r
+            this.label8.Name = "label8";\r
+            this.label8.Size = new System.Drawing.Size(58, 13);\r
+            this.label8.TabIndex = 37;\r
+            this.label8.Text = "Deblock:";\r
+            // \r
             // frmMain\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
@@ -3192,6 +3216,7 @@ namespace Handbrake
             this.TabPage3.PerformLayout();\r
             this.TabPage1.ResumeLayout(false);\r
             this.TabPage1.PerformLayout();\r
+            ((System.ComponentModel.ISupportInitialize)(this.slider_deblock)).EndInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_bottom)).EndInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_top)).EndInit();\r
             ((System.ComponentModel.ISupportInitialize)(this.text_left)).EndInit();\r
@@ -3280,9 +3305,7 @@ namespace Handbrake
         internal System.Windows.Forms.Label Label20;\r
         internal System.Windows.Forms.CheckBox check_grayscale;\r
         internal System.Windows.Forms.Label label24;\r
-        internal System.Windows.Forms.ComboBox drp_deNoise;\r
         internal System.Windows.Forms.Label label11;\r
-        internal System.Windows.Forms.CheckBox check_deblock;\r
         internal System.Windows.Forms.CheckBox check_detelecine;\r
         internal System.Windows.Forms.Label label4;\r
         internal System.Windows.Forms.ComboBox drp_deInterlace_option;\r
@@ -3436,6 +3459,10 @@ namespace Handbrake
         internal System.Windows.Forms.CheckBox check_decomb;\r
         internal System.Windows.Forms.RadioButton check_customCrop;\r
         internal System.Windows.Forms.RadioButton check_autoCrop;\r
+        internal System.Windows.Forms.Label lbl_deblockVal;\r
+        internal System.Windows.Forms.TrackBar slider_deblock;\r
+        internal System.Windows.Forms.ComboBox drp_deNoise;\r
+        internal System.Windows.Forms.Label label8;\r
 \r
     }\r
 }
\ No newline at end of file
index 323d49f..5d88867 100644 (file)
@@ -161,8 +161,13 @@ namespace Handbrake
             // Try to load the users default settings.\r
             string userDefaults = Properties.Settings.Default.defaultUserSettings;\r
 \r
-            Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);\r
-            hb_common_func.presetLoader(this, presetQuery, "User Defaults ");\r
+            if (userDefaults == "")\r
+                loadNormalPreset();\r
+            else\r
+            {\r
+                Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);\r
+                hb_common_func.presetLoader(this, presetQuery, "User Defaults ");\r
+            }\r
         }\r
         private void queueRecovery()\r
         {\r
@@ -816,6 +821,10 @@ namespace Handbrake
                 text_width.Enabled = true;\r
             }\r
         }\r
+        private void slider_deblock_Scroll(object sender, EventArgs e)\r
+        {\r
+            lbl_deblockVal.Text = slider_deblock.Value.ToString();\r
+        }\r
 \r
         // Audio Tab\r
         private void drp_track2Audio_SelectedIndexChanged(object sender, EventArgs e)\r
@@ -1887,6 +1896,8 @@ namespace Handbrake
         #endregion\r
 \r
 \r
+\r
+\r
         // This is the END of the road ------------------------------------------------------------------------------\r
     }\r
 }
\ No newline at end of file
index 1b5323e..d0c9f18 100644 (file)
@@ -155,6 +155,12 @@ Make sure you have selected a "Title" from the "Source" box above otherwise
 the list will not be populated with the correct amount of chapters.\r
 Note: Do not change any of the chapter numbers!</value>\r
   </data>\r
+  <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+    <value>True</value>\r
+  </metadata>\r
+  <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
+    <value>True</value>\r
+  </metadata>\r
   <metadata name="DVD_Open.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
     <value>223, 15</value>\r
   </metadata>\r