summaryrefslogtreecommitdiffstats
path: root/win/C#
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-08-29 21:08:50 +0000
committersr55 <[email protected]>2009-08-29 21:08:50 +0000
commit70a9464be721381abbd87792abeffe5a57f5f33e (patch)
treed6b8d2eaf0e131b6786879dd990f117a5d25f52d /win/C#
parentfab46b2a994d8d60980e5474ee8a7ede5e0742ca (diff)
WinGui:
- 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://svn.handbrake.fr/HandBrake/trunk@2791 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#')
-rw-r--r--win/C#/Changelog.html2
-rw-r--r--win/C#/Functions/PresetLoader.cs4
-rw-r--r--win/C#/Functions/QueryGenerator.cs4
-rw-r--r--win/C#/Properties/Settings.Designer.cs4
-rw-r--r--win/C#/Properties/Settings.settings2
-rw-r--r--win/C#/frmMain.Designer.cs104
-rw-r--r--win/C#/frmMain.cs29
-rw-r--r--win/C#/frmOptions.cs27
8 files changed, 90 insertions, 86 deletions
diff --git a/win/C#/Changelog.html b/win/C#/Changelog.html
index 9be2005ed..408583fe8 100644
--- a/win/C#/Changelog.html
+++ b/win/C#/Changelog.html
@@ -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 />
- Fix issue with the destination File box double appending the file extension<br />
- Fix issue changing file format causing the audio encoder dropdown to be set to ""<br />
- - Fixed an issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />
+ - Fix an issue with autoName function and format dropdown with regards to AC3 in the audio list. Also, CC or SRT<br />
<h4>Backend / Not important changes</h4>
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index 90f16f658..fae48ee46 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -151,8 +151,7 @@ namespace Handbrake.Functions
mainWindow.radio_cq.Checked = true;
if (presetQuery.VideoEncoder == "H.264 (x264)")
{
- double cqStep;
- double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);
+ double cqStep = Properties.Settings.Default.x264cqstep;
int value;
double x264step = cqStep;
double presetValue = presetQuery.VideoQuality;
@@ -184,7 +183,6 @@ namespace Handbrake.Functions
mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked;
-
mainWindow.drp_videoFramerate.Text = presetQuery.VideoFramerate;
mainWindow.check_turbo.CheckState = presetQuery.TurboFirstPass ? CheckState.Checked : CheckState.Unchecked;
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index 58e59cd70..4d0033415 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -192,9 +192,7 @@ namespace Handbrake.Functions
// Video Quality Setting
if (mainWindow.radio_cq.Checked)
{
- double cqStep;
- double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);
-
+ double cqStep = Properties.Settings.Default.x264cqstep;
double value;
switch (mainWindow.drp_videoEncoder.Text)
{
diff --git a/win/C#/Properties/Settings.Designer.cs b/win/C#/Properties/Settings.Designer.cs
index c60c8da1b..86c2c76d0 100644
--- a/win/C#/Properties/Settings.Designer.cs
+++ b/win/C#/Properties/Settings.Designer.cs
@@ -302,9 +302,9 @@ namespace Handbrake.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0.25")]
- public string x264cqstep {
+ public double x264cqstep {
get {
- return ((string)(this["x264cqstep"]));
+ return ((double)(this["x264cqstep"]));
}
set {
this["x264cqstep"] = value;
diff --git a/win/C#/Properties/Settings.settings b/win/C#/Properties/Settings.settings
index 5c3d4d3b3..f88c3e3d7 100644
--- a/win/C#/Properties/Settings.settings
+++ b/win/C#/Properties/Settings.settings
@@ -71,7 +71,7 @@
<Setting Name="QueryEditorTab" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
- <Setting Name="x264cqstep" Type="System.String" Scope="User">
+ <Setting Name="x264cqstep" Type="System.Double" Scope="User">
<Value Profile="(Default)">0.25</Value>
</Setting>
<Setting Name="verboseLevel" Type="System.Int32" Scope="User">
diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs
index 8e73a3fbb..b98355165 100644
--- a/win/C#/frmMain.Designer.cs
+++ b/win/C#/frmMain.Designer.cs
@@ -99,6 +99,7 @@ namespace Handbrake
this.Label47 = new System.Windows.Forms.Label();
this.Label3 = new System.Windows.Forms.Label();
this.tab_audio = new System.Windows.Forms.TabPage();
+ this.AudioSettings = new Handbrake.Controls.AudioPanel();
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);
this.tab_video = new System.Windows.Forms.TabPage();
this.radio_cq = new System.Windows.Forms.RadioButton();
@@ -110,14 +111,18 @@ namespace Handbrake
this.SliderValue = new System.Windows.Forms.Label();
this.Label46 = new System.Windows.Forms.Label();
this.tab_picture = new System.Windows.Forms.TabPage();
+ this.PictureSettings = new Handbrake.Controls.PictureSettings();
this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();
this.tabs_panel = new System.Windows.Forms.TabControl();
this.tab_filters = new System.Windows.Forms.TabPage();
+ this.Filters = new Handbrake.Controls.Filters();
this.tab_subtitles = new System.Windows.Forms.TabPage();
+ this.Subtitles = new Handbrake.Controls.Subtitles();
this.tab_chapters = new System.Windows.Forms.TabPage();
this.btn_importChapters = new System.Windows.Forms.Button();
this.label31 = new System.Windows.Forms.Label();
this.tab_advanced = new System.Windows.Forms.TabPage();
+ this.x264Panel = new Handbrake.Controls.x264Panel();
this.tab_query = new System.Windows.Forms.TabPage();
this.btn_clear = new System.Windows.Forms.Button();
this.label34 = new System.Windows.Forms.Label();
@@ -171,11 +176,6 @@ namespace Handbrake
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.openPreset = new System.Windows.Forms.OpenFileDialog();
this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();
- this.PictureSettings = new Handbrake.Controls.PictureSettings();
- this.Filters = new Handbrake.Controls.Filters();
- this.AudioSettings = new Handbrake.Controls.AudioPanel();
- this.Subtitles = new Handbrake.Controls.Subtitles();
- this.x264Panel = new Handbrake.Controls.x264Panel();
notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
notifyIconMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();
@@ -784,6 +784,15 @@ namespace Handbrake
this.tab_audio.Text = "Audio";
this.tab_audio.UseVisualStyleBackColor = true;
//
+ // AudioSettings
+ //
+ this.AudioSettings.BackColor = System.Drawing.Color.Transparent;
+ this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.AudioSettings.Location = new System.Drawing.Point(0, 0);
+ this.AudioSettings.Name = "AudioSettings";
+ this.AudioSettings.Size = new System.Drawing.Size(715, 310);
+ this.AudioSettings.TabIndex = 0;
+ //
// AudioMenuRowHeightHack
//
this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
@@ -920,6 +929,16 @@ namespace Handbrake
this.tab_picture.Text = "Picture";
this.tab_picture.UseVisualStyleBackColor = true;
//
+ // PictureSettings
+ //
+ this.PictureSettings.BackColor = System.Drawing.Color.Transparent;
+ this.PictureSettings.Enabled = false;
+ this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.PictureSettings.Location = new System.Drawing.Point(0, 0);
+ this.PictureSettings.Name = "PictureSettings";
+ this.PictureSettings.Size = new System.Drawing.Size(666, 279);
+ this.PictureSettings.TabIndex = 0;
+ //
// Check_ChapterMarkers
//
this.Check_ChapterMarkers.AutoSize = true;
@@ -959,6 +978,15 @@ namespace Handbrake
this.tab_filters.Text = "Video Filters";
this.tab_filters.UseVisualStyleBackColor = true;
//
+ // Filters
+ //
+ this.Filters.BackColor = System.Drawing.Color.Transparent;
+ this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Filters.Location = new System.Drawing.Point(0, 0);
+ this.Filters.Name = "Filters";
+ this.Filters.Size = new System.Drawing.Size(713, 310);
+ this.Filters.TabIndex = 0;
+ //
// tab_subtitles
//
this.tab_subtitles.Controls.Add(this.Subtitles);
@@ -970,6 +998,15 @@ namespace Handbrake
this.tab_subtitles.Text = "Subtitles";
this.tab_subtitles.UseVisualStyleBackColor = true;
//
+ // Subtitles
+ //
+ this.Subtitles.BackColor = System.Drawing.Color.Transparent;
+ this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Subtitles.Location = new System.Drawing.Point(0, 0);
+ this.Subtitles.Name = "Subtitles";
+ this.Subtitles.Size = new System.Drawing.Size(722, 310);
+ this.Subtitles.TabIndex = 0;
+ //
// tab_chapters
//
this.tab_chapters.BackColor = System.Drawing.Color.Transparent;
@@ -1020,6 +1057,16 @@ namespace Handbrake
this.tab_advanced.Text = "Advanced";
this.tab_advanced.UseVisualStyleBackColor = true;
//
+ // x264Panel
+ //
+ this.x264Panel.BackColor = System.Drawing.Color.Transparent;
+ this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.x264Panel.Location = new System.Drawing.Point(0, 0);
+ this.x264Panel.Name = "x264Panel";
+ this.x264Panel.Size = new System.Drawing.Size(720, 306);
+ this.x264Panel.TabIndex = 0;
+ this.x264Panel.x264Query = "";
+ //
// tab_query
//
this.tab_query.Controls.Add(this.btn_clear);
@@ -1593,53 +1640,6 @@ namespace Handbrake
//
this.File_ChapterImport.Filter = "CSV Files|*.csv";
//
- // PictureSettings
- //
- this.PictureSettings.BackColor = System.Drawing.Color.Transparent;
- this.PictureSettings.Enabled = false;
- this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.PictureSettings.Location = new System.Drawing.Point(0, 0);
- this.PictureSettings.Name = "PictureSettings";
- this.PictureSettings.Size = new System.Drawing.Size(666, 279);
- this.PictureSettings.TabIndex = 0;
- //
- // Filters
- //
- this.Filters.BackColor = System.Drawing.Color.Transparent;
- this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.Filters.Location = new System.Drawing.Point(0, 0);
- this.Filters.Name = "Filters";
- this.Filters.Size = new System.Drawing.Size(713, 310);
- this.Filters.TabIndex = 0;
- //
- // AudioSettings
- //
- this.AudioSettings.BackColor = System.Drawing.Color.Transparent;
- this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.AudioSettings.Location = new System.Drawing.Point(0, 0);
- this.AudioSettings.Name = "AudioSettings";
- this.AudioSettings.Size = new System.Drawing.Size(715, 310);
- this.AudioSettings.TabIndex = 0;
- //
- // Subtitles
- //
- this.Subtitles.BackColor = System.Drawing.Color.Transparent;
- this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.Subtitles.Location = new System.Drawing.Point(0, 0);
- this.Subtitles.Name = "Subtitles";
- this.Subtitles.Size = new System.Drawing.Size(722, 310);
- this.Subtitles.TabIndex = 0;
- //
- // x264Panel
- //
- this.x264Panel.BackColor = System.Drawing.Color.Transparent;
- this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.x264Panel.Location = new System.Drawing.Point(0, 0);
- this.x264Panel.Name = "x264Panel";
- this.x264Panel.Size = new System.Drawing.Size(720, 306);
- this.x264Panel.TabIndex = 0;
- this.x264Panel.x264Query = "";
- //
// frmMain
//
this.AllowDrop = true;
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs
index 662491551..9dd44d215 100644
--- a/win/C#/frmMain.cs
+++ b/win/C#/frmMain.cs
@@ -1169,8 +1169,7 @@ namespace Handbrake
slider_videoQuality.TickFrequency = 1;
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
- double cqStep;
- double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);
+ double cqStep = Properties.Settings.Default.x264cqstep;
double multiplier = 1.0 / cqStep;
double value = slider_videoQuality.Value * multiplier;
@@ -1225,31 +1224,29 @@ namespace Handbrake
check_iPodAtom.Checked = false;
}
}
- private string _cachedCqStep = Properties.Settings.Default.x264cqstep;
+ private double _cachedCqStep = Properties.Settings.Default.x264cqstep;
/// <summary>
/// Update the CQ slider for x264 for a new CQ step. This is set from option
/// </summary>
public void setQualityFromSlider()
{
// Work out the current RF value.
- double cqStep;
- double.TryParse(_cachedCqStep, out cqStep);
+ double cqStep = _cachedCqStep;
double rfValue = 51.0 - slider_videoQuality.Value * cqStep;
// Change the maximum value for the slider
- CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
- switch (Properties.Settings.Default.x264cqstep.ToString(culture))
+ switch (Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US")))
{
- case "0.20":
+ case "0.2":
slider_videoQuality.Maximum = 255;
break;
case "0.25":
slider_videoQuality.Maximum = 204;
break;
- case "0.50":
+ case "0.5":
slider_videoQuality.Maximum = 102;
break;
- case "1.0":
+ case "1":
slider_videoQuality.Maximum = 51;
break;
default:
@@ -1261,8 +1258,7 @@ namespace Handbrake
slider_videoQuality.Value = slider_videoQuality.Maximum;
// Reset the CQ slider back to the previous value as close as possible
- double cqStepNew;
- double.TryParse(Properties.Settings.Default.x264cqstep, out cqStepNew);
+ double cqStepNew = Properties.Settings.Default.x264cqstep;
double rfValueCurrent = 51.0 - slider_videoQuality.Value * cqStepNew;
while (rfValueCurrent < rfValue)
{
@@ -1275,8 +1271,7 @@ namespace Handbrake
}
private void slider_videoQuality_Scroll(object sender, EventArgs e)
{
- double cqStep;
- double.TryParse(Properties.Settings.Default.x264cqstep, out cqStep);
+ double cqStep = Properties.Settings.Default.x264cqstep;
switch (drp_videoEncoder.Text)
{
case "MPEG-4 (FFmpeg)":
@@ -1284,7 +1279,7 @@ namespace Handbrake
double max = slider_videoQuality.Maximum;
double min = slider_videoQuality.Minimum;
double val = ((max - min) - (rfValue - min)) / (max - min);
- SliderValue.Text = Math.Round((val * 100), 2) + "% QP:" + (32 - slider_videoQuality.Value);
+ SliderValue.Text = Math.Round((val * 100), 2).ToString(new CultureInfo("en-US")) + "% QP:" + (32 - slider_videoQuality.Value);
break;
case "H.264 (x264)":
rfValue = 51.0 - slider_videoQuality.Value * cqStep;
@@ -1292,12 +1287,12 @@ namespace Handbrake
min = slider_videoQuality.Minimum;
val = ((max - min) - (rfValue - min)) / (max - min);
rfValue = Math.Round(rfValue, 2);
- SliderValue.Text = Math.Round((val * 100), 2) + "% RF:" + rfValue;
+ SliderValue.Text = Math.Round((val * 100), 2).ToString(new CultureInfo("en-US")) + "% RF:" + rfValue.ToString(new CultureInfo("en-US"));
break;
case "VP3 (Theora)":
rfValue = slider_videoQuality.Value;
double value = rfValue / 63;
- SliderValue.Text = Math.Round((value * 100), 2) + "% QP:" + slider_videoQuality.Value;
+ SliderValue.Text = Math.Round((value * 100), 2).ToString(new CultureInfo("en-US")) + "% QP:" + slider_videoQuality.Value;
break;
}
}
diff --git a/win/C#/frmOptions.cs b/win/C#/frmOptions.cs
index 462bdb8c4..ce281e9f1 100644
--- a/win/C#/frmOptions.cs
+++ b/win/C#/frmOptions.cs
@@ -165,9 +165,22 @@ namespace Handbrake
}
// x264 step
- CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
- string test = Properties.Settings.Default.x264cqstep.ToString(culture);
- drop_x264step.SelectedItem = test;
+ string step = Properties.Settings.Default.x264cqstep.ToString(new CultureInfo("en-US"));
+ switch (step)
+ {
+ case "1":
+ drop_x264step.SelectedIndex = 0;
+ break;
+ case "0.5":
+ drop_x264step.SelectedIndex = 1;
+ break;
+ case "0.25":
+ drop_x264step.SelectedIndex = 2;
+ break;
+ case "0.2":
+ drop_x264step.SelectedIndex = 3;
+ break;
+ }
// Use Experimental dvdnav
if (Properties.Settings.Default.dvdnav)
@@ -398,16 +411,16 @@ namespace Handbrake
switch (drop_x264step.SelectedIndex)
{
case 0:
- Properties.Settings.Default.x264cqstep = "1.0";
+ Properties.Settings.Default.x264cqstep = 1.0;
break;
case 1:
- Properties.Settings.Default.x264cqstep = "0.50";
+ Properties.Settings.Default.x264cqstep = 0.50;
break;
case 2:
- Properties.Settings.Default.x264cqstep = "0.25";
+ Properties.Settings.Default.x264cqstep = 0.25;
break;
case 3:
- Properties.Settings.Default.x264cqstep = "0.20";
+ Properties.Settings.Default.x264cqstep = 0.20;
break;
}
mainWindow.setQualityFromSlider();