summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-05-27 17:19:01 +0000
committersr55 <[email protected]>2012-05-27 17:19:01 +0000
commit0464170f84054a57f6200084f02783e679c1f768 (patch)
treeeba17d76e7d54a5b03347d00bcfe6a0a56201038 /win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
parentf2ffde5fff6540a84bca511a67ad7468c25aab81 (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
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs60
1 files changed, 39 insertions, 21 deletions
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.