summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-08-25 14:05:56 +0000
committersr55 <[email protected]>2012-08-25 14:05:56 +0000
commit5c878c4eab2f01acc386165fca26d2f3ef943b77 (patch)
tree5e7a7257147ad1f074297dcd28af691a554cae97
parentcbe5f09e69c95df3be3b38de06c2b7bd6b5bd949 (diff)
WinGui: General Tidyup of the Services Library API.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4915 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj10
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs12
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs14
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs10
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs11
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs26
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/PresetService.cs17
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs14
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs16
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs29
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs29
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs93
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs30
16 files changed, 184 insertions, 150 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 04f8149dd..463ccc4ca 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -45,15 +45,17 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Caliburn.Micro">
+ <Reference Include="Caliburn.Micro, Version=1.3.1.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\caliburn\Caliburn.Micro.dll</HintPath>
</Reference>
- <Reference Include="Castle.Core">
+ <Reference Include="Castle.Core, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\caliburn\Castle.Core.dll</HintPath>
</Reference>
- <Reference Include="Castle.Windsor">
+ <Reference Include="Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\caliburn\Castle.Windsor.dll</HintPath>
- <EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Growl.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=980c2339411be384, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
index f6b57b1e3..e7869459b 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs
@@ -79,7 +79,6 @@ namespace HandBrake.ApplicationServices.Model
this.Denoise = task.Denoise;
this.Destination = task.Destination;
this.Detelecine = task.Detelecine;
- this.DisableLibDvdNav = task.DisableLibDvdNav;
this.DisplayWidth = task.DisplayWidth;
this.EndPoint = task.EndPoint;
this.Framerate = task.Framerate;
@@ -112,7 +111,6 @@ namespace HandBrake.ApplicationServices.Model
this.Title = task.Title;
this.TurboFirstPass = task.TurboFirstPass;
this.TwoPass = task.TwoPass;
- this.Verbosity = task.Verbosity;
this.VideoBitrate = task.VideoBitrate;
this.VideoEncoder = task.VideoEncoder;
this.VideoEncodeRateType = task.VideoEncodeRateType;
@@ -413,16 +411,6 @@ namespace HandBrake.ApplicationServices.Model
/// </summary>
public x264Tune X264Tune { get; set; }
- /// <summary>
- /// Gets or sets Verbosity.
- /// </summary>
- public int Verbosity { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether disableLibDvdNav.
- /// </summary>
- public bool DisableLibDvdNav { get; set; }
-
#endregion
#region Preview
diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
index 42161a52d..02bacc429 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs
@@ -258,7 +258,6 @@ namespace HandBrake.ApplicationServices.Model.Encoding
}
}
-
/// <summary>
/// Gets a value indicating whether this is an SRT subtitle.
/// </summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 36b9002bc..ced71d4eb 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -44,7 +44,7 @@ namespace HandBrake.ApplicationServices.Services.Base
/// <summary>
/// The Log File Header
/// </summary>
- private readonly StringBuilder header = GeneralUtilities.CreateCliLogHeader();
+ private readonly StringBuilder header;
/// <summary>
/// The Log Buffer
@@ -68,6 +68,11 @@ namespace HandBrake.ApplicationServices.Services.Base
{
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
+ header =
+ GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+
}
#region Events
@@ -260,7 +265,10 @@ namespace HandBrake.ApplicationServices.Services.Base
try
{
- string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task));
+ string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
this.logBuffer = new StringBuilder();
this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));
this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
@@ -278,7 +286,7 @@ namespace HandBrake.ApplicationServices.Services.Base
}
this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
- this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader());
+ this.fileWriter.WriteLine(header);
this.fileWriter.WriteLine(String.Format("CLI Query: {0}", query));
this.fileWriter.WriteLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.fileWriter.WriteLine();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 98827a6e3..dbf598796 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -132,8 +132,14 @@ namespace HandBrake.ApplicationServices.Services
? QueryGeneratorUtility.GeneratePreviewQuery(
new EncodeTask(this.currentTask.Task),
this.currentTask.Task.PreviewEncodeDuration,
- this.currentTask.Task.PreviewEncodeStartAt)
- : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task));
+ this.currentTask.Task.PreviewEncodeStartAt,
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
+ : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
index 0ae6bf518..b52be1aef 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IQueueManager.cs
@@ -127,10 +127,19 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="path">
/// The path to the location for the script to be saved.
/// </param>
+ /// <param name="previewScanCount">
+ /// The preview Scan Count.
+ /// </param>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibdvdnav">
+ /// The disable Libdvdnav.
+ /// </param>
/// <returns>
/// True if sucessful
/// </returns>
- bool WriteBatchScriptToFile(string path);
+ bool WriteBatchScriptToFile(string path, int previewScanCount, int verbosity, bool disableLibdvdnav);
/// <summary>
/// Temp workaround until this can be fixed properly.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index 3ae06bbfd..404a47fac 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -12,8 +12,6 @@ namespace HandBrake.ApplicationServices.Services
using System;
using System.Diagnostics;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Base;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -65,13 +63,16 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public LibEncode(IUserSettingService userSettingService)
+ /// <param name="handBrakeInstance">
+ /// The hand Brake Instance.
+ /// </param>
+ public LibEncode(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)
: base(userSettingService)
{
this.userSettingService = userSettingService;
// Setup the HandBrake Instance
- this.instance = IoC.Get<IHandBrakeInstance>();
+ this.instance = handBrakeInstance;
this.instance.EncodeCompleted += this.InstanceEncodeCompleted;
this.instance.EncodeProgress += this.InstanceEncodeProgress;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index a25f3a2a6..73f5fca57 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -14,8 +14,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Text;
using System.Threading;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
@@ -58,6 +56,11 @@ namespace HandBrake.ApplicationServices.Services
private readonly StringBuilder logging;
/// <summary>
+ /// The Log File Header
+ /// </summary>
+ private readonly StringBuilder header;
+
+ /// <summary>
/// The Current source scan path.
/// </summary>
private string currentSourceScanPath;
@@ -67,11 +70,21 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- public LibScan()
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ /// <param name="handBrakeInstance">
+ /// The hand Brake Instance.
+ /// </param>
+ public LibScan(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)
{
logging = new StringBuilder();
- instance = IoC.Get<IHandBrakeInstance>();
+ header = GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
+
+ instance = handBrakeInstance;
instance.Initialize(1);
instance.ScanProgress += this.InstanceScanProgress;
instance.ScanCompleted += this.InstanceScanCompleted;
@@ -97,11 +110,6 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public event ScanProgessStatus ScanStatusChanged;
- /// <summary>
- /// The Log File Header
- /// </summary>
- StringBuilder header = GeneralUtilities.CreateCliLogHeader();
-
#endregion
#region Properties
diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
index 0b86be749..9e31173ae 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs
@@ -47,6 +47,11 @@ namespace HandBrake.ApplicationServices.Services
private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Preset>));
/// <summary>
+ /// The User Setting Service
+ /// </summary>
+ private readonly IUserSettingService userSettingService;
+
+ /// <summary>
/// User Preset Default Catgory Name
/// </summary>
public static string UserPresetCatgoryName = "User Presets";
@@ -66,19 +71,19 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private ObservableCollection<Preset> presets = new ObservableCollection<Preset>();
- /// <summary>
- /// The User Setting Service
- /// </summary>
- private IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
-
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="PresetService"/> class.
/// </summary>
- public PresetService()
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
+ public PresetService(IUserSettingService userSettingService)
{
+ this.userSettingService = userSettingService;
+
// If the preset file doesn't exist. Create it.
if (!File.Exists(this.builtInPresetFile))
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
index abe684a17..161653da0 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs
@@ -369,15 +369,24 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="file">
/// The location of the file to write the batch file to.
/// </param>
+ /// <param name="previewScanCount">
+ /// The preview Scan Count.
+ /// </param>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibdvdnav">
+ /// The disable Libdvdnav.
+ /// </param>
/// <returns>
/// The write batch script to file.
/// </returns>
- public bool WriteBatchScriptToFile(string file)
+ public bool WriteBatchScriptToFile(string file, int previewScanCount, int verbosity, bool disableLibdvdnav)
{
string queries = string.Empty;
foreach (QueueTask queueItem in this.queue)
{
- string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task));
+ string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task), previewScanCount, verbosity, disableLibdvdnav);
string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + qItem;
if (queries == string.Empty)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index f90aa0ef4..bbb085916 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -13,8 +13,6 @@ namespace HandBrake.ApplicationServices.Services
using System.Diagnostics;
using System.Windows.Forms;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -28,7 +26,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// The User Setting Service
/// </summary>
- private static IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
+ private readonly IUserSettingService userSettingService;
/// <summary>
/// Initializes a new instance of the <see cref="QueueProcessor"/> class.
@@ -39,11 +37,15 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="encodeService">
/// The encode Service.
/// </param>
+ /// <param name="userSettingService">
+ /// The user Setting Service.
+ /// </param>
/// <exception cref="ArgumentNullException">
/// Services are not setup
/// </exception>
- public QueueProcessor(IQueueManager queueManager, IEncode encodeService)
+ public QueueProcessor(IQueueManager queueManager, IEncode encodeService, IUserSettingService userSettingService)
{
+ this.userSettingService = userSettingService;
this.QueueManager = queueManager;
this.EncodeService = encodeService;
@@ -278,7 +280,7 @@ namespace HandBrake.ApplicationServices.Services
/// Send a file to a 3rd party application after encoding has completed.
/// </summary>
/// <param name="file"> The file path</param>
- private static void SendToApplication(string file)
+ private void SendToApplication(string file)
{
if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.SendFile) && !string.IsNullOrEmpty(userSettingService.GetUserSetting<string>(ASUserSettingConstants.SendFileTo)))
{
@@ -291,7 +293,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Perform an action after an encode. e.g a shutdown, standby, restart etc.
/// </summary>
- private static void Finish()
+ private void Finish()
{
// Growl
if (userSettingService.GetUserSetting<bool>(ASUserSettingConstants.GrowlQueue))
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index 3e0c36d20..9eb05eb39 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -39,6 +39,11 @@ namespace HandBrake.ApplicationServices.Services
private readonly IUserSettingService userSettingService;
/// <summary>
+ /// The Log File Header
+ /// </summary>
+ private readonly StringBuilder header;
+
+ /// <summary>
/// The CLI data parser
/// </summary>
private Parser readData;
@@ -53,11 +58,6 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private Process hbProc;
- /// <summary>
- /// The Log File Header
- /// </summary>
- StringBuilder header = GeneralUtilities.CreateCliLogHeader();
-
#endregion
/// <summary>
@@ -70,6 +70,10 @@ namespace HandBrake.ApplicationServices.Services
{
this.userSettingService = userSettingService;
this.logBuffer = new StringBuilder();
+
+ header = GeneralUtilities.CreateCliLogHeader(
+ userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild));
}
#region Events
@@ -290,7 +294,7 @@ namespace HandBrake.ApplicationServices.Services
// Only write the log file to disk if it's less than 50MB.
if (this.readData.Buffer.Length < 50000000)
{
- scanLog.WriteLine(GeneralUtilities.CreateCliLogHeader());
+ scanLog.WriteLine(header);
scanLog.WriteLine(query);
scanLog.Write(this.readData.Buffer);
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 696eaedef..bebdc734d 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -106,35 +106,24 @@ namespace HandBrake.ApplicationServices.Utilities
/// <summary>
/// Add the CLI Query to the Log File.
/// </summary>
+ /// <param name="version">
+ /// The version.
+ /// </param>
+ /// <param name="build">
+ /// The build.
+ /// </param>
/// <returns>
/// The create cli log header.
/// </returns>
- public static StringBuilder CreateCliLogHeader()
+ public static StringBuilder CreateCliLogHeader(string version, int build)
{
var logHeader = new StringBuilder();
- IUserSettingService userSettingService;
- try
- {
- userSettingService = IoC.Get<IUserSettingService>();
- }
- catch (Exception)
- {
- // TODO Sort this out. Should not be calling IoC.Get or creating a new instance here.
- userSettingService = new UserSettingService();
- }
-
- logHeader.AppendLine(
- String.Format(
- "HandBrake {0} {1}",
- userSettingService.GetUserSetting<string>(ASUserSettingConstants.HandBrakeVersion),
- userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild)));
+ logHeader.AppendLine(String.Format("HandBrake {0} {1}", version, build));
logHeader.AppendLine(String.Format("OS: {0}", Environment.OSVersion));
logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount));
logHeader.Append(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory));
- logHeader.AppendLine(
- String.Format(
- "Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
+ logHeader.AppendLine(String.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height));
logHeader.AppendLine(String.Format("Temp Dir: {0}", Path.GetTempPath()));
logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath));
logHeader.AppendLine(String.Format("Data Dir: {0}\n", Application.UserAppDataPath));
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
index 871bc5adc..797c456f3 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/PlistUtility.cs
@@ -16,12 +16,9 @@ namespace HandBrake.ApplicationServices.Utilities
using System.Windows.Forms;
using System.Xml;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
/// <summary>
@@ -29,11 +26,6 @@ namespace HandBrake.ApplicationServices.Utilities
/// </summary>
public class PlistUtility
{
- /// <summary>
- /// The User Setting Service
- /// </summary>
- private static IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
-
#region Import
/// <summary>
@@ -490,7 +482,10 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="preset">
/// The preset.
/// </param>
- public static void Export(string path, Preset preset)
+ /// <param name="build">
+ /// The build.
+ /// </param>
+ public static void Export(string path, Preset preset, string build)
{
if (string.IsNullOrEmpty(path))
{
@@ -509,7 +504,7 @@ namespace HandBrake.ApplicationServices.Utilities
xmlWriter.WriteStartElement("array");
// Add New Preset Here. Can write multiple presets here if required in future.
- WritePreset(xmlWriter, parsed, preset);
+ WritePreset(xmlWriter, parsed, preset, build);
// Footer
xmlWriter.WriteEndElement();
@@ -534,11 +529,14 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="preset">
/// The preset.
/// </param>
- private static void WritePreset(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset)
+ /// <param name="build">
+ /// The build.
+ /// </param>
+ private static void WritePreset(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset, string build)
{
xmlWriter.WriteStartElement("dict");
AudioListArrayDict(xmlWriter, parsed);
- AddEncodeSettings(xmlWriter, parsed, preset);
+ AddEncodeSettings(xmlWriter, parsed, preset, build);
xmlWriter.WriteEndElement();
}
@@ -574,7 +572,10 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="preset">
/// The preset.
/// </param>
- private static void AddEncodeSettings(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset)
+ /// <param name="build">
+ /// The build.
+ /// </param>
+ private static void AddEncodeSettings(XmlTextWriter xmlWriter, EncodeTask parsed, Preset preset, string build)
{
AddEncodeElement(xmlWriter, "AudioAllowAACPass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowAACPass));
AddEncodeElement(xmlWriter, "AudioAllowAC3Pass", "integer", getNullBoolValue(parsed.AllowedPassthruOptions.AudioAllowAC3Pass));
@@ -701,7 +702,7 @@ namespace HandBrake.ApplicationServices.Utilities
AddEncodeElement(xmlWriter, "PictureWidth", "integer", parsed.Width.ToString());
// Preset Information
- AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString());
+ AddEncodeElement(xmlWriter, "PresetBuildNumber", "string", build);
AddEncodeElement(xmlWriter, "PresetDescription", "string", "No Description");
AddEncodeElement(xmlWriter, "PresetName", "string", preset.Name);
AddEncodeElement(xmlWriter, "Type", "integer", "1"); // 1 is user preset, 0 is built in
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index b28de2264..2bd04a93f 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -15,12 +15,8 @@ namespace HandBrake.ApplicationServices.Utilities
using System.Globalization;
using System.IO;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
- using HandBrake.ApplicationServices.Services;
- using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.Model.Encoding.x264;
@@ -30,38 +26,29 @@ namespace HandBrake.ApplicationServices.Utilities
public class QueryGeneratorUtility
{
/// <summary>
- /// Backing field for the user settings service.
- /// </summary>
- private static IUserSettingService UserSettingService;
-
- /// <summary>
/// Generate a CLI Query for an EncodeTask Model object
/// </summary>
/// <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>
/// <returns>
/// A Cli Query
/// </returns>
- public static string GenerateQuery(EncodeTask task)
+ public static string GenerateQuery(EncodeTask task, int previewScanCount, int verbosity, bool disableLibDvdNav)
{
- // TODO Remove this quick hack
- if (UserSettingService == null)
- {
- try
- {
- UserSettingService = IoC.Get<IUserSettingService>();
- }
- catch (Exception exc)
- {
- UserSettingService = new UserSettingService();
- }
- }
-
string query = string.Empty;
- query += SourceQuery(task, null, null);
+ query += SourceQuery(task, null, null, previewScanCount);
query += DestinationQuery(task);
- query += GenerateTabbedComponentsQuery(task, true);
+ query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav);
return query;
}
@@ -78,28 +65,24 @@ namespace HandBrake.ApplicationServices.Utilities
/// <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>
/// <returns>
/// A Cli query suitable for generating a preview video.
/// </returns>
- public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview)
+ public static string GeneratePreviewQuery(EncodeTask task, int duration, string startAtPreview, int previewScanCount, int verbosity, bool disableLibDvdNav)
{
- // TODO Remove this quick hack
- if (UserSettingService == null)
- {
- try
- {
- UserSettingService = IoC.Get<IUserSettingService>();
- }
- catch (Exception exc)
- {
- UserSettingService = new UserSettingService();
- }
- }
-
string query = string.Empty;
- query += SourceQuery(task, duration, startAtPreview);
+ query += SourceQuery(task, duration, startAtPreview, previewScanCount);
query += DestinationQuery(task);
- query += GenerateTabbedComponentsQuery(task, true);
+ query += GenerateTabbedComponentsQuery(task, true, verbosity, disableLibDvdNav);
return query;
}
@@ -115,10 +98,16 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="enableFilters">
/// The enableFilters.
/// </param>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibDvdNav">
+ /// The disable Lib Dvd Nav.
+ /// </param>
/// <returns>
/// The CLI query for the Tabbed section of the main window UI
/// </returns>
- private static string GenerateTabbedComponentsQuery(EncodeTask task, bool enableFilters)
+ private static string GenerateTabbedComponentsQuery(EncodeTask task, bool enableFilters, int verbosity, bool disableLibDvdNav)
{
string query = string.Empty;
@@ -148,7 +137,7 @@ namespace HandBrake.ApplicationServices.Utilities
query += AdvancedQuery(task);
// Extra Settings
- query += ExtraSettings();
+ query += ExtraSettings(verbosity, disableLibDvdNav);
return query;
}
@@ -165,10 +154,13 @@ namespace HandBrake.ApplicationServices.Utilities
/// <param name="preview">
/// The preview.
/// </param>
+ /// <param name="previewScanCount">
+ /// The preview Scan Count.
+ /// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
- private static string SourceQuery(EncodeTask task, int? duration, string preview)
+ private static string SourceQuery(EncodeTask task, int? duration, string preview, int previewScanCount)
{
string query = string.Empty;
@@ -198,7 +190,7 @@ namespace HandBrake.ApplicationServices.Utilities
query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", task.StartPoint, calculatedDuration);
break;
case PointToPointMode.Preview: // Preview
- query += " --previews " + UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount) + " ";
+ query += " --previews " + previewScanCount + " ";
query += " --start-at-preview " + preview;
query += " --stop-at duration:" + duration + " ";
break;
@@ -946,19 +938,24 @@ namespace HandBrake.ApplicationServices.Utilities
/// <summary>
/// Generate the Command Line Arguments for any additional advanced options.
/// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <param name="disableLibdvdNav">
+ /// The disable Libdvd Nav.
+ /// </param>
/// <returns>
/// A Cli Query as a string
/// </returns>
- private static string ExtraSettings()
+ private static string ExtraSettings(int verbosity, bool disableLibdvdNav)
{
string query = string.Empty;
// Verbosity Level
- int verbosity = UserSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity);
query += string.Format(" --verbose={0}", verbosity);
// LibDVDNav
- if (UserSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
+ if (disableLibdvdNav)
query += " --no-dvdnav";
return query;
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 5f65b26ce..f262ea7e3 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -298,7 +298,7 @@ namespace HandBrakeWPF.ViewModels
set
{
- if (!Equals(this.statusLabel, value))
+ if (!Equals(this.programStatusLabel, value))
{
this.programStatusLabel = value;
this.NotifyOfPropertyChange(() => this.ProgramStatusLabel);
@@ -1120,7 +1120,10 @@ namespace HandBrakeWPF.ViewModels
public void ShowCliQuery()
{
this.errorService.ShowMessageBox(
- QueryGeneratorUtility.GenerateQuery(this.CurrentTask),
+ QueryGeneratorUtility.GenerateQuery(this.CurrentTask,
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
+ userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
+ userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav)),
"CLI Query",
MessageBoxButton.OK,
MessageBoxImage.Information);
@@ -1362,7 +1365,7 @@ namespace HandBrakeWPF.ViewModels
if (filename != null)
{
- PlistUtility.Export(savefiledialog.FileName, this.selectedPreset);
+ PlistUtility.Export(savefiledialog.FileName, this.selectedPreset, userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild).ToString());
}
}
else
@@ -1645,15 +1648,18 @@ namespace HandBrakeWPF.ViewModels
Execute.OnUIThread(
() =>
{
- this.ProgramStatusLabel =
- string.Format(
- "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}, Pending Jobs {5}",
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
- e.ElapsedTime,
- this.queueProcessor.QueueManager.Count);
+ if (this.IsEncoding)
+ {
+ this.ProgramStatusLabel =
+ string.Format(
+ "{0:00.00}%, FPS: {1:000.0}, Avg FPS: {2:000.0}, Time Remaining: {3}, Elapsed: {4:hh\\:mm\\:ss}, Pending Jobs {5}",
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
+ e.ElapsedTime,
+ this.queueProcessor.QueueManager.Count);
+ }
});
}