]> granicus.if.org Git - handbrake/commitdiff
WinGui: Started work on API improvements in the Application services dll. Removing...
authorsr55 <sr55.hb@outlook.com>
Tue, 19 Nov 2013 21:55:44 +0000 (21:55 +0000)
committersr55 <sr55.hb@outlook.com>
Tue, 19 Nov 2013 21:55:44 +0000 (21:55 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5896 b64f7644-9d1e-0410-96f1-a4d463321fa5

23 files changed:
win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs [new file with mode: 0644]
win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs
win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
win/CS/HandBrake.ApplicationServices/Services/Encode.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
win/CS/HandBrakeWPF/UserSettingConstants.cs
win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs

index f5ca3bef565b6c7b74098f2868400428a6225991..a03bf58d9a5ec6e2b8206c61a7200d5934ac35ce 100644 (file)
@@ -44,11 +44,6 @@ namespace HandBrake.ApplicationServices
         /// </summary>\r
         public const string HandBrakeBuild = "HandBrakeBuild";\r
 \r
-        /// <summary>\r
-        /// Disable Libdvdnav\r
-        /// </summary>\r
-        public const string DisableLibDvdNav = "DisableLibDvdNav";\r
-\r
         /// <summary>\r
         /// Min Title Scan Duration\r
         /// </summary>\r
index 473ae68931ed3017af2c447733ed93248b29a07a..e9386ac37c95dc33014310701336420225c8e596 100644 (file)
@@ -97,6 +97,7 @@
     <Compile Include="Isolation\BackgroundServiceConnector.cs" />\r
     <Compile Include="Isolation\IsolatedEncodeService.cs" />\r
     <Compile Include="LibHb\AudioVideoHelpers.cs" />\r
+    <Compile Include="Model\HBConfiguration.cs" />\r
     <Compile Include="Model\VideoScaler.cs" />\r
     <Compile Include="Services\Interfaces\IEncodeServiceWrapper.cs" />\r
     <Compile Include="Services\Interfaces\IHbServiceCallback.cs" />\r
index 2f29d705442f60c0db5736c13bbff459b942558e..bc31544a4a585bb36c845236f94e20056c8120f1 100644 (file)
@@ -173,13 +173,10 @@ namespace HandBrake.ApplicationServices.Isolation
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable Logging.\r
-        /// </param>\r
-        public void Start(QueueTask job, bool enableLogging)\r
+        public void Start(QueueTask job)\r
         {\r
             ThreadPool.QueueUserWorkItem(\r
-                delegate { this.Service.StartEncode(job, enableLogging); });\r
+                delegate { this.Service.StartEncode(job); });\r
         }\r
 \r
         /// <summary>\r
diff --git a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
new file mode 100644 (file)
index 0000000..35d07dc
--- /dev/null
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="HBConfiguration.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   HandBrakes Configuration options\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Model\r
+{\r
+    /// <summary>\r
+    /// HandBrakes configuration options\r
+    /// </summary>\r
+    public class HBConfiguration\r
+    {\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether is logging enabled.\r
+        /// </summary>\r
+        public bool IsLoggingEnabled { get; set; }\r
+\r
+        /// <summary>\r
+        /// Gets or sets a value indicating whether is dvd nav disabled.\r
+        /// </summary>\r
+        public bool IsDvdNavDisabled { get; set; }\r
+    }\r
+}\r
index 84e9eee9fe1fd6e6a3165f3dd88c1ef5f31eb75b..68f32011a56450523bd475c8de1624449b482b84 100644 (file)
@@ -38,14 +38,25 @@ namespace HandBrake.ApplicationServices.Model
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets ScannedSource.\r
+        /// Initializes a new instance of the <see cref="QueueTask"/> class.\r
         /// </summary>\r
-        public Source ScannedSource { get; set; } \r
+        /// <param name="task">\r
+        /// The task.\r
+        /// </param>\r
+        /// <param name="configuration">\r
+        /// The configuration.\r
+        /// </param>\r
+        public QueueTask(EncodeTask task, HBConfiguration configuration)\r
+        {\r
+            this.Task = task;\r
+            this.Configuration = configuration;\r
+            this.Status = QueueItemStatus.Waiting;\r
+        }\r
 \r
         /// <summary>\r
-        /// Gets or sets a value indicating whether if this is a user or GUI generated query\r
+        /// Gets or sets ScannedSource.\r
         /// </summary>\r
-        public bool CustomQuery { get; set; }\r
+        public Source ScannedSource { get; set; } \r
 \r
         /// <summary>\r
         /// Gets or sets Status.\r
@@ -65,10 +76,15 @@ namespace HandBrake.ApplicationServices.Model
         }\r
 \r
         /// <summary>\r
-        /// Gets or sets the Encode Task.\r
+        /// Gets the task.\r
         /// </summary>\r
         public EncodeTask Task { get; set; }\r
 \r
+        /// <summary>\r
+        /// Gets the configuration.\r
+        /// </summary>\r
+        public HBConfiguration Configuration { get; set; }\r
+\r
         #endregion\r
 \r
         /// <summary>\r
@@ -82,7 +98,7 @@ namespace HandBrake.ApplicationServices.Model
         /// </returns>\r
         protected bool Equals(QueueTask other)\r
         {\r
-            return Equals(this.ScannedSource, other.ScannedSource) && this.CustomQuery.Equals(other.CustomQuery) && Equals(this.Task, other.Task) && this.status == other.status;\r
+            return Equals(this.ScannedSource, other.ScannedSource) && Equals(this.Task, other.Task) && this.status == other.status;\r
         }\r
 \r
         /// <summary>\r
@@ -125,7 +141,6 @@ namespace HandBrake.ApplicationServices.Model
             unchecked\r
             {\r
                 int hashCode = (this.ScannedSource != null ? this.ScannedSource.GetHashCode() : 0);\r
-                hashCode = (hashCode * 397) ^ this.CustomQuery.GetHashCode();\r
                 hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0);\r
                 hashCode = (hashCode * 397) ^ (int)this.status;\r
                 return hashCode;\r
index 58f67401e6bc2d5d32c2d74fa6cecfa7e9d92a4c..f1a94a05bc2cc9b28679e48115543cc33784ea5e 100644 (file)
@@ -323,13 +323,12 @@ namespace HandBrake.ApplicationServices.Services.Base
                 string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task),\r
                     userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                     userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
-                    userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),\r
+                    encodeQueueTask.Configuration.IsDvdNavDisabled,\r
                     userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),\r
                                        userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);\r
                 this.logBuffer = new StringBuilder();\r
                 this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));\r
-                this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));\r
                 this.logBuffer.AppendLine();\r
 \r
                 // Clear the current Encode Logs)\r
@@ -346,7 +345,6 @@ namespace HandBrake.ApplicationServices.Services.Base
                 this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };\r
                 this.fileWriter.WriteLine(header);\r
                 this.fileWriter.WriteLine(string.Format("CLI Query: {0}", query));\r
-                this.fileWriter.WriteLine(string.Format("User Query: {0}", encodeQueueTask.CustomQuery));\r
                 this.fileWriter.WriteLine();\r
             }\r
             catch (Exception)\r
index 5ad95d08e76163f8f0984202975f52033d90a72d..08394b88c5ec1a3bcf2a5351ae7b0fa6ae73fe3c 100644 (file)
@@ -96,10 +96,7 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="encodeQueueTask">\r
         /// The encodeQueueTask.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// Enable Logging. When Disabled we onlt parse Standard Ouput for progress info. Standard Error log data is ignored.\r
-        /// </param>\r
-        public void Start(QueueTask encodeQueueTask, bool enableLogging)\r
+        public void Start(QueueTask encodeQueueTask)\r
         {\r
             try\r
             {\r
@@ -111,7 +108,7 @@ namespace HandBrake.ApplicationServices.Services
                 this.IsEncoding = true;\r
                 this.currentTask = encodeQueueTask;\r
 \r
-                if (enableLogging)\r
+                if (encodeQueueTask.Configuration.IsLoggingEnabled)\r
                 {\r
                     try\r
                     {\r
@@ -137,12 +134,12 @@ namespace HandBrake.ApplicationServices.Services
                                        this.currentTask.Task.PreviewEncodeStartAt,\r
                                        userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                                        userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
-                                       userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),\r
+                                       encodeQueueTask.Configuration.IsDvdNavDisabled,\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding))\r
                                    : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),\r
                                    userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                                    userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
-                                   userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),\r
+                                   encodeQueueTask.Configuration.IsDvdNavDisabled,\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),\r
                                        userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);\r
@@ -150,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services
                 ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)\r
                 {\r
                     RedirectStandardOutput = true,\r
-                    RedirectStandardError = enableLogging,\r
+                    RedirectStandardError = encodeQueueTask.Configuration.IsLoggingEnabled,\r
                     UseShellExecute = false,\r
                     CreateNoWindow = true\r
                 };\r
@@ -161,7 +158,7 @@ namespace HandBrake.ApplicationServices.Services
 \r
                 this.startTime = DateTime.Now;\r
 \r
-                if (enableLogging)\r
+                if (encodeQueueTask.Configuration.IsLoggingEnabled)\r
                 {\r
                     this.HbProcess.ErrorDataReceived += this.HbProcErrorDataReceived;\r
                     this.HbProcess.BeginErrorReadLine();\r
index 8d70247f7f6abcd15311213411828851b5f7e9ee..17cf2e7f89ea6882c62a3ef9af7cea6e8c4ad316 100644 (file)
@@ -82,10 +82,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable Logging.\r
-        /// </param>\r
-        void Start(QueueTask job, bool enableLogging);\r
+        void Start(QueueTask job);\r
 \r
         /// <summary>\r
         /// The pause.\r
index 78572858256473121b6ce28d4bbc9c3edc736777..d1049ba49b0ab0fa30afbbbfc6bdd2e44bccf5a9 100644 (file)
@@ -12,6 +12,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
     using System;\r
 \r
     using HandBrake.ApplicationServices.EventArgs;\r
+    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Parsing;\r
 \r
     /// <summary>\r
@@ -87,7 +88,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// <param name="postAction">\r
         /// The post Action.\r
         /// </param>\r
-        void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction);\r
+        /// <param name="configuration">\r
+        /// The configuraiton.\r
+        /// </param>\r
+        void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuration);\r
 \r
         /// <summary>\r
         /// Kill the scan\r
index 9aa1f1cb77acdd5b2e9821e3b68d6f8f3f9a842e..9351ab03d538ef8055a2c13b925d5d9d83900d72 100644 (file)
@@ -54,11 +54,8 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable logging.\r
-        /// </param>\r
         [OperationContract]\r
-        void StartEncode(QueueTask job, bool enableLogging);\r
+        void StartEncode(QueueTask job);\r
 \r
         /// <summary>\r
         /// The process encode logs.\r
index f6da448acd3e5df88c9ce20eabe1fd5b0418d6d3..744bbc890eaecade7d6b1a56cc475da7ae189c76 100644 (file)
@@ -95,14 +95,11 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable Logging.\r
-        /// </param>\r
-        public void Start(QueueTask job, bool enableLogging)\r
+        public void Start(QueueTask job)\r
         {\r
             // Setup\r
             this.startTime = DateTime.Now;\r
-            this.loggingEnabled = enableLogging;\r
+            this.loggingEnabled = job.Configuration.IsLoggingEnabled;\r
             this.currentTask = job;\r
 \r
             // Create a new HandBrake instance\r
@@ -123,7 +120,7 @@ namespace HandBrake.ApplicationServices.Services
                 this.IsEncoding = true;\r
 \r
                 // Enable logging if required.\r
-                if (enableLogging)\r
+                if (job.Configuration.IsLoggingEnabled)\r
                 {\r
                     try\r
                     {\r
index 7064cc6439cd179f548c9ec331b48d30cccf3e7a..6a372f2288948b4d973618e968ac926564310450 100644 (file)
@@ -15,6 +15,7 @@ namespace HandBrake.ApplicationServices.Services
     using System.Text;\r
 \r
     using HandBrake.ApplicationServices.EventArgs;\r
+    using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Model.Encoding;\r
     using HandBrake.ApplicationServices.Parsing;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
@@ -175,7 +176,10 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="postAction">\r
         /// The post Action.\r
         /// </param>\r
-        public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction)\r
+        /// <param name="configuraiton">\r
+        /// The configuraiton.\r
+        /// </param>\r
+        public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuraiton)\r
         {\r
             // Try to cleanup any previous scan instances.\r
             if (instance != null)\r
@@ -223,7 +227,7 @@ namespace HandBrake.ApplicationServices.Services
             instance.ScanCompleted += this.InstanceScanCompleted;\r
 \r
             // Start the scan on a back\r
-            this.ScanSource(sourcePath, title, previewCount);\r
+            this.ScanSource(sourcePath, title, previewCount, configuraiton);\r
         }\r
 \r
         /// <summary>\r
@@ -263,7 +267,10 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="previewCount">\r
         /// The preview Count.\r
         /// </param>\r
-        private void ScanSource(object sourcePath, int title, int previewCount)\r
+        /// <param name="configuraiton">\r
+        /// The configuraiton.\r
+        /// </param>\r
+        private void ScanSource(object sourcePath, int title, int previewCount, HBConfiguration configuraiton)\r
         {\r
             try\r
             {\r
@@ -281,7 +288,7 @@ namespace HandBrake.ApplicationServices.Services
                     TimeSpan.FromSeconds(\r
                         this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration));\r
 \r
-                HandBrakeUtils.SetDvdNav(!this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));\r
+                HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);\r
 \r
                 this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0);\r
             }\r
index d80a485ecd951795c780f35613258603b6de6239..eb173c5b3d5aa075fcaac3f1fb5f3fc8bedfd077 100644 (file)
@@ -581,7 +581,7 @@ namespace HandBrake.ApplicationServices.Services
             if (job != null)\r
             {\r
                 this.InvokeJobProcessingStarted(new QueueProgressEventArgs(job));\r
-                this.EncodeService.Start(job, true);\r
+                this.EncodeService.Start(job);\r
             }\r
             else\r
             {\r
index ab0acd596b91bc7dc6910a22ec28ce892ad92900..0fd2ef4b136087d09a49f36287b9c0d3b1484c5d 100644 (file)
@@ -115,16 +115,13 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable logging.\r
-        /// </param>\r
-        public void StartEncode(QueueTask job, bool enableLogging)\r
+        public void StartEncode(QueueTask job)\r
         {\r
             Console.WriteLine("Starting Source Encode for: " + job.Task.Source);\r
             encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;\r
             encodeService.EncodeStarted += this.encodeService_EncodeStarted;\r
             encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;\r
-            encodeService.Start(job, enableLogging);\r
+            encodeService.Start(job);\r
         }\r
 \r
         /// <summary>\r
index 5dee884263629d85e87d8545fabc4942f20ac9bd..30c1e9eb745c48383d2e5615ca5f89a8976dac7a 100644 (file)
@@ -957,24 +957,24 @@ namespace HandBrake.ApplicationServices.Utilities
                     {\r
                         query += string.Format(" -x {0}", task.ExtraAdvancedArguments);\r
                     }\r
-                }
-            }
-
-            // QSV Only
-            if (task.VideoEncoder == VideoEncoder.QuickSync)
-            {
-                query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower());
-            }
-
-            // options that apply to all encoders
-            if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
-            {
-                query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
-            }
-
-            // Options that apply to both x264 and QuickSync
-            if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
-            {
+                }\r
+            }\r
+\r
+            // QSV Only\r
+            if (task.VideoEncoder == VideoEncoder.QuickSync)\r
+            {\r
+                query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower());\r
+            }\r
+\r
+            // options that apply to all encoders\r
+            if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))\r
+            {\r
+                query += string.Format(" -x {0}", task.AdvancedEncoderOptions);\r
+            }\r
+\r
+            // Options that apply to both x264 and QuickSync\r
+            if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)\r
+            {\r
                 // when using x264 with the advanced panel, the H.264 profile/level widgets are disabled\r
                 if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))\r
                 {\r
@@ -985,15 +985,15 @@ namespace HandBrake.ApplicationServices.Utilities
                     if (task.H264Profile != x264Profile.None)\r
                     {\r
                         query += string.Format(\r
-                            " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
-                    }
-                }
-            }
-
-            return query;
-        }
-
-        /// <summary>
+                            " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));\r
+                    }\r
+                }\r
+            }\r
+\r
+            return query;\r
+        }\r
+\r
+        /// <summary>\r
         /// Generate the Command Line Arguments for any additional advanced options.\r
         /// </summary>\r
         /// <param name="verbosity">\r
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
new file mode 100644 (file)
index 0000000..8c353bb
--- /dev/null
@@ -0,0 +1,58 @@
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="HBConfigurationFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
+//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+//   HBConfiguration Factory\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Factories\r
+{\r
+    using Caliburn.Micro;\r
+\r
+    using HandBrake.ApplicationServices.Model;\r
+    using HandBrake.ApplicationServices.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// HBConfiguration Factory\r
+    /// </summary>\r
+    public class HBConfigurationFactory\r
+    {\r
+        /// <summary>\r
+        /// The user setting service.\r
+        /// </summary>\r
+        private static readonly IUserSettingService UserSettingService = IoC.Get<IUserSettingService>();\r
+\r
+        /// <summary>\r
+        /// The create.\r
+        /// </summary>\r
+        /// <param name="isLoggingEnabled">\r
+        /// The is logging enabled.\r
+        /// </param>\r
+        /// <returns>\r
+        /// The <see cref="HBConfiguration"/>.\r
+        /// </returns>\r
+        public static HBConfiguration Create(bool isLoggingEnabled)\r
+        {\r
+            HBConfiguration config = new HBConfiguration\r
+                                         {\r
+                                             IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),\r
+                                             IsLoggingEnabled = isLoggingEnabled\r
+                                         };\r
+\r
+            return config;\r
+        }\r
+\r
+        /// <summary>\r
+        /// The create.\r
+        /// </summary>\r
+        /// <returns>\r
+        /// The <see cref="HBConfiguration"/>.\r
+        /// </returns>\r
+        public static HBConfiguration Create()\r
+        {\r
+            return Create(true);\r
+        }\r
+    }\r
+}\r
index 44296ceeebf90955d9a58645e4dc6328af2e8d8a..d6eb106410abbc82bc3748e9bf6dcb9cc7c9f4e7 100644 (file)
     <Compile Include="Constants.cs" />\r
     <Compile Include="Controls\SplitButton\SplitMenuButton.cs" />\r
     <Compile Include="Converters\Video\ScalingConverter.cs" />\r
+    <Compile Include="Factories\HBConfigurationFactory.cs" />\r
     <Compile Include="ViewModels\CountdownAlertViewModel.cs" />\r
     <Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />\r
     <Compile Include="Views\CountdownAlertView.xaml.cs">\r
index 1fe1a448e098064dcd11dccd62bbd3ecac9c1689..c7247a7c79fe3a8c8ab46f41be811b17e66bd3a0 100644 (file)
@@ -187,12 +187,9 @@ namespace HandBrakeWPF.Services
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
-        /// <param name="enableLogging">\r
-        /// The enable Logging.\r
-        /// </param>\r
-        public void Start(QueueTask job, bool enableLogging)\r
+        public void Start(QueueTask job)\r
         {\r
-            this.encodeService.Start(job, enableLogging);\r
+            this.encodeService.Start(job);\r
         }\r
 \r
         /// <summary>\r
index 14b712ddf329e6d98c9bbd7ed6b39350a08803e7..ac876e6bfbbcb91b2904031a5e133cbf91a7c60b 100644 (file)
@@ -246,6 +246,11 @@ namespace HandBrakeWPF
         /// </summary>\r
         public const string AddForeignAudioScanTrack = "AddForeignAudioScanTrack";\r
 \r
+        /// <summary>\r
+        /// The disable lib dvd nav.\r
+        /// </summary>\r
+        public const string DisableLibDvdNav = "DisableLibDvdNav";\r
+\r
         #endregion\r
     }\r
 }
\ No newline at end of file
index c99fb1c5142c81a2b7cee77dff3c9610d540b01a..15c5df12799a37576414d5a617b2d248e92dfd0d 100644 (file)
@@ -29,6 +29,7 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices.Utilities;\r
 \r
     using HandBrakeWPF.Commands;\r
+    using HandBrakeWPF.Factories;\r
     using HandBrakeWPF.Helpers;\r
     using HandBrakeWPF.Model;\r
     using HandBrakeWPF.Services.Interfaces;\r
@@ -777,7 +778,8 @@ namespace HandBrakeWPF.ViewModels
                     filename, \r
                     title, \r
                     this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), \r
-                    null);\r
+                    null,\r
+                    HBConfigurationFactory.Create());\r
             }\r
         }\r
 \r
index e4e938be7d61bf2a2ba0ab14385b1ed2ab572e35..68e4077d7bc17f7544eae23e1edf486dead68052 100644 (file)
@@ -31,6 +31,7 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices.Utilities;\r
 \r
     using HandBrakeWPF.Commands;\r
+    using HandBrakeWPF.Factories;\r
     using HandBrakeWPF.Helpers;\r
     using HandBrakeWPF.Model;\r
     using HandBrakeWPF.Properties;\r
@@ -1087,7 +1088,7 @@ namespace HandBrakeWPF.ViewModels
                 return;\r
             }\r
 \r
-            QueueTask task = new QueueTask { Task = new EncodeTask(this.CurrentTask) };\r
+            QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());\r
             if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))\r
             {\r
                 this.queueProcessor.Add(task);\r
@@ -1284,11 +1285,7 @@ namespace HandBrakeWPF.ViewModels
             }\r
 \r
             // Create the Queue Task and Start Processing\r
-            QueueTask task = new QueueTask\r
-                {\r
-                    Task = new EncodeTask(this.CurrentTask),\r
-                    CustomQuery = false\r
-                };\r
+            QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());\r
             this.queueProcessor.Add(task);\r
             this.queueProcessor.Start();\r
             this.IsEncoding = true;\r
@@ -1304,7 +1301,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             // Rescan the source to make sure it's still valid\r
             this.queueEditTask = task;\r
-            this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction);\r
+            this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction, HBConfigurationFactory.Create());\r
         }\r
 \r
         /// <summary>\r
@@ -1341,7 +1338,7 @@ namespace HandBrakeWPF.ViewModels
                 QueryGeneratorUtility.GenerateQuery(this.CurrentTask,\r
                 userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),\r
                 userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),\r
-                userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),\r
+                HBConfigurationFactory.Create().IsDvdNavDisabled,\r
                     userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),\r
                                        userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),\r
                                        userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl),\r
@@ -1630,7 +1627,7 @@ namespace HandBrakeWPF.ViewModels
         {\r
             if (!string.IsNullOrEmpty(filename))\r
             {\r
-                this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);\r
+                this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null, HBConfigurationFactory.Create());\r
             }\r
         }\r
 \r
index 19d42918adf3a9978b72ff6925266f4820064531..fd7f0920c0d42339ad35b9d9c969d048ed7913ce 100644 (file)
@@ -1982,7 +1982,7 @@ namespace HandBrakeWPF.ViewModels
             this.MinLength = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration);\r
 \r
             // Use dvdnav\r
-            this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav);\r
+            this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);\r
 \r
             int port;\r
             int.TryParse(userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort), out port);\r
@@ -2064,7 +2064,7 @@ namespace HandBrakeWPF.ViewModels
                 this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value);\r
             }\r
 \r
-            userSettingService.SetUserSetting(ASUserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);\r
+            userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);\r
             userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);\r
             userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString(CultureInfo.InvariantCulture));\r
             userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);\r
index 39bc48090a0a17a9fd9f21444c811d4442a74849..9aba8e44260ede502abaeee34a2a382ce7ed8180 100644 (file)
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
     using HandBrake.ApplicationServices.Model.Encoding;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
 \r
+    using HandBrakeWPF.Factories;\r
     using HandBrakeWPF.Services;\r
     using HandBrakeWPF.Services.Interfaces;\r
     using HandBrakeWPF.ViewModels.Interfaces;\r
@@ -300,11 +301,7 @@ namespace HandBrakeWPF.ViewModels
             encodeTask.IsPreviewEncode = true;\r
             encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);\r
             encodeTask.PreviewEncodeDuration = this.Duration;\r
-            QueueTask task = new QueueTask\r
-                {\r
-                    Task = encodeTask,\r
-                };\r
-\r
+            QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(false));\r
             ThreadPool.QueueUserWorkItem(this.CreatePreview, task);\r
         }\r
 \r
@@ -389,7 +386,7 @@ namespace HandBrakeWPF.ViewModels
             this.encodeService.EncodeCompleted += this.encodeService_EncodeCompleted;\r
             this.encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;\r
 \r
-            this.encodeService.Start((QueueTask)state, false);\r
+            this.encodeService.Start((QueueTask)state);\r
             this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);\r
         }\r
         #endregion\r