OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 29 Aug 2009 21:08:50 +0000 (21:08 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 29 Aug 2009 21:08:50 +0000 (21:08 +0000)
- Fix a nasty culture issue with the Video Quality slider. Should now work correctly for systems which represent floats as 1,25 instead of 1.25

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

win/C#/Changelog.html
win/C#/Functions/PresetLoader.cs
win/C#/Functions/QueryGenerator.cs
win/C#/Properties/Settings.Designer.cs
win/C#/Properties/Settings.settings
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmOptions.cs

index 9be2005..408583f 100644 (file)
@@ -24,7 +24,7 @@ Windows Platform Specific Changlog.<br />
     - Fix a regex error in the appcast reader and make it more robust to errors.<br />\r
     - Fix issue with the destination File box double appending the file extension<br />\r
     - Fix issue changing file format causing the audio encoder dropdown to be set to ""<br />\r
-    - Fixed an issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />\r
+    - Fix an issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />\r
 \r
     \r
     <h4>Backend / Not important changes</h4>\r
index 90f16f6..fae48ee 100644 (file)
@@ -151,8 +151,7 @@ namespace Handbrake.Functions
                 mainWindow.radio_cq.Checked = true;\r
                 if (presetQuery.VideoEncoder == "H.264 (x264)")\r
                 {\r
-                    double cqStep;\r
-                    double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);\r
+                    double cqStep = Properties.Settings.Default.x264cqstep;\r
                     int value;\r
                     double x264step = cqStep;\r
                     double presetValue = presetQuery.VideoQuality;\r
@@ -184,7 +183,6 @@ namespace Handbrake.Functions
 \r
             mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked;\r
 \r
-\r
             mainWindow.drp_videoFramerate.Text = presetQuery.VideoFramerate;\r
 \r
             mainWindow.check_turbo.CheckState = presetQuery.TurboFirstPass ? CheckState.Checked : CheckState.Unchecked;\r
index 58e59cd..4d00334 100644 (file)
@@ -192,9 +192,7 @@ namespace Handbrake.Functions
             // Video Quality Setting\r
             if (mainWindow.radio_cq.Checked)\r
             {\r
-                double cqStep;\r
-                double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);\r
-\r
+                double cqStep = Properties.Settings.Default.x264cqstep;\r
                 double value;\r
                 switch (mainWindow.drp_videoEncoder.Text)\r
                 {\r
index c60c8da..86c2c76 100644 (file)
@@ -302,9 +302,9 @@ namespace Handbrake.Properties {
         [global::System.Configuration.UserScopedSettingAttribute()]\r
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
         [global::System.Configuration.DefaultSettingValueAttribute("0.25")]\r
-        public string x264cqstep {\r
+        public double x264cqstep {\r
             get {\r
-                return ((string)(this["x264cqstep"]));\r
+                return ((double)(this["x264cqstep"]));\r
             }\r
             set {\r
                 this["x264cqstep"] = value;\r
index 5c3d4d3..f88c3e3 100644 (file)
@@ -71,7 +71,7 @@
     <Setting Name="QueryEditorTab" Type="System.Boolean" Scope="User">\r
       <Value Profile="(Default)">False</Value>\r
     </Setting>\r
-    <Setting Name="x264cqstep" Type="System.String" Scope="User">\r
+    <Setting Name="x264cqstep" Type="System.Double" Scope="User">\r
       <Value Profile="(Default)">0.25</Value>\r
     </Setting>\r
     <Setting Name="verboseLevel" Type="System.Int32" Scope="User">\r
index 8e73a3f..b983551 100644 (file)
@@ -99,6 +99,7 @@ namespace Handbrake
             this.Label47 = new System.Windows.Forms.Label();\r
             this.Label3 = new System.Windows.Forms.Label();\r
             this.tab_audio = new System.Windows.Forms.TabPage();\r
+            this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
             this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
             this.tab_video = new System.Windows.Forms.TabPage();\r
             this.radio_cq = new System.Windows.Forms.RadioButton();\r
@@ -110,14 +111,18 @@ namespace Handbrake
             this.SliderValue = new System.Windows.Forms.Label();\r
             this.Label46 = new System.Windows.Forms.Label();\r
             this.tab_picture = new System.Windows.Forms.TabPage();\r
+            this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
             this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
             this.tabs_panel = new System.Windows.Forms.TabControl();\r
             this.tab_filters = new System.Windows.Forms.TabPage();\r
+            this.Filters = new Handbrake.Controls.Filters();\r
             this.tab_subtitles = new System.Windows.Forms.TabPage();\r
+            this.Subtitles = new Handbrake.Controls.Subtitles();\r
             this.tab_chapters = new System.Windows.Forms.TabPage();\r
             this.btn_importChapters = new System.Windows.Forms.Button();\r
             this.label31 = new System.Windows.Forms.Label();\r
             this.tab_advanced = new System.Windows.Forms.TabPage();\r
+            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             this.tab_query = new System.Windows.Forms.TabPage();\r
             this.btn_clear = new System.Windows.Forms.Button();\r
             this.label34 = new System.Windows.Forms.Label();\r
@@ -171,11 +176,6 @@ namespace Handbrake
             this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();\r
             this.openPreset = new System.Windows.Forms.OpenFileDialog();\r
             this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();\r
-            this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
-            this.Filters = new Handbrake.Controls.Filters();\r
-            this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
-            this.Subtitles = new Handbrake.Controls.Subtitles();\r
-            this.x264Panel = new Handbrake.Controls.x264Panel();\r
             notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
             notifyIconMenu.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
@@ -784,6 +784,15 @@ namespace Handbrake
             this.tab_audio.Text = "Audio";\r
             this.tab_audio.UseVisualStyleBackColor = true;\r
             // \r
+            // AudioSettings\r
+            // \r
+            this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
+            this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
+            this.AudioSettings.Name = "AudioSettings";\r
+            this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
+            this.AudioSettings.TabIndex = 0;\r
+            // \r
             // AudioMenuRowHeightHack\r
             // \r
             this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;\r
@@ -920,6 +929,16 @@ namespace Handbrake
             this.tab_picture.Text = "Picture";\r
             this.tab_picture.UseVisualStyleBackColor = true;\r
             // \r
+            // PictureSettings\r
+            // \r
+            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
+            this.PictureSettings.Enabled = false;\r
+            this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
+            this.PictureSettings.Name = "PictureSettings";\r
+            this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
+            this.PictureSettings.TabIndex = 0;\r
+            // \r
             // Check_ChapterMarkers\r
             // \r
             this.Check_ChapterMarkers.AutoSize = true;\r
@@ -959,6 +978,15 @@ namespace Handbrake
             this.tab_filters.Text = "Video Filters";\r
             this.tab_filters.UseVisualStyleBackColor = true;\r
             // \r
+            // Filters\r
+            // \r
+            this.Filters.BackColor = System.Drawing.Color.Transparent;\r
+            this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.Filters.Location = new System.Drawing.Point(0, 0);\r
+            this.Filters.Name = "Filters";\r
+            this.Filters.Size = new System.Drawing.Size(713, 310);\r
+            this.Filters.TabIndex = 0;\r
+            // \r
             // tab_subtitles\r
             // \r
             this.tab_subtitles.Controls.Add(this.Subtitles);\r
@@ -970,6 +998,15 @@ namespace Handbrake
             this.tab_subtitles.Text = "Subtitles";\r
             this.tab_subtitles.UseVisualStyleBackColor = true;\r
             // \r
+            // Subtitles\r
+            // \r
+            this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
+            this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
+            this.Subtitles.Name = "Subtitles";\r
+            this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
+            this.Subtitles.TabIndex = 0;\r
+            // \r
             // tab_chapters\r
             // \r
             this.tab_chapters.BackColor = System.Drawing.Color.Transparent;\r
@@ -1020,6 +1057,16 @@ namespace Handbrake
             this.tab_advanced.Text = "Advanced";\r
             this.tab_advanced.UseVisualStyleBackColor = true;\r
             // \r
+            // x264Panel\r
+            // \r
+            this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
+            this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+            this.x264Panel.Name = "x264Panel";\r
+            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
+            this.x264Panel.TabIndex = 0;\r
+            this.x264Panel.x264Query = "";\r
+            // \r
             // tab_query\r
             // \r
             this.tab_query.Controls.Add(this.btn_clear);\r
@@ -1593,53 +1640,6 @@ namespace Handbrake
             // \r
             this.File_ChapterImport.Filter = "CSV Files|*.csv";\r
             // \r
-            // PictureSettings\r
-            // \r
-            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
-            this.PictureSettings.Enabled = false;\r
-            this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.PictureSettings.Name = "PictureSettings";\r
-            this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
-            this.PictureSettings.TabIndex = 0;\r
-            // \r
-            // Filters\r
-            // \r
-            this.Filters.BackColor = System.Drawing.Color.Transparent;\r
-            this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.Filters.Location = new System.Drawing.Point(0, 0);\r
-            this.Filters.Name = "Filters";\r
-            this.Filters.Size = new System.Drawing.Size(713, 310);\r
-            this.Filters.TabIndex = 0;\r
-            // \r
-            // AudioSettings\r
-            // \r
-            this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
-            this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.AudioSettings.Name = "AudioSettings";\r
-            this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
-            this.AudioSettings.TabIndex = 0;\r
-            // \r
-            // Subtitles\r
-            // \r
-            this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
-            this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
-            this.Subtitles.Name = "Subtitles";\r
-            this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
-            this.Subtitles.TabIndex = 0;\r
-            // \r
-            // x264Panel\r
-            // \r
-            this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
-            this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
-            this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
-            this.x264Panel.Name = "x264Panel";\r
-            this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
-            this.x264Panel.TabIndex = 0;\r
-            this.x264Panel.x264Query = "";\r
-            // \r
             // frmMain\r
             // \r
             this.AllowDrop = true;\r
index 6624915..9dd44d2 100644 (file)
@@ -1169,8 +1169,7 @@ namespace Handbrake
                     slider_videoQuality.TickFrequency = 1;\r
 \r
                     CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                    double cqStep;\r
-                    double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);\r
+                    double cqStep = Properties.Settings.Default.x264cqstep;\r
                     double multiplier = 1.0 / cqStep;\r
                     double value = slider_videoQuality.Value * multiplier;\r
 \r
@@ -1225,31 +1224,29 @@ namespace Handbrake
                 check_iPodAtom.Checked = false;\r
             }\r
         }\r
-        private string _cachedCqStep = Properties.Settings.Default.x264cqstep;   \r
+        private double _cachedCqStep = Properties.Settings.Default.x264cqstep;   \r
         /// <summary>\r
         /// Update the CQ slider for x264 for a new CQ step. This is set from option\r
         /// </summary>\r
         public void setQualityFromSlider()\r
         {\r
             // Work out the current RF value.\r
-            double cqStep;\r
-            double.TryParse(_cachedCqStep, out cqStep);\r
+            double cqStep = _cachedCqStep;\r
             double rfValue = 51.0 - slider_videoQuality.Value * cqStep;\r
             \r
             // Change the maximum value for the slider\r
-            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-            switch (Properties.Settings.Default.x264cqstep.ToString(culture))\r
+            switch (Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US")))\r
             {\r
-                case "0.20":\r
+                case "0.2":\r
                     slider_videoQuality.Maximum = 255;\r
                     break;\r
                 case "0.25":\r
                     slider_videoQuality.Maximum = 204;\r
                     break;\r
-                case "0.50":\r
+                case "0.5":\r
                     slider_videoQuality.Maximum = 102;\r
                     break;\r
-                case "1.0":\r
+                case "1":\r
                     slider_videoQuality.Maximum = 51;\r
                     break;\r
                 default:\r
@@ -1261,8 +1258,7 @@ namespace Handbrake
             slider_videoQuality.Value = slider_videoQuality.Maximum;\r
 \r
             // Reset the CQ slider back to the previous value as close as possible\r
-            double cqStepNew;\r
-            double.TryParse(Properties.Settings.Default.x264cqstep, out cqStepNew);\r
+            double cqStepNew = Properties.Settings.Default.x264cqstep;\r
             double rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;\r
             while (rfValueCurrent < rfValue)\r
             {\r
@@ -1275,8 +1271,7 @@ namespace Handbrake
         }\r
         private void slider_videoQuality_Scroll(object sender, EventArgs e)\r
         {\r
-            double cqStep;\r
-            double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);\r
+            double cqStep = Properties.Settings.Default.x264cqstep;\r
             switch (drp_videoEncoder.Text)\r
             {\r
                 case "MPEG-4 (FFmpeg)":\r
@@ -1284,7 +1279,7 @@ namespace Handbrake
                     double max = slider_videoQuality.Maximum;\r
                     double min = slider_videoQuality.Minimum;\r
                     double val = ((max - min) - (rfValue - min)) / (max - min);\r
-                    SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);\r
+                    SliderValue.Text = Math.Round((val * 100), 2).ToString(new CultureInfo("en-US")) + "% QP:" + (32 - slider_videoQuality.Value);\r
                     break;\r
                 case "H.264 (x264)":\r
                     rfValue = 51.0 - slider_videoQuality.Value * cqStep;\r
@@ -1292,12 +1287,12 @@ namespace Handbrake
                     min = slider_videoQuality.Minimum;\r
                     val = ((max - min) - (rfValue - min)) / (max - min);\r
                     rfValue = Math.Round(rfValue, 2);\r
-                    SliderValue.Text = Math.Round((val * 100), 2) + "% RF:" + rfValue;\r
+                    SliderValue.Text = Math.Round((val * 100), 2).ToString(new CultureInfo("en-US")) + "% RF:" + rfValue.ToString(new CultureInfo("en-US"));\r
                     break;\r
                 case "VP3 (Theora)":\r
                     rfValue = slider_videoQuality.Value;\r
                     double value = rfValue / 63;\r
-                    SliderValue.Text = Math.Round((value * 100), 2) + "% QP:" + slider_videoQuality.Value;\r
+                    SliderValue.Text = Math.Round((value * 100), 2).ToString(new CultureInfo("en-US")) + "% QP:" + slider_videoQuality.Value;\r
                     break;\r
             }\r
         }\r
index 462bdb8..ce281e9 100644 (file)
@@ -165,9 +165,22 @@ namespace Handbrake
             }\r
 \r
             // x264 step\r
-            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-            string test = Properties.Settings.Default.x264cqstep.ToString(culture);\r
-            drop_x264step.SelectedItem = test;\r
+            string step = Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US"));\r
+            switch (step)\r
+            {\r
+                case "1":\r
+                    drop_x264step.SelectedIndex = 0;\r
+                    break;\r
+                case "0.5":\r
+                    drop_x264step.SelectedIndex = 1;\r
+                    break;\r
+                case "0.25":\r
+                    drop_x264step.SelectedIndex = 2;\r
+                    break;\r
+                case "0.2":\r
+                    drop_x264step.SelectedIndex = 3;\r
+                    break;\r
+            }\r
 \r
             // Use Experimental dvdnav\r
             if (Properties.Settings.Default.dvdnav)\r
@@ -398,16 +411,16 @@ namespace Handbrake
             switch (drop_x264step.SelectedIndex)\r
             {\r
                 case 0:\r
-                    Properties.Settings.Default.x264cqstep = "1.0";\r
+                    Properties.Settings.Default.x264cqstep = 1.0;\r
                     break;\r
                 case 1:\r
-                    Properties.Settings.Default.x264cqstep = "0.50";\r
+                    Properties.Settings.Default.x264cqstep = 0.50;\r
                     break;\r
                 case 2:\r
-                    Properties.Settings.Default.x264cqstep = "0.25";\r
+                    Properties.Settings.Default.x264cqstep = 0.25;\r
                     break;\r
                 case 3:\r
-                    Properties.Settings.Default.x264cqstep = "0.20";\r
+                    Properties.Settings.Default.x264cqstep = 0.20;\r
                     break;\r
             }\r
             mainWindow.setQualityFromSlider();\r