summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Services/Queue
diff options
context:
space:
mode:
authorsr55 <[email protected]>2020-07-24 22:02:50 +0100
committersr55 <[email protected]>2020-07-24 22:02:50 +0100
commit2974cc767def7a4651fcd1b5922730c02af0d1bb (patch)
tree507248a20c63980c96d6c9e895924617fc769553 /win/CS/HandBrakeWPF/Services/Queue
parent88a5af3e108e1839ec86c7a08d77f13a9e45f6ed (diff)
WinGui: Add back lost functionality on the new queue design. There is now a Stop button that allows for existing jobs to be completed before stopping the queue. When done action will also be honoured. #2974
Diffstat (limited to 'win/CS/HandBrakeWPF/Services/Queue')
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs12
-rw-r--r--win/CS/HandBrakeWPF/Services/Queue/QueueService.cs39
2 files changed, 36 insertions, 15 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs
index 761737434..2cbca0439 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs
@@ -211,13 +211,19 @@ namespace HandBrakeWPF.Services.Queue.Interfaces
/// <summary>
/// Stop the current encode and pause the queue.
/// </summary>
- void Stop();
+ /// <param name="stopExistingJobs">
+ /// Set to false to allow existing jobs to complete.
+ /// </param>
+ void Stop(bool stopExistingJobs);
/// <summary>
/// Pause the queue but allow the current encode to complete.
/// </summary>
- void Pause();
-
+ /// <param name="pauseJobs">
+ /// Also pause the active jobs
+ /// </param>
+ void Pause(bool pauseJobs);
+
/// <summary>
/// Get the status of all running queue jobs.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
index c656fb90f..666a3b15e 100644
--- a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
+++ b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs
@@ -233,7 +233,7 @@ namespace HandBrakeWPF.Services.Queue
if (result == MessageBoxResult.Yes)
{
- this.Stop();
+ this.Stop(true);
foreach (QueueTask task in duplicates)
{
@@ -455,13 +455,16 @@ namespace HandBrakeWPF.Services.Queue
}
}
- public void Pause()
+ public void Pause(bool pauseJobs)
{
- foreach (ActiveJob job in this.activeJobs)
+ if (pauseJobs)
{
- if (job.IsEncoding && !job.IsPaused)
+ foreach (ActiveJob job in this.activeJobs)
{
- job.Pause();
+ if (job.IsEncoding && !job.IsPaused)
+ {
+ job.Pause();
+ }
}
}
@@ -493,20 +496,27 @@ namespace HandBrakeWPF.Services.Queue
this.IsProcessing = true;
}
- public void Stop()
+ public void Stop(bool stopExistingJobs)
{
- foreach (ActiveJob job in this.activeJobs)
+ if (stopExistingJobs)
{
- if (job.IsEncoding || job.IsPaused)
+ foreach (ActiveJob job in this.activeJobs)
{
- job.Stop();
+ if (job.IsEncoding || job.IsPaused)
+ {
+ job.Stop();
+ }
}
}
this.IsProcessing = false;
this.IsPaused = false;
- this.InvokeQueueChanged(EventArgs.Empty);
- this.InvokeQueueCompleted(new QueueCompletedEventArgs(true));
+
+ if (stopExistingJobs || this.activeJobs.Count == 0)
+ {
+ this.InvokeQueueChanged(EventArgs.Empty);
+ this.InvokeQueueCompleted(new QueueCompletedEventArgs(true));
+ }
}
public List<QueueProgressStatus> GetQueueProgressStatus()
@@ -630,6 +640,11 @@ namespace HandBrakeWPF.Services.Queue
{
this.ProcessNextJob();
}
+ else
+ {
+ this.InvokeQueueChanged(EventArgs.Empty);
+ this.InvokeQueueCompleted(new QueueCompletedEventArgs(true));
+ }
}
private void InvokeQueueCompleted(QueueCompletedEventArgs e)
@@ -686,7 +701,7 @@ namespace HandBrakeWPF.Services.Queue
{
this.logService.LogMessage(Resources.PauseOnLowDiskspace);
job.Status = QueueItemStatus.Waiting;
- this.Pause();
+ this.Pause(true);
this.BackupQueue(string.Empty);
return true; // Don't start the next job.
}