From c9981d44669f19962691f985a0560682fc73b159 Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 4 Jan 2019 21:25:01 +0000 Subject: [PATCH] WinGui: Improvements to the new queue design. - Added "Options" drop button to the Summary Tab. Includes "Play File" and "Open Source/Dest directory" options - Moved the encode status information onto the Summary Tab (only shown when encoding) - Added placeholder buttons for Move up/down to make queue re-ordering more discoverable. - Space optimisation --- .../Properties/Resources.Designer.cs | 9 +++ win/CS/HandBrakeWPF/Properties/Resources.resx | 3 + .../HandBrakeWPF/ViewModels/QueueViewModel.cs | 54 ++++++++++++--- .../Views/Queue/QueueTwoContent.xaml | 67 ++++++++++++++++--- .../Views/Queue/QueueTwoContent.xaml.cs | 13 +++- win/CS/HandBrakeWPF/Views/QueueView.xaml | 2 +- 6 files changed, 128 insertions(+), 20 deletions(-) diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index e03f008f4..c09fd1370 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -4121,6 +4121,15 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to Play File. + /// + public static string QueueView_PlayMediaFile { + get { + return ResourceManager.GetString("QueueView_PlayMediaFile", resourceCulture); + } + } + /// /// Looks up a localized string similar to Quit HandBrake. /// diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index efa015780..521194d2c 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2011,4 +2011,7 @@ This will not affect your current settings in the Subtitle tab. 'Add Selection' to Queue + + Play File + \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 2e31a2a04..ee5dfb583 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.ViewModels using System.Diagnostics; using System.IO; using System.Linq; + using System.Runtime.CompilerServices; using System.Windows; using Caliburn.Micro; @@ -74,7 +75,7 @@ namespace HandBrakeWPF.ViewModels this.errorService = errorService; this.Title = Resources.QueueViewModel_Queue; this.JobsPending = Resources.QueueViewModel_NoEncodesPending; - this.JobStatus = Resources.QueueViewModel_NoJobsPending; + this.JobStatus = string.Empty; this.SelectedItems = new BindingList(); this.DisplayName = "Queue"; this.IsQueueRunning = false; @@ -118,9 +119,12 @@ namespace HandBrakeWPF.ViewModels { this.jobStatus = value; this.NotifyOfPropertyChange(() => this.JobStatus); + this.NotifyOfPropertyChange(() => this.IsJobStatusVisible); } } + public bool IsJobStatusVisible => !string.IsNullOrEmpty(this.JobStatus); + /// /// Gets or sets JobsPending. /// @@ -188,6 +192,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.CanRetryJob); this.NotifyOfPropertyChange(() => this.CanEditJob); this.NotifyOfPropertyChange(() => this.CanRemoveJob); + this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource); + this.NotifyOfPropertyChange(() => this.CanPlayFile); this.NotifyOfPropertyChange(() => this.StatsVisible); } } @@ -200,6 +206,12 @@ namespace HandBrakeWPF.ViewModels public bool CanRemoveJob => this.SelectedTask != null; + public bool CanPerformActionOnSource => this.SelectedTask != null; + + public bool CanPlayFile => + this.SelectedTask != null && this.SelectedTask.Task.Destination != null && + this.SelectedTask.Status == QueueItemStatus.Completed && File.Exists(this.SelectedTask.Task.Destination); + public double ProgressValue { get => this.progressValue; @@ -348,7 +360,6 @@ namespace HandBrakeWPF.ViewModels { this.queueProcessor.Pause(); - this.JobStatus = Resources.QueueViewModel_QueuePending; this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count); this.IsQueueRunning = false; @@ -447,7 +458,6 @@ namespace HandBrakeWPF.ViewModels task.Status = QueueItemStatus.Waiting; this.queueProcessor.BackupQueue(null); this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count); - this.JobStatus = Resources.QueueViewModel_QueueReady; this.NotifyOfPropertyChange(() => this.CanRetryJob); } @@ -471,7 +481,6 @@ namespace HandBrakeWPF.ViewModels return; } - this.JobStatus = Resources.QueueViewModel_QueueStarted; this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count); this.IsQueueRunning = true; @@ -536,6 +545,17 @@ namespace HandBrakeWPF.ViewModels mvm.EditQueueJob(task); } + public void OpenSourceDir() + { + this.OpenSourceDirectory(this.SelectedTask); + + } + + public void OpenDestDir() + { + this.OpenDestinationDirectory(this.SelectedTask); + } + public void OpenSourceDirectory(QueueTask task) { if (task != null) @@ -585,6 +605,23 @@ namespace HandBrakeWPF.ViewModels } } + public void PlayFile() + { + if (this.SelectedTask != null && this.SelectedTask.Task != null && File.Exists(this.SelectedTask.Task.Destination)) + { + Process.Start(this.SelectedTask.Task.Destination); + } + } + + public void MoveUp() + { + this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information); + } + + public void MoveDown() + { + this.errorService.ShowMessageBox("Not Implemented yet. You can drag / drop re-organise the queue for now.", "Coming Soon!", MessageBoxButton.OK, MessageBoxImage.Information); + } #endregion @@ -615,7 +652,6 @@ namespace HandBrakeWPF.ViewModels this.queueProcessor.QueuePaused += this.QueueProcessor_QueuePaused; this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count); - this.JobStatus = Resources.QueueViewModel_QueueReady; base.OnActivate(); } @@ -794,13 +830,14 @@ namespace HandBrakeWPF.ViewModels if (!queueProcessor.IsProcessing) { - this.JobStatus = Resources.QueueViewModel_QueueNotRunning; this.IsQueueRunning = false; } this.NotifyOfPropertyChange(() => this.CanRetryJob); this.NotifyOfPropertyChange(() => this.CanEditJob); this.NotifyOfPropertyChange(() => this.CanRemoveJob); + this.NotifyOfPropertyChange(() => this.CanPerformActionOnSource); + this.NotifyOfPropertyChange(() => this.CanPlayFile); this.NotifyOfPropertyChange(() => this.StatsVisible); this.HandleLogData(); } @@ -816,12 +853,13 @@ namespace HandBrakeWPF.ViewModels /// private void queueProcessor_QueueCompleted(object sender, EventArgs e) { - this.JobStatus = Resources.QueueViewModel_QueueCompleted; this.JobsPending = string.Format(Resources.QueueViewModel_JobsPending, this.queueProcessor.Count); this.IsQueueRunning = false; this.NotifyOfPropertyChange(() => this.SelectedTask); this.NotifyOfPropertyChange(() => this.StatsVisible); this.NotifyOfPropertyChange(() => this.CanRetryJob); + + this.JobStatus = string.Empty; } /// @@ -837,7 +875,7 @@ namespace HandBrakeWPF.ViewModels { if (!this.queueProcessor.IsProcessing) { - this.JobStatus = Resources.QueueViewModel_LastJobFinished; + this.JobStatus = string.Empty; } } diff --git a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml index 930533987..66e8d3ab4 100644 --- a/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml +++ b/win/CS/HandBrakeWPF/Views/Queue/QueueTwoContent.xaml @@ -52,15 +52,9 @@ - - - - - - - + @@ -69,11 +63,32 @@ + - + + + + + + + + + + + + + + + + + + - + + +