diff options
author | sr55 <[email protected]> | 2013-05-24 19:13:09 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-05-24 19:13:09 +0000 |
commit | 0a535389348c04fb8f2ccae1fcf37215d2072f80 (patch) | |
tree | bbd34872576979d16f8193cc31d112bffc25fede /win/CS | |
parent | 70ea64b335ed39cb8e2584b64229ab3a9ee6d21f (diff) |
WinGui: Some usability improvements and bug fixes around the queue window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5510 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs | 37 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 12 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 74 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/QueueView.xaml | 8 |
4 files changed, 75 insertions, 56 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs index 92f69142c..a8cb55f58 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -51,6 +51,11 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
private string queueFile;
+ /// <summary>
+ /// The is paused.
+ /// </summary>
+ private bool isPaused;
+
#endregion
#region Constructors and Destructors
@@ -236,15 +241,15 @@ namespace HandBrake.ApplicationServices.Services {
Execute.OnUIThread(
() =>
+ {
+ List<QueueTask> deleteList =
+ this.queue.Where(task => task.Status == QueueItemStatus.Completed).ToList();
+ foreach (QueueTask item in deleteList)
{
- List<QueueTask> deleteList =
- this.queue.Where(task => task.Status == QueueItemStatus.Completed).ToList();
- foreach (QueueTask item in deleteList)
- {
- this.queue.Remove(item);
- }
- this.InvokeQueueChanged(EventArgs.Empty);
- });
+ this.queue.Remove(item);
+ }
+ this.InvokeQueueChanged(EventArgs.Empty);
+ });
}
/// <summary>
@@ -379,8 +384,8 @@ namespace HandBrake.ApplicationServices.Services catch (Exception exc)
{
throw new GeneralApplicationException(
- "Unable to restore queue file.",
- "The file may be corrupted or from an older incompatible version of HandBrake",
+ "Unable to restore queue file.",
+ "The file may be corrupted or from an older incompatible version of HandBrake",
exc);
}
@@ -419,6 +424,7 @@ namespace HandBrake.ApplicationServices.Services {
this.InvokeQueuePaused(EventArgs.Empty);
this.IsProcessing = false;
+ this.isPaused = true;
}
/// <summary>
@@ -432,9 +438,16 @@ namespace HandBrake.ApplicationServices.Services throw new Exception("Already Processing the Queue");
}
- this.IsProcessing = true;
+ this.EncodeService.EncodeCompleted -= this.EncodeServiceEncodeCompleted;
this.EncodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
- this.ProcessNextJob();
+
+ if (!this.EncodeService.IsEncoding)
+ {
+ this.ProcessNextJob();
+ }
+
+ this.IsProcessing = true;
+ this.isPaused = false;
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 4063c1e68..f3945fb7a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1843,7 +1843,7 @@ namespace HandBrakeWPF.ViewModels Execute.OnUIThread(
() =>
{
- if (this.IsEncoding)
+ if (this.queueProcessor.EncodeService.IsEncoding)
{
this.ProgramStatusLabel =
string.Format(
@@ -1862,6 +1862,16 @@ namespace HandBrakeWPF.ViewModels lastEncodePercentage = percent;
}
+ else
+ {
+ this.ProgramStatusLabel = "Queue Finished";
+ this.IsEncoding = false;
+
+ if (this.windowsSeven.IsWindowsSeven)
+ {
+ this.windowsSeven.SetTaskBarProgressToNoProgress();
+ }
+ }
});
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index faa856d6b..3465fe273 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -237,6 +237,13 @@ namespace HandBrakeWPF.ViewModels public void PauseEncode()
{
this.queueProcessor.Pause();
+
+ this.JobStatus = "Queue Paused";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.IsEncoding = false;
+
+ MessageBox.Show("The Queue has been pasued. The currently running job will run to completion and no further jobs will start.", "Queue",
+ MessageBoxButton.OK, MessageBoxImage.Information);
}
/// <summary>
@@ -293,6 +300,10 @@ namespace HandBrakeWPF.ViewModels return;
}
+ this.JobStatus = "Queue Started";
+ this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.IsEncoding = true;
+
this.queueProcessor.Start();
}
@@ -364,13 +375,13 @@ namespace HandBrakeWPF.ViewModels this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
- this.queueProcessor.JobProcessingStarted += this.queueProcessor_JobProcessingStarted;
this.queueProcessor.QueueCompleted += this.queueProcessor_QueueCompleted;
- this.queueProcessor.QueuePaused += this.queueProcessor_QueuePaused;
this.queueProcessor.QueueChanged += this.QueueManager_QueueChanged;
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeService_EncodeStatusChanged;
+ this.queueProcessor.EncodeService.EncodeCompleted += EncodeService_EncodeCompleted;
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
+ this.JobStatus = "Queue Ready";
base.OnActivate();
}
@@ -383,11 +394,10 @@ namespace HandBrakeWPF.ViewModels /// </param>
protected override void OnDeactivate(bool close)
{
- this.queueProcessor.JobProcessingStarted -= this.queueProcessor_JobProcessingStarted;
this.queueProcessor.QueueCompleted -= this.queueProcessor_QueueCompleted;
- this.queueProcessor.QueuePaused -= this.queueProcessor_QueuePaused;
this.queueProcessor.QueueChanged -= this.QueueManager_QueueChanged;
this.queueProcessor.EncodeService.EncodeStatusChanged -= this.EncodeService_EncodeStatusChanged;
+ this.queueProcessor.EncodeService.EncodeCompleted -= EncodeService_EncodeCompleted;
base.OnDeactivate(close);
}
@@ -406,19 +416,16 @@ namespace HandBrakeWPF.ViewModels {
Caliburn.Micro.Execute.OnUIThread(() =>
{
- if (this.IsEncoding)
- {
- this.JobStatus =
- string.Format(
- "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
- e.Task,
- e.TaskCount,
- e.PercentComplete,
- e.CurrentFrameRate,
- e.AverageFrameRate,
- e.EstimatedTimeLeft,
- e.ElapsedTime);
- }
+ this.JobStatus =
+ string.Format(
+ "Encoding: Pass {0} of {1}, {2:00.00}%, FPS: {3:000.0}, Avg FPS: {4:000.0}, Time Remaining: {5}, Elapsed: {6:hh\\:mm\\:ss}",
+ e.Task,
+ e.TaskCount,
+ e.PercentComplete,
+ e.CurrentFrameRate,
+ e.AverageFrameRate,
+ e.EstimatedTimeLeft,
+ e.ElapsedTime);
});
}
@@ -434,23 +441,11 @@ namespace HandBrakeWPF.ViewModels private void QueueManager_QueueChanged(object sender, EventArgs e)
{
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- }
- /// <summary>
- /// Handle teh Job Processing Started Event
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The QueueProgressEventArgs.
- /// </param>
- private void queueProcessor_JobProcessingStarted(
- object sender, QueueProgressEventArgs e)
- {
- this.JobStatus = "Queue Started";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- this.IsEncoding = true;
+ if (!queueProcessor.IsProcessing)
+ {
+ this.JobStatus = "Queue Not Running";
+ }
}
/// <summary>
@@ -470,19 +465,20 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Handle the Queue Paused Event
+ /// The encode service_ encode completed.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
- /// The EventArgs.
+ /// The e.
/// </param>
- private void queueProcessor_QueuePaused(object sender, EventArgs e)
+ private void EncodeService_EncodeCompleted(object sender, EncodeCompletedEventArgs e)
{
- this.JobStatus = "Queue Paused";
- this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
- this.IsEncoding = false;
+ if (!this.queueProcessor.IsProcessing)
+ {
+ this.JobStatus = "Last Queued Job Finished";
+ }
}
#endregion
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index e0758689d..d3df53451 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -10,10 +10,10 @@ xmlns:YourNamespace="clr-namespace:HandBrakeWPF.AttachedProperties"
xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio"
xmlns:Subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles" Title="{Binding Title}"
- Width="600"
- Height="400"
- MinWidth="600"
- MinHeight="400"
+ Width="700"
+ Height="500"
+ MinWidth="200"
+ MinHeight="200"
Background="#FFF0F0F0"
WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display"
|