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/Queue/Model | |
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/Queue/Model')
3 files changed, 235 insertions, 0 deletions
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; }
+ }
+}
|