From 2f0f372b09897e703a8d01fe9774aa59c936a013 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 29 Oct 2011 20:17:24 +0000 Subject: WinGui: (WPF) Continued work on the options window. Save Settings, Various functions and place holders for TODO's git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4328 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/Factories/ViewModelFactory.cs | 24 +- win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 17 +- win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs | 30 + win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 740 +++++++++++++-------- win/CS/HandBrakeWPF/Views/LogView.xaml | 8 + win/CS/HandBrakeWPF/Views/LogView.xaml.cs | 26 + win/CS/HandBrakeWPF/Views/MainView.xaml | 10 + win/CS/HandBrakeWPF/Views/OptionsView.xaml | 131 ++-- win/CS/HandBrakeWPF/defaultsettings.xml | 411 ++++++++++++ 9 files changed, 1064 insertions(+), 333 deletions(-) create mode 100644 win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs create mode 100644 win/CS/HandBrakeWPF/Views/LogView.xaml create mode 100644 win/CS/HandBrakeWPF/Views/LogView.xaml.cs create mode 100644 win/CS/HandBrakeWPF/defaultsettings.xml (limited to 'win') diff --git a/win/CS/HandBrakeWPF/Factories/ViewModelFactory.cs b/win/CS/HandBrakeWPF/Factories/ViewModelFactory.cs index e8e298546..6b110fcd1 100644 --- a/win/CS/HandBrakeWPF/Factories/ViewModelFactory.cs +++ b/win/CS/HandBrakeWPF/Factories/ViewModelFactory.cs @@ -9,16 +9,38 @@ namespace HandBrakeWPF.Factories { + using Caliburn.Micro; + + using HandBrake.ApplicationServices.Services.Interfaces; + /// /// The View Model Factory /// public class ViewModelFactory { + /// + /// The Window Manager + /// + private readonly IWindowManager windowManager; + + /// + /// The User Setting Service + /// + private readonly IUserSettingService userSettingsService; + /// /// Initializes a new instance of the class. /// - public ViewModelFactory() + /// + /// The window Manager. + /// + /// + /// The user Settings Service. + /// + public ViewModelFactory(IWindowManager windowManager, IUserSettingService userSettingsService) { + this.windowManager = windowManager; + this.userSettingsService = userSettingsService; } } } diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 8737b9958..f94cf2a28 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -48,6 +48,9 @@ ..\libraries\caliburn\Common.Logging.dll + + ..\libraries\OokiiDialogs\Ookii.Dialogs.Wpf.dll + @@ -81,6 +84,7 @@ + @@ -105,6 +109,9 @@ AddPresetView.xaml + + LogView.xaml + PreviewView.xaml @@ -179,6 +186,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -216,7 +227,11 @@ MSBuild:Compile - + + + Always + + diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs new file mode 100644 index 000000000..b0159669f --- /dev/null +++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs @@ -0,0 +1,30 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Defines the LogViewModel type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.ViewModels +{ + using Caliburn.Micro; + + /// + /// The Log View Model + /// + public class LogViewModel : ViewModelBase + { + /// + /// Initializes a new instance of the class. + /// + /// + /// The window manager. + /// + public LogViewModel(IWindowManager windowManager) + : base(windowManager) + { + } + } +} diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index f27d71b59..68a4ecf5d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -9,12 +9,16 @@ namespace HandBrakeWPF.ViewModels { + using System; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.ComponentModel.Composition; + using System.Diagnostics; using System.Globalization; using System.IO; + using System.Linq; + using System.Windows; using Caliburn.Micro; @@ -24,6 +28,8 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.ViewModels.Interfaces; + using Ookii.Dialogs.Wpf; + /// /// The Options View Model /// @@ -37,11 +43,6 @@ namespace HandBrakeWPF.ViewModels /// private readonly IUserSettingService userSettingService; - /// - /// A Property to block Saving while the screen is loading. - /// - private bool isLoading = true; - /// /// The add audio mode options. /// @@ -267,6 +268,12 @@ namespace HandBrakeWPF.ViewModels /// private string sendFileTo; + /// + /// The send file to Path. + /// + private string sendFileToPath; + + /// /// The show cli window. /// @@ -316,615 +323,628 @@ namespace HandBrakeWPF.ViewModels #region Properties + #region General + /// - /// Gets or sets AddAudioModeOptions. + /// Gets or sets a value indicating whether CheckForUpdates. /// - public BindingList AddAudioModeOptions + public bool CheckForUpdates { get { - return this.addAudioModeOptions; + return this.checkForUpdates; } set { - this.addAudioModeOptions = value; - this.NotifyOfPropertyChange("AddAudioModeOptions"); + this.checkForUpdates = value; + this.NotifyOfPropertyChange("CheckForUpdates"); } } /// - /// Gets or sets a value indicating whether AddClosedCaptions. + /// Gets or sets CheckForUpdatesFrequencies. /// - public bool AddClosedCaptions + public BindingList CheckForUpdatesFrequencies { get { - return this.addClosedCaptions; + return this.checkForUpdatesFrequencies; } set { - this.addClosedCaptions = value; - this.NotifyOfPropertyChange("AddClosedCaptions"); + this.checkForUpdatesFrequencies = value; + this.NotifyOfPropertyChange("CheckForUpdatesFrequencies"); } } /// - /// Gets or sets a value indicating whether AddOnlyOneAudioTrackPerLanguage. + /// Gets or sets a value indicating whether CheckForUpdatesFrequency. /// - public bool AddOnlyOneAudioTrackPerLanguage + public int CheckForUpdatesFrequency { get { - return this.addOnlyOneAudioTrackPerLanguage; + return this.checkForUpdatesFrequency; } set { - this.addOnlyOneAudioTrackPerLanguage = value; - this.NotifyOfPropertyChange("AddOnlyOneAudioTrackPerLanguage"); + this.checkForUpdatesFrequency = value; + this.NotifyOfPropertyChange("CheckForUpdatesFrequency"); } } /// - /// Gets or sets AddSubtitleModeOptions. + /// Gets or sets Arguments. /// - public BindingList AddSubtitleModeOptions + public string Arguments { get { - return this.addSubtitleModeOptions; + return this.arguments; } set { - this.addSubtitleModeOptions = value; - this.NotifyOfPropertyChange("AddSubtitleModeOptions"); + this.arguments = value; + this.NotifyOfPropertyChange("Arguments"); } } /// - /// Gets or sets Arguments. + /// Gets or sets a value indicating whether GrowlAfterEncode. /// - public string Arguments + public bool GrowlAfterEncode { get { - return this.arguments; + return this.growlAfterEncode; } set { - this.arguments = value; - this.NotifyOfPropertyChange("Arguments"); + this.growlAfterEncode = value; + this.NotifyOfPropertyChange("GrowlAfterEncode"); } } /// - /// Gets or sets AutoNameDefaultPath. + /// Gets or sets a value indicating whether GrowlAfterQueue. /// - public string AutoNameDefaultPath + public bool GrowlAfterQueue { get { - return this.autoNameDefaultPath; + return this.growlAfterQueue; } set { - this.autoNameDefaultPath = value; - this.NotifyOfPropertyChange("AutoNameDefaultPath"); + this.growlAfterQueue = value; + this.NotifyOfPropertyChange("GrowlAfterQueue"); } } /// - /// Gets or sets a value indicating whether AutomaticallyNameFiles. + /// Gets or sets a value indicating whether SendFileAfterEncode. /// - public bool AutomaticallyNameFiles + public bool SendFileAfterEncode { get { - return this.automaticallyNameFiles; + return this.sendFileAfterEncode; } set { - this.automaticallyNameFiles = value; - this.NotifyOfPropertyChange("AutomaticallyNameFiles"); + this.sendFileAfterEncode = value; + this.NotifyOfPropertyChange("SendFileAfterEncode"); } } /// - /// Gets or sets AutonameFormat. + /// Gets or sets SendFileTo. /// - public string AutonameFormat + public string SendFileTo { get { - return this.autonameFormat; + return this.sendFileTo; } set { - this.autonameFormat = value; - this.NotifyOfPropertyChange("AutonameFormat"); + this.sendFileTo = value; + this.NotifyOfPropertyChange("SendFileTo"); } } /// - /// Gets or sets AvailableLanguages. + /// Gets or sets SendFileToPath. /// - public BindingList AvailableLanguages + public string SendFileToPath { get { - return this.availableLanguages; + return this.sendFileToPath; } set { - this.availableLanguages = value; - this.NotifyOfPropertyChange("AvailableLanguages"); + this.sendFileToPath = value; + this.NotifyOfPropertyChange("SendFileToPath"); } } /// - /// Gets or sets a value indicating whether ChangeToTitleCase. + /// Gets or sets a value indicating whether EnableGuiTooltips. /// - public bool ChangeToTitleCase + public bool EnableGuiTooltips { get { - return this.changeToTitleCase; + return this.enableGuiTooltips; } set { - this.changeToTitleCase = value; - this.NotifyOfPropertyChange("ChangeToTitleCase"); + this.enableGuiTooltips = value; + this.NotifyOfPropertyChange("EnableGuiTooltips"); } } /// - /// Gets or sets a value indicating whether CheckForUpdates. + /// Gets or sets WhenDone. /// - public bool CheckForUpdates + public string WhenDone { get { - return this.checkForUpdates; + return this.whenDone; } set { - this.checkForUpdates = value; - this.NotifyOfPropertyChange("CheckForUpdates"); + this.whenDone = value; + this.NotifyOfPropertyChange("WhenDone"); } } /// - /// Gets or sets CheckForUpdatesFrequencies. + /// Gets or sets WhenDoneOptions. /// - public BindingList CheckForUpdatesFrequencies + public BindingList WhenDoneOptions { get { - return this.checkForUpdatesFrequencies; + return this.whenDoneOptions; } set { - this.checkForUpdatesFrequencies = value; - this.NotifyOfPropertyChange("CheckForUpdatesFrequencies"); + this.whenDoneOptions = value; + this.NotifyOfPropertyChange("WhenDoneOptions"); } } + #endregion + + #region Output Files /// - /// Gets or sets a value indicating whether CheckForUpdatesFrequency. + /// Gets or sets AutoNameDefaultPath. /// - public int CheckForUpdatesFrequency + public string AutoNameDefaultPath { get { - return this.checkForUpdatesFrequency; + return this.autoNameDefaultPath; } set { - this.checkForUpdatesFrequency = value; - this.NotifyOfPropertyChange("CheckForUpdatesFrequency"); + this.autoNameDefaultPath = value; + this.NotifyOfPropertyChange("AutoNameDefaultPath"); } } /// - /// Gets or sets a value indicating whether ClearOldOlgs. + /// Gets or sets a value indicating whether AutomaticallyNameFiles. /// - public bool ClearOldOlgs + public bool AutomaticallyNameFiles { get { - return this.clearOldOlgs; + return this.automaticallyNameFiles; } set { - this.clearOldOlgs = value; - this.NotifyOfPropertyChange("ClearOldOlgs"); + this.automaticallyNameFiles = value; + this.NotifyOfPropertyChange("AutomaticallyNameFiles"); } } /// - /// Gets or sets ConstantQualityGranularity. + /// Gets or sets AutonameFormat. /// - public BindingList ConstantQualityGranularity + public string AutonameFormat { get { - return this.constantQualityGranularity; + return this.autonameFormat; } set { - this.constantQualityGranularity = value; - this.NotifyOfPropertyChange("ConstantQualityGranularity"); + this.autonameFormat = value; + this.NotifyOfPropertyChange("AutonameFormat"); } } /// - /// Gets or sets a value indicating whether CopyLogToEncodeDirectory. + /// Gets or sets a value indicating whether ChangeToTitleCase. /// - public bool CopyLogToEncodeDirectory + public bool ChangeToTitleCase { get { - return this.copyLogToEncodeDirectory; + return this.changeToTitleCase; } set { - this.copyLogToEncodeDirectory = value; - this.NotifyOfPropertyChange("CopyLogToEncodeDirectory"); + this.changeToTitleCase = value; + this.NotifyOfPropertyChange("ChangeToTitleCase"); } } /// - /// Gets or sets a value indicating whether CopyLogToSepcficedLocation. + /// Gets or sets Mp4ExtensionOptions. /// - public bool CopyLogToSepcficedLocation + public BindingList Mp4ExtensionOptions { get { - return this.copyLogToSepcficedLocation; + return this.mp4ExtensionOptions; } set { - this.copyLogToSepcficedLocation = value; - this.NotifyOfPropertyChange("CopyLogToSepcficedLocation"); + this.mp4ExtensionOptions = value; + this.NotifyOfPropertyChange("Mp4ExtensionOptions"); } } /// - /// Gets or sets a value indicating whether DisableLibdvdNav. + /// Gets or sets a value indicating whether RemoveUnderscores. /// - public bool DisableLibdvdNav + public bool RemoveUnderscores { get { - return this.disableLibdvdNav; + return this.removeUnderscores; } set { - this.disableLibdvdNav = value; - this.NotifyOfPropertyChange("DisableLibdvdNav"); + this.removeUnderscores = value; + this.NotifyOfPropertyChange("RemoveUnderscores"); } } /// - /// Gets or sets a value indicating whether disablePresetUpdateCheckNotification. + /// Gets or sets SelectedMp4Extension. /// - public bool DisablePresetUpdateCheckNotification + public int SelectedMp4Extension { get { - return this.disablePresetUpdateCheckNotification; + return this.selectedMp4Extension; } set { - this.disablePresetUpdateCheckNotification = value; - this.NotifyOfPropertyChange("DisablePresetUpdateCheckNotification"); + this.selectedMp4Extension = value; + this.NotifyOfPropertyChange("SelectedMp4Extension"); } } + #endregion + + #region Preview /// - /// Gets or sets a value indicating whether DisplayStatusMessagesTrayIcon. + /// Gets or sets VLCPath. /// - public bool DisplayStatusMessagesTrayIcon + public string VLCPath { get { - return this.displayStatusMessagesTrayIcon; + return this.vlcPath; } set { - this.displayStatusMessagesTrayIcon = value; - this.NotifyOfPropertyChange("DisplayStatusMessagesTrayIcon"); + this.vlcPath = value; + this.NotifyOfPropertyChange("VLCPath"); } } + #endregion + + #region Audio and Subtitles /// - /// Gets or sets a value indicating whether EnableGuiTooltips. + /// Gets or sets AvailableLanguages. /// - public bool EnableGuiTooltips + public BindingList AvailableLanguages { get { - return this.enableGuiTooltips; + return this.availableLanguages; } set { - this.enableGuiTooltips = value; - this.NotifyOfPropertyChange("EnableGuiTooltips"); + this.availableLanguages = value; + this.NotifyOfPropertyChange("AvailableLanguages"); } } /// - /// Gets or sets a value indicating whether EnableQueryEditor. + /// Gets or sets AddAudioModeOptions. /// - public bool EnableQueryEditor + public BindingList AddAudioModeOptions { get { - return this.enableQueryEditor; + return this.addAudioModeOptions; } set { - this.enableQueryEditor = value; - this.NotifyOfPropertyChange("EnableQueryEditor"); + this.addAudioModeOptions = value; + this.NotifyOfPropertyChange("AddAudioModeOptions"); } } /// - /// Gets or sets a value indicating whether GrowlAfterEncode. + /// Gets or sets a value indicating whether AddClosedCaptions. /// - public bool GrowlAfterEncode + public bool AddClosedCaptions { get { - return this.growlAfterEncode; + return this.addClosedCaptions; } set { - this.growlAfterEncode = value; - this.NotifyOfPropertyChange("GrowlAfterEncode"); + this.addClosedCaptions = value; + this.NotifyOfPropertyChange("AddClosedCaptions"); } } /// - /// Gets or sets a value indicating whether GrowlAfterQueue. + /// Gets or sets a value indicating whether AddOnlyOneAudioTrackPerLanguage. /// - public bool GrowlAfterQueue + public bool AddOnlyOneAudioTrackPerLanguage { get { - return this.growlAfterQueue; + return this.addOnlyOneAudioTrackPerLanguage; } set { - this.growlAfterQueue = value; - this.NotifyOfPropertyChange("GrowlAfterQueue"); + this.addOnlyOneAudioTrackPerLanguage = value; + this.NotifyOfPropertyChange("AddOnlyOneAudioTrackPerLanguage"); } } /// - /// Gets or sets LogDirectory. + /// Gets or sets AddSubtitleModeOptions. /// - public string LogDirectory + public BindingList AddSubtitleModeOptions { get { - return this.logDirectory; + return this.addSubtitleModeOptions; } set { - this.logDirectory = value; - this.NotifyOfPropertyChange("LogDirectory"); + this.addSubtitleModeOptions = value; + this.NotifyOfPropertyChange("AddSubtitleModeOptions"); } } /// - /// Gets or sets LogVerbosityOptions. + /// Gets or sets SelectedAddAudioMode. /// - public BindingList LogVerbosityOptions + public int SelectedAddAudioMode { get { - return this.logVerbosityOptions; + return this.selectedAddAudioMode; } set { - this.logVerbosityOptions = value; - this.NotifyOfPropertyChange("LogVerbosityOptions"); + this.selectedAddAudioMode = value; + this.NotifyOfPropertyChange("SelectedAddAudioMode"); } } /// - /// Gets or sets MinLength. + /// Gets or sets SelectedAddSubtitleMode. /// - public long MinLength + public int SelectedAddSubtitleMode { get { - return this.minLength; + return this.selectedAddSubtitleMode; } set { - this.minLength = value; - this.NotifyOfPropertyChange("MinLength"); + this.selectedAddSubtitleMode = value; + this.NotifyOfPropertyChange("SelectedAddSubtitleMode"); } } /// - /// Gets or sets a value indicating whether MinimiseToTray. + /// Gets or sets preferredLanguages. /// - public bool MinimiseToTray + public BindingList PreferredLanguages { get { - return this.minimiseToTray; + return this.preferredLanguages; } set { - this.minimiseToTray = value; - this.NotifyOfPropertyChange("MinimiseToTray"); + this.preferredLanguages = value; + this.NotifyOfPropertyChange("preferredLanguages"); } } /// - /// Gets or sets Mp4ExtensionOptions. + /// Gets or sets SelectedLangauges. /// - public BindingList Mp4ExtensionOptions + public BindingList SelectedLangauges { get { - return this.mp4ExtensionOptions; + return this.selectedLangauges; } - set { - this.mp4ExtensionOptions = value; - this.NotifyOfPropertyChange("Mp4ExtensionOptions"); + this.selectedLangauges = value; + this.NotifyOfPropertyChange("SelectedLangauges"); } } /// - /// Gets or sets a value indicating whether PreventSleep. + /// Gets or sets SelectedPreferreedLangauge. /// - public bool PreventSleep + public string SelectedPreferredLangauge { get { - return this.preventSleep; + return this.selectedPreferredLangauge; } set { - this.preventSleep = value; - this.NotifyOfPropertyChange("PreventSleep"); + this.selectedPreferredLangauge = value; + this.NotifyOfPropertyChange("SelectedPreferreedLangauge"); } } + #endregion + + #region System and Logging /// - /// Gets or sets PreviewPicturesToScan. + /// Gets or sets a value indicating whether CopyLogToEncodeDirectory. /// - public BindingList PreviewPicturesToScan + public bool CopyLogToEncodeDirectory { get { - return this.previewPicturesToScan; + return this.copyLogToEncodeDirectory; } set { - this.previewPicturesToScan = value; - this.NotifyOfPropertyChange("PreviewPicturesToScan"); + this.copyLogToEncodeDirectory = value; + this.NotifyOfPropertyChange("CopyLogToEncodeDirectory"); } } /// - /// Gets or sets PriorityLevelOptions. + /// Gets or sets a value indicating whether CopyLogToSepcficedLocation. /// - public BindingList PriorityLevelOptions + public bool CopyLogToSepcficedLocation { get { - return this.priorityLevelOptions; + return this.copyLogToSepcficedLocation; } set { - this.priorityLevelOptions = value; - this.NotifyOfPropertyChange("PriorityLevelOptions"); + this.copyLogToSepcficedLocation = value; + this.NotifyOfPropertyChange("CopyLogToSepcficedLocation"); } } /// - /// Gets or sets a value indicating whether PromptOnDifferentQuery. + /// Gets or sets a value indicating whether ClearOldOlgs. /// - public bool PromptOnDifferentQuery + public bool ClearOldOlgs { get { - return this.promptOnDifferentQuery; + return this.clearOldOlgs; } set { - this.promptOnDifferentQuery = value; - this.NotifyOfPropertyChange("PromptOnDifferentQuery"); + this.clearOldOlgs = value; + this.NotifyOfPropertyChange("ClearOldOlgs"); } } /// - /// Gets or sets a value indicating whether RemoveUnderscores. + /// Gets or sets LogDirectory. /// - public bool RemoveUnderscores + public string LogDirectory { get { - return this.removeUnderscores; + return this.logDirectory; } set { - this.removeUnderscores = value; - this.NotifyOfPropertyChange("RemoveUnderscores"); + this.logDirectory = value; + this.NotifyOfPropertyChange("LogDirectory"); } } /// - /// Gets or sets SelectedAddAudioMode. + /// Gets or sets a value indicating whether PreventSleep. /// - public int SelectedAddAudioMode + public bool PreventSleep { get { - return this.selectedAddAudioMode; + return this.preventSleep; } set { - this.selectedAddAudioMode = value; - this.NotifyOfPropertyChange("SelectedAddAudioMode"); + this.preventSleep = value; + this.NotifyOfPropertyChange("PreventSleep"); } } /// - /// Gets or sets SelectedAddSubtitleMode. + /// Gets or sets PriorityLevelOptions. /// - public int SelectedAddSubtitleMode + public BindingList PriorityLevelOptions { get { - return this.selectedAddSubtitleMode; + return this.priorityLevelOptions; } set { - this.selectedAddSubtitleMode = value; - this.NotifyOfPropertyChange("SelectedAddSubtitleMode"); + this.priorityLevelOptions = value; + this.NotifyOfPropertyChange("PriorityLevelOptions"); } } @@ -946,225 +966,247 @@ namespace HandBrakeWPF.ViewModels } /// - /// Gets or sets SelectedMp4Extension. + /// Gets or sets SelectedPriority. /// - public int SelectedMp4Extension + public string SelectedPriority { get { - return this.selectedMp4Extension; + return this.selectedPriority; } set { - this.selectedMp4Extension = value; - this.NotifyOfPropertyChange("SelectedMp4Extension"); + this.selectedPriority = value; + this.NotifyOfPropertyChange("SelectedPriority"); } } + #endregion + + #region Advanced /// - /// Gets or sets preferredLanguages. + /// Gets or sets a value indicating whether EnableQueryEditor. /// - public BindingList PreferredLanguages + public bool EnableQueryEditor { get { - return this.preferredLanguages; + return this.enableQueryEditor; } set { - this.preferredLanguages = value; - this.NotifyOfPropertyChange("preferredLanguages"); + this.enableQueryEditor = value; + this.NotifyOfPropertyChange("EnableQueryEditor"); } } /// - /// Gets or sets SelectedPreferreedLangauge. + /// Gets or sets a value indicating whether PromptOnDifferentQuery. /// - public string SelectedPreferredLangauge + public bool PromptOnDifferentQuery { get { - return this.selectedPreferredLangauge; + return this.promptOnDifferentQuery; } set { - this.selectedPreferredLangauge = value; - this.NotifyOfPropertyChange("SelectedPreferreedLangauge"); + this.promptOnDifferentQuery = value; + this.NotifyOfPropertyChange("PromptOnDifferentQuery"); } } /// - /// Gets or sets SelectedPreviewCount. + /// Gets or sets ConstantQualityGranularity. /// - public int SelectedPreviewCount + public BindingList ConstantQualityGranularity { get { - return this.selectedPreviewCount; + return this.constantQualityGranularity; } set { - this.selectedPreviewCount = value; - this.NotifyOfPropertyChange("SelectedPreviewCount"); + this.constantQualityGranularity = value; + this.NotifyOfPropertyChange("ConstantQualityGranularity"); } } /// - /// Gets or sets SelectedPriority. + /// Gets or sets a value indicating whether DisableLibdvdNav. /// - public string SelectedPriority + public bool DisableLibdvdNav { get { - return this.selectedPriority; + return this.disableLibdvdNav; } set { - this.selectedPriority = value; - this.NotifyOfPropertyChange("SelectedPriority"); + this.disableLibdvdNav = value; + this.NotifyOfPropertyChange("DisableLibdvdNav"); } } /// - /// Gets or sets SelectedVerbosity. + /// Gets or sets a value indicating whether disablePresetUpdateCheckNotification. /// - public int SelectedVerbosity + public bool DisablePresetUpdateCheckNotification { get { - return this.selectedVerbosity; + return this.disablePresetUpdateCheckNotification; } set { - this.selectedVerbosity = value; - this.NotifyOfPropertyChange("SelectedVerbosity"); + this.disablePresetUpdateCheckNotification = value; + this.NotifyOfPropertyChange("DisablePresetUpdateCheckNotification"); } } /// - /// Gets or sets a value indicating whether SendFileAfterEncode. + /// Gets or sets a value indicating whether DisplayStatusMessagesTrayIcon. /// - public bool SendFileAfterEncode + public bool DisplayStatusMessagesTrayIcon { get { - return this.sendFileAfterEncode; + return this.displayStatusMessagesTrayIcon; } set { - this.sendFileAfterEncode = value; - this.NotifyOfPropertyChange("SendFileAfterEncode"); + this.displayStatusMessagesTrayIcon = value; + this.NotifyOfPropertyChange("DisplayStatusMessagesTrayIcon"); } } /// - /// Gets or sets SendFileTo. + /// Gets or sets LogVerbosityOptions. /// - public string SendFileTo + public BindingList LogVerbosityOptions { get { - return this.sendFileTo; + return this.logVerbosityOptions; } set { - this.sendFileTo = value; - this.NotifyOfPropertyChange("SendFileTo"); + this.logVerbosityOptions = value; + this.NotifyOfPropertyChange("LogVerbosityOptions"); } } /// - /// Gets or sets a value indicating whether ShowCliWindow. + /// Gets or sets MinLength. /// - public bool ShowCliWindow + public long MinLength { get { - return this.showCliWindow; + return this.minLength; } set { - this.showCliWindow = value; - this.NotifyOfPropertyChange("ShowCliWindow"); + this.minLength = value; + this.NotifyOfPropertyChange("MinLength"); } } /// - /// Gets or sets SelectedLangauges. + /// Gets or sets a value indicating whether MinimiseToTray. /// - public BindingList SelectedLangauges + public bool MinimiseToTray { get { - return this.selectedLangauges; + return this.minimiseToTray; } + set { - this.selectedLangauges = value; - this.NotifyOfPropertyChange("SelectedLangauges"); + this.minimiseToTray = value; + this.NotifyOfPropertyChange("MinimiseToTray"); } } /// - /// Gets or sets VLCPath. + /// Gets or sets PreviewPicturesToScan. /// - public string VLCPath + public BindingList PreviewPicturesToScan { get { - return this.vlcPath; + return this.previewPicturesToScan; } set { - this.vlcPath = value; - this.NotifyOfPropertyChange("VLCPath"); + this.previewPicturesToScan = value; + this.NotifyOfPropertyChange("PreviewPicturesToScan"); } } /// - /// Gets or sets WhenDone. + /// Gets or sets SelectedPreviewCount. /// - public string WhenDone + public int SelectedPreviewCount { get { - return this.whenDone; + return this.selectedPreviewCount; } set { - this.whenDone = value; - this.NotifyOfPropertyChange("WhenDone"); + this.selectedPreviewCount = value; + this.NotifyOfPropertyChange("SelectedPreviewCount"); } } /// - /// Gets or sets WhenDoneOptions. + /// Gets or sets SelectedVerbosity. /// - public BindingList WhenDoneOptions + public int SelectedVerbosity { get { - return this.whenDoneOptions; + return this.selectedVerbosity; } set { - this.whenDoneOptions = value; - this.NotifyOfPropertyChange("WhenDoneOptions"); + this.selectedVerbosity = value; + this.NotifyOfPropertyChange("SelectedVerbosity"); } } + /// + /// Gets or sets a value indicating whether ShowCliWindow. + /// + public bool ShowCliWindow + { + get + { + return this.showCliWindow; + } + + set + { + this.showCliWindow = value; + this.NotifyOfPropertyChange("ShowCliWindow"); + } + } + #endregion + #endregion #region Public Methods @@ -1212,27 +1254,25 @@ namespace HandBrakeWPF.ViewModels this.growlAfterEncode = userSettingService.GetUserSetting(ASUserSettingConstants.GrowlEncode); this.growlAfterQueue = userSettingService.GetUserSetting(ASUserSettingConstants.GrowlQueue); - this.SendFileAfterEncode = this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFile); - this.sendFileTo = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFileTo)); - this.arguments = this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFileToArgs); + this.sendFileAfterEncode = this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFile); + this.sendFileTo = Path.GetFileNameWithoutExtension(this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFileTo)) ?? string.Empty; + this.sendFileToPath = this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFileTo) ?? string.Empty; + this.arguments = this.userSettingService.GetUserSetting(ASUserSettingConstants.SendFileToArgs) ?? string.Empty; // ############################# // Output Settings // ############################# // Enable auto naming feature.) - if (this.userSettingService.GetUserSetting(UserSettingConstants.AutoNaming)) - { - this.automaticallyNameFiles = true; - } + this.automaticallyNameFiles = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNaming); // Store the auto name path - this.autoNameDefaultPath = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNamePath); + this.autoNameDefaultPath = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNamePath) ?? string.Empty; if (string.IsNullOrEmpty(this.autoNameDefaultPath)) this.autoNameDefaultPath = "Click 'Browse' to set the default location"; // Store auto name format - this.autonameFormat = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNameFormat); + this.autonameFormat = this.userSettingService.GetUserSetting(UserSettingConstants.AutoNameFormat) ?? string.Empty; // Use iPod/iTunes friendly .m4v extension for MP4 files. this.mp4ExtensionOptions.Add("Automatic"); @@ -1251,7 +1291,7 @@ namespace HandBrakeWPF.ViewModels // ############################# // VLC Path - this.vlcPath = this.userSettingService.GetUserSetting(UserSettingConstants.VLC_Path); + this.vlcPath = this.userSettingService.GetUserSetting(UserSettingConstants.VLC_Path) ?? string.Empty; // ############################# // Audio and Subtitles Tab @@ -1279,7 +1319,7 @@ namespace HandBrakeWPF.ViewModels } } - this.selectedPreferredLangauge = this.userSettingService.GetUserSetting(UserSettingConstants.NativeLanguage); + this.selectedPreferredLangauge = this.userSettingService.GetUserSetting(UserSettingConstants.NativeLanguage) ?? string.Empty; this.AddAudioModeOptions.Add("None"); this.AddAudioModeOptions.Add("All Remaining Tracks"); @@ -1324,7 +1364,7 @@ namespace HandBrakeWPF.ViewModels this.copyLogToSepcficedLocation = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory); // The saved log path - this.logDirectory = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory); + this.logDirectory = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory) ?? string.Empty; this.clearOldOlgs = this.userSettingService.GetUserSetting(UserSettingConstants.ClearOldLogs); @@ -1360,8 +1400,6 @@ namespace HandBrakeWPF.ViewModels // Use Experimental dvdnav this.disableLibdvdNav = userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav); - - this.isLoading = false; } /// @@ -1369,9 +1407,181 @@ namespace HandBrakeWPF.ViewModels /// public void Close() { + this.Save(); this.TryClose(); } + /// + /// 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 LanguageMoveLeft() + { + // TODO + } + + /// + /// Audio List Move Right + /// + public void LanguageMoveRight() + { + // TODO + } + + /// + /// Audio List Clear all selected languages + /// + public void LanguageClearAll() + { + this.SelectedLangauges.Clear(); + } + + /// + /// Audio List Language Move UP + /// + public void LanguageMoveUp() + { + // TODO + } + + /// + /// Audio List Language Move Down + /// + public void LanguageMoveDown() + { + // TODO + } + + /// + /// 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 + + /// + /// Save the settings selected + /// + private void Save() + { + /* General */ + this.userSettingService.SetUserSetting(UserSettingConstants.UpdateStatus, this.CheckForUpdates); + this.userSettingService.SetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck, this.CheckForUpdatesFrequency); + this.userSettingService.SetUserSetting(UserSettingConstants.TooltipEnable, this.EnableGuiTooltips); + this.userSettingService.SetUserSetting(ASUserSettingConstants.WhenCompleteAction, this.WhenDone); + this.userSettingService.SetUserSetting(ASUserSettingConstants.GrowlQueue, this.GrowlAfterQueue); + this.userSettingService.SetUserSetting(ASUserSettingConstants.GrowlEncode, this.GrowlAfterEncode); + this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFileTo, this.SendFileToPath); + this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFile, this.SendFileAfterEncode); + this.userSettingService.SetUserSetting(ASUserSettingConstants.SendFileToArgs, this.Arguments); + + /* Output Files */ + this.userSettingService.SetUserSetting(UserSettingConstants.AutoNaming, this.AutomaticallyNameFiles); + this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameFormat, this.AutonameFormat); + this.userSettingService.SetUserSetting(UserSettingConstants.AutoNamePath, this.AutoNameDefaultPath); + this.userSettingService.SetUserSetting(UserSettingConstants.UseM4v, this.SelectedMp4Extension); + this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameRemoveUnderscore, this.RemoveUnderscores); + this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameTitleCase, this.ChangeToTitleCase); + + /* Previews */ + this.userSettingService.SetUserSetting(UserSettingConstants.VLC_Path, this.VLCPath); + + /* Audio and Subtitles */ + this.userSettingService.SetUserSetting(UserSettingConstants.NativeLanguage, this.SelectedPreferredLangauge); + StringCollection collection = new StringCollection(); + collection.AddRange(this.SelectedLangauges.ToArray()); + this.userSettingService.SetUserSetting(UserSettingConstants.SelectedLanguages, collection); + this.userSettingService.SetUserSetting(UserSettingConstants.AddOnlyOneAudioPerLanguage, this.AddOnlyOneAudioTrackPerLanguage); + this.userSettingService.SetUserSetting(UserSettingConstants.UseClosedCaption, this.AddClosedCaptions); + this.userSettingService.SetUserSetting(UserSettingConstants.DubModeAudio, this.SelectedAddAudioMode); + this.userSettingService.SetUserSetting(UserSettingConstants.DubModeSubtitle, this.SelectedAddSubtitleMode); + + /* System and Logging */ + userSettingService.SetUserSetting(ASUserSettingConstants.ProcessPriority, this.SelectedPriority); + userSettingService.SetUserSetting(ASUserSettingConstants.PreventSleep, this.PreventSleep); + userSettingService.SetUserSetting(ASUserSettingConstants.Verbosity, this.SelectedVerbosity); + userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogWithVideo, this.CopyLogToEncodeDirectory); + userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory, this.CopyLogToSepcficedLocation); + userSettingService.SetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory, this.LogDirectory); + userSettingService.SetUserSetting(UserSettingConstants.ClearOldLogs, this.ClearOldOlgs); + + /* Advanced */ + userSettingService.SetUserSetting(UserSettingConstants.MainWindowMinimize, this.MinimiseToTray); + userSettingService.SetUserSetting(UserSettingConstants.TrayIconAlerts, this.DisplayStatusMessagesTrayIcon); + userSettingService.SetUserSetting(UserSettingConstants.QueryEditorTab, this.EnableQueryEditor); + userSettingService.SetUserSetting(UserSettingConstants.PromptOnUnmatchingQueries, this.PromptOnDifferentQuery); + userSettingService.SetUserSetting(UserSettingConstants.PresetNotification, this.DisablePresetUpdateCheckNotification); + userSettingService.SetUserSetting(ASUserSettingConstants.ShowCLI, this.ShowCliWindow); + userSettingService.SetUserSetting(UserSettingConstants.PreviewScanCount, this.SelectedPreviewCount); + userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, double.Parse(this.SelectedGranulairty)); + + int value; + if (int.TryParse(this.MinLength.ToString(), out value)) + { + this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value); + } + + userSettingService.SetUserSetting(ASUserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav); + } } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml b/win/CS/HandBrakeWPF/Views/LogView.xaml new file mode 100644 index 000000000..ee6656788 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml.cs b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs new file mode 100644 index 000000000..375cbed43 --- /dev/null +++ b/win/CS/HandBrakeWPF/Views/LogView.xaml.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace HandBrakeWPF.Views +{ + /// + /// Interaction logic for LogView.xaml + /// + public partial class LogView : Window + { + public LogView() + { + InitializeComponent(); + } + } +} diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index cdb63a7df..6b0e9ca66 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -4,6 +4,16 @@ xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" xmlns:Controls="clr-namespace:HandBrakeWPF.Views.Controls" Title="{Data:Binding Path=WindowTitle}" Height="655" Width="1015" FontSize="11"> + + + + diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 1a4c50ef7..8f3d155bd 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -1,37 +1,30 @@  + Title="OptionsView" MinWidth="620" MinHeight="550" Width="620" Height="550"> - - - - + + - - + @@ -42,7 +35,7 @@ - + @@ -55,7 +48,7 @@ - + @@ -73,18 +66,18 @@ - + - - - - - - + + + - - + + +