From 1befa4f1a72a9e8b0277b4ff04b0200dd884f6bc Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 24 Mar 2012 16:17:04 +0000 Subject: WinGui: (WPF) Fixes to the Audio and Subtitle panels. Add pdb's to installer. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4532 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/Controls/AudioPanel.cs | 2 + .../Model/Encoding/AllowedPassthru.cs | 6 ++ .../Model/Encoding/SubtitleTrack.cs | 88 ++++++++++++++++------ .../Services/PresetService.cs | 6 ++ .../Utilities/QueryGeneratorUtility.cs | 24 +++++- win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl | 1 + win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 3 + .../ViewModels/PictureSettingsViewModel.cs | 3 +- .../HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 33 ++++++++ win/CS/HandBrakeWPF/Views/AudioView.xaml | 11 ++- win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 20 ++++- 11 files changed, 165 insertions(+), 32 deletions(-) (limited to 'win') diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index 531ebb781..4eb01fba2 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -1230,6 +1230,7 @@ namespace Handbrake.Controls /// private void autoPassthru_CheckedChanged(object sender, EventArgs e) { + this.PassthruSettings.IsEnabled = true; if (sender == this.check_mp3) { this.PassthruSettings.AudioAllowMP3Pass = this.check_mp3.Checked; @@ -1267,6 +1268,7 @@ namespace Handbrake.Controls /// private void drp_passthruFallback_SelectedIndexChanged(object sender, EventArgs e) { + this.PassthruSettings.IsEnabled = true; this.PassthruSettings.AudioEncoderFallback = EnumHelper.GetValue(drp_passthruFallback.SelectedItem.ToString()); } diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs index 4b86fc9a1..31447355b 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/AllowedPassthru.cs @@ -58,6 +58,12 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.AudioEncoderFallback = initialValue.AudioEncoderFallback; } + /// + /// Gets or sets a value indicating whether IsEnabled. + /// Temp Measure until forms gui is retired. + /// + public bool IsEnabled { get; set; } + /// /// Gets or sets a value indicating whether AudioAllowAACPass. /// diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs index c15b9db02..b1ae05a0d 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs @@ -12,15 +12,27 @@ namespace HandBrake.ApplicationServices.Model.Encoding using System; using System.Windows.Forms; + using Caliburn.Micro; + using HandBrake.ApplicationServices.Parsing; /// /// Subtitle Information /// - public class SubtitleTrack : ModelBase + public class SubtitleTrack : PropertyChangedBase { #region Constants and Fields + /// + /// The burned in backing field. + /// + private bool burned; + + /// + /// The is default backing field. + /// + private bool isDefault; + /// /// The source track. /// @@ -28,6 +40,8 @@ namespace HandBrake.ApplicationServices.Model.Encoding #endregion + #region Constructors and Destructors + /// /// Initializes a new instance of the class. /// @@ -57,18 +71,43 @@ namespace HandBrake.ApplicationServices.Model.Encoding this.SourceTrack = subtitle.SourceTrack; } - #region Public Properties + #endregion + #region Properties /// /// Gets or sets a value indicating whether Burned. /// - public bool Burned { get; set; } + public bool Burned + { + get + { + return this.burned; + } + + set + { + this.burned = value; + this.NotifyOfPropertyChange(() => this.Burned); + } + } /// /// Gets or sets a value indicating whether Default. /// - public bool Default { get; set; } + public bool Default + { + get + { + return this.isDefault; + } + + set + { + this.isDefault = value; + this.NotifyOfPropertyChange(() => this.Default); + } + } /// /// Gets or sets a value indicating whether Forced. @@ -87,11 +126,23 @@ namespace HandBrake.ApplicationServices.Model.Encoding } /// - /// Gets or sets Track. + /// Gets A ListViewItem Containing information about this subitlte /// - [Obsolete("Use SourceTrack Instead")] - public string Track { get; set; } - + [Obsolete("Used only for the old forms gui. Will be removed.")] + public ListViewItem ListView + { + get + { + var listTrack = new ListViewItem(this.Track); + listTrack.SubItems.Add(this.Forced ? "Yes" : "No"); + listTrack.SubItems.Add(this.Burned ? "Yes" : "No"); + listTrack.SubItems.Add(this.Default ? "Yes" : "No"); + listTrack.SubItems.Add(this.SrtLang); + listTrack.SubItems.Add(this.SrtCharCode); + listTrack.SubItems.Add(this.SrtOffset.ToString()); + return listTrack; + } + } /// /// Gets or sets SourceTrack. @@ -106,7 +157,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding set { this.sourceTrack = value; - this.OnPropertyChanged("SourceTrack"); + this.NotifyOfPropertyChange(() => this.SourceTrack); if (this.sourceTrack != null) { this.Track = this.sourceTrack.ToString(); @@ -145,23 +196,10 @@ namespace HandBrake.ApplicationServices.Model.Encoding public SubtitleType SubtitleType { get; set; } /// - /// Gets A ListViewItem Containing information about this subitlte + /// Gets or sets Track. /// - [Obsolete("Used only for the old forms gui. Will be removed.")] - public ListViewItem ListView - { - get - { - var listTrack = new ListViewItem(this.Track); - listTrack.SubItems.Add(this.Forced ? "Yes" : "No"); - listTrack.SubItems.Add(this.Burned ? "Yes" : "No"); - listTrack.SubItems.Add(this.Default ? "Yes" : "No"); - listTrack.SubItems.Add(this.SrtLang); - listTrack.SubItems.Add(this.SrtCharCode); - listTrack.SubItems.Add(this.SrtOffset.ToString()); - return listTrack; - } - } + [Obsolete("Use SourceTrack Instead")] + public string Track { get; set; } #endregion } diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index 63d636f5c..bd93dc043 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -485,6 +485,12 @@ namespace HandBrake.ApplicationServices.Services { try { + string directory = Path.GetDirectoryName(this.userPresetFile); + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + using (FileStream strm = new FileStream(this.builtInPresetFile, FileMode.Create, FileAccess.Write)) { Ser.Serialize(strm, this.presets.Where(p => p.IsBuildIn).ToList()); diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index d46296244..bbcb9c4f7 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -477,6 +477,7 @@ namespace HandBrake.ApplicationServices.Utilities List samplerates = new List(); List bitrates = new List(); List drcs = new List(); + List gains = new List(); // No Audio if (audioTracks.Count == 0) @@ -506,6 +507,9 @@ namespace HandBrake.ApplicationServices.Utilities // DRC (-D) drcs.Add(track.DRC); + + // Gain (--gain) + gains.Add(track.Gain); } // Audio Track (-a) @@ -606,8 +610,26 @@ namespace HandBrake.ApplicationServices.Utilities if (audioItems.Trim() != String.Empty) query += " -D " + audioItems; + audioItems = string.Empty; // Reset for another pass. + firstLoop = true; + + // Gain (--gain) + foreach (var itm in gains) + { + string item = itm.ToString(new CultureInfo("en-US")); + if (firstLoop) + { + audioItems = item; + firstLoop = false; + } + else + audioItems += "," + item; + } + if (audioItems.Trim() != String.Empty) + query += " --gain " + audioItems; + // Passthru Settings - if (task.AllowedPassthruOptions != null) + if (task.AllowedPassthruOptions != null && task.AllowedPassthruOptions.IsEnabled) { string fallbackEncoders = string.Empty; diff --git a/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl index 53ac01d52..2be087486 100644 --- a/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl +++ b/win/CS/HandBrakeWPF/Installer/MakeAlpha.nsi.tmpl @@ -106,6 +106,7 @@ Section "Handbrake" SEC01 File "*.dll" File "*.config" File "*.xml" + File "*.pdb" ; Copy the standard doc set into the doc folder SetOutPath "$INSTDIR\doc" diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index dbe32a813..b8485be40 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -134,6 +134,9 @@ namespace HandBrakeWPF.ViewModels { this.AddTracksFromPreset(preset); } + + this.Task.AllowedPassthruOptions.IsEnabled = + this.UserSettingService.GetUserSetting(UserSettingConstants.ShowAdvancedAudioPassthruOpts); } /// diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 2c7b47c95..e3fddb827 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -477,8 +477,7 @@ namespace HandBrakeWPF.ViewModels public void SetPreset(Preset preset, EncodeTask task) { this.Task = task; - - + // TODO: These all need to be handled correctly. this.SelectedAnamorphicMode = preset.Task.Anamorphic; diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 9595855bc..3be51ec05 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -177,6 +177,39 @@ namespace HandBrakeWPF.ViewModels this.Task.SubtitleTracks.Remove(track); } + /// + /// Select the default subtitle track. + /// + /// + /// The subtitle. + /// + public void SelectDefaultTrack(SubtitleTrack subtitle) + { + foreach (SubtitleTrack track in this.Task.SubtitleTracks) + { + track.Default = false; + } + subtitle.Default = true; + + this.NotifyOfPropertyChange(() => this.Task); + } + + /// + /// Select the burned in track. + /// + /// + /// The subtitle. + /// + public void SelectBurnedInTrack(SubtitleTrack subtitle) + { + foreach (SubtitleTrack track in this.Task.SubtitleTracks) + { + track.Burned = false; + } + subtitle.Burned = true; + this.NotifyOfPropertyChange(() => this.Task); + } + #endregion #region Implemented Interfaces diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index d94f25738..a27c02085 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -81,14 +81,17 @@ + + + + - + + - + diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 71e48a7ba..0611bba0b 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -79,9 +79,25 @@ - + + + + + + + + + - + + + + + + + + + -- cgit v1.2.3