summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-11-19 22:41:36 +0000
committersr55 <[email protected]>2013-11-19 22:41:36 +0000
commitf0dbe6e2a2af173e60a20da86c78692757e69112 (patch)
tree5c7e67c77449b3839654e2d34e1105faec5ed114 /win/CS/HandBrakeWPF
parent830bb18b173a1c68720eb0df2ed860daea7d4c7e (diff)
WinGui: Finish off moving the User Settings service to the UI Layer.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5898 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs2
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs2
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj2
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs4
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs71
-rw-r--r--win/CS/HandBrakeWPF/Services/UpdateService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs227
-rw-r--r--win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs1
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs9
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs7
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs95
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs1
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml.cs1
22 files changed, 383 insertions, 57 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs
index eecb25890..2dd2e82d8 100644
--- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs
@@ -23,6 +23,8 @@ namespace HandBrakeWPF.Converters.Video
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Services.Interfaces;
+
/// <summary>
/// Video Encoder Converter
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
index 86f061eca..8be9bcd41 100644
--- a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
+++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
@@ -14,6 +14,8 @@ namespace HandBrakeWPF.Factories
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Services.Interfaces;
+
/// <summary>
/// HBConfiguration Factory
/// </summary>
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index d6eb10641..5e8ab59c2 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -141,6 +141,8 @@
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
<Compile Include="Factories\HBConfigurationFactory.cs" />
+ <Compile Include="Services\Interfaces\IUserSettingService.cs" />
+ <Compile Include="Services\UserSettingService.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />
<Compile Include="Views\CountdownAlertView.xaml.cs">
diff --git a/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs
index 9b67f97e2..556cf53b4 100644
--- a/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AppStyleHelper.cs
@@ -15,6 +15,8 @@ namespace HandBrakeWPF.Helpers
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Services.Interfaces;
+
/// <summary>
/// The AppStyle Helper.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index 8c4032466..e9e4d0278 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -21,6 +21,8 @@ namespace HandBrakeWPF.Helpers
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Services.Interfaces;
+
/// <summary>
/// The Destination AutoName Helper
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
index 0060b1d15..ede46fa8b 100644
--- a/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/CliCheckHelper.cs
@@ -85,7 +85,7 @@ namespace HandBrakeWPF.Helpers
int buildValue;
int.TryParse(build, out buildValue);
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, buildValue);
+ userSettingService.SetUserSetting(UserSettingConstants.HandBrakeBuild, buildValue);
success = true;
}
}
@@ -109,7 +109,7 @@ namespace HandBrakeWPF.Helpers
}
catch (Exception e)
{
- userSettingService.SetUserSetting(ASUserSettingConstants.HandBrakeBuild, 0);
+ userSettingService.SetUserSetting(UserSettingConstants.HandBrakeBuild, 0);
userSettingService.SetUserSetting(UserSettingConstants.HandBrakeExeHash, string.Empty);
errorService.ShowError(
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index 254ccefb9..b8d715ede 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -19,6 +19,8 @@ namespace HandBrakeWPF.Services
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Services.Interfaces;
+
using EncodeCompletedEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs;
using EncodeProgressEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs;
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
new file mode 100644
index 000000000..d2f433bc1
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
@@ -0,0 +1,71 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IUserSettingService.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>
+// The User Setting Service Interace.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services.Interfaces
+{
+ using HandBrake.ApplicationServices.EventArgs;
+
+ /// <summary>
+ /// The setting event handler.
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ public delegate void SettingEventHandler(object sender, SettingChangedEventArgs e);
+
+ /// <summary>
+ /// The User Setting Service Interace.
+ /// </summary>
+ public interface IUserSettingService
+ {
+ /// <summary>
+ /// The setting changed.
+ /// </summary>
+ event SettingEventHandler SettingChanged;
+
+ /// <summary>
+ /// Set the specified user setting.
+ /// </summary>
+ /// <param name="name">
+ /// Name of the property
+ /// </param>
+ /// <param name="value">
+ /// The value to store.
+ /// </param>
+ void SetUserSetting(string name, object value);
+
+ /// <summary>
+ /// Get user setting for a given key.
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ /// <typeparam name="T">
+ /// The Type of the setting
+ /// </typeparam>
+ /// <returns>
+ /// The user setting
+ /// </returns>
+ T GetUserSetting<T>(string name);
+
+ /// <summary>
+ /// Get an StringCollection type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ System.Collections.Specialized.StringCollection GetUserSettingStringCollection(string name);
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs
index b95a1d862..41135743b 100644
--- a/win/CS/HandBrakeWPF/Services/UpdateService.cs
+++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs
@@ -92,7 +92,7 @@ namespace HandBrakeWPF.Services
: Constants.Appcast32;
var currentBuild =
- this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild);
+ this.userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild);
var skipBuild = this.userSettingService.GetUserSetting<int>(
UserSettingConstants.Skipversion);
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
new file mode 100644
index 000000000..6b7df3d85
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
@@ -0,0 +1,227 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="UserSettingService.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>
+// The User Setting Serivce
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using System;
+ using System.Collections.Specialized;
+ using System.IO;
+ using System.Linq;
+ using System.Reflection;
+ using System.Xml.Serialization;
+
+ using HandBrake.ApplicationServices.Collections;
+ using HandBrake.ApplicationServices.EventArgs;
+ using HandBrake.ApplicationServices.Exceptions;
+
+ using HandBrakeWPF.Services.Interfaces;
+
+ /// <summary>
+ /// The User Setting Serivce
+ /// </summary>
+ public class UserSettingService : IUserSettingService
+ {
+ /// <summary>
+ /// The Settings File
+ /// </summary>
+ private readonly string settingsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\settings.xml";
+
+ /// <summary>
+ /// The XML Serializer
+ /// </summary>
+ readonly XmlSerializer serializer = new XmlSerializer(typeof(SerializableDictionary<string, object>));
+
+ /// <summary>
+ /// The User Settings
+ /// </summary>
+ private SerializableDictionary<string, object> userSettings;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="UserSettingService"/> class.
+ /// </summary>
+ public UserSettingService()
+ {
+ this.Load();
+ }
+
+ /// <summary>
+ /// The setting changed.
+ /// </summary>
+ public event SettingEventHandler SettingChanged;
+
+ /// <summary>
+ /// Set the specified user setting.
+ /// </summary>
+ /// <param name="name">
+ /// Name of the property
+ /// </param>
+ /// <param name="value">
+ /// The value to store.
+ /// </param>
+ public void SetUserSetting(string name, object value)
+ {
+ this.userSettings[name] = value;
+ this.Save();
+
+ this.OnSettingChanged(new SettingChangedEventArgs { Key = name, Value = value });
+ }
+
+ /// <summary>
+ /// Get user setting for a given key.
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ /// <typeparam name="T">
+ /// The Type of the setting
+ /// </typeparam>
+ /// <returns>
+ /// The user setting
+ /// </returns>
+ public T GetUserSetting<T>(string name)
+ {
+ if (this.userSettings.ContainsKey(name))
+ {
+ return (T)this.userSettings[name];
+ }
+
+ return default(T);
+ }
+
+ /// <summary>
+ /// Get an StringCollection type user setting
+ /// </summary>
+ /// <param name="name">
+ /// The setting name
+ /// </param>
+ /// <returns>
+ /// The settings value
+ /// </returns>
+ public StringCollection GetUserSettingStringCollection(string name)
+ {
+ return (StringCollection)this.userSettings[name];
+ }
+
+ /// <summary>
+ /// The on setting changed.
+ /// </summary>
+ /// <param name="e">
+ /// The e.
+ /// </param>
+ protected virtual void OnSettingChanged(SettingChangedEventArgs e)
+ {
+ SettingEventHandler handler = this.SettingChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Save the User Settings
+ /// </summary>
+ private void Save()
+ {
+ try
+ {
+ string directory = Path.GetDirectoryName(this.settingsFile);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+
+ using (FileStream strm = new FileStream(this.settingsFile, FileMode.Create, FileAccess.Write))
+ {
+ this.serializer.Serialize(strm, this.userSettings);
+ }
+ }
+ catch (Exception exc)
+ {
+ throw new GeneralApplicationException(
+ "A problem occured when trying to save your preferences.",
+ "Any settings you changed may need to be reset the next time HandBrake launches.",
+ exc);
+ }
+ }
+
+ /// <summary>
+ /// Load the User Settings
+ /// </summary>
+ private void Load()
+ {
+ try
+ {
+ // Load up the users current settings file.
+ if (File.Exists(this.settingsFile))
+ {
+ using (StreamReader reader = new StreamReader(this.settingsFile))
+ {
+ SerializableDictionary<string, object> data = (SerializableDictionary<string, object>)this.serializer.Deserialize(reader);
+ this.userSettings = data;
+ }
+ }
+ else
+ {
+ this.userSettings = new SerializableDictionary<string, object>();
+ }
+
+ // Add any missing / new settings
+ SerializableDictionary<string, object> defaults = this.GetDefaults();
+ foreach (var item in defaults.Where(item => !this.userSettings.Keys.Contains(item.Key)))
+ {
+ this.userSettings.Add(item.Key, item.Value);
+ this.Save();
+ }
+ }
+ catch (Exception exc)
+ {
+ try
+ {
+ this.userSettings = this.GetDefaults();
+ if (File.Exists(this.settingsFile))
+ {
+ File.Delete(this.settingsFile);
+ }
+ this.Save();
+
+ throw new GeneralApplicationException("Warning, your settings have been reset!", "Your user settings file was corrupted or inaccessible. Settings have been reset to defaults.", exc);
+ }
+ catch (Exception)
+ {
+ throw new GeneralApplicationException("Unable to load user settings file: " + this.settingsFile, "Your user settings file appears to be inaccessible or corrupted. You may have to delete the file and let HandBrake generate a new one.", exc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Load Default Settings
+ /// </summary>
+ /// <returns>
+ /// The get defaults.
+ /// </returns>
+ private SerializableDictionary<string, object> GetDefaults()
+ {
+ try
+ {
+ Assembly assembly = Assembly.GetEntryAssembly();
+ Stream stream = assembly.GetManifestResourceStream("HandBrakeWPF.defaultsettings.xml");
+ if (stream != null)
+ {
+ return (SerializableDictionary<string, object>)this.serializer.Deserialize(stream);
+ }
+ }
+ catch (Exception exc)
+ {
+ return new SerializableDictionary<string, object>();
+ }
+
+ return new SerializableDictionary<string, object>();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
index 34f58c862..45dbde20d 100644
--- a/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
+++ b/win/CS/HandBrakeWPF/Startup/CastleBootstrapper.cs
@@ -62,6 +62,7 @@ namespace HandBrakeWPF.Startup
this.windsorContainer.Register(Component.For<IEncodeServiceWrapper>().ImplementedBy<EncodeServiceWrapper>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<INotificationService>().ImplementedBy<NotificationService>().LifeStyle.Is(LifestyleType.Singleton));
this.windsorContainer.Register(Component.For<IPrePostActionService>().ImplementedBy<PrePostActionService>().LifeStyle.Is(LifestyleType.Singleton));
+ this.windsorContainer.Register(Component.For<IUserSettingService>().ImplementedBy<UserSettingService>());
// Commands
this.windsorContainer.Register(Component.For<IAdvancedEncoderOptionsCommand>().ImplementedBy<AdvancedEncoderOptionsCommand>().LifeStyle.Is(LifestyleType.Singleton));
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index bf50ec8db..9f8c69b53 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -17,6 +17,11 @@ namespace HandBrakeWPF
#region Constants and Fields
/// <summary>
+ /// HandBrakes build
+ /// </summary>
+ public const string HandBrakeBuild = "HandBrakeBuild";
+
+ /// <summary>
/// Add Only One Per Langage
/// </summary>
public const string AddOnlyOneAudioPerLanguage = "addOnlyOneAudioPerLanguage";
@@ -301,6 +306,10 @@ namespace HandBrakeWPF
/// </summary>
public const string SaveLogCopyDirectory = "SaveLogCopyDirectory";
+ /// <summary>
+ /// The clear completed from queue.
+ /// </summary>
+ public const string ClearCompletedFromQueue = "ClearCompletedFromQueue";
#endregion
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index 61c2d4a22..296b1faa4 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -26,6 +26,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Commands;
using HandBrakeWPF.Model;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
index 6344e262b..b8f2a265b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
using LumenWorks.Framework.IO.Csv;
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index de08398bb..e5d825ba4 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -19,6 +19,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index d20657728..dc87292d9 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1258,7 +1258,7 @@ namespace HandBrakeWPF.ViewModels
// Check if we already have jobs, and if we do, just start the queue.
if (this.queueProcessor.Count != 0)
{
- this.queueProcessor.Start();
+ this.queueProcessor.Start(UserSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue));
return;
}
@@ -1287,7 +1287,7 @@ namespace HandBrakeWPF.ViewModels
// Create the Queue Task and Start Processing
QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
this.queueProcessor.Add(task);
- this.queueProcessor.Start();
+ this.queueProcessor.Start(UserSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue));
this.IsEncoding = true;
}
@@ -1572,8 +1572,7 @@ namespace HandBrakeWPF.ViewModels
PlistUtility.Export(
savefiledialog.FileName,
this.selectedPreset,
- this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.HandBrakeBuild)
- .ToString(CultureInfo.InvariantCulture));
+ this.userSettingService.GetUserSetting<int>(UserSettingConstants.HandBrakeBuild).ToString(CultureInfo.InvariantCulture));
}
}
else
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 122914d13..f8a86494e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1953,7 +1953,7 @@ namespace HandBrakeWPF.ViewModels
// Minimise to Tray
this.MinimiseToTray = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize);
this.DisablePresetUpdateCheckNotification = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification);
- this.ClearQueueOnEncodeCompleted = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ClearCompletedFromQueue);
+ this.ClearQueueOnEncodeCompleted = userSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue);
this.ShowAdvancedTab = userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAdvancedTab);
// Set the preview count
@@ -2052,7 +2052,7 @@ namespace HandBrakeWPF.ViewModels
/* Advanced */
userSettingService.SetUserSetting(UserSettingConstants.MainWindowMinimize, this.MinimiseToTray);
userSettingService.SetUserSetting(UserSettingConstants.PresetNotification, this.DisablePresetUpdateCheckNotification);
- userSettingService.SetUserSetting(ASUserSettingConstants.ClearCompletedFromQueue, this.ClearQueueOnEncodeCompleted);
+ userSettingService.SetUserSetting(UserSettingConstants.ClearCompletedFromQueue, this.ClearQueueOnEncodeCompleted);
userSettingService.SetUserSetting(UserSettingConstants.PreviewScanCount, this.SelectedPreviewCount);
userSettingService.SetUserSetting(UserSettingConstants.X264Step, double.Parse(this.SelectedGranulairty, CultureInfo.InvariantCulture));
userSettingService.SetUserSetting(UserSettingConstants.ShowAdvancedTab, this.ShowAdvancedTab);
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
index aa390eaa6..59ce20942 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.Helpers;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
using Size = System.Drawing.Size;
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
index 972c46d94..e89ecc4cd 100644
--- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -304,7 +304,7 @@ namespace HandBrakeWPF.ViewModels
this.JobsPending = string.Format("{0} jobs pending", this.queueProcessor.Count);
this.IsEncoding = true;
- this.queueProcessor.Start();
+ this.queueProcessor.Start(UserSettingService.GetUserSetting<bool>(UserSettingConstants.ClearCompletedFromQueue));
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index a40e76a46..d12798fef 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -30,6 +30,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Properties;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -983,53 +984,53 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.Task);
- if (preset.Task != null)
- {
- this.SetEncoder(preset.Task.VideoEncoder);
-
- // applies to both x264 and QSV
- if (preset.Task.VideoEncoder == VideoEncoder.X264 ||
- preset.Task.VideoEncoder == VideoEncoder.QuickSync)
- {
- this.H264Profile = preset.Task.H264Profile;
- this.H264Level = preset.Task.H264Level;
- }
- else
- {
- this.H264Profile = x264Profile.None;
- this.H264Level = "Auto";
- }
-
- // x264 Only
- if (preset.Task.VideoEncoder == VideoEncoder.X264)
- {
- this.X264PresetValue = (int)preset.Task.X264Preset;
- this.X264Tune = preset.Task.X264Tune;
- this.FastDecode = preset.Task.FastDecode;
- }
- else
- {
- this.X264PresetValue = (int)x264Preset.Medium;
- this.X264Tune = x264Tune.None;
- this.FastDecode = false;
- }
-
- // QSV Only
- if (preset.Task.VideoEncoder == VideoEncoder.QuickSync)
- {
- this.QsvPresetValue = (int)preset.Task.QsvPreset;
- }
- else
- {
- this.QsvPresetValue = SystemInfo.IsHswOrNewer
- ? (int)QsvPreset.Quality
- : (int)QsvPreset.Balanced;
- }
-
- this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
- this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
- }
- }
+ if (preset.Task != null)
+ {
+ this.SetEncoder(preset.Task.VideoEncoder);
+
+ // applies to both x264 and QSV
+ if (preset.Task.VideoEncoder == VideoEncoder.X264 ||
+ preset.Task.VideoEncoder == VideoEncoder.QuickSync)
+ {
+ this.H264Profile = preset.Task.H264Profile;
+ this.H264Level = preset.Task.H264Level;
+ }
+ else
+ {
+ this.H264Profile = x264Profile.None;
+ this.H264Level = "Auto";
+ }
+
+ // x264 Only
+ if (preset.Task.VideoEncoder == VideoEncoder.X264)
+ {
+ this.X264PresetValue = (int)preset.Task.X264Preset;
+ this.X264Tune = preset.Task.X264Tune;
+ this.FastDecode = preset.Task.FastDecode;
+ }
+ else
+ {
+ this.X264PresetValue = (int)x264Preset.Medium;
+ this.X264Tune = x264Tune.None;
+ this.FastDecode = false;
+ }
+
+ // QSV Only
+ if (preset.Task.VideoEncoder == VideoEncoder.QuickSync)
+ {
+ this.QsvPresetValue = (int)preset.Task.QsvPreset;
+ }
+ else
+ {
+ this.QsvPresetValue = SystemInfo.IsHswOrNewer
+ ? (int)QsvPreset.Quality
+ : (int)QsvPreset.Balanced;
+ }
+
+ this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
+ this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
+ }
+ }
/// <summary>
/// Update all the UI controls based on the encode task passed in.
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
index 7a13881dc..301e161dd 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
@@ -14,6 +14,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrakeWPF.Helpers;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
index 0347bc647..fbf700b4a 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.Views
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
using Application = System.Windows.Application;