diff options
author | sr55 <[email protected]> | 2021-01-30 15:50:07 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-01-30 15:50:07 +0000 |
commit | 15cad9f2092ece526ea245b9600fd57de0d0561c (patch) | |
tree | ec4e621dd291f53084f599e3409d3b7171e76d33 /win/CS | |
parent | c27895e811262d8331b318c23eaae1c2e977ab12 (diff) |
WinGui: Relax the Picture Settings behaviours on source or title change. Cropping and Resolution Limit are no longer reset and will obey last choice.
Add selection to queue now consistenty uses the current preset, or it's modified variant. (as will Add All)
#3338
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 18 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs | 47 |
2 files changed, 46 insertions, 19 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index ef06f0171..02a9c4d19 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1162,6 +1162,20 @@ namespace HandBrakeWPF.ViewModels }
}
+ // Always use the current settings when adding to the queue as best as possible.
+ Preset temporaryPreset = this.selectedPreset;
+ if (this.IsModifiedPreset)
+ {
+ temporaryPreset = new Preset(this.SelectedPreset);
+ temporaryPreset.Name = string.Format(
+ "{0} {1}",
+ temporaryPreset.Name,
+ Resources.MainView_ModifiedPreset);
+ temporaryPreset.Task = new EncodeTask(this.CurrentTask);
+ temporaryPreset.AudioTrackBehaviours = this.AudioViewModel.AudioBehaviours.Clone();
+ temporaryPreset.SubtitleTrackBehaviours = this.SubtitleViewModel.SubtitleBehaviours.Clone();
+ }
+
Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueSelectionViewModel));
IQueueSelectionViewModel viewModel = IoC.Get<IQueueSelectionViewModel>();
@@ -1183,8 +1197,8 @@ namespace HandBrakeWPF.ViewModels }
}
}
- },
- this.selectedPreset);
+ },
+ temporaryPreset);
if (window != null)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 53493faea..f816192b9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -160,6 +160,7 @@ namespace HandBrakeWPF.ViewModels {
this.Task.MaxHeight = value;
this.NotifyOfPropertyChange(() => this.MaxHeight);
+ this.OnTabStatusChanged(null);
}
}
}
@@ -173,6 +174,7 @@ namespace HandBrakeWPF.ViewModels {
this.Task.MaxWidth = value;
this.NotifyOfPropertyChange(() => this.MaxWidth);
+ this.OnTabStatusChanged(null);
}
}
}
@@ -335,6 +337,7 @@ namespace HandBrakeWPF.ViewModels {
this.Task.HasCropping = value;
this.NotifyOfPropertyChange(() => this.IsCustomCrop);
+ this.OnTabStatusChanged(null);
if (!value && this.currentTitle != null)
{
@@ -579,16 +582,8 @@ namespace HandBrakeWPF.ViewModels this.sourceParValues = title.ParVal;
this.sourceResolution = title.Resolution;
- // Update the cropping values, preffering those in the presets.
- if (!preset.Task.HasCropping)
- {
- this.Task.Cropping.Top = title.AutoCropDimensions.Top;
- this.Task.Cropping.Bottom = title.AutoCropDimensions.Bottom;
- this.Task.Cropping.Left = title.AutoCropDimensions.Left;
- this.Task.Cropping.Right = title.AutoCropDimensions.Right;
- this.IsCustomCrop = false;
- }
- else
+ // Update the cropping values, preferring those in the presets.
+ if (preset.Task.HasCropping)
{
this.Task.Cropping.Left = preset.Task.Cropping.Left;
this.Task.Cropping.Right = preset.Task.Cropping.Right;
@@ -596,17 +591,20 @@ namespace HandBrakeWPF.ViewModels this.Task.Cropping.Bottom = preset.Task.Cropping.Bottom;
this.IsCustomCrop = true;
}
-
- // Setup the Maximum Width / Height with sane 4K fallback.
- this.MaxWidth = preset.Task.MaxWidth ?? 3840;
- this.MaxHeight = preset.Task.MaxHeight ?? 2160;
- this.SetSelectedPictureSettingsResLimitMode();
-
+ else if (!this.IsCustomCrop)
+ {
+ // Only set Auto-crop values if we are in Automatic mode. If it's custom, assume the user has taken control.
+ this.Task.Cropping.Top = title.AutoCropDimensions.Top;
+ this.Task.Cropping.Bottom = title.AutoCropDimensions.Bottom;
+ this.Task.Cropping.Left = title.AutoCropDimensions.Left;
+ this.Task.Cropping.Right = title.AutoCropDimensions.Right;
+ this.IsCustomCrop = false;
+ }
+
// Set the W/H
// Set the width, then check the height doesn't breach the max height and correct if necessary.
this.Task.Width = this.GetModulusValue(this.GetRes((this.sourceResolution.Width - this.CropLeft - this.CropRight), this.MaxWidth));
this.Task.Height = this.GetModulusValue(this.GetRes((this.sourceResolution.Height - this.CropTop - this.CropBottom), this.MaxHeight));
- this.MaintainAspectRatio = preset.Task.KeepDisplayAspect;
// Set Screen Controls
this.SourceInfo = string.Format(
@@ -635,6 +633,21 @@ namespace HandBrakeWPF.ViewModels return false;
}
+ if (preset.Task.MaxHeight != this.MaxHeight)
+ {
+ return false;
+ }
+
+ if (preset.Task.MaxWidth != this.MaxWidth)
+ {
+ return false;
+ }
+
+ if (!preset.Task.HasCropping && this.IsCustomCrop)
+ {
+ return false;
+ }
+
if (!PaddingFilter.MatchesPreset(preset))
{
return false;
|