diff options
author | sr55 <[email protected]> | 2010-01-09 23:23:33 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-01-09 23:23:33 +0000 |
commit | d79226267d254143685d21ad35e5695181fefc4a (patch) | |
tree | d84891a6ef194b45147b3dad75a5d9e6ec0b434e /win/C#/Functions | |
parent | 426d68db20624c9709d89c82375d2569313b6ce7 (diff) |
WinGui:
- Don't try set the quality slider when the preset doesn't use it.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3064 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/PresetLoader.cs | 60 | ||||
-rw-r--r-- | win/C#/Functions/QueryParser.cs | 4 |
2 files changed, 34 insertions, 30 deletions
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index b484b6958..5f0459040 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -155,40 +155,42 @@ namespace Handbrake.Functions // Quality
- mainWindow.radio_cq.Checked = true;
- if (presetQuery.VideoEncoder == "H.264 (x264)")
+ if (presetQuery.VideoQuality != -1)
{
- double cqStep = Properties.Settings.Default.x264cqstep;
- int value;
- double x264step = cqStep;
- double presetValue = presetQuery.VideoQuality;
-
- double x = 51 / x264step;
-
- double calculated = presetValue / x264step;
- calculated = x - calculated;
-
- int.TryParse(calculated.ToString(), out value);
-
- // This will sometimes occur when the preset was generated
- // with a different granularity, so, round and try again.
- if (value == 0)
+ mainWindow.radio_cq.Checked = true;
+ if (presetQuery.VideoEncoder == "H.264 (x264)")
{
- double val = Math.Round(calculated, 0);
- int.TryParse(val.ToString(), out value);
+ double cqStep = Properties.Settings.Default.x264cqstep;
+ int value;
+ double x264step = cqStep;
+ double presetValue = presetQuery.VideoQuality;
+
+ double x = 51/x264step;
+
+ double calculated = presetValue/x264step;
+ calculated = x - calculated;
+
+ int.TryParse(calculated.ToString(), out value);
+
+ // This will sometimes occur when the preset was generated
+ // with a different granularity, so, round and try again.
+ if (value == 0)
+ {
+ double val = Math.Round(calculated, 0);
+ int.TryParse(val.ToString(), out value);
+ }
+ if (value <= mainWindow.slider_videoQuality.Maximum)
+ mainWindow.slider_videoQuality.Value = value;
+ }
+ else
+ {
+ int presetVal;
+ int.TryParse(presetQuery.VideoQuality.ToString(), out presetVal);
+ if (presetVal > mainWindow.slider_videoQuality.Minimum)
+ mainWindow.slider_videoQuality.Value = presetVal;
}
- if (value <= mainWindow.slider_videoQuality.Maximum)
- mainWindow.slider_videoQuality.Value = value;
- }
- else
- {
- int presetVal;
- int.TryParse(presetQuery.VideoQuality.ToString(), out presetVal);
- if (presetVal > mainWindow.slider_videoQuality.Minimum)
- mainWindow.slider_videoQuality.Value = presetVal;
}
-
mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked;
mainWindow.drp_videoFramerate.Text = presetQuery.VideoFramerate;
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 7230ad993..78a73b52b 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -329,7 +329,9 @@ namespace Handbrake.Functions {
float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);
thisQuery.VideoQuality = qConvert;
- }
+ }
+ else
+ thisQuery.VideoQuality = -1;
#endregion
#region Audio Tab
|