summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services/Queue/Model
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-08-28 15:16:40 +0100
committersr55 <[email protected]>2017-08-28 15:16:40 +0100
commitec19d8520ea39761053cccb2744931f0195b7bba (patch)
treec141be678fb13ee103cc2831737eaad40734b0c9 /win/CS/HandBrakeWPF/Services/Queue/Model
parent871ffc2ed52c5480b4765a21d12e18173c1c0eac (diff)
WinGui: Putting in some back-end infrastructure into the queue screen to support future features + some misc tidy up.
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Queue/Model')
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs100
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs5
2 files changed, 105 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs
new file mode 100644
index 000000000..857feb924
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs
@@ -0,0 +1,100 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QueueStats.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>
+// A file to record stats about a queue task.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services.Queue.Model
+{
+ using System;
+
+ using Caliburn.Micro;
+
+ public class QueueStats : PropertyChangedBase
+ {
+ private DateTime startTime;
+
+ private DateTime endTime;
+
+ private long? finalFileSize;
+
+ public QueueStats()
+ {
+ }
+
+ public DateTime StartTime
+ {
+ get
+ {
+ return this.startTime;
+ }
+ set
+ {
+ if (value.Equals(this.startTime)) return;
+ this.startTime = value;
+ this.NotifyOfPropertyChange(() => this.StartTime);
+ this.NotifyOfPropertyChange(() => this.Duration);
+ }
+ }
+
+ public DateTime EndTime
+ {
+ get
+ {
+ return this.endTime;
+ }
+ set
+ {
+ if (value.Equals(this.endTime)) return;
+ this.endTime = value;
+ this.NotifyOfPropertyChange(() => this.EndTime);
+ this.NotifyOfPropertyChange(() => this.Duration);
+ }
+ }
+
+ public TimeSpan Duration
+ {
+ get
+ {
+ // TODO, take into account Paused Duration. Requires some refactoring first.
+ return this.EndTime - this.StartTime;
+ }
+ }
+
+ /// <summary>
+ /// Final filesize in Bytes
+ /// </summary>
+ public long? FinalFileSize
+ {
+ get
+ {
+ return this.finalFileSize;
+ }
+ set
+ {
+ if (value == this.finalFileSize) return;
+ this.finalFileSize = value;
+ this.NotifyOfPropertyChange(() => this.FinalFileSize);
+ this.NotifyOfPropertyChange(() => this.FinalFileSizeInMegaBytes);
+ }
+ }
+
+ public long? FinalFileSizeInMegaBytes
+ {
+ get
+ {
+ if (this.finalFileSize.HasValue)
+ {
+ return this.finalFileSize / 1024 / 1024;
+ }
+
+ return 0;
+ }
+ }
+
+ public string CompletedActivityLogPath { get; set; }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
index be3a8a4b9..334842d31 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs
@@ -35,6 +35,7 @@ namespace HandBrakeWPF.Services.Queue.Model
this.Status = QueueItemStatus.Waiting;
id = id + 1;
this.Id = string.Format("{0}.{1}", GeneralUtilities.ProcessId, id);
+ this.Statistics = new QueueStats();
}
/// <summary>
@@ -58,6 +59,8 @@ namespace HandBrakeWPF.Services.Queue.Model
id = id + 1;
this.Id = string.Format("{0}.{1}", GeneralUtilities.ProcessId, id);
+
+ this.Statistics = new QueueStats();
}
public string Id { get; }
@@ -94,6 +97,8 @@ namespace HandBrakeWPF.Services.Queue.Model
/// </summary>
public HBConfiguration Configuration { get; set; }
+ public QueueStats Statistics { get; set; }
+
#endregion
protected bool Equals(QueueTask other)