diff options
Diffstat (limited to 'win/CS/Controls')
-rw-r--r-- | win/CS/Controls/AdvancedEncoderOpts.cs | 13 | ||||
-rw-r--r-- | win/CS/Controls/AudioPanel.cs | 19 | ||||
-rw-r--r-- | win/CS/Controls/Subtitles.cs | 20 | ||||
-rw-r--r-- | win/CS/Controls/x264Panel.cs | 10 |
4 files changed, 48 insertions, 14 deletions
diff --git a/win/CS/Controls/AdvancedEncoderOpts.cs b/win/CS/Controls/AdvancedEncoderOpts.cs index 8eb2e8ae7..b3f42913a 100644 --- a/win/CS/Controls/AdvancedEncoderOpts.cs +++ b/win/CS/Controls/AdvancedEncoderOpts.cs @@ -7,19 +7,27 @@ namespace Handbrake.Controls {
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
/// <summary>
/// The x264 Panel
/// </summary>
public partial class AdvancedEncoderOpts : UserControl
{
/// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
+ /// <summary>
/// Initializes a new instance of the <see cref="AdvancedEncoderOpts"/> class.
/// </summary>
public AdvancedEncoderOpts()
{
InitializeComponent();
- if (Properties.Settings.Default.tooltipEnable)
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
ToolTip.Active = true;
}
@@ -39,6 +47,9 @@ namespace Handbrake.Controls }
}
+ /// <summary>
+ /// Sets a value indicating whether IsDisabled.
+ /// </summary>
public bool IsDisabled
{
set
diff --git a/win/CS/Controls/AudioPanel.cs b/win/CS/Controls/AudioPanel.cs index 0d7c1db77..6bfef3cca 100644 --- a/win/CS/Controls/AudioPanel.cs +++ b/win/CS/Controls/AudioPanel.cs @@ -9,15 +9,18 @@ namespace Handbrake.Controls using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+ using System.Collections.Specialized;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
+ using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
using Handbrake.ToolWindows;
@@ -31,6 +34,10 @@ namespace Handbrake.Controls private readonly BindingList<AudioTrack> audioTracks = new BindingList<AudioTrack>();
private const string Passthru = "Passthru";
private AdvancedAudio advancedAudio = new AdvancedAudio();
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
#endregion
#region Constructor and Events
@@ -437,7 +444,7 @@ namespace Handbrake.Controls continue;
}
- if (Properties.Settings.Default.addOnlyOneAudioPerLanguage && currentTrack.TrackDisplay.Contains(sourceTrack.Language))
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.AddOnlyOneAudioPerLanguage) && currentTrack.TrackDisplay.Contains(sourceTrack.Language))
{
foundTrack = true;
continue;
@@ -586,7 +593,7 @@ namespace Handbrake.Controls }
// Handle Preferred Language
- if (Properties.Settings.Default.NativeLanguage == "Any")
+ if (this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
{
drp_audioTrack.SelectedIndex = 0;
foreach (AudioTrack track in this.audioTracks)
@@ -603,7 +610,7 @@ namespace Handbrake.Controls {
foreach (Audio item in drp_audioTrack.Items)
{
- if (item.Language.Contains(Properties.Settings.Default.NativeLanguage))
+ if (item.Language.Contains(this.UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage)))
{
drp_audioTrack.SelectedItem = item;
break;
@@ -624,11 +631,11 @@ namespace Handbrake.Controls Dictionary<String, ArrayList> languageIndex = new Dictionary<String, ArrayList>();
// Now add any additional Langauges tracks on top of the presets tracks.
- int mode = Properties.Settings.Default.DubModeAudio;
+ int mode = this.UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeAudio);
ArrayList languageOrder = new ArrayList(); // This is used to keep the Prefered Language in the front and the other languages in order. TODO this is no longer required, refactor this.
if (mode > 0)
{
- foreach (string item in Properties.Settings.Default.SelectedLanguages)
+ foreach (string item in this.UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
if (!languageIndex.ContainsKey(item))
{
@@ -646,7 +653,7 @@ namespace Handbrake.Controls if (item.ToString().Contains(kvp.Key))
{
// Only the first Element if the "Only One Audio"-option is chosen.
- if (!Properties.Settings.Default.addOnlyOneAudioPerLanguage || kvp.Value.Count == 0)
+ if (!this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.AddOnlyOneAudioPerLanguage) || kvp.Value.Count == 0)
{
kvp.Value.Add(i);
}
diff --git a/win/CS/Controls/Subtitles.cs b/win/CS/Controls/Subtitles.cs index 578eda4dc..35b05aa26 100644 --- a/win/CS/Controls/Subtitles.cs +++ b/win/CS/Controls/Subtitles.cs @@ -8,11 +8,14 @@ namespace Handbrake.Controls using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
/// <summary>
@@ -37,6 +40,11 @@ namespace Handbrake.Controls /// </summary>
private readonly List<SubtitleTrack> subList = new List<SubtitleTrack>();
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
#endregion
/// <summary>
@@ -207,18 +215,18 @@ namespace Handbrake.Controls ArrayList languageOrder = new ArrayList();
// New DUB Settings
- int mode = Properties.Settings.Default.DubModeSubtitle;
+ int mode = UserSettingService.GetUserSetting<int>(UserSettingConstants.DubModeSubtitle);
- if (Properties.Settings.Default.NativeLanguage == "Any")
+ if (UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage) == "Any")
mode = 0;
// Native Language is not 'Any', so initialising the Language Dictionary
if (mode >= 3)
{
- languageIndex.Add(Properties.Settings.Default.NativeLanguage, new ArrayList());
- languageOrder.Add(Properties.Settings.Default.NativeLanguage);
+ languageIndex.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage), new ArrayList());
+ languageOrder.Add(UserSettingService.GetUserSetting<string>(UserSettingConstants.NativeLanguage));
- foreach (string item in Properties.Settings.Default.SelectedLanguages)
+ foreach (string item in UserSettingService.GetUserSetting<StringCollection>(UserSettingConstants.SelectedLanguages))
{
if (!languageIndex.ContainsKey(item))
{
@@ -299,7 +307,7 @@ namespace Handbrake.Controls drp_subtitleTracks.SelectedIndex = 0;
// Add Closed Captions if the user has the option enabled.
- if (Properties.Settings.Default.useClosedCaption)
+ if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.UseClosedCaption))
{
foreach (object item in drp_subtitleTracks.Items)
{
diff --git a/win/CS/Controls/x264Panel.cs b/win/CS/Controls/x264Panel.cs index 829e1cf5c..c7625d720 100644 --- a/win/CS/Controls/x264Panel.cs +++ b/win/CS/Controls/x264Panel.cs @@ -9,6 +9,9 @@ namespace Handbrake.Controls using System.Globalization;
using System.Windows.Forms;
+ using HandBrake.ApplicationServices;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
/// <summary>
/// The x264 Panel
/// </summary>
@@ -19,6 +22,11 @@ namespace Handbrake.Controls * at some point.
*/
+ /// <summary>
+ /// The User Setting Service.
+ /// </summary>
+ private readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+
private CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
/// <summary>
@@ -29,7 +37,7 @@ namespace Handbrake.Controls {
InitializeComponent();
- if (Properties.Settings.Default.tooltipEnable)
+ if (this.UserSettingService.GetUserSetting<bool>(UserSettingConstants.TooltipEnable))
ToolTip.Active = true;
Reset2Defaults();
|