OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 28 Jun 2009 11:38:35 +0000 (11:38 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 28 Jun 2009 11:38:35 +0000 (11:38 +0000)
- Attempt 2 at fixing culture issues. Thanks to zhango

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

win/C#/Functions/PresetLoader.cs
win/C#/Functions/QueryGenerator.cs
win/C#/frmMain.Designer.cs
win/C#/frmMain.cs
win/C#/frmOptions.cs

index 6730b8e..82d96e6 100644 (file)
@@ -159,8 +159,6 @@ namespace Handbrake.Functions
                 if (presetQuery.VideoEncoder == "H.264 (x264)")\r
                 {\r
                     int value;\r
-                    System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");\r
-\r
                     double x264step = Properties.Settings.Default.x264cqstep;\r
                     double presetValue = presetQuery.VideoQuality;\r
 \r
@@ -178,10 +176,7 @@ namespace Handbrake.Functions
                         double val = Math.Round(calculated, 0);\r
                         int.TryParse(val.ToString(), out value);\r
                     }\r
-\r
-                    int safevalue;\r
-                    int.TryParse(value.ToString(culture), out safevalue);\r
-                    mainWindow.slider_videoQuality.Value = safevalue;\r
+                    mainWindow.slider_videoQuality.Value = value;\r
                 }\r
                 else\r
                 {\r
index da44e60..85e76f5 100644 (file)
@@ -222,12 +222,10 @@ namespace Handbrake.Functions
                         query += " -q " + value.ToString(new CultureInfo("en-US"));\r
                         break;\r
                     case "H.264 (x264)":\r
-                        double divided;\r
                         CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                        double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divided);\r
-                        value = 51 - mainWindow.slider_videoQuality.Value * divided;\r
+                        value = 51 - mainWindow.slider_videoQuality.Value * Properties.Settings.Default.x264cqstep;\r
                         value = Math.Round(value, 2);\r
-                        query += " -q " + value.ToString(new CultureInfo("en-US"));\r
+                        query += " -q " + value.ToString(culture);\r
                         break;\r
                     case "VP3 (Theora)":\r
                         value = mainWindow.slider_videoQuality.Value;\r
index 8375119..6d7edb2 100644 (file)
@@ -103,6 +103,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
@@ -114,13 +115,17 @@ 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.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
@@ -158,11 +163,6 @@ namespace Handbrake
             this.lbl_source = new System.Windows.Forms.Label();\r
             this.label4 = new System.Windows.Forms.Label();\r
             this.groupBox_output = new System.Windows.Forms.Label();\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
@@ -824,6 +824,14 @@ 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.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
@@ -960,6 +968,14 @@ namespace Handbrake
             this.tab_picture.Text = "Picture Settings";\r
             this.tab_picture.UseVisualStyleBackColor = true;\r
             // \r
+            // PictureSettings\r
+            // \r
+            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
+            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
+            this.PictureSettings.Name = "PictureSettings";\r
+            this.PictureSettings.Size = new System.Drawing.Size(713, 310);\r
+            this.PictureSettings.TabIndex = 0;\r
+            // \r
             // Check_ChapterMarkers\r
             // \r
             this.Check_ChapterMarkers.AutoSize = true;\r
@@ -1001,6 +1017,14 @@ 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.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
@@ -1012,6 +1036,14 @@ 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.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
@@ -1049,6 +1081,14 @@ namespace Handbrake
             this.tab_advanced.Text = "Advanced";\r
             this.tab_advanced.UseVisualStyleBackColor = true;\r
             // \r
+            // x264Panel\r
+            // \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
@@ -1434,46 +1474,6 @@ namespace Handbrake
             this.groupBox_output.TabIndex = 47;\r
             this.groupBox_output.Text = "Output Settings: (Preset: None)";\r
             // \r
-            // PictureSettings\r
-            // \r
-            this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
-            this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
-            this.PictureSettings.Name = "PictureSettings";\r
-            this.PictureSettings.Size = new System.Drawing.Size(713, 310);\r
-            this.PictureSettings.TabIndex = 0;\r
-            // \r
-            // Filters\r
-            // \r
-            this.Filters.BackColor = System.Drawing.Color.Transparent;\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.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.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.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 0aec0fa..a8418e0 100644 (file)
@@ -1049,14 +1049,11 @@ namespace Handbrake
                     slider_videoQuality.Minimum = 0;\r
                     slider_videoQuality.TickFrequency = 1;\r
 \r
-                    double divider;\r
                     CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                    double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divider);\r
-\r
-                    double multiplier = 1.0 / divider;\r
+                    double multiplier = 1.0 / Properties.Settings.Default.x264cqstep;\r
                     double value = slider_videoQuality.Value*multiplier;\r
-                    \r
-                    switch (Properties.Settings.Default.x264cqstep.ToString())\r
+\r
+                    switch (Properties.Settings.Default.x264cqstep.ToString(culture))\r
                     {\r
                         case "0.20":\r
                             slider_videoQuality.Maximum = 255;\r
@@ -1119,11 +1116,8 @@ namespace Handbrake
                     SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);\r
                     break;\r
                 case "H.264 (x264)":\r
-                    double divided;\r
-                    CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
-                    double.TryParse(Properties.Settings.Default.x264cqstep.ToString(culture), out divided);\r
-                    rfValue = 51.0 - slider_videoQuality.Value * divided;\r
-                    max = slider_videoQuality.Maximum * divided;\r
+                    rfValue = 51.0 - slider_videoQuality.Value * Properties.Settings.Default.x264cqstep;\r
+                    max = slider_videoQuality.Maximum * Properties.Settings.Default.x264cqstep;\r
                     min = slider_videoQuality.Minimum;\r
                     val = ((max - min) - (rfValue - min)) / (max - min);\r
                     rfValue = Math.Round(rfValue, 2);\r
@@ -1574,6 +1568,7 @@ namespace Handbrake
         }\r
         #endregion\r
 \r
+\r
         // This is the END of the road ****************************************\r
     }\r
 }
\ No newline at end of file
index 3c0a81f..9aeeb00 100644 (file)
@@ -5,6 +5,7 @@
           It may be used under the terms of the GNU General Public License. */\r
 \r
 using System;\r
+using System.Globalization;\r
 using System.Windows.Forms;\r
 using Handbrake.Functions;\r
 \r
@@ -119,7 +120,8 @@ namespace Handbrake
             numeric_updateCheckDays.Value = Properties.Settings.Default.daysBetweenUpdateCheck;\r
 \r
             // x264 step\r
-            drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep.ToString();\r
+            CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");\r
+            drop_x264step.SelectedItem = Properties.Settings.Default.x264cqstep.ToString(culture);\r
 \r
             // Use Experimental dvdnav\r
             if (Properties.Settings.Default.dvdnav)\r