]> granicus.if.org Git - handbrake/commitdiff
Make Process Priority a real-time setting. Not per encode instance.
authorScott <sr55.hb@outlook.com>
Sat, 31 Oct 2015 17:40:57 +0000 (17:40 +0000)
committerScott <sr55.hb@outlook.com>
Sat, 31 Oct 2015 17:40:57 +0000 (17:40 +0000)
win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs

index ecb82ba85f87985a9c8150225c5e4caa6825f9ff..7cce56bb5cef5d6c7e9e872c545ae5b245c85787 100644 (file)
@@ -49,11 +49,6 @@ namespace HandBrake.ApplicationServices.Model
         /// </summary>\r
         public int MinScanDuration { get; set; }\r
 \r
-        /// <summary>\r
-        /// Gets or sets the process priority.\r
-        /// </summary>\r
-        public string ProcessPriority { get; set; }\r
-\r
         /// <summary>\r
         /// Gets or sets a value indicating whether save log to copy directory.\r
         /// </summary>\r
index c0ba006334e51485b6c00484a7cb97af0c1a701f..c500ef7b18e8769bf1329d9b3eeae7f6929dc5c5 100644 (file)
@@ -42,7 +42,6 @@ namespace HandBrakeWPF.Factories
                                              PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount), \r
                                              Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity), \r
                                              MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration), \r
-                                             ProcessPriority = UserSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority), \r
                                              SaveLogToCopyDirectory = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory), \r
                                              SaveLogWithVideo = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo), \r
                                              SaveLogCopyDirectory = UserSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory), \r
index 111c91c6e225e0bbf036e8c3e8f4852f49cf467d..4bf64e5e1d919d2fdb86a3c0b9bc00410649351f 100644 (file)
@@ -91,29 +91,6 @@ namespace HandBrakeWPF.Services.Encode
 
                 // Fire the Encode Started Event
                 this.InvokeEncodeStarted(System.EventArgs.Empty);
-
-                // Set the Process Priority
-                switch (configuration.ProcessPriority)
-                {
-                    case "Realtime":
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
-                        break;
-                    case "High":
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
-                        break;
-                    case "Above Normal":
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;
-                        break;
-                    case "Normal":
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;
-                        break;
-                    case "Low":
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;
-                        break;
-                    default:
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
-                        break;
-                }
             }
             catch (Exception exc)
             {
index 8ecb46ae25159b4d5e9fba42714e73c7e6d3a220..69d38f159aefd3840c18ad8d4feb754199046276 100644 (file)
@@ -198,6 +198,29 @@ namespace HandBrakeWPF.ViewModels
             this.Presets = this.presetService.Presets;\r
             this.Drives = new BindingList<SourceMenuItem>();\r
 \r
+            // Set Process Priority\r
+            switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority))\r
+            {\r
+                case "Realtime":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;\r
+                    break;\r
+                case "High":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;\r
+                    break;\r
+                case "Above Normal":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;\r
+                    break;\r
+                case "Normal":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;\r
+                    break;\r
+                case "Low":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;\r
+                    break;\r
+                default:\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;\r
+                    break;\r
+            }\r
+\r
             HandBrakeInstanceManager.Init();\r
         }\r
 \r
index 4d7ea3a80e08d58eaa4b6852f97acaeb6ab35caf..3e37a8a852b952346ba57c3bbadc65bfec85583d 100644 (file)
@@ -633,7 +633,30 @@ namespace HandBrakeWPF.ViewModels
             set\r
             {\r
                 this.selectedPriority = value;\r
-                this.NotifyOfPropertyChange("SelectedPriority");\r
+                this.NotifyOfPropertyChange();\r
+\r
+                // Set the Process Priority\r
+                switch (value)\r
+                {\r
+                    case "Realtime":\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;\r
+                        break;\r
+                    case "High":\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;\r
+                        break;\r
+                    case "Above Normal":\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;\r
+                        break;\r
+                    case "Normal":\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;\r
+                        break;\r
+                    case "Low":\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;\r
+                        break;\r
+                    default:\r
+                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;\r
+                        break;\r
+                }\r
             }\r
         }\r
         #endregion\r