From 02b77f3bc692e0d059c29ea907393fda31a3790b Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 30 Jun 2012 17:37:25 +0000 Subject: WinGui: Assorted fixes. - Implementation of CanBeBurned and CanBeForced on the subtitles panel. - Save updates to user presets from the Presets Options Menu. (Can use Add Preset to overwrite preset configuration instead also) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4800 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/Encoding/SubtitleTrack.cs | 60 ++++++++++++++++++---- .../Services/PresetService.cs | 3 ++ win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 29 +++++++++++ win/CS/HandBrakeWPF/Views/AudioView.xaml | 4 +- win/CS/HandBrakeWPF/Views/LogView.xaml | 30 +++++++---- win/CS/HandBrakeWPF/Views/LogView.xaml.cs | 26 ++++++++++ win/CS/HandBrakeWPF/Views/MainView.xaml | 3 ++ win/CS/HandBrakeWPF/Views/SubtitlesView.xaml | 2 + 8 files changed, 133 insertions(+), 24 deletions(-) (limited to 'win/CS') diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs index 334d636d6..42161a52d 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs @@ -150,17 +150,6 @@ namespace HandBrake.ApplicationServices.Model.Encoding } } - /// - /// Gets a value indicating whether this is an SRT subtitle. - /// - public bool IsSrtSubtitle - { - get - { - return this.SrtFileName != "-" && this.SrtFileName != null; - } - } - /// /// Gets or sets SourceTrack. /// @@ -179,6 +168,9 @@ namespace HandBrake.ApplicationServices.Model.Encoding { this.Track = this.sourceTrack.ToString(); } + + this.NotifyOfPropertyChange(() => this.CanBeBurned); + this.NotifyOfPropertyChange(() => this.CanBeForced); } } @@ -231,5 +223,51 @@ namespace HandBrake.ApplicationServices.Model.Encoding public string Track { get; set; } #endregion + + /// + /// Gets a value indicating whether CanForced. + /// + public bool CanBeForced + { + get + { + if (this.SourceTrack != null) + { + return this.SourceTrack.SubtitleType == SubtitleType.VobSub || this.SourceTrack.SubtitleType == SubtitleType.PGS + || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch; + } + + return false; + } + } + + /// + /// Gets a value indicating whether CanBeBurned. + /// + public bool CanBeBurned + { + get + { + if (this.SourceTrack != null) + { + return this.SourceTrack.SubtitleType == SubtitleType.VobSub || this.SourceTrack.SubtitleType == SubtitleType.PGS + || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch || this.SourceTrack.SubtitleType == SubtitleType.SSA; + } + + return false; + } + } + + + /// + /// Gets a value indicating whether this is an SRT subtitle. + /// + public bool IsSrtSubtitle + { + get + { + return this.SrtFileName != "-" && this.SrtFileName != null; + } + } } } \ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs index bab41a9b8..8337ddd56 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/PresetService.cs @@ -161,6 +161,9 @@ namespace HandBrake.ApplicationServices.Services { preset.Task = update.Task; preset.UsePictureFilters = update.UsePictureFilters; + preset.PictureSettingsMode = update.PictureSettingsMode; + preset.Category = update.Category; + preset.Description = update.Description; // Update the presets file this.UpdatePresetFiles(); diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 0e508a7a2..7596919eb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1226,6 +1226,33 @@ namespace HandBrakeWPF.ViewModels this.WindowManager.ShowWindow(presetViewModel); } + /// + /// Update a selected preset. + /// + public void PresetUpdate() + { + if (this.SelectedPreset == null) + { + this.errorService.ShowMessageBox( + "Please select a preset to update.", "No Preset selected", MessageBoxButton.OK, MessageBoxImage.Warning); + + return; + } + + if (this.SelectedPreset.IsBuildIn) + { + this.errorService.ShowMessageBox( + "You can not modify built in presets. Please select one of your own presets.", "No Preset selected", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + + this.SelectedPreset.Task = new EncodeTask(this.CurrentTask); + this.presetService.Update(this.SelectedPreset); + + this.errorService.ShowMessageBox( + "The Preset has now been updated with your current settings.", "Preset Updated", MessageBoxButton.OK, MessageBoxImage.Information); + } + /// /// Remove a Preset /// @@ -1475,6 +1502,8 @@ namespace HandBrakeWPF.ViewModels { MessageBox.Show("There is no new updates at this time.", "No Update Available", MessageBoxButton.OK, MessageBoxImage.Information); } + + this.ProgramStatusLabel = "Ready"; } #endregion diff --git a/win/CS/HandBrakeWPF/Views/AudioView.xaml b/win/CS/HandBrakeWPF/Views/AudioView.xaml index ccc74e5cf..3741e3c07 100644 --- a/win/CS/HandBrakeWPF/Views/AudioView.xaml +++ b/win/CS/HandBrakeWPF/Views/AudioView.xaml @@ -116,7 +116,7 @@ - + @@ -141,7 +141,7 @@ Text="Source" /> - + + + + + + + + - - - - /// Interaction logic for LogView.xaml /// public partial class LogView : Window { + /// + /// Initializes a new instance of the class. + /// public LogView() { InitializeComponent(); } + + /// + /// Hide the Toolbar Endplate. + /// + /// + /// The sender. + /// + /// + /// The e. + /// + private void ToolBarLoaded(object sender, RoutedEventArgs e) + { + ToolBar toolBar = sender as ToolBar; + if (toolBar != null) + { + var overflowGrid = toolBar.Template.FindName("OverflowGrid", toolBar) as FrameworkElement; + if (overflowGrid != null) + { + overflowGrid.Visibility = Visibility.Collapsed; + } + } + } } } diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 1d00b3cf4..9efcf6dd7 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -530,6 +530,7 @@ SelectedItem="{Binding SelectedPreset, Mode=TwoWay}" BorderThickness="0,0,0,1" BorderBrush="LightGray" > + @@ -600,6 +601,8 @@ + + diff --git a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml index 93f0ba7c5..d5a37afa6 100644 --- a/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml +++ b/win/CS/HandBrakeWPF/Views/SubtitlesView.xaml @@ -134,6 +134,7 @@ -- cgit v1.2.3