diff options
9 files changed, 71 insertions, 139 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs index e4312e451..519d0480a 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -458,6 +458,11 @@ namespace HandBrake.ApplicationServices.Interop /// </returns>
public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout)
{
+ if (mixdown == null)
+ {
+ return null;
+ }
+
int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id);
if (sanitizedMixdown != -1)
{
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 698cf086d..1eab4eee8 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -124,6 +124,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Configure how the Audio Tracks are automatically selected and configured when you select a new title or source video..
+ /// </summary>
+ public static string AudioView_AudioDefaultsDescription {
+ get {
+ return ResourceManager.GetString("AudioView_AudioDefaultsDescription", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to 'Auto Passthru' Behaviour:.
/// </summary>
public static string AudioView_AutoPassthruBehaviour {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index c77f2580c..29a0ea5ec 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -866,4 +866,7 @@ This will not affect your current settings in the Subtitle tab.</value> <data name="QueueSelection_UsingPreset" xml:space="preserve">
<value>The selected titles will be added using the "{0}" preset.</value>
</data>
+ <data name="AudioView_AudioDefaultsDescription" xml:space="preserve">
+ <value>Configure how the Audio Tracks are automatically selected and configured when you select a new title or source video.</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs index 43138481a..53b162f87 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/AudioTrack.cs @@ -645,12 +645,11 @@ namespace HandBrakeWPF.Services.Encode.Model.Models HBMixdown sanitisedMixdown = HandBrakeEncoderHelpers.SanitizeMixdown(currentMixdown, aencoder, (uint)this.ScannedTrack.ChannelLayout); HBMixdown defaultMixdown = HandBrakeEncoderHelpers.GetDefaultMixdown(aencoder, (uint)this.ScannedTrack.ChannelLayout); - if (this.mixDown == null || this.mixDown == "none") { this.MixDown = defaultMixdown.ShortName; } - else + else if (sanitisedMixdown != null) { this.MixDown = sanitisedMixdown.ShortName; } diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 04115d5b8..86f8b36d2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -38,21 +38,10 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public class AudioViewModel : ViewModelBase, IAudioViewModel
{
- /// <summary>
- /// Backing field for the source tracks list.
- /// </summary>
+ private readonly IWindowManager windowManager;
private IEnumerable<Audio> sourceTracks;
-
- /// <summary>
- /// The current preset.
- /// </summary>
private Preset currentPreset;
- /// <summary>
- /// The show audio defaults panel.
- /// </summary>
- private bool showAudioDefaultsPanel;
-
#region Constructors and Destructors
/// <summary>
@@ -65,7 +54,8 @@ namespace HandBrakeWPF.ViewModels /// The user Setting Service.
/// </param>
public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
- {
+ {
+ this.windowManager = windowManager;
this.Task = new EncodeTask();
this.AudioDefaultsViewModel = new AudioDefaultsViewModel(this.Task);
@@ -124,27 +114,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public EncodeTask Task { get; set; }
- /// <summary>
- /// Gets or sets a value indicating whether show audio defaults panel.
- /// </summary>
- public bool ShowAudioDefaultsPanel
- {
- get
- {
- return this.showAudioDefaultsPanel;
- }
- set
- {
- if (value.Equals(this.showAudioDefaultsPanel))
- {
- return;
- }
- this.showAudioDefaultsPanel = value;
- this.NotifyOfPropertyChange(() => this.ShowAudioDefaultsPanel);
- this.NotifyOfPropertyChange(() => this.PanelTitle);
- this.NotifyOfPropertyChange(() => this.SwitchDisplayTitle);
- }
- }
/// <summary>
/// Gets the panel title.
@@ -153,7 +122,7 @@ namespace HandBrakeWPF.ViewModels {
get
{
- return this.ShowAudioDefaultsPanel ? Resources.AudioViewModel_AudioDefaults : Resources.AudioViewModel_AudioTracks;
+ return Resources.AudioViewModel_AudioTracks;
}
}
@@ -164,7 +133,7 @@ namespace HandBrakeWPF.ViewModels {
get
{
- return this.ShowAudioDefaultsPanel ? Resources.AudioViewModel_SwitchBackToTracks : Resources.AudioViewModel_ConfigureDefaults;
+ return Resources.AudioViewModel_ConfigureDefaults;
}
}
@@ -246,21 +215,19 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Open the options screen to the Audio and Subtitles tab.
- /// </summary>
- public void SetDefaultBehaviour()
- {
- this.ShowAudioDefaultsPanel = true;
- }
-
- /// <summary>
/// The show audio defaults.
/// </summary>
public void ShowAudioDefaults()
{
- // OpenOverlayPanelCommand command = new OpenOverlayPanelCommand();
- // command.Execute(new AudioDefaultsViewModel(this.WindowManager, this.UserSettingService));
- this.ShowAudioDefaultsPanel = !this.ShowAudioDefaultsPanel;
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.AudioDefaultsViewModel, ResourcesUI.Preset_AudioDefaults_Title, ResourcesUI.AudioView_AudioDefaultsDescription);
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ // Nothing to do yet, it's by reference.
+ }
+ else
+ {
+ // Handle other case(s)
+ }
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index d27b8dc26..20fc39918 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -14,6 +14,8 @@ namespace HandBrakeWPF.ViewModels using System.IO;
using System.Linq;
+ using Caliburn.Micro;
+
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Model.Subtitles;
@@ -35,28 +37,13 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public class SubtitlesViewModel : ViewModelBase, ISubtitlesViewModel
{
+ private readonly IWindowManager windowManager;
+
#region Constants and Fields
- /// <summary>
- /// The Foreign Audio Search Track
- /// </summary>
private readonly Subtitle ForeignAudioSearchTrack;
-
- /// <summary>
- /// Backing field for the source subtitle tracks.
- /// </summary>
private IList<Subtitle> sourceTracks;
- /// <summary>
- /// The show defaults panel.
- /// </summary>
- private bool showDefaultsPanel;
-
- /// <summary>
- /// The audio behaviours.
- /// </summary>
- private SubtitleBehaviours subtitleBehaviours;
-
#endregion
#region Constructors and Destructors
@@ -64,8 +51,12 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.SubtitlesViewModel"/> class.
/// </summary>
- public SubtitlesViewModel()
+ /// <param name="windowManager">
+ /// The window Manager.
+ /// </param>
+ public SubtitlesViewModel(IWindowManager windowManager)
{
+ this.windowManager = windowManager;
this.SubtitleDefaultsViewModel = new SubtitlesDefaultsViewModel();
this.Task = new EncodeTask();
@@ -118,35 +109,13 @@ namespace HandBrakeWPF.ViewModels public EncodeTask Task { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether show defaults panel.
- /// </summary>
- public bool ShowDefaultsPanel
- {
- get
- {
- return this.showDefaultsPanel;
- }
- set
- {
- if (value.Equals(this.showDefaultsPanel))
- {
- return;
- }
- this.showDefaultsPanel = value;
- this.NotifyOfPropertyChange(() => this.ShowDefaultsPanel);
- this.NotifyOfPropertyChange(() => this.PanelTitle);
- this.NotifyOfPropertyChange(() => this.SwitchDisplayTitle);
- }
- }
-
- /// <summary>
/// Gets the panel title.
/// </summary>
public string PanelTitle
{
get
{
- return this.ShowDefaultsPanel ? Resources.SubtitlesViewModel_SubDefaults : Resources.SubtitlesViewModel_SubTracks;
+ return Resources.SubtitlesViewModel_SubTracks;
}
}
@@ -157,7 +126,7 @@ namespace HandBrakeWPF.ViewModels {
get
{
- return this.ShowDefaultsPanel ? Resources.SubtitlesViewModel_SwitchToTracks : Resources.SubtitlesViewModel_ConfigureDefaults;
+ return Resources.SubtitlesViewModel_ConfigureDefaults;
}
}
@@ -435,19 +404,19 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Open the options screen to the Audio and Subtitles tab.
- /// </summary>
- public void SetDefaultBehaviour()
- {
- this.ShowDefaultsPanel = true;
- }
-
- /// <summary>
/// The show audio defaults.
/// </summary>
public void ShowSubtitleDefaultsPanel()
{
- this.ShowDefaultsPanel = !this.ShowDefaultsPanel;
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.SubtitleDefaultsViewModel, ResourcesUI.Preset_AudioDefaults_Title, ResourcesUI.AudioView_AudioDefaultsDescription);
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ // Nothing to do yet, it's by reference.
+ }
+ else
+ {
+ // Handle other case(s)
+ }
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index 8620646da..812361428 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -17,7 +17,6 @@ x:Name="audioTab">
<UserControl.Resources>
- <Conveters:EnumComboConverter x:Key="enumComboConverter" />
<Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
@@ -47,13 +46,6 @@ VerticalAlignment="Top"
Text="{Binding PanelTitle}" />
- <Button MinWidth="65" Grid.Row="0" Grid.Column="1"
- Margin="0,5,10,0"
- cal:Message.Attach="[Event Click] = [Action ShowAudioDefaults]"
- Content="{Binding SwitchDisplayTitle}"
- Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}}"
- />
-
<!-- Row 1 -->
<Grid Grid.Row="1" Margin="10,5,10,0" Grid.Column="0"
Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
@@ -121,7 +113,7 @@ <Separator />
<MenuItem Header="{x:Static Properties:ResourcesUI.Generic_Clear}" cal:Message.Attach="[Event Click] = [Action Clear]" />
<Separator />
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_ConfigureDefaultBehaviours}" cal:Message.Attach="[Event Click] = [Action SetDefaultBehaviour]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_ConfigureDefaultBehaviours}" cal:Message.Attach="[Event Click] = [Action ShowAudioDefaults]" />
</ContextMenu>
</ListBox.ContextMenu>
@@ -278,9 +270,5 @@ </ListBox.ItemTemplate>
</ListBox>
- <!-- Audio Defaults -->
- <ContentControl x:Name="AudioDefaultsViewModel" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0"
- Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=false, FallbackValue=Visible}" />
-
</Grid>
</UserControl>
diff --git a/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml b/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml index 2efe3fcd7..1d2860f2e 100644 --- a/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml +++ b/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml @@ -8,6 +8,7 @@ xmlns:converters="clr-namespace:HandBrakeWPF.Converters" d:DesignHeight="250" d:DesignWidth="600" + MaxHeight="600" Title="{Binding Title}" ResizeMode="NoResize" SizeToContent="WidthAndHeight" @@ -29,31 +30,34 @@ <TextBlock Text="{Binding WindowTitle}" FontSize="26" FontFamily="Segoe UI Light" Margin="10,10,10,5" Grid.Row="0" /> <TextBlock Text="{Binding SubText}" Margin="10,0,0,15" Grid.Row="1" Visibility="{Binding SubTextVisible, Converter={StaticResource boolToVisConverter}}" /> - - <ContentControl x:Name="ContentViewModel" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Margin="0,0,10,10" /> - <Grid Grid.Row="3" - Margin="0,20,0,0"> + <ScrollViewer VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="2" Margin="0,0,10,10" VerticalScrollBarVisibility="Auto" > + <ContentControl x:Name="ContentViewModel"/> + </ScrollViewer> + + <Border BorderBrush="DarkGray" Grid.Row="3" BorderThickness="0,1,0,0" Margin="0,20,0,0"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" /> - </Grid.ColumnDefinitions> - - <Button Grid.Column="1" + <Button Grid.Column="1" Margin="0,5,10,10" cal:Message.Attach="[Event Click] = [Action Cancel]" Content="{x:Static properties:ResourcesUI.Generic_Cancel}" IsCancel="True" + Visibility="Collapsed" Padding="8,2" /> - <Button Grid.Column="2" + <Button Grid.Column="2" Margin="0,5,10,10" cal:Message.Attach="[Event Click] = [Action Save]" Content="{x:Static properties:ResourcesUI.Generic_Save}" IsDefault="True" Padding="8,2" /> - </Grid> + </Grid> + </Border> </Grid> diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 099e21271..d1dcc88c9 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -45,13 +45,6 @@ VerticalAlignment="Top"
Text="{Binding PanelTitle}" />
- <Button MinWidth="65" Grid.Row="0" Grid.Column="1"
- Margin="0,5,10,0"
- cal:Message.Attach="[Event Click] = [Action ShowSubtitleDefaultsPanel]"
- Content="{Binding SwitchDisplayTitle}"
- Visibility="{Binding ShowDefaultsPanel, Converter={StaticResource booleanToVisConverter}}"
- />
-
<!-- Row 1 -->
<Grid Grid.Row="1" Margin="10,5,10,0"
Visibility="{Binding ShowDefaultsPanel, Converter={StaticResource booleanToVisConverter}, ConverterParameter=true}" >
@@ -120,7 +113,7 @@ <Separator />
<MenuItem Header="{x:Static Properties:ResourcesUI.Generic_Clear}" cal:Message.Attach="[Event Click] = [Action Clear]" />
<Separator />
- <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_ConfigureDefaultBehaviours}" cal:Message.Attach="[Event Click] = [Action SetDefaultBehaviour]" />
+ <MenuItem Header="{x:Static Properties:ResourcesUI.Shared_ConfigureDefaultBehaviours}" cal:Message.Attach="[Event Click] = [Action ShowSubtitleDefaultsPanel]" />
</ContextMenu>
</ListBox.ContextMenu>
@@ -280,10 +273,5 @@ </ListBox.ItemTemplate>
</ListBox>
- <!-- Audio Defaults -->
- <ContentControl x:Name="SubtitleDefaultsViewModel" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,0,0"
- Visibility="{Binding ShowDefaultsPanel, Converter={StaticResource booleanToVisConverter}, ConverterParameter=false, FallbackValue=Visible}" />
-
-
</Grid>
</UserControl>
|