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 /win/CS/HandBrakeWPF/ViewModels | |
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.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
5 files changed, 28 insertions, 20 deletions
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)) { |