summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services/Scan
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-04-11 11:11:40 +0100
committersr55 <[email protected]>2020-04-11 13:00:48 +0100
commitc3d62f1465fc9813d079bdf33f2e062a48ec8549 (patch)
tree9cdc71a68890a46a57c0982e563928fe40316e0d /win/CS/HandBrakeWPF/Services/Scan
parent30c15df16bc543f4d2ad828176c787cbc7b7c74e (diff)
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
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Scan')
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs12
-rw-r--r--win/CS/HandBrakeWPF/Services/Scan/LibScan.cs63
2 files changed, 14 insertions, 61 deletions
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
/// <param name="postAction">
/// The post Action.
/// </param>
- /// <param name="configuration">
- /// The configuraiton.
- /// </param>
- void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuration);
+ void Scan(string sourcePath, int title, Action<bool, Source> postAction);
/// <summary>
/// Cancel the current scan.
@@ -97,13 +92,10 @@ namespace HandBrakeWPF.Services.Scan.Interfaces
/// <param name="preview">
/// The preview.
/// </param>
- /// <param name="configuration">
- /// The configuration.
- /// </param>
/// <returns>
/// The <see cref="BitmapImage"/>.
/// </returns>
- BitmapImage GetPreview(EncodeTask task, int preview, HBConfiguration configuration);
+ BitmapImage GetPreview(EncodeTask task, int preview);
/// <summary>
/// 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
/// </summary>
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<bool, Source> 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
- /// <summary>
- /// Scan has Started
- /// </summary>
public event EventHandler ScanStarted;
- /// <summary>
- /// Scan has completed
- /// </summary>
public event ScanCompletedStatus ScanCompleted;
- /// <summary>
- /// Encode process has progressed
- /// </summary>
public event ScanProgessStatus ScanStatusChanged;
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Gets a value indicating whether IsScanning.
- /// </summary>
public bool IsScanning { get; private set; }
- #endregion
-
- #region Public Methods
-
/// <summary>
/// Scan a Source Path.
/// Title 0: scan all
@@ -100,10 +79,7 @@ namespace HandBrakeWPF.Services.Scan
/// <param name="postAction">
/// The post Action.
/// </param>
- /// <param name="configuraiton">
- /// The configuraiton.
- /// </param>
- public void Scan(string sourcePath, int title, Action<bool, Source> postAction, HBConfiguration configuraiton)
+ public void Scan(string sourcePath, int title, Action<bool, Source> 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<int>(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<int>(UserSettingConstants.PreviewScanCount));
}
/// <summary>
@@ -182,13 +158,10 @@ namespace HandBrakeWPF.Services.Scan
/// <param name="preview">
/// The preview.
/// </param>
- /// <param name="configuraiton">
- /// The configuraiton.
- /// </param>
/// <returns>
/// The <see cref="BitmapImage"/>.
/// </returns>
- 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
-
/// <summary>
/// The service log message.
/// </summary>
@@ -251,10 +220,7 @@ namespace HandBrakeWPF.Services.Scan
/// <param name="previewCount">
/// The preview Count.
/// </param>
- /// <param name="configuraiton">
- /// The configuration.
- /// </param>
- 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<int>(UserSettingConstants.MinScanDuration));
- HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);
+ HandBrakeUtils.SetDvdNav(!this.userSettingService.GetUserSetting<bool>(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
/// <summary>
/// Scan Completed Event Handler
@@ -395,7 +357,6 @@ namespace HandBrakeWPF.Services.Scan
return titleList;
}
- #endregion
public void Dispose()
{