diff options
author | sr55 <[email protected]> | 2016-02-06 15:29:34 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2016-02-06 15:29:34 +0000 |
commit | 8ce01f3f60df3e2065e44bdf2629f81b7b10b2b6 (patch) | |
tree | 3dbce92cee59bcd7b3ff09e8dbce0a7f140ef1c4 /win/CS | |
parent | 3053ec908dab32b4da6ce9ec022215087a28a37e (diff) |
WinGui:
- Refractor the Audio and Subtitle Defaults into their own View/ViewModel
- Add a new PopupWindow container system.
- Add "Edit Defaults" for Audio and Subtitles on the Add Preset Pane to make the feature more discoverable. (Note, this does not change the existing settings on the Audio/Subtitle Tabs)
Diffstat (limited to 'win/CS')
22 files changed, 1287 insertions, 554 deletions
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 85328d652..21b92b13e 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -243,16 +243,28 @@ <Compile Include="Utilities\PropertyChangedBase.cs" />
<Compile Include="Utilities\DirectoryUtilities.cs" />
<Compile Include="Utilities\Win7.cs" />
+ <Compile Include="ViewModels\AudioDefaultsViewModel.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\IAudioDefaultsViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />
<Compile Include="Controls\SourceSelection.xaml.cs">
<DependentUpon>SourceSelection.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\Interfaces\IOverlayPanel.cs" />
+ <Compile Include="ViewModels\Interfaces\IPopupWindowViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IStaticPreviewViewModel.cs" />
<Compile Include="ViewModels\Interfaces\IMiniViewModel.cs" />
+ <Compile Include="ViewModels\Interfaces\ISubtitlesDefaultsViewModel.cs" />
<Compile Include="ViewModels\MiniViewModel.cs" />
+ <Compile Include="ViewModels\PopupWindowViewModel.cs" />
<Compile Include="ViewModels\StaticPreviewViewModel.cs" />
+ <Compile Include="ViewModels\SubtitlesDefaultsViewModel.cs" />
+ <Compile Include="Views\AudioDefaultsView.xaml.cs">
+ <DependentUpon>AudioDefaultsView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\PopupWindowView.xaml.cs">
+ <DependentUpon>PopupWindowView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\CountdownAlertView.xaml.cs">
<DependentUpon>CountdownAlertView.xaml</DependentUpon>
</Compile>
@@ -370,6 +382,9 @@ <SubType>Code</SubType>
</Compile>
<Compile Include="ViewModels\MainViewModel.cs" />
+ <Compile Include="Views\SubtitlesDefaultsView.xaml.cs">
+ <DependentUpon>SubtitlesDefaultsView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\X264View.xaml.cs">
<DependentUpon>X264View.xaml</DependentUpon>
</Compile>
@@ -456,6 +471,14 @@ <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\AudioDefaultsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\PopupWindowView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\CountdownAlertView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -504,6 +527,10 @@ <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\SubtitlesDefaultsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\X264View.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 0ecbb9446..320c1bc73 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -556,6 +556,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Save.
+ /// </summary>
+ public static string Generic_Save {
+ get {
+ return ResourceManager.GetString("Generic_Save", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Copy to clipboard.
/// </summary>
public static string LogView_CopyClipboard {
@@ -1564,6 +1573,25 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Change the behaviour of the audio track selection for this preset.
+ ///This will not affect your current settings in the Audio tab..
+ /// </summary>
+ public static string Preset_AudioDefaults_SubText {
+ get {
+ return ResourceManager.GetString("Preset_AudioDefaults_SubText", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Audio Defaults.
+ /// </summary>
+ public static string Preset_AudioDefaults_Title {
+ get {
+ return ResourceManager.GetString("Preset_AudioDefaults_Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Export to file.
/// </summary>
public static string Preset_Export {
@@ -1582,6 +1610,25 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Change the behaviour of the subtitle track selection for this preset.
+ ///This will not affect your current settings in the Subtitle tab..
+ /// </summary>
+ public static string Preset_SubtitleDefaults_SubText {
+ get {
+ return ResourceManager.GetString("Preset_SubtitleDefaults_SubText", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Subtitle Defaults.
+ /// </summary>
+ public static string Preset_SubtitleDefaults_Title {
+ get {
+ return ResourceManager.GetString("Preset_SubtitleDefaults_Title", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Choose titles:.
/// </summary>
public static string QueueSelectionView_ChooseTitles {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 98acf368e..bc21ee95d 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -849,4 +849,21 @@ <data name="MainView_SourceOpen" xml:space="preserve">
<value>Open Source</value>
</data>
+ <data name="Generic_Save" xml:space="preserve">
+ <value>Save</value>
+ </data>
+ <data name="Preset_AudioDefaults_SubText" xml:space="preserve">
+ <value>Change the behaviour of the audio track selection for this preset.
+This will not affect your current settings in the Audio tab.</value>
+ </data>
+ <data name="Preset_AudioDefaults_Title" xml:space="preserve">
+ <value>Audio Defaults</value>
+ </data>
+ <data name="Preset_SubtitleDefaults_SubText" xml:space="preserve">
+ <value>Change the behaviour of the subtitle track selection for this preset.
+This will not affect your current settings in the Subtitle tab.</value>
+ </data>
+ <data name="Preset_SubtitleDefaults_Title" xml:space="preserve">
+ <value>Subtitle Defaults</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 2d8a7bd68..6bc8b2998 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -12,7 +12,8 @@ namespace HandBrakeWPF.ViewModels using System.Collections.Generic;
using System.Windows;
- using HandBrake.ApplicationServices.Utilities;
+ using Caliburn.Micro;
+
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Model.Audio;
@@ -45,6 +46,11 @@ namespace HandBrakeWPF.ViewModels private readonly IErrorService errorService;
/// <summary>
+ /// The window manager.
+ /// </summary>
+ private readonly IWindowManager windowManager;
+
+ /// <summary>
/// Backing fields for Selected Picture settings mode.
/// </summary>
private PresetPictureSettingsMode selectedPictureSettingMode;
@@ -59,6 +65,9 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private Title selectedTitle;
+ private IAudioDefaultsViewModel audioDefaultsViewModel;
+ private ISubtitlesDefaultsViewModel subtitlesDefaultsViewModel;
+
/// <summary>
/// Initializes a new instance of the <see cref="AddPresetViewModel"/> class.
/// </summary>
@@ -68,10 +77,14 @@ namespace HandBrakeWPF.ViewModels /// <param name="errorService">
/// The Error Service
/// </param>
- public AddPresetViewModel(IPresetService presetService, IErrorService errorService)
+ /// <param name="windowManager">
+ /// The window Manager.
+ /// </param>
+ public AddPresetViewModel(IPresetService presetService, IErrorService errorService, IWindowManager windowManager)
{
this.presetService = presetService;
this.errorService = errorService;
+ this.windowManager = windowManager;
this.Title = "Add Preset";
this.Preset = new Preset { IsBuildIn = false, IsDefault = false, Category = PresetService.UserPresetCatgoryName};
this.PictureSettingsModes = EnumHelper<PresetPictureSettingsMode>.GetEnumList();
@@ -146,9 +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.subtitlesDefaultsViewModel = new SubtitlesDefaultsViewModel();
+ this.subtitlesDefaultsViewModel.SetupLanguages(subtitleBehaviours);
+
this.Preset.Task = new EncodeTask(task);
- this.Preset.AudioTrackBehaviours = audioBehaviours.Clone();
+ this.Preset.AudioTrackBehaviours = audioBehaviours;
this.Preset.SubtitleTrackBehaviours = subtitleBehaviours.Clone();
+
this.selectedTitle = title;
switch (task.Anamorphic)
@@ -236,6 +256,39 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// The edit audio defaults.
+ /// </summary>
+ public void EditAudioDefaults()
+ {
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.audioDefaultsViewModel, ResourcesUI.Preset_AudioDefaults_Title, ResourcesUI.Preset_AudioDefaults_SubText);
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ this.Preset.AudioTrackBehaviours = this.audioDefaultsViewModel.AudioBehaviours.Clone();
+ }
+ else
+ {
+ // Handle other case(s)
+ }
+ }
+
+ /// <summary>
+ /// The edit subtitle defaults.
+ /// </summary>
+ public void EditSubtitleDefaults()
+ {
+ IPopupWindowViewModel popup = new PopupWindowViewModel(this.subtitlesDefaultsViewModel, ResourcesUI.Preset_SubtitleDefaults_Title, ResourcesUI.Preset_SubtitleDefaults_SubText);
+
+ if (this.windowManager.ShowDialog(popup) == true)
+ {
+ this.Preset.SubtitleTrackBehaviours = this.subtitlesDefaultsViewModel.SubtitleBehaviours.Clone();
+ }
+ else
+ {
+ // Handle other case(s)
+ }
+ }
+
+ /// <summary>
/// Cancel adding a preset
/// </summary>
public void Cancel()
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs new file mode 100644 index 000000000..f61aa4010 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/AudioDefaultsViewModel.cs @@ -0,0 +1,230 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="AudioDefaultsViewModel.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 Audio Defaults View Model +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels +{ + using System.Collections.Generic; + using System.ComponentModel; + using System.Linq; + + using HandBrake.ApplicationServices.Utilities; + + using HandBrakeWPF.Model.Audio; + using HandBrakeWPF.Services.Presets.Model; + using HandBrakeWPF.Utilities; + using HandBrakeWPF.ViewModels.Interfaces; + + /// <summary> + /// The Audio View Model + /// </summary> + public class AudioDefaultsViewModel : ViewModelBase, IAudioDefaultsViewModel + { + private BindingList<string> availableLanguages; + private AudioBehaviours audioBehaviours; + + #region Constructors and Destructors + + /// <summary> + /// Initializes a new instance of the <see cref="AudioDefaultsViewModel"/> class. + /// </summary> + public AudioDefaultsViewModel() + { + this.AudioBehaviours = new AudioBehaviours(); + this.SelectedAvailableToMove = new BindingList<string>(); + this.SelectedLangaugesToMove = new BindingList<string>(); + this.AvailableLanguages = new BindingList<string>(); + this.SetupLanguages((Preset)null); + } + + #endregion + + #region Properties + + /// <summary> + /// Gets the audio behaviours. + /// </summary> + public AudioBehaviours AudioBehaviours + { + get + { + return this.audioBehaviours; + } + + private set + { + if (Equals(value, this.audioBehaviours)) + { + return; + } + this.audioBehaviours = value; + this.NotifyOfPropertyChange(() => this.AudioBehaviours); + } + } + + /// <summary> + /// Gets the audio behaviour modes. + /// </summary> + public BindingList<AudioBehaviourModes> AudioBehaviourModeList + { + get + { + return new BindingList<AudioBehaviourModes>(EnumHelper<AudioBehaviourModes>.GetEnumList().ToList()); + } + } + + /// <summary> + /// Gets the audio track default behaviour mode list. + /// </summary> + public BindingList<AudioTrackDefaultsMode> AudioTrackDefaultBehaviourModeList + { + get + { + return new BindingList<AudioTrackDefaultsMode>(EnumHelper<AudioTrackDefaultsMode>.GetEnumList().ToList()); + } + } + + /// <summary> + /// Gets AvailableLanguages. + /// </summary> + public BindingList<string> AvailableLanguages + { + get + { + return this.availableLanguages; + } + + private set + { + this.availableLanguages = value; + this.NotifyOfPropertyChange("AvailableLanguages"); + } + } + + /// <summary> + /// Gets SelectedLangauges. + /// </summary> + public BindingList<string> SelectedAvailableToMove { get; private set; } + + /// <summary> + /// Gets SelectedLangauges. + /// </summary> + public BindingList<string> SelectedLangaugesToMove { get; private set; } + + #endregion + + #region Public Methods + + /// <summary> + /// Audio List Move Left + /// </summary> + public void LanguageMoveRight() + { + if (this.SelectedAvailableToMove.Count > 0) + { + List<string> copiedList = this.SelectedAvailableToMove.ToList(); + foreach (string item in copiedList) + { + this.AvailableLanguages.Remove(item); + this.AudioBehaviours.SelectedLangauges.Add(item); + } + + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + } + + /// <summary> + /// Audio List Move Right + /// </summary> + public void LanguageMoveLeft() + { + if (this.SelectedLangaugesToMove.Count > 0) + { + List<string> copiedList = this.SelectedLangaugesToMove.ToList(); + foreach (string item in copiedList) + { + this.AudioBehaviours.SelectedLangauges.Remove(item); + this.AvailableLanguages.Add(item); + } + } + + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + + /// <summary> + /// Audio List Clear all selected languages + /// </summary> + public void LanguageClearAll() + { + foreach (string item in this.AudioBehaviours.SelectedLangauges) + { + this.AvailableLanguages.Add(item); + } + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + + this.AudioBehaviours.SelectedLangauges.Clear(); + } + + #endregion + + #region Methods + + /// <summary> + /// The setup languages. + /// </summary> + /// <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> + public void SetupLanguages(AudioBehaviours behaviours) + { + // Step 1, Set the behaviour mode + this.AudioBehaviours.SelectedBehaviour = AudioBehaviourModes.None; + this.AudioBehaviours.SelectedLangauges.Clear(); + + // Step 2, Get all the languages + 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 + if (behaviours != null) + { + this.AudioBehaviours.SelectedBehaviour = behaviours.SelectedBehaviour; + this.AudioBehaviours.SelectedTrackDefaultBehaviour = behaviours.SelectedTrackDefaultBehaviour; + + foreach (string selectedItem in behaviours.SelectedLangauges) + { + this.AvailableLanguages.Remove(selectedItem); + this.AudioBehaviours.SelectedLangauges.Add(selectedItem); + } + } + } + + #endregion + } +}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 05a904d5f..9e86506fa 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -54,16 +54,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private bool showAudioDefaultsPanel;
- /// <summary>
- /// The available languages.
- /// </summary>
- private BindingList<string> availableLanguages;
-
- /// <summary>
- /// The audio behaviours.
- /// </summary>
- private AudioBehaviours audioBehaviours;
-
#region Constructors and Destructors
/// <summary>
@@ -77,6 +67,7 @@ namespace HandBrakeWPF.ViewModels /// </param>
public AudioViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
+ this.AudioDefaultsViewModel = new AudioDefaultsViewModel();
this.Task = new EncodeTask();
this.SampleRates = new ObservableCollection<string> { "Auto" };
@@ -88,12 +79,6 @@ namespace HandBrakeWPF.ViewModels this.AudioEncoders = EnumHelper<AudioEncoder>.GetEnumList();
this.AudioMixdowns = EnumHelper<Mixdown>.GetEnumList();
this.SourceTracks = new List<Audio>();
-
- this.AudioBehaviours = new AudioBehaviours();
- this.SelectedAvailableToMove = new BindingList<string>();
- this.SelectedLangaugesToMove = new BindingList<string>();
- this.AvailableLanguages = new BindingList<string>();
- this.SetupLanguages(null);
}
#endregion
@@ -101,46 +86,9 @@ namespace HandBrakeWPF.ViewModels #region Properties
/// <summary>
- /// Gets or sets the audio behaviours.
+ /// Gets or sets the audio defaults view model.
/// </summary>
- public AudioBehaviours AudioBehaviours
- {
- get
- {
- return this.audioBehaviours;
- }
- set
- {
- if (Equals(value, this.audioBehaviours))
- {
- return;
- }
- this.audioBehaviours = value;
- this.NotifyOfPropertyChange(() => this.AudioBehaviours);
- }
- }
-
- /// <summary>
- /// Gets the audio behaviour modes.
- /// </summary>
- public BindingList<AudioBehaviourModes> AudioBehaviourModeList
- {
- get
- {
- return new BindingList<AudioBehaviourModes>(EnumHelper<AudioBehaviourModes>.GetEnumList().ToList());
- }
- }
-
- /// <summary>
- /// Gets the audio track default behaviour mode list.
- /// </summary>
- public BindingList<AudioTrackDefaultsMode> AudioTrackDefaultBehaviourModeList
- {
- get
- {
- return new BindingList<AudioTrackDefaultsMode>(EnumHelper<AudioTrackDefaultsMode>.GetEnumList().ToList());
- }
- }
+ public IAudioDefaultsViewModel AudioDefaultsViewModel { get; set; }
/// <summary>
/// Gets or sets AudioBitrates.
@@ -228,32 +176,16 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets AvailableLanguages.
+ /// Gets the default audio behaviours.
/// </summary>
- public BindingList<string> AvailableLanguages
+ public AudioBehaviours AudioBehaviours
{
get
{
- return this.availableLanguages;
- }
-
- set
- {
- this.availableLanguages = value;
- this.NotifyOfPropertyChange("AvailableLanguages");
+ return this.AudioDefaultsViewModel.AudioBehaviours;
}
}
- /// <summary>
- /// Gets or sets SelectedLangauges.
- /// </summary>
- public BindingList<string> SelectedAvailableToMove { get; set; }
-
- /// <summary>
- /// Gets or sets SelectedLangauges.
- /// </summary>
- public BindingList<string> SelectedLangaugesToMove { get; set; }
-
#endregion
#region Public Methods
@@ -336,56 +268,6 @@ namespace HandBrakeWPF.ViewModels this.ShowAudioDefaultsPanel = !this.ShowAudioDefaultsPanel;
}
- /// <summary>
- /// Audio List Move Left
- /// </summary>
- public void LanguageMoveRight()
- {
- if (this.SelectedAvailableToMove.Count > 0)
- {
- List<string> copiedList = this.SelectedAvailableToMove.ToList();
- foreach (string item in copiedList)
- {
- this.AvailableLanguages.Remove(item);
- this.AudioBehaviours.SelectedLangauges.Add(item);
- }
-
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
- }
- }
-
- /// <summary>
- /// Audio List Move Right
- /// </summary>
- public void LanguageMoveLeft()
- {
- if (this.SelectedLangaugesToMove.Count > 0)
- {
- List<string> copiedList = this.SelectedLangaugesToMove.ToList();
- foreach (string item in copiedList)
- {
- this.AudioBehaviours.SelectedLangauges.Remove(item);
- this.AvailableLanguages.Add(item);
- }
- }
-
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
- }
-
- /// <summary>
- /// Audio List Clear all selected languages
- /// </summary>
- public void LanguageClearAll()
- {
- foreach (string item in this.AudioBehaviours.SelectedLangauges)
- {
- this.AvailableLanguages.Add(item);
- }
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
-
- this.AudioBehaviours.SelectedLangauges.Clear();
- }
-
#endregion
#region Implemented Interfaces
@@ -405,7 +287,7 @@ namespace HandBrakeWPF.ViewModels this.currentPreset = preset;
// Audio Behaviours
- this.SetupLanguages(preset);
+ this.AudioDefaultsViewModel.SetupLanguages(preset);
if (preset != null && preset.Task != null)
{
@@ -495,7 +377,7 @@ namespace HandBrakeWPF.ViewModels return;
}
- switch (this.AudioBehaviours.SelectedTrackDefaultBehaviour)
+ switch (this.AudioDefaultsViewModel.AudioBehaviours.SelectedTrackDefaultBehaviour)
{
case AudioTrackDefaultsMode.None:
this.Task.AudioTracks.Add(new AudioTrack { ScannedTrack = track });
@@ -563,7 +445,7 @@ namespace HandBrakeWPF.ViewModels }
// Step 4, Handle the default selection behaviour.
- switch (this.AudioBehaviours.SelectedBehaviour)
+ switch (this.AudioDefaultsViewModel.AudioBehaviours.SelectedBehaviour)
{
case AudioBehaviourModes.None:
this.Task.AudioTracks.Clear();
@@ -635,9 +517,9 @@ namespace HandBrakeWPF.ViewModels // The first track in the selected languages list is considered the preferred language.
// So, try match tracks on this.
IEnumerable<Audio> preferredAudioTracks = new List<Audio>();
- if (this.AudioBehaviours.SelectedLangauges.Count > 0)
+ if (this.AudioDefaultsViewModel.AudioBehaviours.SelectedLangauges.Count > 0)
{
- string langName = this.AudioBehaviours.SelectedLangauges.FirstOrDefault(w => !w.Equals(Constants.Any));
+ string langName = this.AudioDefaultsViewModel.AudioBehaviours.SelectedLangauges.FirstOrDefault(w => !w.Equals(Constants.Any));
if (!string.IsNullOrEmpty(langName))
{
preferredAudioTracks = this.SourceTracks.Where(item => item.Language.Contains(langName));
@@ -660,7 +542,7 @@ namespace HandBrakeWPF.ViewModels {
List<Audio> trackList = new List<Audio>();
- List<string> isoCodes = LanguageUtilities.GetLanguageCodes(this.AudioBehaviours.SelectedLangauges.ToArray());
+ List<string> isoCodes = LanguageUtilities.GetLanguageCodes(this.AudioDefaultsViewModel.AudioBehaviours.SelectedLangauges.ToArray());
if (includeAny)
{
@@ -675,42 +557,7 @@ namespace HandBrakeWPF.ViewModels return trackList;
}
- /// <summary>
- /// The setup languages.
- /// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- private void SetupLanguages(Preset preset)
- {
- // Step 1, Set the behaviour mode
- this.AudioBehaviours.SelectedBehaviour = AudioBehaviourModes.None;
- this.AudioBehaviours.SelectedLangauges.Clear();
-
- // Step 2, Get all the languages
- 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
- if (preset != null && preset.AudioTrackBehaviours != null)
- {
- this.AudioBehaviours.SelectedBehaviour = preset.AudioTrackBehaviours.SelectedBehaviour;
- this.AudioBehaviours.SelectedTrackDefaultBehaviour = preset.AudioTrackBehaviours.SelectedTrackDefaultBehaviour;
-
- foreach (string selectedItem in preset.AudioTrackBehaviours.SelectedLangauges)
- {
- this.AvailableLanguages.Remove(selectedItem);
- this.AudioBehaviours.SelectedLangauges.Add(selectedItem);
- }
- }
- }
#endregion
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs index db2ce4d26..d6859e38e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAudioDefaultsViewModel.cs @@ -10,15 +10,32 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
using HandBrakeWPF.Model.Audio;
+ using HandBrakeWPF.Services.Presets.Model;
/// <summary>
/// The Audio View Model Interface
/// </summary>
- public interface IAudioDefaultsViewModel : IOverlayPanel
+ public interface IAudioDefaultsViewModel : IOverlayPanel, IViewModelBase
{
/// <summary>
/// Gets the audio behaviours.
/// </summary>
AudioBehaviours AudioBehaviours { get; }
+
+ /// <summary>
+ /// The setup languages.
+ /// </summary>
+ /// <param name="preset">
+ /// The preset.
+ /// </param>
+ void SetupLanguages(Preset preset);
+
+ /// <summary>
+ /// The setup languages.
+ /// </summary>
+ /// <param name="behaviours">
+ /// The behaviours.
+ /// </param>
+ void SetupLanguages(AudioBehaviours behaviours);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPopupWindowViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPopupWindowViewModel.cs new file mode 100644 index 000000000..f4b432e4f --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IPopupWindowViewModel.cs @@ -0,0 +1,22 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="IPopupWindowViewModel.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 PopupWindowViewModel interface. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels.Interfaces +{ + /// <summary> + /// The PopupWindowViewModel interface. + /// </summary> + public interface IPopupWindowViewModel + { + /// <summary> + /// Gets the content view model. + /// </summary> + IViewModelBase ContentViewModel { get; } + } +}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs new file mode 100644 index 000000000..ed4521897 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ISubtitlesDefaultsViewModel.cs @@ -0,0 +1,41 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="ISubtitlesDefaultsViewModel.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 ISubtitlesDefaultsViewMode type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels.Interfaces +{ + using HandBrakeWPF.Model.Subtitles; + using HandBrakeWPF.Services.Presets.Model; + + /// <summary> + /// The Subtiles View Model Interface + /// </summary> + public interface ISubtitlesDefaultsViewModel : IViewModelBase + { + /// <summary> + /// Gets the subtitle behaviours. + /// </summary> + SubtitleBehaviours SubtitleBehaviours { get; } + + /// <summary> + /// The setup languages. + /// </summary> + /// <param name="preset"> + /// The preset. + /// </param> + void SetupLanguages(Preset preset); + + /// <summary> + /// The setup languages. + /// </summary> + /// <param name="behaviours"> + /// The behaviours. + /// </param> + void SetupLanguages(SubtitleBehaviours behaviours); + } +} diff --git a/win/CS/HandBrakeWPF/ViewModels/PopupWindowViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PopupWindowViewModel.cs new file mode 100644 index 000000000..1bca58f43 --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/PopupWindowViewModel.cs @@ -0,0 +1,112 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="PopupWindowViewModel.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 PopupWindowViewModel type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels +{ + using HandBrakeWPF.ViewModels.Interfaces; + + /// <summary> + /// The popup window view model. + /// </summary> + public class PopupWindowViewModel : ViewModelBase, IPopupWindowViewModel + { + private string windowTitle; + private string subText; + + /// <summary> + /// Initializes a new instance of the <see cref="PopupWindowViewModel"/> class. + /// </summary> + /// <param name="contentViewModel"> + /// The content View Model. + /// </param> + /// <param name="title"> + /// The title. + /// </param> + /// <param name="subText"> + /// The sub Text. + /// </param> + public PopupWindowViewModel(IViewModelBase contentViewModel, string title, string subText) + { + this.ContentViewModel = contentViewModel; + this.WindowTitle = title; + this.Title = title; + this.SubText = subText; + } + + /// <summary> + /// Gets or sets the content view model. + /// </summary> + public IViewModelBase ContentViewModel { get; set; } + + /// <summary> + /// Gets or sets the title. + /// </summary> + public string WindowTitle + { + get + { + return this.windowTitle; + } + set + { + if (value == this.windowTitle) + { + return; + } + this.windowTitle = value; + this.NotifyOfPropertyChange(() => this.Title); + } + } + + /// <summary> + /// Gets or sets the sub text. + /// </summary> + public string SubText + { + get + { + return this.subText; + } + set + { + if (value == this.subText) + { + return; + } + this.subText = value; + + this.SubTextVisible = !string.IsNullOrEmpty(value); + + this.NotifyOfPropertyChange(() => this.SubText); + this.NotifyOfPropertyChange(() => this.SubTextVisible); + } + } + + /// <summary> + /// Gets or sets a value indicating whether sub text visible. + /// </summary> + public bool SubTextVisible { get; set; } + + /// <summary> + /// The save. + /// </summary> + public void Save() + { + this.TryClose(true); + } + + /// <summary> + /// The cancel. + /// </summary> + public void Cancel() + { + this.TryClose(false); + } + } +} diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs new file mode 100644 index 000000000..0334d2d1a --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesDefaultsViewModel.cs @@ -0,0 +1,249 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="SubtitlesDefaultsViewModel.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 Subtitles Defaults View Model +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels +{ + using System.Collections.Generic; + using System.ComponentModel; + using System.Linq; + + using HandBrake.ApplicationServices.Utilities; + + using HandBrakeWPF.Model.Subtitles; + using HandBrakeWPF.Services.Presets.Model; + using HandBrakeWPF.Utilities; + using HandBrakeWPF.ViewModels.Interfaces; + + /// <summary> + /// The Subtitles View Model + /// </summary> + public class SubtitlesDefaultsViewModel : ViewModelBase, ISubtitlesDefaultsViewModel + { + #region Constants and Fields + + private SubtitleBehaviours subtitleBehaviours; + private BindingList<string> availableLanguages; + + #endregion + + #region Constructors and Destructors + + /// <summary> + /// Initializes a new instance of the <see cref="SubtitlesDefaultsViewModel"/> class. + /// </summary> + public SubtitlesDefaultsViewModel() + { + this.Langauges = LanguageUtilities.MapLanguages().Keys; + this.CharacterCodes = CharCodesUtilities.GetCharacterCodes(); + this.SubtitleBehaviours = new SubtitleBehaviours(); + this.SelectedAvailableToMove = new BindingList<string>(); + this.SelectedLangaugesToMove = new BindingList<string>(); + this.availableLanguages = new BindingList<string>(); + this.SetupLanguages((Preset)null); + } + + #endregion + + #region Properties + + /// <summary> + /// Gets CharacterCodes. + /// </summary> + public IEnumerable<string> CharacterCodes { get; private set; } + + /// <summary> + /// Gets Langauges. + /// </summary> + public IEnumerable<string> Langauges { get; private set; } + + /// <summary> + /// Gets or sets the subtitle behaviours. + /// </summary> + public SubtitleBehaviours SubtitleBehaviours + { + get + { + return this.subtitleBehaviours; + } + set + { + if (Equals(value, this.subtitleBehaviours)) + { + return; + } + this.subtitleBehaviours = value; + this.NotifyOfPropertyChange(() => this.SubtitleBehaviours); + } + } + + /// <summary> + /// Gets the sbutitle behaviour modes. + /// </summary> + public BindingList<SubtitleBehaviourModes> SubtitleBehaviourModeList + { + get + { + return new BindingList<SubtitleBehaviourModes>(EnumHelper<SubtitleBehaviourModes>.GetEnumList().ToList()); + } + } + + /// <summary> + /// Gets the subtitle burn in behaviour mode list. + /// </summary> + public BindingList<SubtitleBurnInBehaviourModes> SubtitleBurnInBehaviourModeList + { + get + { + return new BindingList<SubtitleBurnInBehaviourModes>(EnumHelper<SubtitleBurnInBehaviourModes>.GetEnumList().ToList()); + } + } + + /// <summary> + /// Gets AvailableLanguages. + /// </summary> + public BindingList<string> AvailableLanguages + { + get + { + return this.availableLanguages; + } + + private set + { + this.availableLanguages = value; + this.NotifyOfPropertyChange("AvailableLanguages"); + } + } + + /// <summary> + /// Gets SelectedLangauges. + /// </summary> + public BindingList<string> SelectedAvailableToMove { get; private set; } + + /// <summary> + /// Gets SelectedLangauges. + /// </summary> + public BindingList<string> SelectedLangaugesToMove { get; private set; } + + #endregion + + #region Public Methods + + /// <summary> + /// Audio List Move Left + /// </summary> + public void LanguageMoveRight() + { + if (this.SelectedAvailableToMove.Count > 0) + { + List<string> copiedList = SelectedAvailableToMove.ToList(); + foreach (string item in copiedList) + { + this.AvailableLanguages.Remove(item); + this.SubtitleBehaviours.SelectedLangauges.Add(item); + } + + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + } + + /// <summary> + /// Audio List Move Right + /// </summary> + public void LanguageMoveLeft() + { + if (this.SelectedLangaugesToMove.Count > 0) + { + List<string> copiedList = SelectedLangaugesToMove.ToList(); + foreach (string item in copiedList) + { + this.SubtitleBehaviours.SelectedLangauges.Remove(item); + this.AvailableLanguages.Add(item); + } + } + + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + + /// <summary> + /// Language List Clear all selected languages + /// </summary> + public void LanguageClearAll() + { + foreach (string item in this.SubtitleBehaviours.SelectedLangauges) + { + this.AvailableLanguages.Add(item); + } + this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList()); + + this.SubtitleBehaviours.SelectedLangauges.Clear(); + } + + #endregion + + #region Methods + + /// <summary> + /// The setup languages. + /// </summary> + /// <param name="preset"> + /// The preset. + /// </param> + public void SetupLanguages(Preset preset) + { + if (preset != null) + { + this.SetupLanguages(preset.SubtitleTrackBehaviours); + } + } + + /// <summary> + /// The setup languages. + /// </summary> + /// <param name="behaviours"> + /// The behaviours. + /// </param> + public void SetupLanguages(SubtitleBehaviours behaviours) + { + // Step 1, Set the behaviour mode + this.SubtitleBehaviours.SelectedBehaviour = SubtitleBehaviourModes.None; + this.SubtitleBehaviours.SelectedBurnInBehaviour = SubtitleBurnInBehaviourModes.None; + this.SubtitleBehaviours.AddClosedCaptions = false; + this.SubtitleBehaviours.AddForeignAudioScanTrack = false; + this.SubtitleBehaviours.SelectedLangauges.Clear(); + + // Step 2, Get all the languages + 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 + if (behaviours != null) + { + this.SubtitleBehaviours.SelectedBehaviour = behaviours.SelectedBehaviour; + this.SubtitleBehaviours.SelectedBurnInBehaviour = behaviours.SelectedBurnInBehaviour; + this.SubtitleBehaviours.AddClosedCaptions = behaviours.AddClosedCaptions; + this.SubtitleBehaviours.AddForeignAudioScanTrack = behaviours.AddForeignAudioScanTrack; + + foreach (string selectedItem in behaviours.SelectedLangauges) + { + this.AvailableLanguages.Remove(selectedItem); + this.SubtitleBehaviours.SelectedLangauges.Add(selectedItem); + } + } + } + #endregion + } +}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 73df64ddd..d27b8dc26 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -57,11 +57,6 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private SubtitleBehaviours subtitleBehaviours;
- /// <summary>
- /// The available languages.
- /// </summary>
- private BindingList<string> availableLanguages;
-
#endregion
#region Constructors and Destructors
@@ -71,6 +66,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public SubtitlesViewModel()
{
+ this.SubtitleDefaultsViewModel = new SubtitlesDefaultsViewModel();
this.Task = new EncodeTask();
this.Langauges = LanguageUtilities.MapLanguages().Keys;
@@ -78,12 +74,6 @@ namespace HandBrakeWPF.ViewModels this.ForeignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = "Foreign Audio Search (Bitmap)" };
this.SourceTracks = new List<Subtitle> { this.ForeignAudioSearchTrack };
-
- this.SubtitleBehaviours = new SubtitleBehaviours();
- this.SelectedAvailableToMove = new BindingList<string>();
- this.SelectedLangaugesToMove = new BindingList<string>();
- this.availableLanguages = new BindingList<string>();
- this.SetupLanguages(null);
}
#endregion
@@ -91,6 +81,11 @@ namespace HandBrakeWPF.ViewModels #region Properties
/// <summary>
+ /// Gets or sets the audio defaults view model.
+ /// </summary>
+ public ISubtitlesDefaultsViewModel SubtitleDefaultsViewModel { get; set; }
+
+ /// <summary>
/// Gets or sets CharacterCodes.
/// </summary>
public IEnumerable<string> CharacterCodes { get; set; }
@@ -167,74 +162,16 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets the subtitle behaviours.
+ /// Gets the default audio behaviours.
/// </summary>
public SubtitleBehaviours SubtitleBehaviours
{
get
{
- return this.subtitleBehaviours;
- }
- set
- {
- if (Equals(value, this.subtitleBehaviours))
- {
- return;
- }
- this.subtitleBehaviours = value;
- this.NotifyOfPropertyChange(() => this.SubtitleBehaviours);
+ return this.SubtitleDefaultsViewModel.SubtitleBehaviours;
}
}
- /// <summary>
- /// Gets the sbutitle behaviour modes.
- /// </summary>
- public BindingList<SubtitleBehaviourModes> SubtitleBehaviourModeList
- {
- get
- {
- return new BindingList<SubtitleBehaviourModes>(EnumHelper<SubtitleBehaviourModes>.GetEnumList().ToList());
- }
- }
-
- /// <summary>
- /// Gets the subtitle burn in behaviour mode list.
- /// </summary>
- public BindingList<SubtitleBurnInBehaviourModes> SubtitleBurnInBehaviourModeList
- {
- get
- {
- return new BindingList<SubtitleBurnInBehaviourModes>(EnumHelper<SubtitleBurnInBehaviourModes>.GetEnumList().ToList());
- }
- }
-
- /// <summary>
- /// Gets or sets AvailableLanguages.
- /// </summary>
- public BindingList<string> AvailableLanguages
- {
- get
- {
- return this.availableLanguages;
- }
-
- set
- {
- this.availableLanguages = value;
- this.NotifyOfPropertyChange("AvailableLanguages");
- }
- }
-
- /// <summary>
- /// Gets or sets SelectedLangauges.
- /// </summary>
- public BindingList<string> SelectedAvailableToMove { get; set; }
-
- /// <summary>
- /// Gets or sets SelectedLangauges.
- /// </summary>
- public BindingList<string> SelectedLangaugesToMove { get; set; }
-
#endregion
#region Public Methods
@@ -514,56 +451,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Audio List Move Left
- /// </summary>
- public void LanguageMoveRight()
- {
- if (this.SelectedAvailableToMove.Count > 0)
- {
- List<string> copiedList = SelectedAvailableToMove.ToList();
- foreach (string item in copiedList)
- {
- this.AvailableLanguages.Remove(item);
- this.SubtitleBehaviours.SelectedLangauges.Add(item);
- }
-
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
- }
- }
-
- /// <summary>
- /// Audio List Move Right
- /// </summary>
- public void LanguageMoveLeft()
- {
- if (this.SelectedLangaugesToMove.Count > 0)
- {
- List<string> copiedList = SelectedLangaugesToMove.ToList();
- foreach (string item in copiedList)
- {
- this.SubtitleBehaviours.SelectedLangauges.Remove(item);
- this.AvailableLanguages.Add(item);
- }
- }
-
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
- }
-
- /// <summary>
- /// Language List Clear all selected languages
- /// </summary>
- public void LanguageClearAll()
- {
- foreach (string item in this.SubtitleBehaviours.SelectedLangauges)
- {
- this.AvailableLanguages.Add(item);
- }
- this.AvailableLanguages = new BindingList<string>(this.AvailableLanguages.OrderBy(o => o).ToList());
-
- this.SubtitleBehaviours.SelectedLangauges.Clear();
- }
-
- /// <summary>
/// Reload the audio tracks based on the defaults.
/// </summary>
public void ReloadDefaults()
@@ -590,7 +477,7 @@ namespace HandBrakeWPF.ViewModels this.Task = task;
this.NotifyOfPropertyChange(() => this.Task);
- this.SetupLanguages(preset);
+ this.SubtitleDefaultsViewModel.SetupLanguages(preset);
this.AutomaticSubtitleSelection();
}
@@ -747,47 +634,6 @@ namespace HandBrakeWPF.ViewModels : this.SourceTracks.Where(subtitle => !this.Task.SubtitleTracks.Any(track => Equals(track.SourceTrack, subtitle))).ToList();
}
- /// <summary>
- /// The setup languages.
- /// </summary>
- /// <param name="preset">
- /// The preset.
- /// </param>
- private void SetupLanguages(Preset preset)
- {
- // Step 1, Set the behaviour mode
- this.SubtitleBehaviours.SelectedBehaviour = SubtitleBehaviourModes.None;
- this.SubtitleBehaviours.SelectedBurnInBehaviour = SubtitleBurnInBehaviourModes.None;
- this.SubtitleBehaviours.AddClosedCaptions = false;
- this.SubtitleBehaviours.AddForeignAudioScanTrack = false;
- this.SubtitleBehaviours.SelectedLangauges.Clear();
-
- // Step 2, Get all the languages
- 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
- if (preset != null && preset.SubtitleTrackBehaviours != null)
- {
- this.SubtitleBehaviours.SelectedBehaviour = preset.SubtitleTrackBehaviours.SelectedBehaviour;
- this.SubtitleBehaviours.SelectedBurnInBehaviour = preset.SubtitleTrackBehaviours.SelectedBurnInBehaviour;
- this.SubtitleBehaviours.AddClosedCaptions = preset.SubtitleTrackBehaviours.AddClosedCaptions;
- this.SubtitleBehaviours.AddForeignAudioScanTrack = preset.SubtitleTrackBehaviours.AddForeignAudioScanTrack;
-
- foreach (string selectedItem in preset.SubtitleTrackBehaviours.SelectedLangauges)
- {
- this.AvailableLanguages.Remove(selectedItem);
- this.SubtitleBehaviours.SelectedLangauges.Add(selectedItem);
- }
- }
- }
#endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs index 835add7fd..db40c7c66 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -11,7 +11,6 @@ namespace HandBrakeWPF.ViewModels {
using Caliburn.Micro;
- using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml index 5287da6d2..4431ab9ca 100644 --- a/win/CS/HandBrakeWPF/Views/AddPresetView.xaml +++ b/win/CS/HandBrakeWPF/Views/AddPresetView.xaml @@ -49,8 +49,8 @@ <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Name -->
@@ -104,6 +104,14 @@ <controls:NumberBox Width="60" Number="{Binding CustomHeight, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,5"
AllowEmpty="True" />
</StackPanel>
+
+ <TextBlock Text="Audio:" Grid.Row="5" />
+ <Button Content="Edit Defaults..." Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" Padding="8,2"
+ cal:Message.Attach="[Event Click] = [Action EditAudioDefaults]" />
+
+ <TextBlock Text="Subtitles:" Grid.Row="6" />
+ <Button Content="Edit Defaults..." Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" Margin="0,5,0,0" Padding="8,2"
+ cal:Message.Attach="[Event Click] = [Action EditSubtitleDefaults]" />
</Grid>
diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml new file mode 100644 index 000000000..835ca65a9 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml @@ -0,0 +1,163 @@ +<UserControl x:Class="HandBrakeWPF.Views.AudioDefaultsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Audio="clr-namespace:HandBrakeWPF.Converters.Audio" + xmlns:cal="http://www.caliburnproject.org" + xmlns:Conveters="clr-namespace:HandBrakeWPF.Converters" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" + d:DesignHeight="360" + d:DesignWidth="770" + mc:Ignorable="d" + x:Name="audioDefaultsTab"> + + <UserControl.Resources> + <Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" /> + <Audio:AudioEncoderConverter x:Key="audioEncoderConverter" /> + <Audio:AudioBehaviourConverter x:Key="audioBehaviourConverter" /> + <Audio:AudioTrackDefaultBehaviourConverter x:Key="audioTrackDefaultBehaviourConverter" /> + </UserControl.Resources> + + <Grid VerticalAlignment="Top"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <!-- Row 2 --> + <StackPanel Grid.Row="0" Grid.Column="0" Margin="10,0,0,0" + Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=false, FallbackValue=Visible}"> + + <Grid Margin="0,0,0,0" > + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <!-- Audio --> + <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_TrackSelectionBehaviour}" Grid.Column="0" Grid.Row="0" Margin="0,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" /> + <ComboBox Name="autoAudioMode" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" + ItemsSource="{Binding AudioBehaviourModeList, Converter={StaticResource audioBehaviourConverter}}" + SelectedItem="{Binding AudioBehaviours.SelectedBehaviour, Converter={StaticResource audioBehaviourConverter}}" Width="210" Margin="0,0,5,0" /> + + + <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_TrackSettingDefaultBehaviour}" Grid.Column="0" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" /> + <ComboBox Name="audioTrackBeahaviorMode" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" + ItemsSource="{Binding AudioTrackDefaultBehaviourModeList, Converter={StaticResource audioTrackDefaultBehaviourConverter}}" + SelectedItem="{Binding AudioBehaviours.SelectedTrackDefaultBehaviour, Converter={StaticResource audioTrackDefaultBehaviourConverter}}" Width="210" Margin="0,5,5,0" /> + </Grid> + + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChooseLanguages}" Margin="5,10,0,0" /> + + <Grid Margin="20,5,0,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Horizontal"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Vertical" Grid.Column="0"> + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_AvailableLanguages}" Margin="0,0,0,5"/> + <ListBox Name="availableLanguages" ItemsSource="{Binding AvailableLanguages}" + helpers:ListBoxHelper.SelectedItems="{Binding SelectedAvailableToMove}" + SelectionMode="Extended" Width="140" Height="120" /> + </StackPanel> + + <DockPanel Grid.Column="1" Margin="10,0,10,0"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveRight}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveRight]" MaxWidth="90" /> + <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveLeft}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveLeft]" MaxWidth="90" /> + <Button Content="{x:Static Properties:ResourcesUI.Generic_Clear}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageClearAll]" Width="80"/> + </StackPanel> + </DockPanel> + + <StackPanel Orientation="Vertical" Grid.Column="2"> + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChosenLangages}" Margin="0,0,0,5"/> + <ListBox Name="selectedLangauges" ItemsSource="{Binding AudioBehaviours.SelectedLangauges}" + helpers:ListBoxHelper.SelectedItems="{Binding SelectedLangaugesToMove}" + SelectionMode="Extended" Width="140" Height="120" + dd:DragDrop.DropHandler="{Binding}" + dd:DragDrop.IsDragSource="True" + dd:DragDrop.IsDropTarget="True"/> + </StackPanel> + </Grid> + </StackPanel> + </Grid> + + <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_AutoPassthruBehaviour}" FontWeight="Bold" Margin="0,10,0,5" /> + <StackPanel Margin="10,5,0,0" + Orientation="Vertical"> + <TextBlock Margin="5,0,5,0" Text="{x:Static Properties:ResourcesUI.AudioView_WhenAutoPassthru}" VerticalAlignment="Center" /> + <TextBlock Margin="5,0,5,0" Text="{x:Static Properties:ResourcesUI.AudioView_AllowPassThruOf}" VerticalAlignment="Center" /> + </StackPanel> + <StackPanel Margin="15,5,0,0" + Orientation="Horizontal"> + <CheckBox Margin="0,0,5,0" + Content="MP3" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowMP3Pass}" /> + <CheckBox Margin="0,0,5,0" + Content="AAC" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAACPass}" /> + <CheckBox Margin="0,0,5,0" + Content="AC3" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAC3Pass}" /> + <CheckBox Margin="0,0,5,0" + Content="E-AC3" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowEAC3Pass}" /> + <CheckBox Margin="0,0,5,0" + Content="DTS" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSPass}" /> + <CheckBox Margin="0,0,5,0" + Content="DTSHD" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSHDPass}" /> + <CheckBox Margin="0,0,5,0" + Content="TrueHD" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowTrueHDPass}" /> + <CheckBox Margin="0,0,5,0" + Content="FLAC" VerticalAlignment="Center" + IsChecked="{Binding Task.AllowedPassthruOptions.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" /> + </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}}" /> + </MultiBinding> + </ComboBox.ItemsSource> + </ComboBox> + + </StackPanel> + + </StackPanel> + + + </Grid> +</UserControl> diff --git a/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs new file mode 100644 index 000000000..7734f706c --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/AudioDefaultsView.xaml.cs @@ -0,0 +1,27 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="AudioDefaultsView.xaml.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> +// Interaction logic for AudioDefaultsView.xaml +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views +{ + using System.Windows.Controls; + + /// <summary> + /// Interaction logic for AudioDefaultsView.xaml + /// </summary> + public partial class AudioDefaultsView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="AudioDefaultsView"/> class. + /// </summary> + public AudioDefaultsView() + { + InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index a0fa960f5..ada1069ac 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -10,10 +10,9 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:splitButton="clr-namespace:HandBrakeWPF.Controls.SplitButton"
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
- xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
- d:DesignHeight="800"
- d:DesignWidth="750"
+ d:DesignHeight="500"
+ d:DesignWidth="770"
mc:Ignorable="d"
x:Name="audioTab">
@@ -22,8 +21,6 @@ <Conveters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Conveters:BooleanToHiddenVisibilityConverter x:Key="boolToHiddenVisConverter" />
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />
- <Audio:AudioBehaviourConverter x:Key="audioBehaviourConverter" />
- <Audio:AudioTrackDefaultBehaviourConverter x:Key="audioTrackDefaultBehaviourConverter" />
<Audio:AudioRateTypeConverter x:Key="audioRateTypeConverter" />
</UserControl.Resources>
@@ -56,7 +53,6 @@ />
<!-- Row 1 -->
-
<Grid Grid.Row="1" Margin="10,5,10,0" Grid.Column="0"
Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}">
<Grid.ColumnDefinitions>
@@ -99,7 +95,6 @@ </Grid>
<!-- Row 2 -->
-
<ListBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Stretch"
Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"
Margin="10,10,10,10"
@@ -280,133 +275,9 @@ </ListBox.ItemTemplate>
</ListBox>
- <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,0"
- Visibility="{Binding ShowAudioDefaultsPanel, Converter={StaticResource boolToVisConverter}, ConverterParameter=false, FallbackValue=Visible}">
-
- <Grid Margin="5,0,0,0" >
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <!-- Audio -->
- <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_TrackSelectionBehaviour}" Grid.Column="0" Grid.Row="0" Margin="0,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
- <ComboBox Name="autoAudioMode" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left"
- ItemsSource="{Binding AudioBehaviourModeList, Converter={StaticResource audioBehaviourConverter}}"
- SelectedItem="{Binding AudioBehaviours.SelectedBehaviour, Converter={StaticResource audioBehaviourConverter}}" Width="210" Margin="0,0,5,0" />
-
-
- <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_TrackSettingDefaultBehaviour}" Grid.Column="0" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
- <ComboBox Name="audioTrackBeahaviorMode" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left"
- ItemsSource="{Binding AudioTrackDefaultBehaviourModeList, Converter={StaticResource audioTrackDefaultBehaviourConverter}}"
- SelectedItem="{Binding AudioBehaviours.SelectedTrackDefaultBehaviour, Converter={StaticResource audioTrackDefaultBehaviourConverter}}" Width="210" Margin="0,5,5,0" />
- </Grid>
-
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChooseLanguages}" Margin="5,10,0,0" />
-
- <Grid Margin="20,5,0,0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <StackPanel Orientation="Horizontal">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <StackPanel Orientation="Vertical" Grid.Column="0">
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_AvailableLanguages}" Margin="0,0,0,5"/>
- <ListBox Name="availableLanguages" ItemsSource="{Binding AvailableLanguages}"
- helpers:ListBoxHelper.SelectedItems="{Binding SelectedAvailableToMove}"
- SelectionMode="Extended" Width="140" Height="120" />
- </StackPanel>
-
- <DockPanel Grid.Column="1" Margin="10,0,10,0">
- <StackPanel Orientation="Vertical" VerticalAlignment="Center">
- <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveRight}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveRight]" MaxWidth="90" />
- <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveLeft}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveLeft]" MaxWidth="90" />
- <Button Content="{x:Static Properties:ResourcesUI.Generic_Clear}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageClearAll]" Width="80"/>
- </StackPanel>
- </DockPanel>
-
- <StackPanel Orientation="Vertical" Grid.Column="2">
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChosenLangages}" Margin="0,0,0,5"/>
- <ListBox Name="selectedLangauges" ItemsSource="{Binding AudioBehaviours.SelectedLangauges}"
- helpers:ListBoxHelper.SelectedItems="{Binding SelectedLangaugesToMove}"
- SelectionMode="Extended" Width="140" Height="120"
- dd:DragDrop.DropHandler="{Binding}"
- dd:DragDrop.IsDragSource="True"
- dd:DragDrop.IsDropTarget="True"/>
- </StackPanel>
- </Grid>
- </StackPanel>
- </Grid>
-
- <TextBlock Text="{x:Static Properties:ResourcesUI.AudioView_AutoPassthruBehaviour}" FontWeight="Bold" Margin="0,10,0,5" />
- <StackPanel Margin="10,5,0,0"
- Orientation="Vertical">
- <TextBlock Margin="5,0,5,0" Text="{x:Static Properties:ResourcesUI.AudioView_WhenAutoPassthru}" VerticalAlignment="Center" />
- <TextBlock Margin="5,0,5,0" Text="{x:Static Properties:ResourcesUI.AudioView_AllowPassThruOf}" VerticalAlignment="Center" />
- </StackPanel>
- <StackPanel Margin="15,5,0,0"
- Orientation="Horizontal">
- <CheckBox Margin="0,0,5,0"
- Content="MP3" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowMP3Pass}" />
- <CheckBox Margin="0,0,5,0"
- Content="AAC" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAACPass}" />
- <CheckBox Margin="0,0,5,0"
- Content="AC3" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowAC3Pass}" />
- <CheckBox Margin="0,0,5,0"
- Content="E-AC3" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowEAC3Pass}" />
- <CheckBox Margin="0,0,5,0"
- Content="DTS" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSPass}" />
- <CheckBox Margin="0,0,5,0"
- Content="DTSHD" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowDTSHDPass}" />
- <CheckBox Margin="0,0,5,0"
- Content="TrueHD" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.AudioAllowTrueHDPass}" />
- <CheckBox Margin="0,0,5,0"
- Content="FLAC" VerticalAlignment="Center"
- IsChecked="{Binding Task.AllowedPassthruOptions.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" />
- </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}}" />
- </MultiBinding>
- </ComboBox.ItemsSource>
- </ComboBox>
-
- </StackPanel>
-
- </StackPanel>
-
+ <!-- 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 new file mode 100644 index 000000000..2efe3fcd7 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml @@ -0,0 +1,60 @@ +<Window x:Class="HandBrakeWPF.Views.PopupWindowView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:cal="http://www.caliburnproject.org" + xmlns:properties="clr-namespace:HandBrakeWPF.Properties" + xmlns:converters="clr-namespace:HandBrakeWPF.Converters" + d:DesignHeight="250" + d:DesignWidth="600" + Title="{Binding Title}" + ResizeMode="NoResize" + SizeToContent="WidthAndHeight" + WindowStartupLocation="CenterScreen" + TextOptions.TextFormattingMode="Display" + mc:Ignorable="d"> + + <Window.Resources> + <converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" /> + </Window.Resources> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <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"> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <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" + Padding="8,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> + +</Window> diff --git a/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml.cs b/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml.cs new file mode 100644 index 000000000..6b806e36c --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/PopupWindowView.xaml.cs @@ -0,0 +1,27 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="PopupWindowView.xaml.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> +// Interaction logic for PopupWindowView.xaml +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views +{ + using System.Windows; + + /// <summary> + /// Interaction logic for PopupWindowView.xaml + /// </summary> + public partial class PopupWindowView : Window + { + /// <summary> + /// Initializes a new instance of the <see cref="PopupWindowView"/> class. + /// </summary> + public PopupWindowView() + { + InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml new file mode 100644 index 000000000..d15c02813 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml @@ -0,0 +1,126 @@ +<UserControl x:Class="HandBrakeWPF.Views.SubtitlesDefaultsView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:cal="http://www.caliburnproject.org" + xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers" + xmlns:subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles" + xmlns:Properties="clr-namespace:HandBrakeWPF.Properties" + d:DesignHeight="350" + d:DesignWidth="500" + mc:Ignorable="d" + x:Name="subTab"> + <UserControl.Resources> + <Converters:BooleanToVisibilityConverter x:Key="booleanToVisConverter" /> + <subtitles:SubtitleBehaviourConverter x:Key="subtitleBehaviourConverter" /> + <subtitles:SubtitleBurnInBehaviourConverter x:Key="subtitleBurnInBehaviourConverter" /> + + <Style x:Key="LongToolTip" TargetType="TextBlock"> + <Setter Property="Width" Value="400" /> + <Setter Property="TextWrapping" Value="Wrap" /> + <Setter Property="ToolTipService.ShowDuration" Value="20000" /> + <Setter Property="Margin" Value="0,2,0,2" /> + </Style> + + </UserControl.Resources> + + <Grid VerticalAlignment="Top"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + + <!-- Row 0 --> + <StackPanel Grid.Row="0" Grid.Column="0" Margin="10,0,0,0" + Visibility="{Binding ShowDefaultsPanel, Converter={StaticResource booleanToVisConverter}, ConverterParameter=false}"> + + <Grid Margin="5,0,0,0" > + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <!-- Subtitles --> + <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_TrackSelectionBehaviour}" Grid.Column="2" Grid.Row="0" Margin="0,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" /> + <ComboBox Name="autoSubtitleMode" Grid.Column="3" Grid.Row="0" HorizontalAlignment="Left" + ItemsSource="{Binding SubtitleBehaviourModeList, Converter={StaticResource subtitleBehaviourConverter}}" + SelectedItem="{Binding SubtitleBehaviours.SelectedBehaviour, Converter={StaticResource subtitleBehaviourConverter}}" Width="210" Margin="0,0,5,0" /> + <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_BurnInBehaviour}" Grid.Column="2" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" /> + <ComboBox Name="burninBehaviour" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" + ItemsSource="{Binding SubtitleBurnInBehaviourModeList, Converter={StaticResource subtitleBurnInBehaviourConverter}}" + SelectedItem="{Binding SubtitleBehaviours.SelectedBurnInBehaviour, Converter={StaticResource subtitleBurnInBehaviourConverter}}" Width="210" Margin="0,5,5,0"> + <ComboBox.ToolTip> + <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Subtitles_BurnInBehaviourModes}" /> + </ComboBox.ToolTip> + </ComboBox> + <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddCC}" Grid.Column="3" Grid.Row="2" Margin="0,5,0,0" + HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddClosedCaptions}"/> + <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddForeignAudioSearch}" Grid.Column="3" Grid.Row="3" Margin="0,5,0,0" + HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddForeignAudioScanTrack}"/> + </Grid> + + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChooseLanguages}" Margin="5,15,0,0"/> + + <Grid Margin="20,5,0,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Horizontal"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + + <StackPanel Orientation="Vertical" Grid.Column="0"> + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_AvailableLanguages}" Margin="0,0,0,5"/> + <ListBox Name="availableLanguages" ItemsSource="{Binding AvailableLanguages}" + helpers:ListBoxHelper.SelectedItems="{Binding SelectedAvailableToMove}" + SelectionMode="Extended" Width="140" Height="120" /> + </StackPanel> + + <DockPanel Grid.Column="1" Margin="10,0,10,0"> + <StackPanel Orientation="Vertical" VerticalAlignment="Center"> + <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveRight}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveRight]" MaxWidth="90" /> + <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveLeft}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveLeft]" MaxWidth="90" /> + <Button Content="{x:Static Properties:ResourcesUI.Generic_Clear}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageClearAll]" Width="80"/> + </StackPanel> + </DockPanel> + + <StackPanel Orientation="Vertical" Grid.Column="2"> + <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChosenLangages}" Margin="0,0,0,5"/> + <ListBox Name="selectedLangauges" ItemsSource="{Binding SubtitleBehaviours.SelectedLangauges}" + helpers:ListBoxHelper.SelectedItems="{Binding SelectedLangaugesToMove}" + SelectionMode="Extended" Width="140" Height="120" + dd:DragDrop.DropHandler="{Binding}" + dd:DragDrop.IsDragSource="True" + dd:DragDrop.IsDropTarget="True"/> + </StackPanel> + </Grid> + </StackPanel> + </Grid> + + </StackPanel> + + + </Grid> +</UserControl> diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs new file mode 100644 index 000000000..adb6a3ef4 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/SubtitlesDefaultsView.xaml.cs @@ -0,0 +1,27 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="SubtitlesDefaultsView.xaml.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> +// Interaction logic for SubtitlesDefaultsView.xaml +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Views +{ + using System.Windows.Controls; + + /// <summary> + /// Interaction logic for SubtitlesDefaultsView.xaml + /// </summary> + public partial class SubtitlesDefaultsView : UserControl + { + /// <summary> + /// Initializes a new instance of the <see cref="SubtitlesDefaultsView"/> class. + /// </summary> + public SubtitlesDefaultsView() + { + InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index cc574227b..099e21271 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -9,8 +9,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
xmlns:splitButton="clr-namespace:HandBrakeWPF.Controls.SplitButton"
- xmlns:helpers="clr-namespace:HandBrakeWPF.Helpers"
- xmlns:subtitles="clr-namespace:HandBrakeWPF.Converters.Subtitles"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
d:DesignHeight="350"
d:DesignWidth="500"
@@ -18,8 +16,6 @@ x:Name="subTab">
<UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="booleanToVisConverter" />
- <subtitles:SubtitleBehaviourConverter x:Key="subtitleBehaviourConverter" />
- <subtitles:SubtitleBurnInBehaviourConverter x:Key="subtitleBurnInBehaviourConverter" />
<Style x:Key="LongToolTip" TargetType="TextBlock">
<Setter Property="Width" Value="400" />
@@ -284,88 +280,9 @@ </ListBox.ItemTemplate>
</ListBox>
- <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,10,10,10"
- Visibility="{Binding ShowDefaultsPanel, Converter={StaticResource booleanToVisConverter}, ConverterParameter=false}">
-
- <Grid Margin="5,0,0,0" >
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <!-- Subtitles -->
- <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_TrackSelectionBehaviour}" Grid.Column="2" Grid.Row="0" Margin="0,0,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
- <ComboBox Name="autoSubtitleMode" Grid.Column="3" Grid.Row="0" HorizontalAlignment="Left"
- ItemsSource="{Binding SubtitleBehaviourModeList, Converter={StaticResource subtitleBehaviourConverter}}"
- SelectedItem="{Binding SubtitleBehaviours.SelectedBehaviour, Converter={StaticResource subtitleBehaviourConverter}}" Width="210" Margin="0,0,5,0" />
- <TextBlock Text="{x:Static Properties:ResourcesUI.SubtitlesView_BurnInBehaviour}" Grid.Column="2" Grid.Row="1" Margin="0,5,5,0" HorizontalAlignment="Left" VerticalAlignment="Center" />
- <ComboBox Name="burninBehaviour" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left"
- ItemsSource="{Binding SubtitleBurnInBehaviourModeList, Converter={StaticResource subtitleBurnInBehaviourConverter}}"
- SelectedItem="{Binding SubtitleBehaviours.SelectedBurnInBehaviour, Converter={StaticResource subtitleBurnInBehaviourConverter}}" Width="210" Margin="0,5,5,0">
- <ComboBox.ToolTip>
- <TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static Properties:Resources.Subtitles_BurnInBehaviourModes}" />
- </ComboBox.ToolTip>
- </ComboBox>
- <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddCC}" Grid.Column="3" Grid.Row="2" Margin="0,5,0,0"
- HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddClosedCaptions}"/>
- <CheckBox Content="{x:Static Properties:ResourcesUI.SubtitlesView_AddForeignAudioSearch}" Grid.Column="3" Grid.Row="3" Margin="0,5,0,0"
- HorizontalAlignment="Left" IsChecked="{Binding SubtitleBehaviours.AddForeignAudioScanTrack}"/>
- </Grid>
-
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChooseLanguages}" Margin="5,15,0,0"/>
-
- <Grid Margin="20,5,0,0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <StackPanel Orientation="Horizontal">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
-
- <StackPanel Orientation="Vertical" Grid.Column="0">
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_AvailableLanguages}" Margin="0,0,0,5"/>
- <ListBox Name="availableLanguages" ItemsSource="{Binding AvailableLanguages}"
- helpers:ListBoxHelper.SelectedItems="{Binding SelectedAvailableToMove}"
- SelectionMode="Extended" Width="140" Height="120" />
- </StackPanel>
-
- <DockPanel Grid.Column="1" Margin="10,0,10,0">
- <StackPanel Orientation="Vertical" VerticalAlignment="Center">
- <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveRight}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveRight]" MaxWidth="90" />
- <Button Content="{x:Static Properties:ResourcesUI.Generic_MoveLeft}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageMoveLeft]" MaxWidth="90" />
- <Button Content="{x:Static Properties:ResourcesUI.Generic_Clear}" VerticalAlignment="Center" Margin="0,0,0,5" cal:Message.Attach="[Event Click] = [Action LanguageClearAll]" Width="80"/>
- </StackPanel>
- </DockPanel>
-
- <StackPanel Orientation="Vertical" Grid.Column="2">
- <TextBlock Text="{x:Static Properties:ResourcesUI.Shared_ChosenLangages}" Margin="0,0,0,5"/>
- <ListBox Name="selectedLangauges" ItemsSource="{Binding SubtitleBehaviours.SelectedLangauges}"
- helpers:ListBoxHelper.SelectedItems="{Binding SelectedLangaugesToMove}"
- SelectionMode="Extended" Width="140" Height="120"
- dd:DragDrop.DropHandler="{Binding}"
- dd:DragDrop.IsDragSource="True"
- dd:DragDrop.IsDropTarget="True"/>
- </StackPanel>
- </Grid>
- </StackPanel>
- </Grid>
-
- </StackPanel>
+ <!-- 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>
|