diff options
author | sr55 <[email protected]> | 2018-01-13 20:30:44 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2018-01-13 20:31:06 +0000 |
commit | d076119d72215edfd3388ebe0d4ee2256f17d586 (patch) | |
tree | 1d5dd2616a96745dfa59d6a8ddec5dddb324a304 | |
parent | 3c35763f418801a564b07a7c6818337c93f8aeef (diff) |
WinGui: Reselect the last selected preset (if still available) when editing a queue task. Fix a bug on the summary task not rendering correctly when queue editing.
6 files changed, 46 insertions, 21 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs index 334842d31..eed9069aa 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Model/QueueTask.cs @@ -13,6 +13,7 @@ namespace HandBrakeWPF.Services.Queue.Model using HandBrake.ApplicationServices.Model;
+ using HandBrakeWPF.Services.Presets.Model;
using HandBrakeWPF.Utilities;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
@@ -24,6 +25,7 @@ namespace HandBrakeWPF.Services.Queue.Model {
private static int id;
private QueueItemStatus status;
+ private string presetKey;
#region Properties
@@ -50,12 +52,19 @@ namespace HandBrakeWPF.Services.Queue.Model /// <param name="scannedSourcePath">
/// The scanned Source Path.
/// </param>
- public QueueTask(EncodeTask task, HBConfiguration configuration, string scannedSourcePath)
+ /// <param name="currentPreset">
+ /// The currently active preset.
+ /// </param>
+ public QueueTask(EncodeTask task, HBConfiguration configuration, string scannedSourcePath, Preset currentPreset)
{
this.Task = task;
this.Configuration = configuration;
this.Status = QueueItemStatus.Waiting;
this.ScannedSourcePath = scannedSourcePath;
+ if (currentPreset != null)
+ {
+ this.presetKey = currentPreset.Name;
+ }
id = id + 1;
this.Id = string.Format("{0}.{1}", GeneralUtilities.ProcessId, id);
@@ -99,6 +108,14 @@ namespace HandBrakeWPF.Services.Queue.Model public QueueStats Statistics { get; set; }
+ public string SelectedPresetKey
+ {
+ get
+ {
+ return this.presetKey;
+ }
+ }
+
#endregion
protected bool Equals(QueueTask other)
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs index bcc72b9dd..19b1c0001 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs @@ -11,6 +11,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces {
using System.Windows;
+ using HandBrakeWPF.Services.Queue.Model;
+
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
/// <summary>
@@ -96,7 +98,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <param name="task">
/// The task.
/// </param>
- void EditQueueJob(EncodeTask task);
+ void EditQueueJob(QueueTask task);
/// <summary>
/// Shutdown this View
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index fd65c9c67..9fce1956c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -87,7 +87,7 @@ namespace HandBrakeWPF.ViewModels private bool isEncoding;
private bool showStatusWindow;
private Preset selectedPreset;
- private EncodeTask queueEditTask;
+ private QueueTask queueEditTask;
private int lastEncodePercentage;
private bool isPresetPanelShowing;
private bool showSourceSelection;
@@ -1504,7 +1504,7 @@ namespace HandBrakeWPF.ViewModels return false;
}
- QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create(), this.ScannedSource.ScanPath);
+ QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create(), this.ScannedSource.ScanPath, this.SelectedPreset);
if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))
{
@@ -1711,13 +1711,15 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Edit a Queue Task
/// </summary>
- /// <param name="task">
+ /// <param name="queueTask">
/// The task.
/// </param>
- public void EditQueueJob(EncodeTask task)
+ public void EditQueueJob(QueueTask queueTask)
{
// Rescan the source to make sure it's still valid
- this.queueEditTask = task;
+ EncodeTask task = queueTask.Task;
+
+ this.queueEditTask = queueTask;
this.scanService.Scan(task.Source, task.Title, QueueEditAction, HBConfigurationFactory.Create());
}
@@ -2200,6 +2202,16 @@ namespace HandBrakeWPF.ViewModels /* TODO Fix this. */
Execute.OnUIThread(() =>
{
+ if (this.queueEditTask != null && this.selectedPreset.Name != this.queueEditTask.SelectedPresetKey)
+ {
+ Preset foundPreset = this.presetService.GetPreset(this.queueEditTask.SelectedPresetKey);
+ if (foundPreset != null)
+ {
+ this.selectedPreset = foundPreset;
+ this.NotifyOfPropertyChange(() => this.SelectedPreset);
+ }
+ }
+
// Copy all the Scan data into the UI
scannedSource.CopyTo(this.ScannedSource);
this.NotifyOfPropertyChange(() => this.ScannedSource);
@@ -2207,7 +2219,7 @@ namespace HandBrakeWPF.ViewModels // Select the Users Title
this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault();
- this.CurrentTask = new EncodeTask(queueEditTask);
+ this.CurrentTask = new EncodeTask(this.queueEditTask.Task);
this.NotifyOfPropertyChange(() => this.CurrentTask);
this.HasSource = true;
@@ -2221,6 +2233,7 @@ namespace HandBrakeWPF.ViewModels this.SelectedEndPoint = end;
// Update the Tab Controls
+ this.SummaryViewModel.UpdateTask(this.CurrentTask);
this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);
this.VideoViewModel.UpdateTask(this.CurrentTask);
this.FiltersViewModel.UpdateTask(this.CurrentTask);
@@ -2229,8 +2242,7 @@ namespace HandBrakeWPF.ViewModels this.ChaptersViewModel.UpdateTask(this.CurrentTask);
this.AdvancedViewModel.UpdateTask(this.CurrentTask);
this.MetaDataViewModel.UpdateTask(this.CurrentTask);
- this.SummaryViewModel.UpdateTask(this.CurrentTask);
-
+
// Cleanup
this.ShowStatusWindow = false;
this.SourceLabel = this.SourceName;
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index f2b2d7b9b..52a09def3 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -450,7 +450,7 @@ namespace HandBrakeWPF.ViewModels // Pass a copy of the job back to the Main Screen
IMainViewModel mvm = IoC.Get<IMainViewModel>();
- mvm.EditQueueJob(new EncodeTask(task.Task));
+ mvm.EditQueueJob(task);
}
public void OpenSourceDirectory(QueueTask task)
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index d801dd256..8a61aa610 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -605,7 +605,7 @@ namespace HandBrakeWPF.ViewModels encodeTask.SubtitleTracks.Remove(scanTrack);
}
- QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(), this.ScannedSource.ScanPath);
+ QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(), this.ScannedSource.ScanPath, null);
ThreadPool.QueueUserWorkItem(this.CreatePreview, task);
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index 90676cc0e..ac12baf2c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -212,12 +212,7 @@ namespace HandBrakeWPF.ViewModels { get { - return this.isMkv; - } - set - { - this.isMkv = value; - this.NotifyOfPropertyChange(() => this.IsMkv); + return this.SelectedOutputFormat == OutputFormat.Mkv; } } @@ -441,19 +436,18 @@ namespace HandBrakeWPF.ViewModels newExtension = ".m4v"; break; } - - this.IsMkv = false; } // Now disable controls that are not required. The Following are for MP4 only! if (newExtension == ".mkv") { - this.IsMkv = true; this.OptimizeMP4 = false; this.IPod5GSupport = false; this.AlignAVStart = false; } + this.NotifyOfPropertyChange(() => this.IsMkv); + // Update The browse file extension display if (Path.HasExtension(newExtension)) { |