From 5cc5a0f9aef4339312d474399207b71cb815b9ff Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 18 Mar 2012 14:36:15 +0000 Subject: WinGui: (WPF) Numerous fixes / UI tweaks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4511 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/EncodeTask.cs | 29 +++++++++++++-- .../Utilities/QueryGeneratorUtility.cs | 8 ++--- .../HandBrakeWPF/ViewModels/ChaptersViewModel.cs | 6 +++- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 12 +++---- .../ViewModels/PictureSettingsViewModel.cs | 42 ++++++++++++++-------- win/CS/HandBrakeWPF/Views/MainView.xaml | 39 ++++++++++++++------ win/CS/HandBrakeWPF/Views/OptionsView.xaml | 10 +++--- 7 files changed, 101 insertions(+), 45 deletions(-) (limited to 'win/CS') diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index d89c77082..5294668d4 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -29,7 +29,6 @@ namespace HandBrake.ApplicationServices.Model this.AudioTracks = new ObservableCollection(); this.SubtitleTracks = new ObservableCollection(); this.ChapterNames = new ObservableCollection(); - this.AllowedPassthruOptions = new AllowedPassthru(); this.x264Preset = x264Preset.None; this.x264Profile = x264Profile.None; this.X264Tune = x264Tune.None; @@ -142,15 +141,39 @@ namespace HandBrake.ApplicationServices.Model /// public PointToPointMode PointToPointMode { get; set; } + private int startPoint; + /// /// Gets or sets StartPoint. /// - public int StartPoint { get; set; } + public int StartPoint + { + get + { + return this.startPoint; + } + set + { + this.startPoint = value; + } + } + + private int endPoint; /// /// Gets or sets EndPoint. /// - public int EndPoint { get; set; } + public int EndPoint + { + get + { + return this.endPoint; + } + set + { + this.endPoint = value; + } + } #endregion diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs index 35cf3a38e..d46296244 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs @@ -237,10 +237,10 @@ namespace HandBrake.ApplicationServices.Utilities if (task.Anamorphic != Anamorphic.Strict) { if (task.MaxWidth.HasValue) query += string.Format(" -X {0}", task.MaxWidth); - else if (task.Width.HasValue) query += string.Format(" -w {0}", task.Width); + else if (task.Width.HasValue && task.Width != 0) query += string.Format(" -w {0}", task.Width); if (task.MaxWidth.HasValue) query += string.Format(" -Y {0}", task.MaxHeight); - else if (task.Height.HasValue) query += string.Format(" -h {0}", task.Height); + else if (task.Height.HasValue && task.Height != 0) query += string.Format(" -h {0}", task.Height); } if (task.HasCropping) @@ -536,7 +536,7 @@ namespace HandBrake.ApplicationServices.Utilities firstLoop = false; } else - audioItems += "," + item; + audioItems += "," + Converters.GetCliAudioEncoder(item); } if (audioItems.Trim() != String.Empty) query += " -E " + audioItems; @@ -552,7 +552,7 @@ namespace HandBrake.ApplicationServices.Utilities firstLoop = false; } else - audioItems += "," + item; + audioItems += "," + Converters.GetCliMixDown(item); } if (audioItems.Trim() != String.Empty) query += " -6 " + audioItems; diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index 264643847..6a2e64ac8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -204,7 +204,11 @@ namespace HandBrakeWPF.ViewModels { this.Task = task; this.NotifyOfPropertyChange(() => this.Task); - this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers; + + if (preset != null) + { + this.IncludeChapterMarkers = preset.Task.IncludeChapterMarkers; + } this.SetSourceChapters(title.Chapters); } diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 28472343c..d42e535c7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -515,9 +515,9 @@ namespace HandBrakeWPF.ViewModels // Use the Path on the Title, or the Source Scan path if one doesn't exist. this.CurrentTask.Source = !string.IsNullOrEmpty(this.selectedTitle.SourceName) ? this.selectedTitle.SourceName : this.ScannedSource.ScanPath; this.CurrentTask.Title = value.TitleNumber; - this.NotifyOfPropertyChange("StartEndRangeItems"); - this.NotifyOfPropertyChange("SelectedTitle"); - this.NotifyOfPropertyChange("Angles"); + this.NotifyOfPropertyChange(() => this.StartEndRangeItems); + this.NotifyOfPropertyChange(() => this.SelectedTitle); + this.NotifyOfPropertyChange(() => this.Angles); // Default the Start and End Point dropdowns this.SelectedStartPoint = 1; @@ -526,7 +526,7 @@ namespace HandBrakeWPF.ViewModels this.SelectedAngle = 1; this.CurrentTask.Destination = AutoNameHelper.AutoName(this.CurrentTask, this.SourceName); - this.NotifyOfPropertyChange("CurrentTask"); + this.NotifyOfPropertyChange(() => this.CurrentTask); this.Duration = selectedTitle.Duration.ToString(); @@ -547,8 +547,8 @@ namespace HandBrakeWPF.ViewModels } set { - this.CurrentTask.EndPoint = value; - this.NotifyOfPropertyChange("SelectedAngle"); + this.CurrentTask.Angle = value; + this.NotifyOfPropertyChange(() => this.SelectedAngle); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 7e955e541..2c7b47c95 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -13,6 +13,7 @@ namespace HandBrakeWPF.ViewModels using System.Collections.Generic; using System.ComponentModel.Composition; using System.Drawing; + using System.Globalization; using Caliburn.Micro; @@ -477,38 +478,46 @@ namespace HandBrakeWPF.ViewModels { this.Task = task; + // TODO: These all need to be handled correctly. + this.SelectedAnamorphicMode = preset.Task.Anamorphic; + if (preset.PictureSettingsMode == PresetPictureSettingsMode.SourceMaximum) { this.Task.MaxWidth = preset.Task.MaxWidth; this.Task.MaxHeight = preset.Task.MaxHeight; - this.Task.Width = preset.Task.MaxWidth ?? 0; - this.Task.Height = preset.Task.MaxHeight ?? 0; + this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight); + this.Height = preset.Task.Height ?? (sourceResolution.Height - this.CropTop - this.CropBottom); } else { - this.Task.Width = preset.Task.Width ?? 0; - this.Task.Height = preset.Task.Height ?? 0; + this.Width = preset.Task.Width ?? (sourceResolution.Width - this.CropLeft - this.CropRight); + this.Height = preset.Task.Height ?? (sourceResolution.Height - this.CropTop - this.CropBottom); } if (this.Task.Anamorphic == Anamorphic.Custom) { - this.Task.DisplayWidth = preset.Task.DisplayWidth ?? 0; - this.Task.PixelAspectX = preset.Task.PixelAspectX; - this.Task.PixelAspectY = preset.Task.PixelAspectY; + this.DisplayWidth = preset.Task.DisplayWidth != null ? int.Parse(preset.Task.DisplayWidth.ToString()) : 0; + this.ParWidth = preset.Task.PixelAspectX; + this.ParHeight = preset.Task.PixelAspectY; } - this.Task.KeepDisplayAspect = preset.Task.KeepDisplayAspect; + this.MaintainAspectRatio = preset.Task.KeepDisplayAspect; if (this.Task.Modulus.HasValue) { - this.Task.Modulus = preset.Task.Modulus; + this.SelectedModulus = preset.Task.Modulus; } if (preset.Task.HasCropping) { - this.Task.Cropping = preset.Task.Cropping; + this.CropLeft = preset.Task.Cropping.Left; + this.CropRight = preset.Task.Cropping.Right; + this.CropTop = preset.Task.Cropping.Top; + this.CropBottom = preset.Task.Cropping.Bottom; } + + this.NotifyOfPropertyChange(() => this.Task); } /// @@ -526,6 +535,7 @@ namespace HandBrakeWPF.ViewModels public void SetSource(Title title, Preset preset, EncodeTask task) { this.Task = task; + if (title != null) { // Set cached info @@ -549,6 +559,8 @@ namespace HandBrakeWPF.ViewModels this.Height = title.Resolution.Height; this.MaintainAspectRatio = true; } + + this.NotifyOfPropertyChange(() => this.Task); } #endregion @@ -848,7 +860,7 @@ namespace HandBrakeWPF.ViewModels (this.sourceResolution.Height * this.SourceAspect.Width * crop_width); this.Task.Height = (int)Math.Round(this.GetModulusValue(newHeight), 0); - this.NotifyOfPropertyChange("Height"); + this.NotifyOfPropertyChange(() => this.Height); } break; @@ -856,14 +868,14 @@ namespace HandBrakeWPF.ViewModels this.Task.Width = 0; this.Task.Height = 0; - this.NotifyOfPropertyChange(() => this.Task.Width); - this.NotifyOfPropertyChange(() => this.Task.Height); + this.NotifyOfPropertyChange(() => this.Width); + this.NotifyOfPropertyChange(() => this.Height); this.SetDisplaySize(); break; case Anamorphic.Loose: this.Task.Height = 0; - this.NotifyOfPropertyChange(() => this.Task.Width); - this.NotifyOfPropertyChange(() => this.Task.Height); + this.NotifyOfPropertyChange(() => this.Width); + this.NotifyOfPropertyChange(() => this.Height); this.SetDisplaySize(); break; case Anamorphic.Custom: diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index af9e27a7b..e6a4e6997 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -3,8 +3,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework" xmlns:Converters="clr-namespace:HandBrakeWPF.Converters" xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" - xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" Title="{Data:Binding Path=WindowTitle}" Height="655" Width="1015" FontSize="11" Background="#FFF0F0F0" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" Title="{Data:Binding Path=WindowTitle}" Height="625" Width="1015" FontSize="11" Background="#FFF0F0F0" Micro:Message.Attach="[Event Loaded] = [Action Load]" + UseLayoutRounding="True" AllowDrop="True"> @@ -74,14 +75,30 @@ - - + + + + + + + + + + - + + + + + - + + + + + @@ -135,21 +152,21 @@ @@ -158,7 +175,7 @@ @@ -236,7 +253,7 @@ - + @@ -268,7 +285,7 @@ diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index cc5d5f775..6852e5704 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -1,7 +1,7 @@  + xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" Title="{Binding Title}" MinWidth="620" MinHeight="545" Width="620" Height="545">