diff options
author | sr55 <[email protected]> | 2013-01-13 17:51:42 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-01-13 17:51:42 +0000 |
commit | f3fcc49085f080ad5f075da4a87bbaff47f92572 (patch) | |
tree | 2b483848c6111e73958d4f69af03e790a8abadc3 /win/CS/HandBrakeWPF/Converters | |
parent | b62992bfb1623ae6c0930c41e00c2b150ea780d9 (diff) |
WinGui: Options screen refactoring.
Help -> Check for updates now takes the user to the options screen update tab.
Help -> About now takes the user to the options screen about tab. Saves popping up annoying window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5169 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Converters')
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs | 27 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs | 71 |
2 files changed, 87 insertions, 11 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs index 9c561e549..128596f3f 100644 --- a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabConverter.cs @@ -15,6 +15,8 @@ namespace HandBrakeWPF.Converters.Options using System.Windows;
using System.Windows.Data;
+ using HandBrakeWPF.Model;
+
/// <summary>
/// The Options Tab Converter. Controls which tab is dispalyed.
/// </summary>
@@ -31,22 +33,25 @@ namespace HandBrakeWPF.Converters.Options {
if (value != null && parameter != null)
{
- switch (value.ToString())
+ switch ((OptionsTab)value)
{
- case "General":
- if (parameter.ToString() == "General") return Visibility.Visible;
+ case OptionsTab.General:
+ if ((OptionsTab)parameter == OptionsTab.General) return Visibility.Visible;
+ break;
+ case OptionsTab.OutputFiles:
+ if ((OptionsTab)parameter == OptionsTab.OutputFiles) return Visibility.Visible;
break;
- case "Output Files":
- if (parameter.ToString() == "Output Files") return Visibility.Visible;
+ case OptionsTab.AudioAndSubtitles:
+ if ((OptionsTab)parameter == OptionsTab.AudioAndSubtitles) return Visibility.Visible;
break;
- case "Audio and Subtitles":
- if (parameter.ToString() == "Audio and Subtitles") return Visibility.Visible;
+ case OptionsTab.Advanced:
+ if ((OptionsTab)parameter == OptionsTab.Advanced) return Visibility.Visible;
break;
- case "Advanced":
- if (parameter.ToString() == "Advanced") return Visibility.Visible;
+ case OptionsTab.Updates:
+ if ((OptionsTab)parameter == OptionsTab.Updates) return Visibility.Visible;
break;
- case "Updates":
- if (parameter.ToString() == "Updates") return Visibility.Visible;
+ case OptionsTab.About:
+ if ((OptionsTab)parameter == OptionsTab.About) return Visibility.Visible;
break;
}
}
diff --git a/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs new file mode 100644 index 000000000..beddd18be --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Options/OptionsTabNameConverter.cs @@ -0,0 +1,71 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="OptionsTabNameConverter.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// A Converter to get the Display Name of each options tab.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Options
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ using HandBrake.ApplicationServices.Utilities;
+
+ using HandBrakeWPF.Model;
+
+ /// <summary>
+ /// A Converter to get the Display Name of each options tab.
+ /// </summary>
+ public class OptionsTabNameConverter : IValueConverter
+ {
+ /// <summary>
+ /// The convert.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return EnumHelper<OptionsTab>.GetDisplay((OptionsTab)value);
+ }
+
+ /// <summary>
+ /// The convert back.
+ /// </summary>
+ /// <param name="value">
+ /// The value.
+ /// </param>
+ /// <param name="targetType">
+ /// The target type.
+ /// </param>
+ /// <param name="parameter">
+ /// The parameter.
+ /// </param>
+ /// <param name="culture">
+ /// The culture.
+ /// </param>
+ /// <returns>
+ /// The <see cref="object"/>.
+ /// </returns>
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return EnumHelper<OptionsTab>.GetValue(value.ToString());
+ }
+ }
+}
\ No newline at end of file |