diff options
author | sr55 <[email protected]> | 2016-02-07 21:32:16 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2016-02-07 21:32:16 +0000 |
commit | 4827c1fefdef10053318477c2eed6386b374a779 (patch) | |
tree | 6dd65cdd450e894cff6b30ff1647ef8d639e1a25 /win/CS/HandBrakeWPF | |
parent | 8ce01f3f60df3e2065e44bdf2629f81b7b10b2b6 (diff) |
WinGui: Fixes to the refactored Audio Defaults View. Settings were not getting applied correctly.
Diffstat (limited to 'win/CS/HandBrakeWPF')
10 files changed, 273 insertions, 61 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs index 5090339b5..40c73251a 100644 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs @@ -204,7 +204,6 @@ namespace HandBrakeWPF.Helpers int outputHeight = result.height;
int outputParWidth = result.par.num;
int outputParHeight = result.par.den;
- Debug.WriteLine("hb_set_anamorphic_size2: {0}x{1}", outputWidth, outputHeight);
return new AnamorphicResult { OutputWidth = outputWidth, OutputHeight = outputHeight, OutputParWidth = outputParWidth, OutputParHeight = outputParHeight };
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 320c1bc73..8b1d323df 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -187,7 +187,7 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
- /// Looks up a localized string similar to Otherwise use fallback encoder:.
+ /// Looks up a localized string similar to Fallback encoder:.
/// </summary>
public static string AudioView_OtherwiseFallbackEncoder {
get {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index bc21ee95d..b7aeef1db 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -349,7 +349,7 @@ <value>Move Right</value>
</data>
<data name="AudioView_OtherwiseFallbackEncoder" xml:space="preserve">
- <value>Otherwise use fallback encoder:</value>
+ <value>Fallback encoder:</value>
</data>
<data name="AudioView_ReloadDefaults" xml:space="preserve">
<value>Reload Defaults</value>
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs index 9586e1632..47ec12828 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AllowedPassthru.cs @@ -165,7 +165,22 @@ namespace HandBrakeWPF.Services.Encode.Model.Models return audioEncoders; } - } + } + + /// <summary> + /// Disable the passthru options. + /// </summary> + public void SetFalse() + { + this.AudioAllowAACPass = false; + this.AudioAllowAC3Pass = false; + this.AudioAllowDTSHDPass = false; + this.AudioAllowDTSPass = false; + this.AudioAllowMP3Pass = false; + this.AudioAllowEAC3Pass = false; + this.AudioAllowTrueHDPass = false; + this.AudioAllowFlacPass = false; + } #endregion } diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index dbb702a77..4a464a68b 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -319,31 +319,35 @@ namespace HandBrakeWPF.Services.Presets.Factories if (importedPreset.AudioCopyMask != null)
{
+ preset.Task.AllowedPassthruOptions.SetFalse();
foreach (var item in importedPreset.AudioCopyMask)
{
- AudioEncoder encoder = EnumHelper<AudioEncoder>.GetValue(item.ToString());
+ AudioEncoder encoder = EnumHelper<AudioEncoder>.GetValue(item);
switch (encoder)
{
case AudioEncoder.AacPassthru:
preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
break;
case AudioEncoder.Ac3Passthrough:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowAC3Pass = true;
break;
case AudioEncoder.EAc3Passthrough:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowEAC3Pass = true;
break;
case AudioEncoder.DtsHDPassthrough:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowDTSHDPass = true;
break;
case AudioEncoder.DtsPassthrough:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowDTSPass = true;
break;
case AudioEncoder.FlacPassthru:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowFlacPass = true;
break;
case AudioEncoder.Mp3Passthru:
- preset.Task.AllowedPassthruOptions.AudioAllowAACPass = true;
+ preset.Task.AllowedPassthruOptions.AudioAllowMP3Pass = true;
+ break;
+ case AudioEncoder.TrueHDPassthrough:
+ preset.Task.AllowedPassthruOptions.AudioAllowTrueHDPass = true;
break;
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 6bc8b2998..b2bb3e5d9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -159,16 +159,16 @@ namespace HandBrakeWPF.ViewModels /// </param>
public void Setup(EncodeTask task, Title title, AudioBehaviours audioBehaviours, SubtitleBehaviours subtitleBehaviours)
{
- this.audioDefaultsViewModel = new AudioDefaultsViewModel();
- this.audioDefaultsViewModel.SetupLanguages(audioBehaviours);
+ this.Preset.Task = new EncodeTask(task);
+ this.Preset.AudioTrackBehaviours = audioBehaviours.Clone();
+ this.Preset.SubtitleTrackBehaviours = subtitleBehaviours.Clone();
+
+ this.audioDefaultsViewModel = new AudioDefaultsViewModel(this.Preset.Task);
+ this.audioDefaultsViewModel.Setup(this.Preset, this.Preset.Task);
this.subtitlesDefaultsViewModel = new SubtitlesDefaultsViewModel();
this.subtitlesDefaultsViewModel.SetupLanguages(subtitleBehaviours);
- this.Preset.Task = new EncodeTask(task);
- this.Preset.AudioTrackBehaviours = audioBehaviours;
- this.Preset.SubtitleTrackBehaviours = subtitleBehaviours.Clone();
-
this.selectedTitle = title;
switch (task.Anamorphic)
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs index f61aa4010..fc1760f8b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs @@ -16,6 +16,8 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.Model.Audio; + using HandBrakeWPF.Services.Encode.Model; + using HandBrakeWPF.Services.Encode.Model.Models; using HandBrakeWPF.Services.Presets.Model; using HandBrakeWPF.Utilities; using HandBrakeWPF.ViewModels.Interfaces; @@ -27,19 +29,28 @@ namespace HandBrakeWPF.ViewModels { private BindingList<string> availableLanguages; private AudioBehaviours audioBehaviours; + private EncodeTask task; + + private AudioEncoder audioEncoderFallback; #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="AudioDefaultsViewModel"/> class. /// </summary> - public AudioDefaultsViewModel() + /// <param name="task"> + /// The task. + /// </param> + public AudioDefaultsViewModel(EncodeTask task) { + this.Task = task; this.AudioBehaviours = new AudioBehaviours(); this.SelectedAvailableToMove = new BindingList<string>(); this.SelectedLangaugesToMove = new BindingList<string>(); this.AvailableLanguages = new BindingList<string>(); - this.SetupLanguages((Preset)null); + this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList(); + + this.Setup((Preset)null, task); } #endregion @@ -47,6 +58,31 @@ namespace HandBrakeWPF.ViewModels #region Properties /// <summary> + /// Gets or sets the task. + /// </summary> + public EncodeTask Task + { + get + { + return this.task; + } + set + { + if (Equals(value, this.task)) + { + return; + } + this.task = value; + this.NotifyOfPropertyChange(() => this.Task); + } + } + + /// <summary> + /// Gets or sets AudioEncoders. + /// </summary> + public IEnumerable<AudioEncoder> AudioEncoders { get; set; } + + /// <summary> /// Gets the audio behaviours. /// </summary> public AudioBehaviours AudioBehaviours @@ -116,6 +152,162 @@ namespace HandBrakeWPF.ViewModels /// </summary> public BindingList<string> SelectedLangaugesToMove { get; private set; } + /// <summary> + /// Gets or sets a value indicating whether audio allow m p 3 pass. + /// </summary> + public bool AudioAllowMP3Pass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowMP3Pass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowMP3Pass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowMP3Pass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow aac pass. + /// </summary> + public bool AudioAllowAACPass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowAACPass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowAACPass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowAACPass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow ac3 pass. + /// </summary> + public bool AudioAllowAC3Pass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowAC3Pass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowAC3Pass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowAC3Pass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow eac3 pass. + /// </summary> + public bool AudioAllowEAC3Pass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowEAC3Pass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowEAC3Pass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowEAC3Pass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow dts pass. + /// </summary> + public bool AudioAllowDTSPass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowDTSPass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowDTSPass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowDTSPass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow dtshd pass. + /// </summary> + public bool AudioAllowDTSHDPass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowDTSHDPass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowDTSHDPass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowDTSHDPass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow true hd pass. + /// </summary> + public bool AudioAllowTrueHDPass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowTrueHDPass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowTrueHDPass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowTrueHDPass); + } + } + + /// <summary> + /// Gets or sets a value indicating whether audio allow flac pass. + /// </summary> + public bool AudioAllowFlacPass + { + get + { + return this.Task.AllowedPassthruOptions.AudioAllowFlacPass; + } + + set + { + this.task.AllowedPassthruOptions.AudioAllowFlacPass = value; + this.NotifyOfPropertyChange(() => this.AudioAllowFlacPass); + } + } + + /// <summary> + /// Gets or sets the audio encoder fallback. + /// </summary> + public AudioEncoder AudioEncoderFallback + { + get + { + return this.audioEncoderFallback; + } + set + { + if (value == this.audioEncoderFallback) + { + return; + } + this.audioEncoderFallback = value; + this.NotifyOfPropertyChange(() => this.AudioEncoderFallback); + } + } + #endregion #region Public Methods @@ -180,38 +372,34 @@ namespace HandBrakeWPF.ViewModels /// <param name="preset"> /// The preset. /// </param> - public void SetupLanguages(Preset preset) - { - if (preset != null) - { - this.SetupLanguages(preset.AudioTrackBehaviours.Clone()); - } - } - - /// <summary> - /// The setup languages. - /// </summary> - /// <param name="behaviours"> - /// The behaviours. + /// <param name="task"> + /// The task. /// </param> - public void SetupLanguages(AudioBehaviours behaviours) + public void Setup(Preset preset, EncodeTask task) { - // Step 1, Set the behaviour mode + // Reset this.AudioBehaviours.SelectedBehaviour = AudioBehaviourModes.None; this.AudioBehaviours.SelectedLangauges.Clear(); - // Step 2, Get all the languages + // Setup for this Encode Task. + this.Task = task; + IDictionary<string, string> langList = LanguageUtilities.MapLanguages(); langList = (from entry in langList orderby entry.Key ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value); - // Step 3, Setup Available Languages this.AvailableLanguages.Clear(); foreach (string item in langList.Keys) { this.AvailableLanguages.Add(item); } - // Step 4, Set the Selected Languages + // Handle the Preset, if it's not null. + if (preset == null) + { + return; + } + + AudioBehaviours behaviours = preset.AudioTrackBehaviours.Clone(); if (behaviours != null) { this.AudioBehaviours.SelectedBehaviour = behaviours.SelectedBehaviour; @@ -223,6 +411,18 @@ namespace HandBrakeWPF.ViewModels this.AudioBehaviours.SelectedLangauges.Add(selectedItem); } } + + this.task.AllowedPassthruOptions = new AllowedPassthru(preset.Task.AllowedPassthruOptions); + + this.NotifyOfPropertyChange(() => this.AudioAllowMP3Pass); + this.NotifyOfPropertyChange(() => this.AudioAllowAACPass); + this.NotifyOfPropertyChange(() => this.AudioAllowAC3Pass); + this.NotifyOfPropertyChange(() => this.AudioAllowEAC3Pass); + this.NotifyOfPropertyChange(() => this.AudioAllowDTSPass); + this.NotifyOfPropertyChange(() => this.AudioAllowDTSHDPass); + this.NotifyOfPropertyChange(() => this.AudioAllowTrueHDPass); + this.NotifyOfPropertyChange(() => this.AudioAllowFlacPass); + this.NotifyOfPropertyChange(() => this.AudioEncoderFallback); } #endregion diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 9e86506fa..d15368c00 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -66,9 +66,9 @@ namespace HandBrakeWPF.ViewModels /// The user Setting Service.
/// </param>
public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
- {
- this.AudioDefaultsViewModel = new AudioDefaultsViewModel();
+ {
this.Task = new EncodeTask();
+ this.AudioDefaultsViewModel = new AudioDefaultsViewModel(this.Task);
this.SampleRates = new ObservableCollection<string> { "Auto" };
foreach (var item in HandBrakeEncoderHelpers.AudioSampleRates)
@@ -287,12 +287,10 @@ namespace HandBrakeWPF.ViewModels this.currentPreset = preset;
// Audio Behaviours
- this.AudioDefaultsViewModel.SetupLanguages(preset);
+ this.AudioDefaultsViewModel.Setup(preset, task);
if (preset != null && preset.Task != null)
{
- this.Task.AllowedPassthruOptions = new AllowedPassthru(preset.Task.AllowedPassthruOptions);
-
this.SetupTracks();
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs index d6859e38e..a34bc82f9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrakeWPF.Model.Audio;
+ using HandBrakeWPF.Services.Encode.Model;
using HandBrakeWPF.Services.Presets.Model;
/// <summary>
@@ -28,14 +29,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// <param name="preset">
/// The preset.
/// </param>
- void SetupLanguages(Preset preset);
-
- /// <summary>
- /// The setup languages.
- /// </summary>
- /// <param name="behaviours">
- /// The behaviours.
+ /// <param name="task">
+ /// The task.
/// </param>
- void SetupLanguages(AudioBehaviours behaviours);
+ void Setup(Preset preset, EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml index 835ca65a9..b8c1263f2 100644 --- a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml @@ -115,41 +115,41 @@ Orientation="Horizontal"> <CheckBox Margin="0,0,5,0" Content="MP3" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowMP3Pass}" /> + IsChecked="{Binding AudioAllowMP3Pass}" /> <CheckBox Margin="0,0,5,0" Content="AAC" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAACPass}" /> + IsChecked="{Binding AudioAllowAACPass}" /> <CheckBox Margin="0,0,5,0" Content="AC3" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAC3Pass}" /> + IsChecked="{Binding AudioAllowAC3Pass}" /> <CheckBox Margin="0,0,5,0" Content="E-AC3" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowEAC3Pass}" /> + IsChecked="{Binding AudioAllowEAC3Pass}" /> <CheckBox Margin="0,0,5,0" Content="DTS" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSPass}" /> + IsChecked="{Binding AudioAllowDTSPass}" /> <CheckBox Margin="0,0,5,0" Content="DTSHD" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSHDPass}" /> + IsChecked="{Binding AudioAllowDTSHDPass}" /> <CheckBox Margin="0,0,5,0" Content="TrueHD" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowTrueHDPass}" /> + IsChecked="{Binding AudioAllowTrueHDPass}" /> <CheckBox Margin="0,0,5,0" Content="FLAC" VerticalAlignment="Center" - IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowFlacPass}" /> + IsChecked="{Binding AudioAllowFlacPass}" /> <TextBlock Margin="15,0,5,0" Text="{x:Static Properties:ResourcesUI.AudioView_OtherwiseFallbackEncoder}" /> <ComboBox VerticalAlignment="Center" Width="105" Height="22" Margin="5,0,5,0"> <ComboBox.SelectedItem> <MultiBinding Converter="{StaticResource audioEncoderConverter}"> - <Binding Path="Task.AllowedPassthruOptions.AudioEncoderFallback" /> + <Binding Path="AudioEncoderFallback" /> </MultiBinding> </ComboBox.SelectedItem> <ComboBox.ItemsSource> <MultiBinding Converter="{StaticResource audioEncoderConverter}" ConverterParameter="True"> - <Binding Path="DataContext.AudioEncoders" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" /> - <Binding Path="DataContext.Task" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" /> + <Binding Path="AudioEncoders" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" /> + <Binding Path="Task" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" /> </MultiBinding> </ComboBox.ItemsSource> </ComboBox> |