summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-12-13 19:35:02 +0000
committersr55 <[email protected]>2016-12-13 19:35:10 +0000
commit35130882b828ff6af96fafa2a24a8b9afc898f0d (patch)
tree2a96438e8fe0c3ba915b447847829bef1f862ac7 /win/CS/HandBrakeWPF/ViewModels
parent1f418c2cf9e74f907311b0f5e77d84342e570e35 (diff)
WinGui: Advanced Tab Changes
1. Strip out a lot of the old advanced tab infrastructure as it is no longer needed. Only the deprecated X264 Advacned Panel is left. All other encoders use the Video tab now. 2. Changed Option to "Allow use of 'Advanced Tab'" and only show the tab if the checkbox on the video tab is checked. It will no longer show based on the perference alone. 3. Fix the one-way communication from Video Tab to X264 Tab so preset options are reflected ont he X264 Tab. The reverse is not supported but it will retain the previous options.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs141
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs32
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs6
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs51
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs29
6 files changed, 17 insertions, 247 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
deleted file mode 100644
index 746d457ef..000000000
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="AdvancedViewModel.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// The Advanced View Model
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.ViewModels
-{
- using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
- using HandBrakeWPF.Services.Presets.Model;
- using HandBrakeWPF.Services.Scan.Model;
- using HandBrakeWPF.ViewModels.Interfaces;
-
- using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
-
- /// <summary>
- /// The Advanced View Model
- /// </summary>
- public class AdvancedViewModel : ViewModelBase, IAdvancedViewModel
- {
- #region Constants and Fields
-
- /// <summary>
- /// The show x 264 panel.
- /// </summary>
- private bool showX264Panel;
-
- #endregion
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AdvancedViewModel"/> class.
- /// </summary>
- /// <param name="x264ViewModel">
- /// The x 264 view model.
- /// </param>
- public AdvancedViewModel(IX264ViewModel x264ViewModel)
- {
- this.X264ViewModel = x264ViewModel;
- }
-
- #region Properties
-
- /// <summary>
- /// Gets or sets the x 264 view model.
- /// </summary>
- public IX264ViewModel X264ViewModel { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether show x 264 panel.
- /// </summary>
- public bool ShowX264Panel
- {
- get
- {
- return this.showX264Panel;
- }
- set
- {
- this.showX264Panel = value;
- this.NotifyOfPropertyChange(() => this.ShowX264Panel);
- }
- }
-
- #endregion
-
- #region Implemented Interfaces
-
- /// <summary>
- /// The set encoder.
- /// </summary>
- /// <param name="encoder">
- /// The encoder.
- /// </param>
- public void SetEncoder(VideoEncoder encoder)
- {
- this.X264ViewModel.SetEncoder(encoder);
- this.ShowX264Panel = encoder == VideoEncoder.X264 || encoder == VideoEncoder.X264_10;
- }
-
- /// <summary>
- /// The clear.
- /// </summary>
- public void Clear()
- {
- this.X264ViewModel.Clear();
- }
-
- /// <summary>
- /// Setup this tab for the specified preset.
- /// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <param name="task">
- /// The task.
- /// </param>
- public void SetPreset(Preset preset, EncodeTask task)
- {
- this.X264ViewModel.SetPreset(preset, task);
- }
-
- /// <summary>
- /// Update all the UI controls based on the encode task passed in.
- /// </summary>
- /// <param name="task">
- /// The task.
- /// </param>
- public void UpdateTask(EncodeTask task)
- {
- this.X264ViewModel.UpdateTask(task);
-
- this.SetEncoder(task.VideoEncoder);
- }
-
- /// <summary>
- /// Setup this window for a new source
- /// </summary>
- /// <param name="source">
- /// The source.
- /// </param>
- /// <param name="title">
- /// The title.
- /// </param>
- /// <param name="preset">
- /// The preset.
- /// </param>
- /// <param name="task">
- /// The task.
- /// </param>
- public void SetSource(Source source, Title title, Preset preset, EncodeTask task)
- {
- this.X264ViewModel.SetSource(source, title, preset, task);
- }
-
- #endregion
- }
-} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs
deleted file mode 100644
index acbcb7d02..000000000
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="IAdvancedViewModel.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Defines the IAdvancedViewModel type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.ViewModels.Interfaces
-{
- using HandBrake.ApplicationServices.Interop.Model.Encoding;
-
- /// <summary>
- /// The Advanced View Model Interface
- /// </summary>
- public interface IAdvancedViewModel : ITabInterface
- {
- /// <summary>
- /// Set the currently selected encoder.
- /// </summary>
- /// <param name="encoder">
- /// The Video Encoder.
- /// </param>
- void SetEncoder(VideoEncoder encoder);
-
- /// <summary>
- /// Clear out the settings.
- /// </summary>
- void Clear();
- }
-}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
index d3602e5e5..d3b162501 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IVideoViewModel.cs
@@ -18,10 +18,5 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// Trigger a Notify Property Changed on the Task to force various UI elements to update.
/// </summary>
void RefreshTask();
-
- /// <summary>
- /// Clear the advanced x264 options.
- /// </summary>
- void ClearAdvancedSettings();
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 957ce4d29..359301296 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -161,8 +161,8 @@ namespace HandBrakeWPF.ViewModels
public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
IErrorService errorService, IUpdateService updateService,
IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,
- IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
- IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
+ IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
+ IX264ViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
IQueueViewModel queueViewModel, IMetaDataViewModel metaDataViewModel)
{
this.scanService = scanService;
@@ -260,7 +260,7 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Gets or sets AdvancedViewModel.
/// </summary>
- public IAdvancedViewModel AdvancedViewModel { get; set; }
+ public IX264ViewModel AdvancedViewModel { get; set; }
/// <summary>
/// Gets or sets VideoViewModel.
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index 55a679ea7..7b3cf7813 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -20,7 +20,6 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Interop;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
- using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
@@ -51,14 +50,12 @@ namespace HandBrakeWPF.ViewModels
private const string SameAsSource = "Same as source";
private readonly IUserSettingService userSettingService;
- private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
private bool displayOptimiseOptions;
private int qualityMax;
private int qualityMin;
private bool showPeakFramerate;
private int rf;
- private bool canClear;
private bool displayTurboFirstPass;
private int videoPresetMaxValue;
private int videoPresetValue;
@@ -82,11 +79,10 @@ namespace HandBrakeWPF.ViewModels
/// <param name="advancedEncoderOptionsCommand">
/// The advanced Encoder Options Command.
/// </param>
- public VideoViewModel(IUserSettingService userSettingService, IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
+ public VideoViewModel(IUserSettingService userSettingService)
{
this.Task = new EncodeTask { VideoEncoder = VideoEncoder.X264 };
this.userSettingService = userSettingService;
- this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
this.QualityMin = 0;
this.QualityMax = 51;
this.IsConstantQuantity = true;
@@ -112,7 +108,7 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Gets a value indicating whether show advanced tab.
/// </summary>
- public bool ShowAdvancedTab
+ public bool IsAdvancedTabOptionEnabled
{
get
{
@@ -124,6 +120,7 @@ namespace HandBrakeWPF.ViewModels
if (this.SelectedVideoEncoder != VideoEncoder.X264 && this.SelectedVideoEncoder != VideoEncoder.X264_10)
{
+ this.UseAdvancedTab = false;
return false;
}
@@ -146,8 +143,8 @@ namespace HandBrakeWPF.ViewModels
{
// Set the Advanced Tab up with the current settings, if we can.
this.Task.AdvancedEncoderOptions = value ? this.GetActualx264Query() : string.Empty;
-
this.Task.ShowAdvancedTab = value;
+
this.NotifyOfPropertyChange(() => this.UseAdvancedTab);
}
}
@@ -673,7 +670,6 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.FastDecode);
this.NotifyOfPropertyChange(() => this.FullOptionsTooltip);
- this.ResetAdvancedTab();
}
}
@@ -691,7 +687,6 @@ namespace HandBrakeWPF.ViewModels
this.Task.VideoPreset = value;
this.NotifyOfPropertyChange(() => this.VideoPreset);
this.NotifyOfPropertyChange(() => this.FullOptionsTooltip);
- this.ResetAdvancedTab();
}
}
@@ -772,7 +767,6 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.VideoTune);
this.NotifyOfPropertyChange(() => this.FullOptionsTooltip);
- this.ResetAdvancedTab();
}
}
@@ -790,7 +784,6 @@ namespace HandBrakeWPF.ViewModels
this.Task.VideoProfile = value;
this.NotifyOfPropertyChange(() => this.VideoProfile);
this.NotifyOfPropertyChange(() => this.FullOptionsTooltip);
- this.ResetAdvancedTab();
}
}
@@ -808,7 +801,6 @@ namespace HandBrakeWPF.ViewModels
this.Task.VideoLevel = value;
this.NotifyOfPropertyChange(() => this.VideoLevel);
this.NotifyOfPropertyChange(() => this.FullOptionsTooltip);
- this.ResetAdvancedTab();
}
}
@@ -954,7 +946,7 @@ namespace HandBrakeWPF.ViewModels
}
this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
- this.UseAdvancedTab = (!string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab) || preset.Task.ShowAdvancedTab;
+ this.UseAdvancedTab = (!string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.IsAdvancedTabOptionEnabled) || preset.Task.ShowAdvancedTab;
}
}
@@ -1018,23 +1010,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Clear advanced settings.
- /// </summary>
- public void ClearAdvancedSettings()
- {
- this.canClear = false;
- this.FastDecode = false;
- this.VideoTune = null;
- this.VideoProfile = new VideoProfile("auto", "auto");
- this.VideoPreset = null;
- this.VideoPresetValue = 1;
- this.VideoLevel = new VideoLevel("auto", "auto");
-
- this.ExtraArguments = string.Empty;
- this.canClear = true;
- }
-
- /// <summary>
/// The copy query.
/// </summary>
public void CopyQuery()
@@ -1080,16 +1055,6 @@ namespace HandBrakeWPF.ViewModels
}
}
- /// <summary>
- /// Reset advanced tab.
- /// </summary>
- private void ResetAdvancedTab()
- {
- if (canClear)
- {
- this.advancedEncoderOptionsCommand.ExecuteClearAdvanced();
- }
- }
/// <summary>
/// The get actualx 264 query.
@@ -1156,7 +1121,7 @@ namespace HandBrakeWPF.ViewModels
{
if (e.Key == UserSettingConstants.ShowAdvancedTab)
{
- this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ this.NotifyOfPropertyChange(() => this.IsAdvancedTabOptionEnabled);
}
}
@@ -1310,7 +1275,7 @@ namespace HandBrakeWPF.ViewModels
}
// Tell the Advanced Panel off the change
- IAdvancedViewModel advancedViewModel = IoC.Get<IAdvancedViewModel>();
+ IX264ViewModel advancedViewModel = IoC.Get<IX264ViewModel>();
advancedViewModel.SetEncoder(this.Task.VideoEncoder);
// Update the Quality Slider. Make sure the bounds are up to date with the users settings.
@@ -1337,7 +1302,7 @@ namespace HandBrakeWPF.ViewModels
// Refresh Display
this.NotifyOfPropertyChange(() => this.Rfqp);
- this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+ this.NotifyOfPropertyChange(() => this.IsAdvancedTabOptionEnabled);
this.NotifyOfPropertyChange(() => this.HighQualityLabel);
// Handle some quicksync specific options.
diff --git a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
index 5b2694cd9..ac92b760f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs
@@ -16,7 +16,6 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Interop.Model.Encoding;
- using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Presets.Model;
@@ -30,11 +29,6 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public class X264ViewModel : ViewModelBase, IX264ViewModel
{
- /// <summary>
- /// The advanced encoder options command.
- /// </summary>
- private readonly IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand;
-
#region Constants and Fields
/// <summary>
@@ -164,12 +158,8 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="X264ViewModel"/> class.
/// </summary>
- /// <param name="advancedEncoderOptionsCommand">
- /// The advanced Encoder Options Command.
- /// </param>
- public X264ViewModel(IAdvancedEncoderOptionsCommand advancedEncoderOptionsCommand)
+ public X264ViewModel()
{
- this.advancedEncoderOptionsCommand = advancedEncoderOptionsCommand;
this.Task = new EncodeTask();
this.UpdateUIFromAdvancedOptions();
}
@@ -190,6 +180,11 @@ namespace HandBrakeWPF.ViewModels
ShowX264AdvancedOptions = this.Task.ShowAdvancedTab;
this.NotifyOfPropertyChange(() => ShowX264AdvancedOptions);
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
+
+ if (ShowX264AdvancedOptions)
+ {
+ this.UpdateUIFromAdvancedOptions();
+ }
}
}
@@ -253,12 +248,6 @@ namespace HandBrakeWPF.ViewModels
this.Task.AdvancedEncoderOptions = value;
this.UpdateUIFromAdvancedOptions();
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
-
- // Reset the video tab if the user is using this tab.
- if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
- {
- this.advancedEncoderOptionsCommand.ExecuteClearVideo();
- }
}
}
@@ -1154,12 +1143,6 @@ namespace HandBrakeWPF.ViewModels
this.Task.AdvancedEncoderOptions = string.Join(":", newOptions);
this.NotifyOfPropertyChange(() => this.AdvancedOptionsString);
-
- // Reset the video tab if the user is using this tab.
- if (!string.IsNullOrEmpty(this.Task.AdvancedEncoderOptions))
- {
- this.advancedEncoderOptionsCommand.ExecuteClearVideo();
- }
}
#endregion