From 9cc5c63d8d1d72240a50dd12f9c5f367b6321983 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 9 Apr 2011 11:35:43 +0000 Subject: WinGui: - Fix a culture issue with user settings (x264) - Made the Preset loader more strict with what settings it can and can't load with regards to video settings. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3916 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Functions/PresetLoader.cs | 23 ++++++++++------------ .../Model/EncodeTask.cs | 2 +- .../Utilities/QueryGeneratorUtility.cs | 10 +++++----- win/CS/frmMain.Designer.cs | 8 ++++---- win/CS/frmMain.resx | 21 +++++++++++--------- win/CS/frmOptions.Designer.cs | 14 ++++++------- win/CS/frmOptions.cs | 2 +- 7 files changed, 40 insertions(+), 40 deletions(-) (limited to 'win/CS') diff --git a/win/CS/Functions/PresetLoader.cs b/win/CS/Functions/PresetLoader.cs index 7b36ab92f..78965f1f9 100644 --- a/win/CS/Functions/PresetLoader.cs +++ b/win/CS/Functions/PresetLoader.cs @@ -206,21 +206,21 @@ namespace Handbrake.Functions break; } - if (presetQuery.VideoBitrate != null) - { - mainWindow.radio_avgBitrate.Checked = true; - mainWindow.text_bitrate.Text = presetQuery.VideoBitrate.ToString(); - } - // Quality if (presetQuery.Quality != null) { mainWindow.radio_cq.Checked = true; - mainWindow.slider_videoQuality.Value = QualityToSliderValue( - presetQuery.VideoEncoder, presetQuery.Quality); + mainWindow.slider_videoQuality.Value = QualityToSliderValue(presetQuery.VideoEncoder, presetQuery.Quality); + mainWindow.check_2PassEncode.CheckState = CheckState.Unchecked; + mainWindow.check_turbo.CheckState = CheckState.Unchecked; } - - mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked; + else if (presetQuery.VideoBitrate != null) + { + mainWindow.radio_avgBitrate.Checked = true; + mainWindow.text_bitrate.Text = presetQuery.VideoBitrate.ToString(); + mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked; + mainWindow.check_turbo.CheckState = presetQuery.TurboFirstPass ? CheckState.Checked : CheckState.Unchecked; + } if (presetQuery.Framerate != null) { @@ -235,7 +235,6 @@ namespace Handbrake.Functions if (presetQuery.Framerate != null) { // Constant or Peak Framerate for a set framerate. - if (presetQuery.FramerateMode == FramerateMode.CFR) mainWindow.radio_constantFramerate.Checked = true; else @@ -250,8 +249,6 @@ namespace Handbrake.Functions mainWindow.radio_peakAndVariable.Checked = true; } - mainWindow.check_turbo.CheckState = presetQuery.TurboFirstPass ? CheckState.Checked : CheckState.Unchecked; - #endregion #region Chapter Markers diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 8dfb5d031..1c1e2ef60 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -222,7 +222,7 @@ namespace HandBrake.ApplicationServices.Model /// /// Gets or sets Quality. /// - public double Quality { get; set; } + public double? Quality { get; set; } /// /// Gets or sets VideoBitrate. diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index bd75880b9..87496dfbc 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -298,26 +298,26 @@ namespace HandBrake.ApplicationServices.Utilities switch (task.VideoEncodeRateType) { - case VideoEncodeRateMode.ConstantQuality: + case VideoEncodeRateMode.AverageBitrate: if (task.VideoBitrate.HasValue) query += string.Format(" -b {0}", task.VideoBitrate.Value); break; - case VideoEncodeRateMode.AverageBitrate: + case VideoEncodeRateMode.ConstantQuality: double value; switch (task.VideoEncoder) { case VideoEncoder.FFMpeg: - value = 31 - (task.Quality - 1); + value = 31 - (task.Quality.Value - 1); query += string.Format(" -q {0}", value.ToString(new CultureInfo("en-US"))); break; case VideoEncoder.X264: CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); - value = 51 - (task.Quality * x264CqStep); + value = 51 - (task.Quality.Value * x264CqStep); value = Math.Round(value, 2); query += string.Format(" -q {0}", value.ToString(culture)); break; case VideoEncoder.Theora: - value = task.Quality; + value = task.Quality.Value; query += string.Format(" -q {0}", value.ToString(new CultureInfo("en-US"))); break; } diff --git a/win/CS/frmMain.Designer.cs b/win/CS/frmMain.Designer.cs index 1171afa78..87d409318 100644 --- a/win/CS/frmMain.Designer.cs +++ b/win/CS/frmMain.Designer.cs @@ -39,7 +39,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container(); System.Windows.Forms.ContextMenuStrip notifyIconMenu; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.btn_restore = new System.Windows.Forms.ToolStripMenuItem(); this.DVD_Save = new System.Windows.Forms.SaveFileDialog(); this.ToolTip = new System.Windows.Forms.ToolTip(this.components); @@ -386,9 +386,9 @@ namespace Handbrake // // number // - dataGridViewCellStyle1.Format = "N0"; - dataGridViewCellStyle1.NullValue = null; - this.number.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Format = "N0"; + dataGridViewCellStyle2.NullValue = null; + this.number.DefaultCellStyle = dataGridViewCellStyle2; this.number.Frozen = true; this.number.HeaderText = "Chapter Number"; this.number.MaxInputLength = 3; diff --git a/win/CS/frmMain.resx b/win/CS/frmMain.resx index a737bb095..9ec365918 100644 --- a/win/CS/frmMain.resx +++ b/win/CS/frmMain.resx @@ -640,6 +640,18 @@ Clear the text box below to return to the internal query generation. 98 + + 664, 15 + + + 310, 54 + + + 423, 54 + + + 98 + AAABAAYAMDAAAAEACACoDgAAZgAAACAgAAABAAgAqAgAAA4PAAAQEAAAAQAIAGgFAAC2FwAAMDAAAAEA @@ -1019,13 +1031,4 @@ Clear the text box below to return to the internal query generation. AAD6AQAA4AEAAMABAACAAQAAgAEAAMBBAADAYQAAjGEAAIRhAADc+wAA3/8AAA== - - 664, 15 - - - 310, 54 - - - 423, 54 - \ No newline at end of file diff --git a/win/CS/frmOptions.Designer.cs b/win/CS/frmOptions.Designer.cs index 7fefefbd3..60cf8fe22 100644 --- a/win/CS/frmOptions.Designer.cs +++ b/win/CS/frmOptions.Designer.cs @@ -892,7 +892,7 @@ namespace Handbrake this.check_showCliForInGUIEncode.BackColor = System.Drawing.Color.Transparent; this.check_showCliForInGUIEncode.Location = new System.Drawing.Point(81, 129); this.check_showCliForInGUIEncode.Name = "check_showCliForInGUIEncode"; - this.check_showCliForInGUIEncode.Size = new System.Drawing.Size(324, 17); + this.check_showCliForInGUIEncode.Size = new System.Drawing.Size(330, 17); this.check_showCliForInGUIEncode.TabIndex = 96; this.check_showCliForInGUIEncode.Text = "Show CLI window (Allows you to cleanly exit encode with ctrl-c)"; this.ToolTip.SetToolTip(this.check_showCliForInGUIEncode, resources.GetString("check_showCliForInGUIEncode.ToolTip")); @@ -946,7 +946,7 @@ namespace Handbrake this.check_trayStatusAlerts.BackColor = System.Drawing.Color.Transparent; this.check_trayStatusAlerts.Location = new System.Drawing.Point(81, 37); this.check_trayStatusAlerts.Name = "check_trayStatusAlerts"; - this.check_trayStatusAlerts.Size = new System.Drawing.Size(288, 17); + this.check_trayStatusAlerts.Size = new System.Drawing.Size(296, 17); this.check_trayStatusAlerts.TabIndex = 93; this.check_trayStatusAlerts.Text = "Display status messages from tray icon (balloon popups)"; this.ToolTip.SetToolTip(this.check_trayStatusAlerts, "Minimize the window to the system tray rather than the task bar.\r\nThe system tray" + @@ -962,7 +962,7 @@ namespace Handbrake this.check_mainMinimize.BackColor = System.Drawing.Color.Transparent; this.check_mainMinimize.Location = new System.Drawing.Point(81, 14); this.check_mainMinimize.Name = "check_mainMinimize"; - this.check_mainMinimize.Size = new System.Drawing.Size(221, 17); + this.check_mainMinimize.Size = new System.Drawing.Size(230, 17); this.check_mainMinimize.TabIndex = 82; this.check_mainMinimize.Text = "Minimize to system tray (Requires Restart)"; this.ToolTip.SetToolTip(this.check_mainMinimize, "Minimize the window to the system tray rather than the task bar.\r\nThe system tray" + @@ -976,7 +976,7 @@ namespace Handbrake this.check_promptOnUnmatchingQueries.AutoSize = true; this.check_promptOnUnmatchingQueries.Location = new System.Drawing.Point(100, 83); this.check_promptOnUnmatchingQueries.Name = "check_promptOnUnmatchingQueries"; - this.check_promptOnUnmatchingQueries.Size = new System.Drawing.Size(300, 17); + this.check_promptOnUnmatchingQueries.Size = new System.Drawing.Size(305, 17); this.check_promptOnUnmatchingQueries.TabIndex = 63; this.check_promptOnUnmatchingQueries.Text = "Prompt when a manual query does not match GUI settings"; this.check_promptOnUnmatchingQueries.UseVisualStyleBackColor = true; @@ -989,7 +989,7 @@ namespace Handbrake this.check_dvdnav.BackColor = System.Drawing.Color.Transparent; this.check_dvdnav.Location = new System.Drawing.Point(82, 247); this.check_dvdnav.Name = "check_dvdnav"; - this.check_dvdnav.Size = new System.Drawing.Size(277, 17); + this.check_dvdnav.Size = new System.Drawing.Size(276, 17); this.check_dvdnav.TabIndex = 90; this.check_dvdnav.Text = "Disable LibDVDNav. (libdvdread will be used instead)"; this.check_dvdnav.UseVisualStyleBackColor = false; @@ -1002,7 +1002,7 @@ namespace Handbrake this.check_queryEditorTab.BackColor = System.Drawing.Color.Transparent; this.check_queryEditorTab.Location = new System.Drawing.Point(81, 60); this.check_queryEditorTab.Name = "check_queryEditorTab"; - this.check_queryEditorTab.Size = new System.Drawing.Size(236, 17); + this.check_queryEditorTab.Size = new System.Drawing.Size(241, 17); this.check_queryEditorTab.TabIndex = 84; this.check_queryEditorTab.Text = "Enable \"Query Editor\" tab (Requires Restart)"; this.ToolTip.SetToolTip(this.check_queryEditorTab, "Enables the Query Editor tab on the main window. Requires program restart to take" + @@ -1054,7 +1054,7 @@ namespace Handbrake this.check_disablePresetNotification.BackColor = System.Drawing.Color.Transparent; this.check_disablePresetNotification.Location = new System.Drawing.Point(81, 106); this.check_disablePresetNotification.Name = "check_disablePresetNotification"; - this.check_disablePresetNotification.Size = new System.Drawing.Size(216, 17); + this.check_disablePresetNotification.Size = new System.Drawing.Size(222, 17); this.check_disablePresetNotification.TabIndex = 91; this.check_disablePresetNotification.Text = "Disable built-in preset update notification"; this.ToolTip.SetToolTip(this.check_disablePresetNotification, "Disables the notification you recieve when presets are updated when a new version" + diff --git a/win/CS/frmOptions.cs b/win/CS/frmOptions.cs index 24dc6c30f..e5d3da2e8 100644 --- a/win/CS/frmOptions.cs +++ b/win/CS/frmOptions.cs @@ -181,7 +181,7 @@ namespace Handbrake drop_previewScanCount.SelectedItem = Properties.Settings.Default.previewScanCount.ToString(); // x264 step - string step = userSettingService.GetUserSettingString(UserSettingConstants.X264Step).ToString(new CultureInfo("en-US")); + string step = userSettingService.GetUserSettingDouble(UserSettingConstants.X264Step).ToString(new CultureInfo("en-US")); switch (step) { case "1": -- cgit v1.2.3