diff options
author | sr55 <[email protected]> | 2019-07-03 21:19:16 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2019-07-03 21:23:56 +0100 |
commit | e91ee8d30f0f620fd78bcbb0ca2f2f911a47442f (patch) | |
tree | 4195748ffb0a19b301ab7c35bdf96901121c72f8 /win | |
parent | 3ce36a1bfe5ce943a6d5ffb0c4a92d8b2390449f (diff) |
WinGui: Nice display of statistics when information isn't available. #2179
Diffstat (limited to 'win')
4 files changed, 61 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index 799647272..b29ec5229 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -4138,6 +4138,15 @@ namespace HandBrakeWPF.Properties { } /// <summary> + /// Looks up a localized string similar to Not Available. + /// </summary> + public static string QueueView_NotAvailable { + get { + return ResourceManager.GetString("QueueView_NotAvailable", resourceCulture); + } + } + + /// <summary> /// Looks up a localized string similar to Open Destination Directory. /// </summary> public static string QueueView_OpenDestDir { diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 4bd8e3e1f..172b478bf 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2017,4 +2017,7 @@ Where supported, any user presets will have been imported.</value> <data name="Options_DarkTheme" xml:space="preserve">
<value>Use the Dark Theme. (Requires Restart) (THIS IS AN EARLY PREVIEW. IT IS NOT YET COMPLETE!)</value>
</data>
+ <data name="QueueView_NotAvailable" xml:space="preserve">
+ <value>Not Available</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs index 3378bd6aa..781105d8f 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueStats.cs @@ -13,6 +13,8 @@ namespace HandBrakeWPF.Services.Queue.Model using Caliburn.Micro; + using HandBrakeWPF.Properties; + using Newtonsoft.Json; [JsonObject(MemberSerialization.OptOut)] @@ -35,12 +37,27 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.startTime; } + set { if (value.Equals(this.startTime)) return; this.startTime = value; this.NotifyOfPropertyChange(() => this.StartTime); this.NotifyOfPropertyChange(() => this.Duration); + this.NotifyOfPropertyChange(() => this.StartTimeDisplay); + } + } + + public string StartTimeDisplay + { + get + { + if (this.startTime == DateTime.MinValue) + { + return Resources.QueueView_NotAvailable; + } + + return this.startTime.ToString(); } } @@ -50,12 +67,27 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.endTime; } + set { if (value.Equals(this.endTime)) return; this.endTime = value; this.NotifyOfPropertyChange(() => this.EndTime); this.NotifyOfPropertyChange(() => this.Duration); + this.NotifyOfPropertyChange(() => this.EndTimeDisplay); + } + } + + public string EndTimeDisplay + { + get + { + if (this.endTime == DateTime.MinValue) + { + return Resources.QueueView_NotAvailable; + } + + return this.endTime.ToString(); } } @@ -73,7 +105,7 @@ namespace HandBrakeWPF.Services.Queue.Model { if (this.endTime == DateTime.MinValue) { - return TimeSpan.MinValue; + return TimeSpan.Zero; } return this.EndTime - this.StartTime - this.PausedDuration; @@ -89,6 +121,7 @@ namespace HandBrakeWPF.Services.Queue.Model { return this.finalFileSize; } + set { if (value == this.finalFileSize) return; @@ -125,5 +158,19 @@ namespace HandBrakeWPF.Services.Queue.Model this.pausedTimespan = this.PausedDuration.Add(pausedDuration); } } + + public void Reset() + { + this.StartTime = DateTime.MinValue; + this.EndTime = DateTime.MinValue; + this.FinalFileSize = 0; + this.pausedTimespan = TimeSpan.Zero; + this.pausedStartPoint = DateTime.MinValue; + this.CompletedActivityLogPath = null; + + this.NotifyOfPropertyChange(() => this.FinalFileSizeInMegaBytes); + this.NotifyOfPropertyChange(() => this.PausedDuration); + this.NotifyOfPropertyChange(() => this.Duration); + } } } diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index e86d8f488..362f10ec6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -467,6 +467,7 @@ namespace HandBrakeWPF.ViewModels }
task.Status = QueueItemStatus.Waiting;
+ task.Statistics.Reset();
this.queueProcessor.BackupQueue(null);
this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count);
this.NotifyOfPropertyChange(() => this.CanRetryJob);
|