diff options
author | sr55 <[email protected]> | 2015-04-12 14:25:56 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-04-12 14:25:56 +0000 |
commit | ca97a5f5239a29e87470509add1fd68099e35f2c (patch) | |
tree | 11bcfc445eedfab7859a47c7038e6a800169370d /win/CS/HandBrakeWPF/Services | |
parent | 6f27f7d0d9d11012cce503052c96946c35a196a8 (diff) |
WinGui: Some further refactoring of the services library. Moving all the queueing functionality up to app layer for now.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7086 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/NotificationService.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/PrePostActionService.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueProcessor.cs (renamed from win/CS/HandBrakeWPF/Services/Interfaces/IQueueProcessor.cs) | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueItemStatus.cs | 39 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs | 154 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/Model/QueueTaskContainer.cs | 42 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Queue/QueueProcessor.cs (renamed from win/CS/HandBrakeWPF/Services/QueueProcessor.cs) | 12 |
7 files changed, 246 insertions, 9 deletions
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
{
|