diff options
author | sr55 <[email protected]> | 2012-05-27 17:19:01 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-05-27 17:19:01 +0000 |
commit | 0464170f84054a57f6200084f02783e679c1f768 (patch) | |
tree | eba17d76e7d54a5b03347d00bcfe6a0a56201038 | |
parent | f2ffde5fff6540a84bca511a67ad7468c25aab81 (diff) |
WinGui: Fix for the Constant Quality slider when changing the granularity without restarting the app.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4706 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 60 |
2 files changed, 40 insertions, 22 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 951d8e3ac..6f9500e0d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1447,7 +1447,7 @@ namespace HandBrakeWPF.ViewModels // x264 step
this.ConstantQualityGranularity.Clear();
- this.ConstantQualityGranularity.Add("1.0");
+ this.ConstantQualityGranularity.Add("1.00");
this.ConstantQualityGranularity.Add("0.50");
this.ConstantQualityGranularity.Add("0.25");
this.ConstantQualityGranularity.Add("0.20");
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index bf7c76c55..a520bf202 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -216,8 +216,11 @@ namespace HandBrakeWPF.ViewModels }
set
{
- this.qualityMax = value;
- this.NotifyOfPropertyChange(() => this.QualityMax);
+ if (!qualityMax.Equals(value))
+ {
+ this.qualityMax = value;
+ this.NotifyOfPropertyChange(() => this.QualityMax);
+ }
}
}
@@ -232,8 +235,11 @@ namespace HandBrakeWPF.ViewModels }
set
{
- this.qualityMin = value;
- this.NotifyOfPropertyChange(() => this.QualityMin);
+ if (!qualityMin.Equals(value))
+ {
+ this.qualityMin = value;
+ this.NotifyOfPropertyChange(() => this.QualityMin);
+ }
}
}
@@ -251,6 +257,7 @@ namespace HandBrakeWPF.ViewModels this.rf = value;
double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
+ this.SetQualitySliderBounds();
switch (this.SelectedVideoEncoder)
{
case VideoEncoder.FFMpeg:
@@ -344,23 +351,8 @@ namespace HandBrakeWPF.ViewModels IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
advancedViewModel.SetEncoder(this.Task.VideoEncoder);
- // Update the Quality Slider
- switch (this.SelectedVideoEncoder)
- {
- case VideoEncoder.FFMpeg:
- case VideoEncoder.FFMpeg2:
- this.QualityMin = 1;
- this.QualityMax = 31;
- break;
- case VideoEncoder.X264:
- this.QualityMin = 0;
- this.QualityMax = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));
- break;
- case VideoEncoder.Theora:
- this.QualityMin = 0;
- this.QualityMax = 63;
- break;
- }
+ // Update the Quality Slider. Make sure the bounds are up to date with the users settings.
+ this.SetQualitySliderBounds();
}
}
@@ -448,6 +440,7 @@ namespace HandBrakeWPF.ViewModels double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);
double rfValue = 0;
+ this.SetQualitySliderBounds();
switch (this.SelectedVideoEncoder)
{
case VideoEncoder.FFMpeg:
@@ -523,6 +516,31 @@ namespace HandBrakeWPF.ViewModels #endregion
+ /// <summary>
+ /// Set the bounds of the Constant Quality Slider
+ /// </summary>
+ private void SetQualitySliderBounds()
+ {
+ // Note Updating bounds to the same values won't trigger an update.
+ // The properties are smart enough to not take in equal values.
+ switch (this.SelectedVideoEncoder)
+ {
+ case VideoEncoder.FFMpeg:
+ case VideoEncoder.FFMpeg2:
+ this.QualityMin = 1;
+ this.QualityMax = 31;
+ break;
+ case VideoEncoder.X264:
+ this.QualityMin = 0;
+ this.QualityMax = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));
+ break;
+ case VideoEncoder.Theora:
+ this.QualityMin = 0;
+ this.QualityMax = 63;
+ break;
+ }
+ }
+
#region Advanced
///// <summary>
///// Gets or sets State.
|