diff options
author | sr55 <[email protected]> | 2020-12-13 14:42:08 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2020-12-13 14:48:53 +0000 |
commit | 7db0c342d286e0d884c3d7c0fcef51254d9fcd4f (patch) | |
tree | 38c3a2aa72db5b49ac0c9618465d910ba074f977 /win/CS/HandBrakeWPF/Services | |
parent | b3237078a5c30afd02ea03866c0cfdc3428a43c3 (diff) |
WinGui: Better handle disabled presets in the UI.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Presets/PresetService.cs | 26 |
2 files changed, 20 insertions, 8 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs index 53e19bc62..096793d73 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Model/PresetDisplayCategory.cs @@ -48,6 +48,8 @@ namespace HandBrakeWPF.Services.Presets.Model } } + public bool IsPresetDisabled => false; + public bool IsSelected { get => this.isSelected; diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index ab1e76d87..748e69a0a 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -17,6 +17,7 @@ namespace HandBrakeWPF.Services.Presets using System.IO;
using System.Linq;
using System.Windows;
+ using System.Windows.Xps.Serialization;
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.Json.Presets;
@@ -433,7 +434,7 @@ namespace HandBrakeWPF.Services.Presets preset.IsBuildIn = true;
preset.Category = category.PresetName;
preset.Task.AllowedPassthruOptions = new AllowedPassthru(true); // We don't want to override the built-in preset
- preset.IsPresetDisabled = this.IsPresetDisabled(preset);
+ preset.IsPresetDisabled = this.IsPresetDisabled(preset) || hbpreset.PresetDisabled;
this.Add(preset, true);
}
@@ -826,37 +827,46 @@ namespace HandBrakeWPF.Services.Presets private bool IsPresetDisabled(Preset preset)
{
- if (preset.Task.VideoEncoder == VideoEncoder.QuickSync && !SystemInfo.IsQsvAvailable)
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265)
+ {
+ Console.Write("tets");
+ }
+
+ bool isQsvEnabled = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncEncoding);
+ bool isNvencEnabled = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableNvencEncoder);
+ bool isVcnEnabled = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableVceEncoder);
+
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSync && (!SystemInfo.IsQsvAvailable || !isQsvEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265 && !SystemInfo.IsQsvAvailableH265)
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH265 && (!SystemInfo.IsQsvAvailableH265 || !isQsvEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b && !SystemInfo.IsQsvAvailableH265)
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSyncH26510b && (!SystemInfo.IsQsvAvailableH265 || !isQsvEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.VceH264 && !SystemInfo.IsVceH264Available)
+ if (preset.Task.VideoEncoder == VideoEncoder.VceH264 && (!SystemInfo.IsVceH264Available || !isVcnEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.VceH265 && !SystemInfo.IsVceH265Available)
+ if (preset.Task.VideoEncoder == VideoEncoder.VceH265 && (!SystemInfo.IsVceH265Available || !isVcnEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.NvencH264 && !SystemInfo.IsNVEncH264Available)
+ if (preset.Task.VideoEncoder == VideoEncoder.NvencH264 && (!SystemInfo.IsNVEncH264Available || !isNvencEnabled))
{
return true;
}
- if (preset.Task.VideoEncoder == VideoEncoder.NvencH265 && !SystemInfo.IsNVEncH265Available)
+ if (preset.Task.VideoEncoder == VideoEncoder.NvencH265 && (!SystemInfo.IsNVEncH265Available || !isNvencEnabled))
{
return true;
}
|