diff options
Diffstat (limited to 'win/CS/HandBrakeWPF')
15 files changed, 264 insertions, 15 deletions
diff --git a/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs b/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs index 3fa93fe7e..03155d0b5 100644 --- a/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs +++ b/win/CS/HandBrakeWPF/EventArgs/QueueProgressEventArgs.cs @@ -13,6 +13,8 @@ namespace HandBrakeWPF.EventArgs using HandBrake.ApplicationServices.Model;
+ using HandBrakeWPF.Services.Queue.Model;
+
/// <summary>
/// Queue Progress Event Args
/// </summary>
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index f8e754663..e0d3979e2 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -154,7 +154,7 @@ <Compile Include="Model\Subtitles\SubtitleBurnInBehaviourModes.cs" />
<Compile Include="Model\Subtitles\SubtitleBehaviourModes.cs" />
<Compile Include="Model\Subtitles\SubtitleBehaviours.cs" />
- <Compile Include="Services\Interfaces\IQueueProcessor.cs" />
+ <Compile Include="Services\Queue\Interfaces\IQueueProcessor.cs" />
<Compile Include="Services\Presets\Factories\PlistPresetFactory.cs" />
<Compile Include="Helpers\FileHelper.cs" />
<Compile Include="Services\Presets\Model\Preset.cs" />
@@ -164,7 +164,10 @@ <Compile Include="Services\Interfaces\IUserSettingService.cs" />
<Compile Include="Services\Presets\Model\PresetContainer.cs" />
<Compile Include="Services\Presets\PresetService.cs" />
- <Compile Include="Services\QueueProcessor.cs" />
+ <Compile Include="Services\Queue\Model\QueueTaskContainer.cs" />
+ <Compile Include="Services\Queue\QueueProcessor.cs" />
+ <Compile Include="Services\Queue\Model\QueueItemStatus.cs" />
+ <Compile Include="Services\Queue\Model\QueueTask.cs" />
<Compile Include="Services\UserSettingService.cs" />
<Compile Include="Utilities\AppcastReader.cs" />
<Compile Include="Utilities\DelayedActionProcessor.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs index e73251b07..d2d9f1322 100644 --- a/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/QueueRecoveryHelper.cs @@ -22,8 +22,9 @@ namespace HandBrakeWPF.Helpers using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Queue.Model;
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
/// <summary>
/// Queue Recovery Helper
diff --git a/win/CS/HandBrakeWPF/Services/NotificationService.cs b/win/CS/HandBrakeWPF/Services/NotificationService.cs index d85a63d42..33870fe14 100644 --- a/win/CS/HandBrakeWPF/Services/NotificationService.cs +++ b/win/CS/HandBrakeWPF/Services/NotificationService.cs @@ -14,7 +14,7 @@ namespace HandBrakeWPF.Services using HandBrakeWPF.Services.Interfaces;
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
/// <summary>
/// The Notification Service (Growl Connector)
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs index 5bb8ca0ad..45889207f 100644 --- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs +++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs @@ -20,6 +20,7 @@ namespace HandBrakeWPF.Services using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Queue.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
using Execute = Caliburn.Micro.Execute;
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IQueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueProcessor.cs index b04c825d9..aaeb37708 100644 --- a/win/CS/HandBrakeWPF/Services/Interfaces/IQueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueProcessor.cs @@ -7,14 +7,15 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrakeWPF.Services.Interfaces
+namespace HandBrakeWPF.Services.Queue.Interfaces
{
using System;
using System.ComponentModel;
- using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Interfaces;
+ using HandBrakeWPF.Services.Queue.Model;
+
/// <summary>
/// The Queue Processor
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueItemStatus.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueItemStatus.cs new file mode 100644 index 000000000..c60945abd --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueItemStatus.cs @@ -0,0 +1,39 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueItemStatus.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>
+// Queue Item Status
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model
+{
+ using System.ComponentModel;
+ using System.ComponentModel.DataAnnotations;
+
+ using HandBrake.ApplicationServices.Converters;
+
+ /// <summary>
+ /// Queue Item Status
+ /// </summary>
+ [TypeConverter(typeof(EnumToDescConverter))]
+ public enum QueueItemStatus
+ {
+ [Description("Waiting")]
+ [Display(Name = "Waiting")]
+ Waiting = 0,
+
+ [Description("In Progress")]
+ [Display(Name = "In Progress")]
+ InProgress,
+
+ [Description("Completed")]
+ [Display(Name = "Completed")]
+ Completed,
+
+ [Description("Error")]
+ [Display(Name = "Error")]
+ Error,
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs new file mode 100644 index 000000000..f11cb9b8d --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs @@ -0,0 +1,154 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueTask.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>
+// The QueueTask.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services.Queue.Model
+{
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services.Encode.Model;
+ using HandBrake.ApplicationServices.Utilities;
+
+ /// <summary>
+ /// The QueueTask.
+ /// </summary>
+ public class QueueTask : PropertyChangedBase
+ {
+ #region Constants and Fields
+
+ /// <summary>
+ /// The status.
+ /// </summary>
+ private QueueItemStatus status;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueTask"/> class.
+ /// </summary>
+ public QueueTask()
+ {
+ this.Status = QueueItemStatus.Waiting;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueTask"/> class.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ /// <param name="scannedSourcePath">
+ /// The scanned Source Path.
+ /// </param>
+ public QueueTask(EncodeTask task, HBConfiguration configuration, string scannedSourcePath)
+ {
+ this.Task = task;
+ this.Configuration = configuration;
+ this.Status = QueueItemStatus.Waiting;
+ this.ScannedSourcePath = scannedSourcePath;
+ }
+
+ /// <summary>
+ /// Gets or sets ScannedSource.
+ /// </summary>
+ public string ScannedSourcePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets Status.
+ /// </summary>
+ public QueueItemStatus Status
+ {
+ get
+ {
+ return this.status;
+ }
+
+ set
+ {
+ this.status = value;
+ this.NotifyOfPropertyChange(() => this.Status);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the task.
+ /// </summary>
+ public EncodeTask Task { get; set; }
+
+ /// <summary>
+ /// Gets or sets the configuration.
+ /// </summary>
+ public HBConfiguration Configuration { get; set; }
+
+ #endregion
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="other">
+ /// The other.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ protected bool Equals(QueueTask other)
+ {
+ return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status;
+ }
+
+ /// <summary>
+ /// The equals.
+ /// </summary>
+ /// <param name="obj">
+ /// The obj.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj.GetType() != this.GetType())
+ {
+ return false;
+ }
+
+ return this.Equals((QueueTask)obj);
+ }
+
+ /// <summary>
+ /// The get hash code.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="int"/>.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = (this.ScannedSourcePath != null ? this.ScannedSourcePath.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (int)this.status;
+ return hashCode;
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTaskContainer.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTaskContainer.cs new file mode 100644 index 000000000..0509cd088 --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTaskContainer.cs @@ -0,0 +1,42 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueTaskContainer.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>
+// The queue task container.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services.Queue.Model
+{
+ /// <summary>
+ /// The queue task container.
+ /// </summary>
+ public class QueueTaskContainer
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="QueueTaskContainer"/> class.
+ /// </summary>
+ /// <param name="version">
+ /// The version.
+ /// </param>
+ /// <param name="queuetask">
+ /// The queuetask.
+ /// </param>
+ public QueueTaskContainer(int version, string queuetask)
+ {
+ Version = version;
+ QueueTask = queuetask;
+ }
+
+ /// <summary>
+ /// Gets or sets the version of the presets stored in this container.
+ /// </summary>
+ public int Version { get; set; }
+
+ /// <summary>
+ /// Gets or sets the presets. This is a serialised string.
+ /// </summary>
+ public string QueueTask { get; set; }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Services/QueueProcessor.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs index 0507f7307..797d74e08 100644 --- a/win/CS/HandBrakeWPF/Services/QueueProcessor.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs @@ -7,7 +7,7 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrakeWPF.Services
+namespace HandBrakeWPF.Services.Queue
{
using System;
using System.Collections.Generic;
@@ -16,23 +16,23 @@ namespace HandBrakeWPF.Services using System.Linq;
using System.Xml.Serialization;
- using Caliburn.Micro;
-
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.EventArgs;
using HandBrake.ApplicationServices.Services.Encode.Interfaces;
using HandBrake.ApplicationServices.Utilities;
+ using HandBrakeWPF.Services.Queue.Model;
+
using Execute = Caliburn.Micro.Execute;
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
using QueueCompletedEventArgs = HandBrakeWPF.EventArgs.QueueCompletedEventArgs;
using QueueProgressEventArgs = HandBrakeWPF.EventArgs.QueueProgressEventArgs;
/// <summary>
/// The HandBrake Queue
/// </summary>
- public class QueueProcessor : IQueueProcessor
+ public class QueueProcessor : Interfaces.IQueueProcessor
{
#region Constants and Fields
@@ -588,7 +588,7 @@ namespace HandBrakeWPF.Services if (job != null)
{
this.InvokeJobProcessingStarted(new QueueProgressEventArgs(job));
- this.EncodeService.Start(job);
+ this.EncodeService.Start(job.Task, job.Configuration);
}
else
{
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs index e51dc1707..0fd29950e 100644 --- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs @@ -36,6 +36,8 @@ namespace HandBrakeWPF.Startup using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Queue;
+ using HandBrakeWPF.Services.Queue.Interfaces;
/// <summary>
/// The Castle Bootstrapper
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 4c9921459..2ba9744f6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -44,6 +44,7 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Services.Presets.Factories;
using HandBrakeWPF.Services.Presets.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
+ using HandBrakeWPF.Services.Queue.Model;
using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
using HandBrakeWPF.Views;
@@ -53,7 +54,7 @@ namespace HandBrakeWPF.ViewModels using Ookii.Dialogs.Wpf;
using Execute = Caliburn.Micro.Execute;
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
/// <summary>
/// HandBrakes Main Window
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 7191ad9b5..52c51419b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -22,6 +22,8 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Queue.Interfaces;
+ using HandBrakeWPF.Services.Queue.Model;
using HandBrakeWPF.ViewModels.Interfaces;
using Microsoft.Win32;
diff --git a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs index 4d505b83d..11a9d8715 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ShellViewModel.cs @@ -18,7 +18,7 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
- using IQueueProcessor = HandBrakeWPF.Services.Interfaces.IQueueProcessor;
+ using IQueueProcessor = HandBrakeWPF.Services.Queue.Interfaces.IQueueProcessor;
/// <summary>
/// The Shell View Model
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 3a3b4e6eb..7e6cc2525 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -33,6 +33,7 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Properties;
using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
+ using HandBrakeWPF.Services.Queue.Model;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -638,7 +639,7 @@ namespace HandBrakeWPF.ViewModels this.encodeService.EncodeCompleted += this.encodeService_EncodeCompleted;
this.encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;
- this.encodeService.Start((QueueTask)state);
+ this.encodeService.Start(((QueueTask)state).Task, ((QueueTask)state).Configuration);
this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);
}
#endregion
|