diff options
author | Scott <[email protected]> | 2015-10-31 17:40:57 +0000 |
---|---|---|
committer | Scott <[email protected]> | 2015-10-31 17:40:57 +0000 |
commit | e0f9ebd0b84ed438e6b11966867c07d29a07d78c (patch) | |
tree | 7b159a7ec658a1948b29fa487fb474c9fd86a45d /win/CS | |
parent | 19f3dc6e8f6f8ee25ef99526276d400753aaa0a7 (diff) |
Make Process Priority a real-time setting. Not per encode instance.
Diffstat (limited to 'win/CS')
5 files changed, 47 insertions, 30 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs index ecb82ba85..7cce56bb5 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs @@ -50,11 +50,6 @@ namespace HandBrake.ApplicationServices.Model public int MinScanDuration { get; set; }
/// <summary>
- /// Gets or sets the process priority.
- /// </summary>
- public string ProcessPriority { get; set; }
-
- /// <summary>
/// Gets or sets a value indicating whether save log to copy directory.
/// </summary>
public bool SaveLogToCopyDirectory { get; set; }
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs index c0ba00633..c500ef7b1 100644 --- a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs +++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs @@ -42,7 +42,6 @@ namespace HandBrakeWPF.Factories PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount),
Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity),
MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration),
- ProcessPriority = UserSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority),
SaveLogToCopyDirectory = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory),
SaveLogWithVideo = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo),
SaveLogCopyDirectory = UserSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory),
diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index 111c91c6e..4bf64e5e1 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -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) { diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 8ecb46ae2..69d38f159 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -198,6 +198,29 @@ namespace HandBrakeWPF.ViewModels this.Presets = this.presetService.Presets;
this.Drives = new BindingList<SourceMenuItem>();
+ // Set Process Priority
+ switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.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;
+ }
+
HandBrakeInstanceManager.Init();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 4d7ea3a80..3e37a8a85 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -633,7 +633,30 @@ namespace HandBrakeWPF.ViewModels set
{
this.selectedPriority = value;
- this.NotifyOfPropertyChange("SelectedPriority");
+ this.NotifyOfPropertyChange();
+
+ // Set the Process Priority
+ switch (value)
+ {
+ 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;
+ }
}
}
#endregion
|