From b1f4095b832276c031162d3f68ce8dfdeedc92ae Mon Sep 17 00:00:00 2001 From: sr55 Date: Fri, 28 Oct 2011 20:39:16 +0000 Subject: WinGui: (WPF) Options window bindings are now in place. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4326 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 187 +++++++++------------ 1 file changed, 84 insertions(+), 103 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs') diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index be2ed51e8..f27d71b59 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -235,12 +235,12 @@ namespace HandBrakeWPF.ViewModels /// /// The selected preferred languages. /// - private BindingList selectedPreferredLanguages = new BindingList(); + private BindingList preferredLanguages = new BindingList(); /// /// The selected preferreed langauge. /// - private string selectedPreferreedLangauge; + private string selectedPreferredLangauge; /// /// The selected preview count. @@ -287,6 +287,11 @@ namespace HandBrakeWPF.ViewModels /// private BindingList whenDoneOptions = new BindingList(); + /// + /// Selected Langauges + /// + private BindingList selectedLangauges = new BindingList(); + #endregion #region Constructors and Destructors @@ -958,35 +963,35 @@ namespace HandBrakeWPF.ViewModels } /// - /// Gets or sets SelectedPreferredLanguages. + /// Gets or sets preferredLanguages. /// - public BindingList SelectedPreferredLanguages + public BindingList PreferredLanguages { get { - return this.selectedPreferredLanguages; + return this.preferredLanguages; } set { - this.selectedPreferredLanguages = value; - this.NotifyOfPropertyChange("SelectedPreferredLanguages"); + this.preferredLanguages = value; + this.NotifyOfPropertyChange("preferredLanguages"); } } /// /// Gets or sets SelectedPreferreedLangauge. /// - public string SelectedPreferreedLangauge + public string SelectedPreferredLangauge { get { - return this.selectedPreferreedLangauge; + return this.selectedPreferredLangauge; } set { - this.selectedPreferreedLangauge = value; + this.selectedPreferredLangauge = value; this.NotifyOfPropertyChange("SelectedPreferreedLangauge"); } } @@ -1093,6 +1098,22 @@ namespace HandBrakeWPF.ViewModels } } + /// + /// Gets or sets SelectedLangauges. + /// + public BindingList SelectedLangauges + { + get + { + return this.selectedLangauges; + } + set + { + this.selectedLangauges = value; + this.NotifyOfPropertyChange("SelectedLangauges"); + } + } + /// /// Gets or sets VLCPath. /// @@ -1153,51 +1174,31 @@ namespace HandBrakeWPF.ViewModels /// public void Load() { - // ############################# - // Screen Setup - // ############################# - - IDictionary langList = LanguageUtilities.MapLanguages(); - - foreach (string selectedItem in this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages)) - { - // removing wrong keys when a new Language list comes out. - if (langList.ContainsKey(selectedItem)) - { - this.selectedPreferredLanguages.Add(selectedItem); - } - } - - foreach (string item in langList.Keys) - { - this.selectedPreferredLanguages.Add(item); - - // In the available languages should be no "Any" and no selected language. - if ((item != "Any") && (!this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages).Contains(item))) - { - this.availableLanguages.Add(item); - } - } - // ############################# // General // ############################# - // Enable Tooltips. - if (this.userSettingService.GetUserSetting(UserSettingConstants.TooltipEnable)) - { - this.enableGuiTooltips = true; - } + this.enableGuiTooltips = this.userSettingService.GetUserSetting(UserSettingConstants.TooltipEnable); + this.checkForUpdates = this.userSettingService.GetUserSetting(UserSettingConstants.UpdateStatus); + + // Days between update checks + this.checkForUpdatesFrequencies.Add("Daily"); + this.checkForUpdatesFrequencies.Add("Weekly"); + this.checkForUpdatesFrequencies.Add("Monthly"); - // Update Check - if (this.userSettingService.GetUserSetting(UserSettingConstants.UpdateStatus)) + // TODO Refactor this. + switch (this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck)) { - this.checkForUpdates = true; + case 1: + this.checkForUpdatesFrequency = 1; + break; + case 7: + this.checkForUpdatesFrequency = 2; + break; + case 30: + this.checkForUpdatesFrequency = 3; + break; } - - // Days between update checks - this.checkForUpdatesFrequency = - this.userSettingService.GetUserSetting(UserSettingConstants.DaysBetweenUpdateCheck); // On Encode Completeion Action this.whenDoneOptions.Add("Do nothing"); @@ -1208,18 +1209,9 @@ namespace HandBrakeWPF.ViewModels this.whenDoneOptions.Add("Log off"); this.whenDoneOptions.Add("Quit HandBrake"); this.whenDone = userSettingService.GetUserSetting("WhenCompleteAction"); - - // Growl. - if (userSettingService.GetUserSetting(ASUserSettingConstants.GrowlEncode)) - { - this.growlAfterEncode = true; - } - - if (userSettingService.GetUserSetting(ASUserSettingConstants.GrowlQueue)) - { - this.growlAfterQueue = true; - } + 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); @@ -1231,7 +1223,7 @@ namespace HandBrakeWPF.ViewModels // Enable auto naming feature.) if (this.userSettingService.GetUserSetting(UserSettingConstants.AutoNaming)) { - this.AutomaticallyNameFiles = true; + this.automaticallyNameFiles = true; } // Store the auto name path @@ -1265,7 +1257,29 @@ namespace HandBrakeWPF.ViewModels // Audio and Subtitles Tab // ############################# - this.selectedPreferreedLangauge = this.userSettingService.GetUserSetting(UserSettingConstants.NativeLanguage); + IDictionary langList = LanguageUtilities.MapLanguages(); + + foreach (string selectedItem in this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages)) + { + // removing wrong keys when a new Language list comes out. + if (langList.ContainsKey(selectedItem)) + { + this.selectedLangauges.Add(selectedItem); + } + } + + foreach (string item in langList.Keys) + { + this.preferredLanguages.Add(item); + + // In the available languages should be no "Any" and no selected language. + if ((item != "Any") && (!this.userSettingService.GetUserSetting(UserSettingConstants.SelectedLanguages).Contains(item))) + { + this.availableLanguages.Add(item); + } + } + + this.selectedPreferredLangauge = this.userSettingService.GetUserSetting(UserSettingConstants.NativeLanguage); this.AddAudioModeOptions.Add("None"); this.AddAudioModeOptions.Add("All Remaining Tracks"); @@ -1305,17 +1319,9 @@ namespace HandBrakeWPF.ViewModels this.logVerbosityOptions.Add(2); this.selectedVerbosity = userSettingService.GetUserSetting(ASUserSettingConstants.Verbosity); - // Save logs in the same directory as encoded files - if (userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogWithVideo)) - { - this.copyLogToEncodeDirectory = true; - } - - // Save Logs in a specified path - if (userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory)) - { - this.copyLogToSepcficedLocation = true; - } + // Logs + this.copyLogToEncodeDirectory = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogWithVideo); + this.copyLogToSepcficedLocation = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogToCopyDirectory); // The saved log path this.logDirectory = userSettingService.GetUserSetting(ASUserSettingConstants.SaveLogCopyDirectory); @@ -1327,33 +1333,11 @@ namespace HandBrakeWPF.ViewModels // ############################# // Minimise to Tray - if (this.userSettingService.GetUserSetting(UserSettingConstants.TrayIconAlerts)) - { - this.DisplayStatusMessagesTrayIcon = true; - } - - // Tray Balloon popups - if (this.userSettingService.GetUserSetting(UserSettingConstants.MainWindowMinimize)) - { - this.minimiseToTray = true; - } - - // Enable / Disable Query editor tab - if (this.userSettingService.GetUserSetting(UserSettingConstants.QueryEditorTab)) - { - this.enableQueryEditor = true; - } - - // Prompt on inconsistant queries + this.displayStatusMessagesTrayIcon = this.userSettingService.GetUserSetting(UserSettingConstants.TrayIconAlerts); + this.minimiseToTray = this.userSettingService.GetUserSetting(UserSettingConstants.MainWindowMinimize); + this.enableQueryEditor = this.userSettingService.GetUserSetting(UserSettingConstants.QueryEditorTab); this.promptOnDifferentQuery = this.userSettingService.GetUserSetting(UserSettingConstants.PromptOnUnmatchingQueries); - - // Preset update notification - if (this.userSettingService.GetUserSetting(UserSettingConstants.PresetNotification)) - { - this.disablePresetUpdateCheckNotification = true; - } - - // Show CLI Window + this.disablePresetUpdateCheckNotification = this.userSettingService.GetUserSetting(UserSettingConstants.PresetNotification); this.showCliWindow = userSettingService.GetUserSetting(ASUserSettingConstants.ShowCLI); // Set the preview count @@ -1369,16 +1353,13 @@ namespace HandBrakeWPF.ViewModels this.ConstantQualityGranularity.Add("0.50"); this.ConstantQualityGranularity.Add("0.25"); this.ConstantQualityGranularity.Add("0.20"); - this.SelectedGranulairty = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString(new CultureInfo("en-US")); + this.selectedGranulairty = userSettingService.GetUserSetting(ASUserSettingConstants.X264Step).ToString("0.00", new CultureInfo("en-US")); // Min Title Length this.minLength = this.userSettingService.GetUserSetting(ASUserSettingConstants.MinScanDuration); // Use Experimental dvdnav - if (userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav)) - { - this.disableLibdvdNav = true; - } + this.disableLibdvdNav = userSettingService.GetUserSetting(ASUserSettingConstants.DisableLibDvdNav); this.isLoading = false; } -- cgit v1.2.3