From: sr55 Date: Sat, 26 Aug 2017 20:03:04 +0000 (+0100) Subject: WinGui: Various improvements and fixes to the new summary tab. Revert tab order chang... X-Git-Tag: 1.1.0~406 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fea60efbcc3108d72dd909048f1586f99f71ca4;p=handbrake WinGui: Various improvements and fixes to the new summary tab. Revert tab order change. #833 --- diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index 802eae0b4..9cdce00b9 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -19,7 +19,7 @@ namespace HandBrakeWPF.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class ResourcesUI { @@ -817,7 +817,7 @@ namespace HandBrakeWPF.Properties { } /// - /// Looks up a localized string similar to Picture. + /// Looks up a localized string similar to Dimensions. /// public static string MainView_PictureTab { get { @@ -2411,6 +2411,15 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to No Source. + /// + public static string SummaryView_NoSource { + get { + return ResourceManager.GetString("SummaryView_NoSource", resourceCulture); + } + } + /// /// Looks up a localized string similar to No Subtitle Tracks. /// @@ -2420,6 +2429,15 @@ namespace HandBrakeWPF.Properties { } } + /// + /// Looks up a localized string similar to No Tracks. + /// + public static string SummaryView_NoTracks { + get { + return ResourceManager.GetString("SummaryView_NoTracks", resourceCulture); + } + } + /// /// Looks up a localized string similar to Preview {0} of {1}. /// diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 27a3a055e..98b46afe9 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -172,7 +172,7 @@ Pause - Picture + Dimensions Presets @@ -971,4 +971,10 @@ This will not affect your current settings in the Subtitle tab. Preview {0} of {1} + + No Source + + + No Tracks + \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index 10f53517f..a65fca5eb 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -17,6 +17,7 @@ namespace HandBrakeWPF.ViewModels using System.Text; using System.Windows.Media.Imaging; + using HandBrake.ApplicationServices.Interop; using HandBrake.ApplicationServices.Interop.Model.Encoding; using HandBrakeWPF.EventArgs; @@ -44,6 +45,10 @@ namespace HandBrakeWPF.ViewModels private bool isMkv; private int selectedPreview = 2; + private bool isPreviousPreviewControlVisible; + + private bool isNextPreviewControlVisible; + public SummaryViewModel(IScan scanService, IUserSettingService userSettingService) { this.scanService = scanService; @@ -126,6 +131,8 @@ namespace HandBrakeWPF.ViewModels public BitmapImage PreviewImage { get; set; } public bool PreviewNotAvailable { get; set; } + public int MaxWidth { get; set; } + public int MaxHeight { get; set; } public string VideoTrackInfo { get; set; } public string AudioTrackInfo { get; set; } @@ -136,11 +143,38 @@ namespace HandBrakeWPF.ViewModels public string DimensionInfo { get; set; } public string AspectInfo { get; set; } - public bool IsPreviousPreviewControlVisible { get; set; } = false; - public bool IsNextPreviewControlVisible { get; set; } = false; - public bool IsPreviewInfoVisible { get; set; } = false; + + public bool IsPreviewInfoVisible { get; set; } public string PreviewInfo { get; set; } + public bool IsPreviousPreviewControlVisible + { + get + { + return this.isPreviousPreviewControlVisible; + } + set + { + if (value == this.isPreviousPreviewControlVisible) return; + this.isPreviousPreviewControlVisible = value; + this.NotifyOfPropertyChange(() => this.IsPreviousPreviewControlVisible); + } + } + + public bool IsNextPreviewControlVisible + { + get + { + return this.isNextPreviewControlVisible; + } + set + { + if (value == this.isNextPreviewControlVisible) return; + this.isNextPreviewControlVisible = value; + this.NotifyOfPropertyChange(() => this.IsNextPreviewControlVisible); + } + } + #endregion #region Task Properties @@ -303,7 +337,6 @@ namespace HandBrakeWPF.ViewModels if (this.selectedPreview == maxPreview) { this.IsNextPreviewControlVisible = false; - this.NotifyOfPropertyChange(() => this.IsNextPreviewControlVisible); } } @@ -318,7 +351,6 @@ namespace HandBrakeWPF.ViewModels if (this.selectedPreview == 1) { this.IsPreviousPreviewControlVisible = false; - this.NotifyOfPropertyChange(() => this.IsPreviousPreviewControlVisible); } } @@ -341,9 +373,6 @@ namespace HandBrakeWPF.ViewModels { this.IsNextPreviewControlVisible = false; } - - this.NotifyOfPropertyChange(() => this.IsPreviousPreviewControlVisible); - this.NotifyOfPropertyChange(() => this.IsNextPreviewControlVisible); } #region Private Methods @@ -477,7 +506,7 @@ namespace HandBrakeWPF.ViewModels filters.Add(ResourcesUI.SummaryView_Rotation); } - return string.Join(", ", filters).Trim(); + return string.Join(", ", filters).TrimEnd(',').Trim(); } private string GetAudioDescription() @@ -492,13 +521,17 @@ namespace HandBrakeWPF.ViewModels if (this.Task.AudioTracks.Count >= 1) { AudioTrack track1 = this.Task.AudioTracks[0]; - desc.AppendLine(string.Format("{0}, {1}", EnumHelper.GetDisplay(track1.Encoder), track1.MixDown)); + HBMixdown mixdownName = HandBrakeEncoderHelpers.GetMixdown(track1.MixDown); + string mixdown = mixdownName != null ? ", " + mixdownName.DisplayName : string.Empty; + desc.AppendLine(string.Format("{0}{1}", EnumHelper.GetDisplay(track1.Encoder), mixdown)); } if (this.Task.AudioTracks.Count >= 2) { AudioTrack track2 = this.Task.AudioTracks[1]; - desc.AppendLine(string.Format("{0}, {1}", EnumHelper.GetDisplay(track2.Encoder), track2.MixDown)); + HBMixdown mixdownName = HandBrakeEncoderHelpers.GetMixdown(track2.MixDown); + string mixdown = mixdownName != null ? ", " + mixdownName.DisplayName : string.Empty; + desc.AppendLine(string.Format("{0}{1}", EnumHelper.GetDisplay(track2.Encoder), mixdown)); } if (this.Task.AudioTracks.Count > 2) @@ -521,13 +554,17 @@ namespace HandBrakeWPF.ViewModels if (this.Task.SubtitleTracks.Count >= 1) { SubtitleTrack track1 = this.Task.SubtitleTracks[0]; - desc.AppendLine(string.Format("{0}, {1}", track1.SourceTrack, track1.Burned ? ResourcesUI.SummaryView_Burned : string.Empty)); + string subtitleName = track1.IsSrtSubtitle ? track1.SrtFileName : track1.SourceTrack.ToString(); + string burned = track1.Burned ? ", " + ResourcesUI.SummaryView_Burned : string.Empty; + desc.AppendLine(string.Format("{0}{1}", subtitleName, burned)); } if (this.Task.SubtitleTracks.Count >= 2) { SubtitleTrack track2 = this.Task.SubtitleTracks[1]; - desc.AppendLine(string.Format("{0}, {1}", track2.SourceTrack, track2.Burned ? ResourcesUI.SummaryView_Burned : string.Empty)); + string subtitleName = track2.IsSrtSubtitle ? track2.SrtFileName : track2.SourceTrack.ToString(); + string burned = track2.Burned ? ", " + ResourcesUI.SummaryView_Burned : string.Empty; + desc.AppendLine(string.Format("{0}{1}", subtitleName, burned)); } if (this.Task.SubtitleTracks.Count > 2) @@ -540,7 +577,7 @@ namespace HandBrakeWPF.ViewModels private void ClearDisplay() { - this.VideoTrackInfo = string.Empty; + this.VideoTrackInfo = ResourcesUI.SummaryView_NoTracks; this.NotifyOfPropertyChange(() => this.VideoTrackInfo); this.AudioTrackInfo = string.Empty; @@ -552,10 +589,10 @@ namespace HandBrakeWPF.ViewModels this.ChapterInfo = string.Empty; this.NotifyOfPropertyChange(() => this.ChapterInfo); - this.FiltersInfo = string.Empty; + this.FiltersInfo = ResourcesUI.SummaryView_NoFilters; this.NotifyOfPropertyChange(() => this.FiltersInfo); - this.DimensionInfo = string.Empty; + this.DimensionInfo = ResourcesUI.SummaryView_NoSource; this.NotifyOfPropertyChange(() => this.ChapterInfo); this.AspectInfo = string.Empty; @@ -595,9 +632,13 @@ namespace HandBrakeWPF.ViewModels { this.PreviewNotAvailable = false; this.PreviewImage = image; + this.MaxWidth = (int)image.Width; + this.MaxHeight = (int)image.Height; this.IsPreviewInfoVisible = true; this.NotifyOfPropertyChange(() => this.IsPreviewInfoVisible); this.NotifyOfPropertyChange(() => this.PreviewImage); + this.NotifyOfPropertyChange(() => this.MaxWidth); + this.NotifyOfPropertyChange(() => this.MaxHeight); } } diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index 47c93c62e..cadd5a5ee 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -420,15 +420,15 @@ - - - + + + diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml index 59a0ce04b..fb3d97892 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -14,19 +14,14 @@ - + - - + + - - - - - - + @@ -59,8 +54,8 @@ - - - + + @@ -90,61 +85,52 @@ - - + + - - - - - - + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - + + - - + + - - diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs index 744003698..5b0354576 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml.cs @@ -11,6 +11,7 @@ namespace HandBrakeWPF.Views { using System.Windows.Controls; using System.Windows.Input; + using System.Windows.Media; using HandBrakeWPF.ViewModels.Interfaces; @@ -42,5 +43,18 @@ namespace HandBrakeWPF.Views ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(leftHalf, rightHalf); } } + + private void PreviewImage_OnMouseLeave(object sender, MouseEventArgs e) + { + HitTestResult result = VisualTreeHelper.HitTest(this.previewImage, e.GetPosition(this.previewImage)); + + if (result != null && result.VisualHit.GetType() == typeof(Image)) + { + e.Handled = true; + return; + } + + ((ISummaryViewModel)this.DataContext).SetPreviewControlVisibility(false, false); + } } }