From 9be558d961413ee242da53dfc18a7c819b0faf41 Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 14 Jun 2012 09:46:46 +0000 Subject: WinGui: Initial layout changes to the options screen. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4729 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Converters/Options/OptionsTabConverter.cs | 66 ++++++ win/CS/HandBrakeWPF/HandBrakeWPF.csproj | 1 + win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 38 ++++ win/CS/HandBrakeWPF/Views/OptionsView.xaml | 244 ++++++++++++--------- 4 files changed, 242 insertions(+), 107 deletions(-) create mode 100644 win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs (limited to 'win/CS') diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs new file mode 100644 index 000000000..5799425d9 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs @@ -0,0 +1,66 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The Options Tab Converter. Controls which tab is dispalyed. +// +// -------------------------------------------------------------------------------------------------------------------- + + +namespace HandBrakeWPF.Converters.Options +{ + using System; + using System.Globalization; + using System.Windows; + using System.Windows.Data; + + /// + /// The Options Tab Converter. Controls which tab is dispalyed. + /// + class OptionsTabConverter : IValueConverter + { + /// + /// Converts a value. + /// + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// The value produced by the binding source.The type of the binding target property.The converter parameter to use.The culture to use in the converter. + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null && parameter != null) + { + switch (value.ToString()) + { + case "General": + if (parameter.ToString() == "General") return Visibility.Visible; + break; + case "Output Files": + if (parameter.ToString() == "Output Files") return Visibility.Visible; + break; + case "Language": + if (parameter.ToString() == "Language") return Visibility.Visible; + break; + case "Advanced": + if (parameter.ToString() == "Advanced") return Visibility.Visible; + break; + } + } + + return Visibility.Collapsed; + } + + /// + /// Converts a value. + /// + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// The value that is produced by the binding target.The type to convert to.The converter parameter to use.The culture to use in the converter. + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index bb6511e7f..1ab37f13e 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -120,6 +120,7 @@ + diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 706009107..ff402a9ed 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -310,6 +310,11 @@ namespace HandBrakeWPF.ViewModels /// private bool clearQueueOnEncodeCompleted; + /// + /// The options tab that is selected. + /// + private string selectedTab; + #endregion #region Constructors and Destructors @@ -332,8 +337,41 @@ namespace HandBrakeWPF.ViewModels this.userSettingService = userSettingService; this.shellViewModel = shellViewModel; this.OnLoad(); + + this.SelectedTab = "General"; + } + + #endregion + + #region Window Properties + + /// + /// Gets OptionTabs. + /// + public IEnumerable OptionTabs + { + get + { + return new List { "General", "Output Files", "Language", "Advanced" }; + } } + /// + /// Gets or sets SelectedTab. + /// + public string SelectedTab + { + get + { + return this.selectedTab; + } + + set + { + this.selectedTab = value; + this.NotifyOfPropertyChange(() => this.SelectedTab); + } + } #endregion #region Properties diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml index 80a97754f..6fd6b5524 100644 --- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml +++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml @@ -1,7 +1,8 @@  + xmlns:Helpers="clr-namespace:HandBrakeWPF.Helpers" + xmlns:Options="clr-namespace:HandBrakeWPF.Converters.Options" Background="White"> - - + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + @@ -88,11 +115,35 @@ + + + + + + + + + + + + + + +