]> granicus.if.org Git - handbrake/commitdiff
WinGui: Fix for the Constant Quality slider when changing the granularity without...
authorsr55 <sr55.hb@outlook.com>
Sun, 27 May 2012 17:19:01 +0000 (17:19 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 27 May 2012 17:19:01 +0000 (17:19 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4706 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs

index 951d8e3ace438f29da1a0e789368252791adfbd8..6f9500e0d36c53861039ed21fc11b046624af002 100644 (file)
@@ -1447,7 +1447,7 @@ namespace HandBrakeWPF.ViewModels
 \r
             // x264 step\r
             this.ConstantQualityGranularity.Clear();\r
-            this.ConstantQualityGranularity.Add("1.0");\r
+            this.ConstantQualityGranularity.Add("1.00");\r
             this.ConstantQualityGranularity.Add("0.50");\r
             this.ConstantQualityGranularity.Add("0.25");\r
             this.ConstantQualityGranularity.Add("0.20");\r
index bf7c76c555b95f9c3b54a2d47ca1e76d364ab3cc..a520bf2028ec82320322e707539f57d4bc2d9c21 100644 (file)
@@ -216,8 +216,11 @@ namespace HandBrakeWPF.ViewModels
             }\r
             set\r
             {\r
-                this.qualityMax = value;\r
-                this.NotifyOfPropertyChange(() => this.QualityMax);\r
+                if (!qualityMax.Equals(value))\r
+                {\r
+                    this.qualityMax = value;\r
+                    this.NotifyOfPropertyChange(() => this.QualityMax);\r
+                }\r
             }\r
         }\r
 \r
@@ -232,8 +235,11 @@ namespace HandBrakeWPF.ViewModels
             }\r
             set\r
             {\r
-                this.qualityMin = value;\r
-                this.NotifyOfPropertyChange(() => this.QualityMin);\r
+                if (!qualityMin.Equals(value))\r
+                {\r
+                    this.qualityMin = value;\r
+                    this.NotifyOfPropertyChange(() => this.QualityMin);\r
+                }\r
             }\r
         }\r
 \r
@@ -251,6 +257,7 @@ namespace HandBrakeWPF.ViewModels
                 this.rf = value;\r
 \r
                 double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);\r
+                this.SetQualitySliderBounds(); \r
                 switch (this.SelectedVideoEncoder)\r
                 {\r
                     case VideoEncoder.FFMpeg:\r
@@ -344,23 +351,8 @@ namespace HandBrakeWPF.ViewModels
                 IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();\r
                 advancedViewModel.SetEncoder(this.Task.VideoEncoder);\r
 \r
-                // Update the Quality Slider\r
-                switch (this.SelectedVideoEncoder)\r
-                {\r
-                    case VideoEncoder.FFMpeg:\r
-                    case VideoEncoder.FFMpeg2:\r
-                        this.QualityMin = 1;\r
-                        this.QualityMax = 31;\r
-                        break;\r
-                    case VideoEncoder.X264:\r
-                        this.QualityMin = 0;\r
-                        this.QualityMax = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));\r
-                        break;\r
-                    case VideoEncoder.Theora:\r
-                        this.QualityMin = 0;\r
-                        this.QualityMax = 63;\r
-                        break;\r
-                }\r
+                // Update the Quality Slider. Make sure the bounds are up to date with the users settings.\r
+                this.SetQualitySliderBounds();\r
             }\r
         }\r
 \r
@@ -448,6 +440,7 @@ namespace HandBrakeWPF.ViewModels
 \r
             double cqStep = userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step);\r
             double rfValue = 0;\r
+            this.SetQualitySliderBounds();\r
             switch (this.SelectedVideoEncoder)\r
             {\r
                 case VideoEncoder.FFMpeg:\r
@@ -523,6 +516,31 @@ namespace HandBrakeWPF.ViewModels
 \r
         #endregion\r
 \r
+        /// <summary>\r
+        /// Set the bounds of the Constant Quality Slider\r
+        /// </summary>\r
+        private void SetQualitySliderBounds()\r
+        {\r
+            // Note Updating bounds to the same values won't trigger an update.\r
+            // The properties are smart enough to not take in equal values.\r
+            switch (this.SelectedVideoEncoder)\r
+            {\r
+                case VideoEncoder.FFMpeg:\r
+                case VideoEncoder.FFMpeg2:\r
+                    this.QualityMin = 1;\r
+                    this.QualityMax = 31;\r
+                    break;\r
+                case VideoEncoder.X264:\r
+                    this.QualityMin = 0;\r
+                    this.QualityMax = (int)(51 / userSettingService.GetUserSetting<double>(ASUserSettingConstants.X264Step));\r
+                    break;\r
+                case VideoEncoder.Theora:\r
+                    this.QualityMin = 0;\r
+                    this.QualityMax = 63;\r
+                    break;\r
+            }\r
+        }\r
+\r
         #region Advanced\r
         ///// <summary>\r
         ///// Gets or sets State.\r