summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-11-19 22:30:26 +0000
committersr55 <[email protected]>2013-11-19 22:30:26 +0000
commit830bb18b173a1c68720eb0df2ed860daea7d4c7e (patch)
tree780e4ad48d4917555121766f5e1f3eb838970042 /win/CS
parentf83ab26ab8e1d2ce277f0c12f23b5753bf63d763 (diff)
WinGui: Removed the need for the user settings service from IEncode and IScan interfaces and various other places. This makes the API much simpler to use.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5897 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs50
-rw-r--r--win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs7
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs50
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs35
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs34
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs15
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs20
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ServerService.cs10
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs46
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs12
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs11
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs51
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs40
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs2
20 files changed, 195 insertions, 218 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
index a03bf58d9..bea0a8844 100644
--- a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
@@ -15,63 +15,13 @@ namespace HandBrake.ApplicationServices
public class ASUserSettingConstants
{
/// <summary>
- /// The Verbosity
- /// </summary>
- public const string Verbosity = "Verbosity";
-
- /// <summary>
- /// Process Priority
- /// </summary>
- public const string ProcessPriority = "ProcessPriority";
-
- /// <summary>
- /// Save Log Directory
- /// </summary>
- public const string SaveLogToCopyDirectory = "SaveLogToCopyDirectory";
-
- /// <summary>
- /// Save log with video
- /// </summary>
- public const string SaveLogWithVideo = "SaveLogWithVideo";
-
- /// <summary>
- /// Save copy of the log to a directory
- /// </summary>
- public const string SaveLogCopyDirectory = "SaveLogCopyDirectory";
-
- /// <summary>
/// HandBrakes build
/// </summary>
public const string HandBrakeBuild = "HandBrakeBuild";
/// <summary>
- /// Min Title Scan Duration
- /// </summary>
- public const string MinScanDuration = "MinTitleScanDuration";
-
- /// <summary>
- /// Preview Scan Count
- /// </summary>
- public const string PreviewScanCount = "previewScanCount";
-
- /// <summary>
/// Clear completed items from the queue automatically.
/// </summary>
public const string ClearCompletedFromQueue = "ClearCompletedFromQueue";
-
- /// <summary>
- /// The disable quick sync decoding.
- /// </summary>
- public const string DisableQuickSyncDecoding = "DisableQuickSyncDecoding";
-
- /// <summary>
- /// The enable dxva.
- /// </summary>
- public const string EnableDxva = "EnableDxva";
-
- /// <summary>
- /// The scaling mode.
- /// </summary>
- public const string ScalingMode = "ScalingMode";
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
index bc31544a4..32dc494d7 100644
--- a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
@@ -162,9 +162,12 @@ namespace HandBrake.ApplicationServices.Isolation
/// <param name="destination">
/// The destination.
/// </param>
- public void ProcessLogs(string destination)
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public void ProcessLogs(string destination, HBConfiguration configuration)
{
- ThreadPool.QueueUserWorkItem(delegate { this.Service.ProcessEncodeLogs(destination); });
+ ThreadPool.QueueUserWorkItem(delegate { this.Service.ProcessEncodeLogs(destination, configuration); });
}
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
index 35d07dcfc..04b6efab6 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
@@ -23,5 +23,55 @@ namespace HandBrake.ApplicationServices.Model
/// Gets or sets a value indicating whether is dvd nav disabled.
/// </summary>
public bool IsDvdNavDisabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether disable quick sync decoding.
+ /// </summary>
+ public bool DisableQuickSyncDecoding { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether enable dxva.
+ /// </summary>
+ public bool EnableDxva { get; set; }
+
+ /// <summary>
+ /// Gets or sets the scaling mode.
+ /// </summary>
+ public VideoScaler ScalingMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preview scan count.
+ /// </summary>
+ public int PreviewScanCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the verbosity.
+ /// </summary>
+ public int Verbosity { get; set; }
+
+ /// <summary>
+ /// Gets or sets the min scan duration.
+ /// </summary>
+ 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; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether save log with video.
+ /// </summary>
+ public bool SaveLogWithVideo{ get; set; }
+
+ /// <summary>
+ /// Gets or sets the save log copy directory.
+ /// </summary>
+ public string SaveLogCopyDirectory { get; set; }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index f1a94a05b..720330c50 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -34,11 +34,6 @@ namespace HandBrake.ApplicationServices.Services.Base
private static readonly object FileWriterLock = new object();
/// <summary>
- /// The User Setting Service
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// The Log File Header
/// </summary>
private readonly StringBuilder header;
@@ -58,16 +53,10 @@ namespace HandBrake.ApplicationServices.Services.Base
/// <summary>
/// Initializes a new instance of the <see cref="EncodeBase"/> class.
/// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public EncodeBase(IUserSettingService userSettingService)
+ public EncodeBase()
{
- this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
- header =
- GeneralUtilities.CreateCliLogHeader();
-
+ header = GeneralUtilities.CreateCliLogHeader();
this.LogIndex = 0;
}
@@ -197,7 +186,10 @@ namespace HandBrake.ApplicationServices.Services.Base
/// <param name="destination">
/// The Destination File Path
/// </param>
- public void ProcessLogs(string destination)
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public void ProcessLogs(string destination, HBConfiguration configuration)
{
try
{
@@ -220,17 +212,16 @@ namespace HandBrake.ApplicationServices.Services.Base
File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile));
// Save a copy of the log file in the same location as the enocde.
- if (this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogWithVideo))
+ if (configuration.SaveLogWithVideo)
{
File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile));
}
// Save a copy of the log file to a user specified location
- if (Directory.Exists(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory)) &&
- this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogToCopyDirectory))
+ if (Directory.Exists(configuration.SaveLogCopyDirectory) && configuration.SaveLogToCopyDirectory)
{
File.Copy(
- tempLogFile, Path.Combine(this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory), encodeLogFile));
+ tempLogFile, Path.Combine(configuration.SaveLogCopyDirectory, encodeLogFile));
}
}
catch (Exception)
@@ -320,13 +311,7 @@ namespace HandBrake.ApplicationServices.Services.Base
try
{
- string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- encodeQueueTask.Configuration.IsDvdNavDisabled,
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
- userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);
+ string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task), encodeQueueTask.Configuration);
this.logBuffer = new StringBuilder();
this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));
this.logBuffer.AppendLine();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 08394b88c..61bb1b575 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -29,11 +29,6 @@ namespace HandBrake.ApplicationServices.Services
#region Private Variables
/// <summary>
- /// The User Setting Service
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// Gets the Process ID
/// </summary>
private int processId;
@@ -55,18 +50,6 @@ namespace HandBrake.ApplicationServices.Services
#endregion
- /// <summary>
- /// Initializes a new instance of the <see cref="Encode"/> class.
- /// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public Encode(IUserSettingService userSettingService)
- : base(userSettingService)
- {
- this.userSettingService = userSettingService;
- }
-
#region Properties
/// <summary>
@@ -130,19 +113,10 @@ namespace HandBrake.ApplicationServices.Services
string query = this.currentTask.Task.IsPreviewEncode
? QueryGeneratorUtility.GeneratePreviewQuery(
new EncodeTask(this.currentTask.Task),
+ encodeQueueTask.Configuration,
this.currentTask.Task.PreviewEncodeDuration,
- this.currentTask.Task.PreviewEncodeStartAt,
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- encodeQueueTask.Configuration.IsDvdNavDisabled,
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding))
- : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- encodeQueueTask.Configuration.IsDvdNavDisabled,
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
- userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);
+ this.currentTask.Task.PreviewEncodeStartAt)
+ : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task), encodeQueueTask.Configuration);
ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)
{
@@ -177,7 +151,7 @@ namespace HandBrake.ApplicationServices.Services
}
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
+ switch (encodeQueueTask.Configuration.ProcessPriority)
{
case "Realtime":
this.HbProcess.PriorityClass = ProcessPriorityClass.RealTime;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
index 17cf2e7f8..61c99eab0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
@@ -105,7 +105,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="destination">
/// The destination.
/// </param>
- void ProcessLogs(string destination);
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ void ProcessLogs(string destination, HBConfiguration configuration);
/// <summary>
/// Shutdown the service.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
index d1049ba49..f102d0d36 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
@@ -82,16 +82,13 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="title">
/// int title number. 0 for scan all
/// </param>
- /// <param name="previewCount">
- /// The preview Count.
- /// </param>
/// <param name="postAction">
/// The post Action.
/// </param>
/// <param name="configuration">
/// The configuraiton.
/// </param>
- void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuration);
+ void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuration);
/// <summary>
/// Kill the scan
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
index 9351ab03d..367555418 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
@@ -63,8 +63,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="destination">
/// The destination.
/// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
[OperationContract]
- void ProcessEncodeLogs(string destination);
+ void ProcessEncodeLogs(string destination, HBConfiguration configuration);
/// <summary>
/// Stop and Encode
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 744bbc890..f97355ad5 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -37,11 +37,6 @@ namespace HandBrake.ApplicationServices.Services
private static readonly object logLock = new object();
/// <summary>
- /// The User Setting Service
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// The instance.
/// </summary>
private IHandBrakeInstance instance;
@@ -66,14 +61,8 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Initializes a new instance of the <see cref="LibEncode"/> class.
/// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public LibEncode(IUserSettingService userSettingService)
- : base(userSettingService)
+ public LibEncode()
{
- this.userSettingService = userSettingService;
-
HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;
}
@@ -218,7 +207,7 @@ namespace HandBrake.ApplicationServices.Services
this.InvokeEncodeStarted(EventArgs.Empty);
// Set the Process Priority
- switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))
+ switch (job.Configuration.ProcessPriority)
{
case "Realtime":
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 6a372f228..28754e15c 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -48,11 +48,6 @@ namespace HandBrake.ApplicationServices.Services
static readonly object LogLock = new object();
/// <summary>
- /// The user setting service.
- /// </summary>
- private readonly IUserSettingService userSettingService;
-
- /// <summary>
/// Log data from HandBrakeInstance
/// </summary>
private readonly StringBuilder logging;
@@ -92,15 +87,11 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- /// <param name="userSettingService">
- /// The user Setting Service.
- /// </param>
- public LibScan(IUserSettingService userSettingService)
+ public LibScan()
{
logging = new StringBuilder();
header = GeneralUtilities.CreateCliLogHeader();
- this.userSettingService = userSettingService;
try
{
@@ -170,16 +161,13 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="title">
/// int title number. 0 for scan all
/// </param>
- /// <param name="previewCount">
- /// The preview Count.
- /// </param>
/// <param name="postAction">
/// The post Action.
/// </param>
/// <param name="configuraiton">
/// The configuraiton.
/// </param>
- public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuraiton)
+ public void Scan(string sourcePath, int title, Action<bool> postAction, HBConfiguration configuraiton)
{
// Try to cleanup any previous scan instances.
if (instance != null)
@@ -227,7 +215,7 @@ namespace HandBrake.ApplicationServices.Services
instance.ScanCompleted += this.InstanceScanCompleted;
// Start the scan on a back
- this.ScanSource(sourcePath, title, previewCount, configuraiton);
+ this.ScanSource(sourcePath, title, configuraiton.PreviewScanCount, configuraiton);
}
/// <summary>
@@ -286,7 +274,7 @@ namespace HandBrake.ApplicationServices.Services
TimeSpan minDuration =
TimeSpan.FromSeconds(
- this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration));
+ configuraiton.MinScanDuration);
HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index eb173c5b3..1ade60d74 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -484,7 +484,7 @@ namespace HandBrake.ApplicationServices.Services
}
// Handling Log Data
- this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination);
+ this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination, this.LastProcessedJob.Configuration);
// Move onto the next job.
if (this.IsProcessing)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
index 0fd2ef4b1..e7f4990bc 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
@@ -79,9 +79,12 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="destination">
/// The destination.
/// </param>
- public void ProcessEncodeLogs(string destination)
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public void ProcessEncodeLogs(string destination, HBConfiguration configuration)
{
- encodeService.ProcessLogs(destination);
+ encodeService.ProcessLogs(destination, configuration);
}
@@ -102,8 +105,7 @@ namespace HandBrake.ApplicationServices.Services
Console.WriteLine("Service Started. Waiting for Clients...");
// Setup the services we are going to use.
- encodeService = new LibEncode(new UserSettingService()); // TODO this needs wired up with castle
-
+ encodeService = new LibEncode();
shutdownFlag = new ManualResetEvent(false);
shutdownFlag.WaitOne();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index 30c1e9eb7..5552f1941 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -34,28 +34,13 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="task">
/// The task.
/// </param>
- /// <param name="previewScanCount">
- /// The preview Scan Count.
- /// </param>
- /// <param name="verbosity">
- /// The verbosity.
- /// </param>
- /// <param name="disableLibDvdNav">
- /// The disable Lib Dvd Nav.
- /// </param>
- /// <param name="disableQsvDecode">
- /// The disable Qsv Decode.
- /// </param>
- /// <param name="enableHwd">
- /// The enable Hwd.
- /// </param>
- /// <param name="enableOpenCL">
- /// The enable Open CL.
+ /// <param name="configuration">
+ /// The configuration.
/// </param>
/// <returns>
/// A Cli Query
/// </returns>
- public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav, bool disableQsvDecode, bool enableHwd, bool enableOpenCL)
+ public static string GenerateQuery(EncodeTask task, HBConfiguration configuration)
{
if (string.IsNullOrEmpty(task.Source))
{
@@ -63,9 +48,9 @@ namespace HandBrake.ApplicationServices.Utilities
}
string query = string.Empty;
- query += SourceQuery(task, null, null, previewScanCount);
+ query += SourceQuery(task, null, null, configuration.PreviewScanCount);
query += DestinationQuery(task);
- query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav, disableQsvDecode, enableHwd, enableOpenCL);
+ query += GenerateTabbedComponentsQuery(task, true, configuration.Verbosity, configuration.IsDvdNavDisabled, configuration.DisableQuickSyncDecoding, configuration.EnableDxva, configuration.ScalingMode == VideoScaler.BicubicCl);
return query;
}
@@ -76,33 +61,24 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="task">
/// The task.
/// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
/// <param name="duration">
/// The duration.
/// </param>
/// <param name="startAtPreview">
/// The start At Preview.
/// </param>
- /// <param name="previewScanCount">
- /// The preview Scan Count.
- /// </param>
- /// <param name="verbosity">
- /// The verbosity.
- /// </param>
- /// <param name="disableLibDvdNav">
- /// The disable Lib Dvd Nav.
- /// </param>
- /// <param name="disableQsvDecode">
- /// The disable Qsv Decode.
- /// </param>
/// <returns>
/// A Cli query suitable for generating a preview video.
/// </returns>
- public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview, int previewScanCount, int verbosity, bool disableLibDvdNav, bool disableQsvDecode)
+ public static string GeneratePreviewQuery(EncodeTask task, HBConfiguration configuration, int duration, string startAtPreview)
{
string query = string.Empty;
- query += SourceQuery(task, duration, startAtPreview, previewScanCount);
+ query += SourceQuery(task, duration, startAtPreview, configuration.PreviewScanCount);
query += DestinationQuery(task);
- query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav, disableQsvDecode, false, false);
+ query += GenerateTabbedComponentsQuery(task, true, configuration.Verbosity, configuration.IsDvdNavDisabled, configuration.DisableQuickSyncDecoding, false, false);
return query;
}
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
index 8c353bbdb..86f061eca 100644
--- a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
+++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
@@ -38,7 +38,17 @@ namespace HandBrakeWPF.Factories
HBConfiguration config = new HBConfiguration
{
IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),
- IsLoggingEnabled = isLoggingEnabled
+ IsLoggingEnabled = isLoggingEnabled,
+ DisableQuickSyncDecoding = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableQuickSyncDecoding),
+ EnableDxva = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableDxva),
+ ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode),
+ 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),
};
return config;
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index c7247a7c7..254ccefb9 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -63,7 +63,7 @@ namespace HandBrakeWPF.Services
}
else
{
- this.encodeService = new LibEncode(userSettingService);
+ this.encodeService = new LibEncode();
}
}
catch (Exception exc)
@@ -78,7 +78,7 @@ namespace HandBrakeWPF.Services
}
else
{
- this.encodeService = new Encode(userSettingService);
+ this.encodeService = new Encode();
}
this.encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
@@ -165,9 +165,12 @@ namespace HandBrakeWPF.Services
/// <param name="destination">
/// The destination.
/// </param>
- public void ProcessLogs(string destination)
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public void ProcessLogs(string destination, HBConfiguration configuration)
{
- this.encodeService.ProcessLogs(destination);
+ this.encodeService.ProcessLogs(destination, configuration);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index ac876e6bf..bf50ec8db 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -251,6 +251,57 @@ namespace HandBrakeWPF
/// </summary>
public const string DisableLibDvdNav = "DisableLibDvdNav";
+ /// <summary>
+ /// The disable quick sync decoding.
+ /// </summary>
+ public const string DisableQuickSyncDecoding = "DisableQuickSyncDecoding";
+
+ /// <summary>
+ /// The enable dxva.
+ /// </summary>
+ public const string EnableDxva = "EnableDxva";
+
+ /// <summary>
+ /// The scaling mode.
+ /// </summary>
+ public const string ScalingMode = "ScalingMode";
+
+ /// <summary>
+ /// Preview Scan Count
+ /// </summary>
+ public const string PreviewScanCount = "previewScanCount";
+
+ /// <summary>
+ /// The Verbosity
+ /// </summary>
+ public const string Verbosity = "Verbosity";
+
+ /// <summary>
+ /// Min Title Scan Duration
+ /// </summary>
+ public const string MinScanDuration = "MinTitleScanDuration";
+
+ /// <summary>
+ /// Process Priority
+ /// </summary>
+ public const string ProcessPriority = "ProcessPriority";
+
+ /// <summary>
+ /// Save Log Directory
+ /// </summary>
+ public const string SaveLogToCopyDirectory = "SaveLogToCopyDirectory";
+
+ /// <summary>
+ /// Save log with video
+ /// </summary>
+ public const string SaveLogWithVideo = "SaveLogWithVideo";
+
+ /// <summary>
+ /// Save copy of the log to a directory
+ /// </summary>
+ public const string SaveLogCopyDirectory = "SaveLogCopyDirectory";
+
+
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
index 15c5df127..d27ef6694 100644
--- a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
@@ -777,7 +777,6 @@ namespace HandBrakeWPF.ViewModels
this.scanService.Scan(
filename,
title,
- this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
null,
HBConfigurationFactory.Create());
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 68e4077d7..d20657728 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1301,7 +1301,7 @@ namespace HandBrakeWPF.ViewModels
{
// Rescan the source to make sure it's still valid
this.queueEditTask = task;
- this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction, HBConfigurationFactory.Create());
+ this.scanService.Scan(task.Source, task.Title, QueueEditAction, HBConfigurationFactory.Create());
}
/// <summary>
@@ -1335,13 +1335,7 @@ namespace HandBrakeWPF.ViewModels
public void ShowCliQuery()
{
this.errorService.ShowMessageBox(
- QueryGeneratorUtility.GenerateQuery(this.CurrentTask,
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- HBConfigurationFactory.Create().IsDvdNavDisabled,
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
- userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl),
+ QueryGeneratorUtility.GenerateQuery(this.CurrentTask, HBConfigurationFactory.Create()),
"CLI Query",
MessageBoxButton.OK,
MessageBoxImage.Information);
@@ -1627,7 +1621,7 @@ namespace HandBrakeWPF.ViewModels
{
if (!string.IsNullOrEmpty(filename))
{
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null, HBConfigurationFactory.Create());
+ this.scanService.Scan(filename, title, null, HBConfigurationFactory.Create());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index fd7f0920c..122914d13 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1911,9 +1911,9 @@ namespace HandBrakeWPF.ViewModels
// Video
// #############################
this.EnableQuickSync = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSync);
- this.DisableQuickSyncDecoding = this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding);
- this.EnableDxvaDecoding = this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva);
- this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode);
+ this.DisableQuickSyncDecoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableQuickSyncDecoding);
+ this.EnableDxvaDecoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableDxva);
+ this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode);
// #############################
// CLI
@@ -1926,7 +1926,7 @@ namespace HandBrakeWPF.ViewModels
this.priorityLevelOptions.Add("Normal");
this.priorityLevelOptions.Add("Below Normal");
this.priorityLevelOptions.Add("Low");
- this.SelectedPriority = userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority);
+ this.SelectedPriority = userSettingService.GetUserSetting<string>(UserSettingConstants.ProcessPriority);
this.PreventSleep = userSettingService.GetUserSetting<bool>(UserSettingConstants.PreventSleep);
@@ -1935,14 +1935,14 @@ namespace HandBrakeWPF.ViewModels
this.logVerbosityOptions.Add(0);
this.logVerbosityOptions.Add(1);
this.logVerbosityOptions.Add(2);
- this.SelectedVerbosity = userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity);
+ this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity);
// Logs
- this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogWithVideo);
- this.CopyLogToSepcficedLocation = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SaveLogToCopyDirectory);
+ this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo);
+ this.CopyLogToSepcficedLocation = userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory);
// The saved log path
- this.LogDirectory = userSettingService.GetUserSetting<string>(ASUserSettingConstants.SaveLogCopyDirectory) ?? string.Empty;
+ this.LogDirectory = userSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory) ?? string.Empty;
this.ClearOldOlgs = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearOldLogs);
@@ -1969,7 +1969,7 @@ namespace HandBrakeWPF.ViewModels
this.PreviewPicturesToScan.Add(50);
this.PreviewPicturesToScan.Add(55);
this.PreviewPicturesToScan.Add(60);
- this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount);
+ this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
// x264 step
this.ConstantQualityGranularity.Clear();
@@ -1979,7 +1979,7 @@ namespace HandBrakeWPF.ViewModels
this.SelectedGranulairty = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture);
// Min Title Length
- this.MinLength = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration);
+ this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);
// Use dvdnav
this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);
@@ -2035,25 +2035,25 @@ namespace HandBrakeWPF.ViewModels
/* Video */
this.userSettingService.SetUserSetting(UserSettingConstants.EnableQuickSync, this.EnableQuickSync);
- this.userSettingService.SetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding, this.DisableQuickSyncDecoding);
- this.userSettingService.SetUserSetting(ASUserSettingConstants.EnableDxva, this.EnableDxvaDecoding);
- this.userSettingService.SetUserSetting(ASUserSettingConstants.ScalingMode, this.SelectedScalingMode);
+ this.userSettingService.SetUserSetting(UserSettingConstants.DisableQuickSyncDecoding, this.DisableQuickSyncDecoding);
+ this.userSettingService.SetUserSetting(UserSettingConstants.EnableDxva, this.EnableDxvaDecoding);
+ this.userSettingService.SetUserSetting(UserSettingConstants.ScalingMode, this.SelectedScalingMode);
/* System and Logging */
- userSettingService.SetUserSetting(ASUserSettingConstants.ProcessPriority, this.SelectedPriority);
+ userSettingService.SetUserSetting(UserSettingConstants.ProcessPriority, this.SelectedPriority);
userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep);
- userSettingService.SetUserSetting(ASUserSettingConstants.Verbosity, this.SelectedVerbosity);
- userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogWithVideo, this.CopyLogToEncodeDirectory);
- userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory, this.CopyLogToSepcficedLocation);
- userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory, this.LogDirectory);
+ userSettingService.SetUserSetting(UserSettingConstants.Verbosity, this.SelectedVerbosity);
+ userSettingService.SetUserSetting(UserSettingConstants.SaveLogWithVideo, this.CopyLogToEncodeDirectory);
+ userSettingService.SetUserSetting(UserSettingConstants.SaveLogToCopyDirectory, this.CopyLogToSepcficedLocation);
+ userSettingService.SetUserSetting(UserSettingConstants.SaveLogCopyDirectory, this.LogDirectory);
userSettingService.SetUserSetting(UserSettingConstants.ClearOldLogs, this.ClearOldOlgs);
/* Advanced */
userSettingService.SetUserSetting(UserSettingConstants.MainWindowMinimize, this.MinimiseToTray);
userSettingService.SetUserSetting(UserSettingConstants.PresetNotification, this.DisablePresetUpdateCheckNotification);
userSettingService.SetUserSetting(ASUserSettingConstants.ClearCompletedFromQueue, this.ClearQueueOnEncodeCompleted);
- userSettingService.SetUserSetting(ASUserSettingConstants.PreviewScanCount, this.SelectedPreviewCount);
+ userSettingService.SetUserSetting(UserSettingConstants.PreviewScanCount, this.SelectedPreviewCount);
userSettingService.SetUserSetting(UserSettingConstants.X264Step, double.Parse(this.SelectedGranulairty, CultureInfo.InvariantCulture));
userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedTab, this.ShowAdvancedTab);
userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedTab, this.ShowAdvancedTab);
@@ -2061,7 +2061,7 @@ namespace HandBrakeWPF.ViewModels
int value;
if (int.TryParse(this.MinLength.ToString(CultureInfo.InvariantCulture), out value))
{
- this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value);
+ this.userSettingService.SetUserSetting(UserSettingConstants.MinScanDuration, value);
}
userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
index 9aba8e442..5c0913a37 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -173,7 +173,7 @@ namespace HandBrakeWPF.ViewModels
{
List<int> startPoints = new List<int>();
for (int i = 1;
- i <= this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount);
+ i <= this.UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
i++)
{
startPoints.Add(i);