From c3d62f1465fc9813d079bdf33f2e062a48ec8549 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 11 Apr 2020 11:11:40 +0100 Subject: WinGui: Stripping much of the remaining app config out of the Queue Jobs. Certain features such as QSV, while global options currently are not really global. I may move these out of perferences at a later point. Fixes #2753 --- .../HandBrakeWPF/Services/Scan/Interfaces/IScan.cs | 12 +---- win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 63 +++++----------------- 2 files changed, 14 insertions(+), 61 deletions(-) (limited to 'win/CS/HandBrakeWPF/Services/Scan') diff --git a/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs b/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs index 61e34ddb4..09ef85cca 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs @@ -12,8 +12,6 @@ namespace HandBrakeWPF.Services.Scan.Interfaces using System; using System.Windows.Media.Imaging; - using HandBrake.Interop.Model; - using HandBrakeWPF.Services.Encode.Model; using HandBrakeWPF.Services.Scan.EventArgs; using HandBrakeWPF.Services.Scan.Model; @@ -78,10 +76,7 @@ namespace HandBrakeWPF.Services.Scan.Interfaces /// /// The post Action. /// - /// - /// The configuraiton. - /// - void Scan(string sourcePath, int title, Action postAction, HBConfiguration configuration); + void Scan(string sourcePath, int title, Action postAction); /// /// Cancel the current scan. @@ -97,13 +92,10 @@ namespace HandBrakeWPF.Services.Scan.Interfaces /// /// The preview. /// - /// - /// The configuration. - /// /// /// The . /// - BitmapImage GetPreview(EncodeTask task, int preview, HBConfiguration configuration); + BitmapImage GetPreview(EncodeTask task, int preview); /// /// Kill the scan diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index 67f33ebbd..5cb336d46 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -24,6 +24,7 @@ namespace HandBrakeWPF.Services.Scan using HandBrakeWPF.Instance; using HandBrakeWPF.Services.Encode.Model; + using HandBrakeWPF.Services.Interfaces; using HandBrakeWPF.Services.Scan.EventArgs; using HandBrakeWPF.Services.Scan.Factories; using HandBrakeWPF.Services.Scan.Interfaces; @@ -40,53 +41,31 @@ namespace HandBrakeWPF.Services.Scan /// public class LibScan : IScan, IDisposable { - #region Private Variables - private readonly ILog log = null; + private readonly IUserSettingService userSettingService; + private TitleFactory titleFactory = new TitleFactory(); private string currentSourceScanPath; private IHandBrakeInstance instance; private Action postScanOperation; private bool isCancelled = false; - #endregion - - public LibScan(ILog logService) + public LibScan(ILog logService, IUserSettingService userSettingService) { this.log = logService; + this.userSettingService = userSettingService; this.IsScanning = false; } - #region Events - /// - /// Scan has Started - /// public event EventHandler ScanStarted; - /// - /// Scan has completed - /// public event ScanCompletedStatus ScanCompleted; - /// - /// Encode process has progressed - /// public event ScanProgessStatus ScanStatusChanged; - #endregion - - #region Properties - - /// - /// Gets a value indicating whether IsScanning. - /// public bool IsScanning { get; private set; } - #endregion - - #region Public Methods - /// /// Scan a Source Path. /// Title 0: scan all @@ -100,10 +79,7 @@ namespace HandBrakeWPF.Services.Scan /// /// The post Action. /// - /// - /// The configuraiton. - /// - public void Scan(string sourcePath, int title, Action postAction, HBConfiguration configuraiton) + public void Scan(string sourcePath, int title, Action postAction) { // Try to cleanup any previous scan instances. if (this.instance != null) @@ -124,12 +100,12 @@ namespace HandBrakeWPF.Services.Scan this.postScanOperation = postAction; // Create a new HandBrake Instance. - this.instance = HandBrakeInstanceManager.GetScanInstance(configuraiton.Verbosity, configuraiton); + this.instance = HandBrakeInstanceManager.GetScanInstance(this.userSettingService.GetUserSetting(UserSettingConstants.Verbosity)); this.instance.ScanProgress += this.InstanceScanProgress; this.instance.ScanCompleted += this.InstanceScanCompleted; // Start the scan on a back - this.ScanSource(sourcePath, title, configuraiton.PreviewScanCount, configuraiton); + this.ScanSource(sourcePath, title, this.userSettingService.GetUserSetting(UserSettingConstants.PreviewScanCount)); } /// @@ -182,13 +158,10 @@ namespace HandBrakeWPF.Services.Scan /// /// The preview. /// - /// - /// The configuraiton. - /// /// /// The . /// - public BitmapImage GetPreview(EncodeTask job, int preview, HBConfiguration configuraiton) + public BitmapImage GetPreview(EncodeTask job, int preview) { if (this.instance == null) { @@ -224,10 +197,6 @@ namespace HandBrakeWPF.Services.Scan return bitmapImage; } - #endregion - - #region Private Methods - /// /// The service log message. /// @@ -251,10 +220,7 @@ namespace HandBrakeWPF.Services.Scan /// /// The preview Count. /// - /// - /// The configuration. - /// - private void ScanSource(object sourcePath, int title, int previewCount, HBConfiguration configuraiton) + private void ScanSource(object sourcePath, int title, int previewCount) { try { @@ -264,9 +230,9 @@ namespace HandBrakeWPF.Services.Scan this.IsScanning = true; - TimeSpan minDuration = TimeSpan.FromSeconds(configuraiton.MinScanDuration); + TimeSpan minDuration = TimeSpan.FromSeconds(this.userSettingService.GetUserSetting(UserSettingConstants.MinScanDuration)); - HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled); + HandBrakeUtils.SetDvdNav(!this.userSettingService.GetUserSetting(UserSettingConstants.DisableLibDvdNav)); this.ServiceLogMessage("Starting Scan ..."); this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0); @@ -279,10 +245,6 @@ namespace HandBrakeWPF.Services.Scan this.Stop(); } } - - #endregion - - #region HandBrakeInstance Event Handlers /// /// Scan Completed Event Handler @@ -395,7 +357,6 @@ namespace HandBrakeWPF.Services.Scan return titleList; } - #endregion public void Dispose() { -- cgit v1.2.3