summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-11-19 21:55:44 +0000
committersr55 <[email protected]>2013-11-19 21:55:44 +0000
commitf83ab26ab8e1d2ce277f0c12f23b5753bf63d763 (patch)
treef59a860b5a06effcdccc57dfa83629d171536864 /win/CS/HandBrakeWPF
parentca8fe7c1fe8abf869d4c53e31124c5f0b1aa8dfa (diff)
WinGui: Started work on API improvements in the Application services dll. Removing the concept of user settings and replacing it with a Configuration object.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5896 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs58
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs7
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs15
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs9
8 files changed, 80 insertions, 23 deletions
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
new file mode 100644
index 000000000..8c353bbdb
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
@@ -0,0 +1,58 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBConfigurationFactory.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// HBConfiguration Factory
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Factories
+{
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ /// <summary>
+ /// HBConfiguration Factory
+ /// </summary>
+ public class HBConfigurationFactory
+ {
+ /// <summary>
+ /// The user setting service.
+ /// </summary>
+ private static readonly IUserSettingService UserSettingService = IoC.Get<IUserSettingService>();
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <param name="isLoggingEnabled">
+ /// The is logging enabled.
+ /// </param>
+ /// <returns>
+ /// The <see cref="HBConfiguration"/>.
+ /// </returns>
+ public static HBConfiguration Create(bool isLoggingEnabled)
+ {
+ HBConfiguration config = new HBConfiguration
+ {
+ IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),
+ IsLoggingEnabled = isLoggingEnabled
+ };
+
+ return config;
+ }
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="HBConfiguration"/>.
+ /// </returns>
+ public static HBConfiguration Create()
+ {
+ return Create(true);
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 44296ceee..d6eb10641 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -140,6 +140,7 @@
<Compile Include="Constants.cs" />
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
+ <Compile Include="Factories\HBConfigurationFactory.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />
<Compile Include="Views\CountdownAlertView.xaml.cs">
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index 1fe1a448e..c7247a7c7 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -187,12 +187,9 @@ namespace HandBrakeWPF.Services
/// <param name="job">
/// The job.
/// </param>
- /// <param name="enableLogging">
- /// The enable Logging.
- /// </param>
- public void Start(QueueTask job, bool enableLogging)
+ public void Start(QueueTask job)
{
- this.encodeService.Start(job, enableLogging);
+ this.encodeService.Start(job);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index 14b712ddf..ac876e6bf 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -246,6 +246,11 @@ namespace HandBrakeWPF
/// </summary>
public const string AddForeignAudioScanTrack = "AddForeignAudioScanTrack";
+ /// <summary>
+ /// The disable lib dvd nav.
+ /// </summary>
+ public const string DisableLibDvdNav = "DisableLibDvdNav";
+
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
index c99fb1c51..15c5df127 100644
--- a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
@@ -29,6 +29,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
@@ -777,7 +778,8 @@ namespace HandBrakeWPF.ViewModels
filename,
title,
this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- null);
+ null,
+ HBConfigurationFactory.Create());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index e4e938be7..68e4077d7 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -31,6 +31,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Properties;
@@ -1087,7 +1088,7 @@ namespace HandBrakeWPF.ViewModels
return;
}
- QueueTask task = new QueueTask { Task = new EncodeTask(this.CurrentTask) };
+ QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))
{
this.queueProcessor.Add(task);
@@ -1284,11 +1285,7 @@ namespace HandBrakeWPF.ViewModels
}
// Create the Queue Task and Start Processing
- QueueTask task = new QueueTask
- {
- Task = new EncodeTask(this.CurrentTask),
- CustomQuery = false
- };
+ QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
this.queueProcessor.Add(task);
this.queueProcessor.Start();
this.IsEncoding = true;
@@ -1304,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);
+ this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction, HBConfigurationFactory.Create());
}
/// <summary>
@@ -1341,7 +1338,7 @@ namespace HandBrakeWPF.ViewModels
QueryGeneratorUtility.GenerateQuery(this.CurrentTask,
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),
+ HBConfigurationFactory.Create().IsDvdNavDisabled,
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl),
@@ -1630,7 +1627,7 @@ namespace HandBrakeWPF.ViewModels
{
if (!string.IsNullOrEmpty(filename))
{
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null, HBConfigurationFactory.Create());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 19d42918a..fd7f0920c 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1982,7 +1982,7 @@ namespace HandBrakeWPF.ViewModels
this.MinLength = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration);
// Use dvdnav
- this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav);
+ this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);
int port;
int.TryParse(userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort), out port);
@@ -2064,7 +2064,7 @@ namespace HandBrakeWPF.ViewModels
this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value);
}
- userSettingService.SetUserSetting(ASUserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
+ userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);
userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString(CultureInfo.InvariantCulture));
userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
index 39bc48090..9aba8e442 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -300,11 +301,7 @@ namespace HandBrakeWPF.ViewModels
encodeTask.IsPreviewEncode = true;
encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);
encodeTask.PreviewEncodeDuration = this.Duration;
- QueueTask task = new QueueTask
- {
- Task = encodeTask,
- };
-
+ QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(false));
ThreadPool.QueueUserWorkItem(this.CreatePreview, task);
}
@@ -389,7 +386,7 @@ namespace HandBrakeWPF.ViewModels
this.encodeService.EncodeCompleted += this.encodeService_EncodeCompleted;
this.encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;
- this.encodeService.Start((QueueTask)state, false);
+ this.encodeService.Start((QueueTask)state);
this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);
}
#endregion