From a27b2c176c84d290339f3bb0dc5b9f9961817b30 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 21 Sep 2013 22:12:56 +0000 Subject: WinGui: Added a new tab in Options to host "Video" related settings including hardware acceleration. Only showing the QuickSync options. DXVA/OpenCl options are hidden for now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5794 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 3 +- win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 429 ++++++++++++++------- 2 files changed, 282 insertions(+), 150 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels') diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 819609f20..f1acf2624 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1341,7 +1341,8 @@ namespace HandBrakeWPF.ViewModels QueryGeneratorUtility.GenerateQuery(this.CurrentTask, userSettingService.GetUserSetting(ASUserSettingConstants.PreviewScanCount), userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity), - userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav), + userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding)), "CLI Query", MessageBoxButton.OK, MessageBoxImage.Information); diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 1ad006447..e6d47241f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -358,6 +358,23 @@ namespace HandBrakeWPF.ViewModels /// private bool resetWhenDoneAction; + /// + /// The selected scaling mode. + /// + private VideoScaler selectedScalingMode; + + /// + /// The enable dxva decoding. + /// + private bool enableDxvaDecoding; + + /// + /// The disable quick sync decoding. + /// + private bool disableQuickSyncDecoding; + + private bool enableQuickSync; + #endregion #region Constructors and Destructors @@ -1390,6 +1407,106 @@ namespace HandBrakeWPF.ViewModels #endregion + #region Video + + /// + /// Gets or sets a value indicating whether enable quick sync. + /// + public bool EnableQuickSync + { + get + { + return this.enableQuickSync; + } + set + { + if (value.Equals(this.enableQuickSync)) + { + return; + } + this.enableQuickSync = value; + this.NotifyOfPropertyChange(() => this.EnableQuickSync); + } + } + + /// + /// Gets or sets a value indicating whether disable quick sync decoding. + /// + public bool DisableQuickSyncDecoding + { + get + { + return this.disableQuickSyncDecoding; + } + set + { + if (value.Equals(this.disableQuickSyncDecoding)) + { + return; + } + this.disableQuickSyncDecoding = value; + this.NotifyOfPropertyChange(() => this.DisableQuickSyncDecoding); + } + } + + /// + /// Gets or sets a value indicating whether enable dxva decoding. + /// + public bool EnableDxvaDecoding + { + get + { + return this.enableDxvaDecoding; + } + set + { + if (value.Equals(this.enableDxvaDecoding)) + { + return; + } + this.enableDxvaDecoding = value; + this.NotifyOfPropertyChange(() => this.EnableDxvaDecoding); + } + } + + /// + /// Gets or sets the selected scaling mode. + /// + public VideoScaler SelectedScalingMode + { + get + { + return this.selectedScalingMode; + } + set + { + this.selectedScalingMode = value; + } + } + + /// + /// Gets a value indicating whether is quick sync available. + /// + public bool IsQuickSyncAvailable + { + get + { + return SystemInfo.IsQsvAvailable; + } + } + + /// + /// Gets the scaling options. + /// + public BindingList ScalingOptions + { + get + { + return new BindingList(EnumHelper.GetEnumList().ToList()); + } + } + #endregion + #endregion #region About HandBrake @@ -1466,6 +1583,151 @@ namespace HandBrakeWPF.ViewModels base.OnActivate(); } + /// + /// Close this window. + /// + public void Close() + { + this.Save(); + this.shellViewModel.DisplayWindow(ShellWindow.MainWindow); + } + + /// + /// Browse - Send File To + /// + public void BrowseSendFileTo() + { + VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" }; + dialog.ShowDialog(); + this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName); + this.sendFileToPath = dialog.FileName; + } + + /// + /// Browse Auto Name Path + /// + public void BrowseAutoNamePath() + { + VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; + dialog.ShowDialog(); + this.AutoNameDefaultPath = dialog.SelectedPath; + } + + /// + /// Browse VLC Path + /// + public void BrowseVlcPath() + { + VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" }; + dialog.ShowDialog(); + this.VLCPath = dialog.FileName; + } + + /// + /// Audio List Move Left + /// + public void LanguageMoveRight() + { + if (this.SelectedAvailableToMove.Count > 0) + { + List copiedList = SelectedAvailableToMove.ToList(); + foreach (string item in copiedList) + { + this.AvailableLanguages.Remove(item); + this.SelectedLangauges.Add(item); + } + + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + } + + /// + /// Audio List Move Right + /// + public void LanguageMoveLeft() + { + if (this.SelectedLangaugesToMove.Count > 0) + { + List copiedList = SelectedLangaugesToMove.ToList(); + foreach (string item in copiedList) + { + this.SelectedLangauges.Remove(item); + this.AvailableLanguages.Add(item); + } + } + + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + } + + /// + /// Audio List Clear all selected languages + /// + public void LanguageClearAll() + { + foreach (string item in this.SelectedLangauges) + { + this.AvailableLanguages.Add(item); + } + this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); + + this.SelectedLangauges.Clear(); + } + + /// + /// Browse - Log Path + /// + public void BrowseLogPath() + { + VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; + dialog.ShowDialog(); + this.LogDirectory = dialog.SelectedPath; + } + + /// + /// View the Default Log Directory for HandBrake + /// + public void ViewLogDirectory() + { + string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; + string windir = Environment.GetEnvironmentVariable("WINDIR"); + Process prc = new Process { StartInfo = { FileName = windir + @"\explorer.exe", Arguments = logDir } }; + prc.Start(); + } + + /// + /// Clear HandBrakes log directory. + /// + public void ClearLogHistory() + { + MessageBoxResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", + MessageBoxButton.YesNoCancel, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) + { + GeneralUtilities.ClearLogFiles(0); + MessageBox.Show("HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + /// + /// Download an Update + /// + public void DownloadUpdate() + { + this.UpdateMessage = "Preparing for Update ..."; + this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.DownloadComplete, this.DownloadProgress); + } + + /// + /// Check for updates + /// + public void PerformUpdateCheck() + { + this.UpdateMessage = "Checking for Updates ..."; + this.updateService.CheckForUpdates(this.UpdateCheckComplete); + } + + #endregion + /// /// Load User Settings /// @@ -1492,7 +1754,7 @@ namespace HandBrakeWPF.ViewModels case 7: this.CheckForUpdatesFrequency = 1; break; - case 30: + default: this.CheckForUpdatesFrequency = 2; break; } @@ -1615,6 +1877,15 @@ namespace HandBrakeWPF.ViewModels this.AddClosedCaptions = this.userSettingService.GetUserSetting(UserSettingConstants.UseClosedCaption); this.ShowAdvancedPassthruOpts = this.userSettingService.GetUserSetting(UserSettingConstants.ShowAdvancedAudioPassthruOpts); + + // ############################# + // Video + // ############################# + this.EnableQuickSync = this.userSettingService.GetUserSetting(UserSettingConstants.EnableQuickSync); + this.DisableQuickSyncDecoding = this.userSettingService.GetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding); + this.EnableDxvaDecoding = this.userSettingService.GetUserSetting(ASUserSettingConstants.EnableDxva); + this.SelectedScalingMode = this.userSettingService.GetUserSetting(ASUserSettingConstants.ScalingMode); + // ############################# // CLI // ############################# @@ -1691,154 +1962,6 @@ namespace HandBrakeWPF.ViewModels this.EnableLibHb = userSettingService.GetUserSetting(UserSettingConstants.EnableLibHb); } - /// - /// Close this window. - /// - public void Close() - { - this.Save(); - this.shellViewModel.DisplayWindow(ShellWindow.MainWindow); - } - - /// - /// Browse - Send File To - /// - public void BrowseSendFileTo() - { - VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" }; - dialog.ShowDialog(); - this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName); - this.sendFileToPath = dialog.FileName; - } - - /// - /// Browse Auto Name Path - /// - public void BrowseAutoNamePath() - { - VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; - dialog.ShowDialog(); - this.AutoNameDefaultPath = dialog.SelectedPath; - } - - /// - /// Browse VLC Path - /// - public void BrowseVlcPath() - { - VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" }; - dialog.ShowDialog(); - this.VLCPath = dialog.FileName; - } - - /// - /// Audio List Move Left - /// - public void LanguageMoveRight() - { - if (this.SelectedAvailableToMove.Count > 0) - { - List copiedList = SelectedAvailableToMove.ToList(); - foreach (string item in copiedList) - { - this.AvailableLanguages.Remove(item); - this.SelectedLangauges.Add(item); - } - - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - } - } - - /// - /// Audio List Move Right - /// - public void LanguageMoveLeft() - { - if (this.SelectedLangaugesToMove.Count > 0) - { - List copiedList = SelectedLangaugesToMove.ToList(); - foreach (string item in copiedList) - { - this.SelectedLangauges.Remove(item); - this.AvailableLanguages.Add(item); - } - } - - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - } - - /// - /// Audio List Clear all selected languages - /// - public void LanguageClearAll() - { - foreach (string item in this.SelectedLangauges) - { - this.AvailableLanguages.Add(item); - } - this.AvailableLanguages = new BindingList(this.AvailableLanguages.OrderBy(o => o).ToList()); - - this.SelectedLangauges.Clear(); - } - - /// - /// Browse - Log Path - /// - public void BrowseLogPath() - { - VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true }; - dialog.ShowDialog(); - this.LogDirectory = dialog.SelectedPath; - } - - /// - /// View the Default Log Directory for HandBrake - /// - public void ViewLogDirectory() - { - string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - string windir = Environment.GetEnvironmentVariable("WINDIR"); - Process prc = new Process { StartInfo = { FileName = windir + @"\explorer.exe", Arguments = logDir } }; - prc.Start(); - } - - /// - /// Clear HandBrakes log directory. - /// - public void ClearLogHistory() - { - MessageBoxResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", - MessageBoxButton.YesNoCancel, MessageBoxImage.Question); - if (result == MessageBoxResult.Yes) - { - GeneralUtilities.ClearLogFiles(0); - MessageBox.Show("HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButton.OK, MessageBoxImage.Information); - } - } - #endregion - - #region Updates - - /// - /// Download an Update - /// - public void DownloadUpdate() - { - this.UpdateMessage = "Preparing for Update ..."; - this.updateService.DownloadFile(this.updateInfo.DownloadFile, this.DownloadComplete, this.DownloadProgress); - } - - /// - /// Check for updates - /// - public void PerformUpdateCheck() - { - this.UpdateMessage = "Checking for Updates ..."; - this.updateService.CheckForUpdates(this.UpdateCheckComplete); - } - - #endregion - /// /// Save the settings selected /// @@ -1880,6 +2003,14 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.DubModeSubtitle, this.SelectedAddSubtitleMode); this.userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedAudioPassthruOpts, this.ShowAdvancedPassthruOpts); + + /* Video */ + this.userSettingService.SetUserSetting(UserSettingConstants.EnableQuickSync, this.EnableQuickSync); + this.userSettingService.SetUserSetting(ASUserSettingConstants.DisableQuickSyncDecoding, this.DisableQuickSyncDecoding); + this.userSettingService.SetUserSetting(ASUserSettingConstants.EnableDxva, this.EnableDxvaDecoding); + this.userSettingService.SetUserSetting(ASUserSettingConstants.ScalingMode, this.SelectedScalingMode); + + /* System and Logging */ userSettingService.SetUserSetting(ASUserSettingConstants.ProcessPriority, this.SelectedPriority); userSettingService.SetUserSetting(UserSettingConstants.PreventSleep, this.PreventSleep); -- cgit v1.2.3