summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2019-06-24 21:15:49 +0100
committersr55 <[email protected]>2019-06-24 21:16:01 +0100
commitb52b25d167d76106c8666c788c17e7a33f713f4d (patch)
treea01ff14c78959c9b4151819c78e46701c1cbf53b /win/CS/HandBrakeWPF
parent1613a41853551dedc5b3219f05ed32aacbc85b79 (diff)
WinGui: Refactor "When Done" to use an enum to avoid language issues. Also change "suspend" to "sleep" to be consistent with the OS. Fixes #2162
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs15
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs10
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs4
-rw-r--r--win/CS/HandBrakeWPF/Model/Options/WhenDone.cs39
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs126
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx16
-rw-r--r--win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs5
-rw-r--r--win/CS/HandBrakeWPF/Services/PrePostActionService.cs26
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/PresetService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UpdateService.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs4
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/CountdownAlertViewModel.cs6
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/ICountdownAlertViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs58
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs13
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml31
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml2
-rw-r--r--win/CS/HandBrakeWPF/Views/QueueView.xaml30
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml4
25 files changed, 242 insertions, 194 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
index d9dec3ae8..20c833cdd 100644
--- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
@@ -90,6 +90,11 @@ namespace HandBrakeWPF.Converters
return EnumHelper<AutonameFileCollisionBehaviour>.GetEnumDisplayValues(typeof(AutonameFileCollisionBehaviour));
}
+ if (value is IEnumerable<WhenDone>)
+ {
+ return EnumHelper<WhenDone>.GetEnumDisplayValues(typeof(WhenDone));
+ }
+
// Single Items
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
{
@@ -151,6 +156,11 @@ namespace HandBrakeWPF.Converters
return EnumHelper<AutonameFileCollisionBehaviour>.GetDisplay((AutonameFileCollisionBehaviour)value);
}
+ if (targetType == typeof(WhenDone) || value.GetType() == typeof(WhenDone))
+ {
+ return EnumHelper<WhenDone>.GetDisplay((WhenDone)value);
+ }
+
return null;
}
@@ -206,6 +216,11 @@ namespace HandBrakeWPF.Converters
return EnumHelper<Sharpen>.GetValue(value.ToString());
}
+ if (targetType == typeof(WhenDone) || value.GetType() == typeof(WhenDone))
+ {
+ return EnumHelper<WhenDone>.GetValue(value.ToString());
+ }
+
return null;
}
}
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
index b2aba62ae..b21c2195d 100644
--- a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
+++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
@@ -36,15 +36,15 @@ namespace HandBrakeWPF.Factories
HBConfiguration config = new HBConfiguration
{
IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),
- ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int)),
- PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)),
- Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int)),
- MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int)),
+ ScalingMode = UserSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode),
+ PreviewScanCount = UserSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount),
+ Verbosity = UserSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity),
+ MinScanDuration = UserSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration),
SaveLogToCopyDirectory = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogToCopyDirectory),
SaveLogWithVideo = UserSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo),
SaveLogCopyDirectory = UserSettingService.GetUserSetting<string>(UserSettingConstants.SaveLogCopyDirectory),
RemoteServiceEnabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.RemoteServiceEnabled),
- RemoteServicePort = UserSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort, typeof(int)),
+ RemoteServicePort = UserSettingService.GetUserSetting<int>(UserSettingConstants.RemoteServicePort),
EnableVceEncoder = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableVceEncoder),
EnableNvencEncoder = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableNvencEncoder),
EnableQsvEncoder = UserSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncEncoding),
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 107176fd6..252f91281 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -171,6 +171,7 @@
<Compile Include="Model\Filters\FilterTune.cs" />
<Compile Include="Model\Filters\FilterPreset.cs" />
<Compile Include="Model\InterfaceLanguage.cs" />
+ <Compile Include="Model\Options\WhenDone.cs" />
<Compile Include="Model\Picture\PresetPictureSettingsMode.cs" />
<Compile Include="Model\Subtitles\SubtitleBurnInBehaviourModes.cs" />
<Compile Include="Model\Subtitles\SubtitleBehaviourModes.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index 4870f54ec..9506fa0e9 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -179,7 +179,7 @@ namespace HandBrakeWPF.Helpers
*/
if (task.OutputFormat == OutputFormat.Mp4)
{
- switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int)))
+ switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Automatic
destinationFilename += task.IncludeChapterMarkers || MP4Helper.RequiresM4v(task) ? ".m4v" : ".mp4";
@@ -258,7 +258,7 @@ namespace HandBrakeWPF.Helpers
private static string CheckAndHandleFilenameCollisions(string autoNamePath, string destinationFilename, EncodeTask task, IUserSettingService userSettingService)
{
- AutonameFileCollisionBehaviour behaviour = (AutonameFileCollisionBehaviour)userSettingService.GetUserSetting<int>(UserSettingConstants.AutonameFileCollisionBehaviour, typeof(int));
+ AutonameFileCollisionBehaviour behaviour = (AutonameFileCollisionBehaviour)userSettingService.GetUserSetting<int>(UserSettingConstants.AutonameFileCollisionBehaviour);
string prefix = string.Empty, postfix = string.Empty;
switch (behaviour)
{
diff --git a/win/CS/HandBrakeWPF/Model/Options/WhenDone.cs b/win/CS/HandBrakeWPF/Model/Options/WhenDone.cs
new file mode 100644
index 000000000..d15e27b26
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Model/Options/WhenDone.cs
@@ -0,0 +1,39 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="WhenDone.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>
+// Defines the WhenDone type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Model.Options
+{
+ using HandBrake.Interop.Attributes;
+
+ using HandBrakeWPF.Properties;
+
+ public enum WhenDone
+ {
+ [DisplayName(typeof(Resources), "WhenDone_DoNothing")]
+ DoNothing = 0,
+
+ [DisplayName(typeof(Resources), "WhenDone_Shutdown")]
+ Shutdown = 1,
+
+ [DisplayName(typeof(Resources), "WhenDone_Suspend")]
+ Sleep = 2,
+
+ [DisplayName(typeof(Resources), "WhenDone_Hibernate")]
+ Hibernate = 3,
+
+ [DisplayName(typeof(Resources), "WhenDone_LockSystem")]
+ LockSystem = 4,
+
+ [DisplayName(typeof(Resources), "WhenDone_Logoff")]
+ LogOff = 5,
+
+ [DisplayName(typeof(Resources), "WhenDone_QuitHandBrake")]
+ QuickHandBrake = 6,
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index f0aba3163..251dfb4fe 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -4066,15 +4066,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Do nothing.
- /// </summary>
- public static string QueueView_DoNothing {
- get {
- return ResourceManager.GetString("QueueView_DoNothing", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Encode Time:.
/// </summary>
public static string QueueView_Duration {
@@ -4129,15 +4120,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Hibernate.
- /// </summary>
- public static string QueueView_Hibernate {
- get {
- return ResourceManager.GetString("QueueView_Hibernate", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Import Queue.
/// </summary>
public static string QueueView_Import {
@@ -4147,15 +4129,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Lock System.
- /// </summary>
- public static string QueueView_LockSystem {
- get {
- return ResourceManager.GetString("QueueView_LockSystem", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to The log will be available after the encode completes..
/// </summary>
public static string QueueView_LogNotAvailableYet {
@@ -4165,15 +4138,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Log off.
- /// </summary>
- public static string QueueView_Logoff {
- get {
- return ResourceManager.GetString("QueueView_Logoff", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Open Destination Directory.
/// </summary>
public static string QueueView_OpenDestDir {
@@ -4237,15 +4201,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Quit HandBrake.
- /// </summary>
- public static string QueueView_QuitHandBrake {
- get {
- return ResourceManager.GetString("QueueView_QuitHandBrake", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Reset.
/// </summary>
public static string QueueView_Reset {
@@ -4282,15 +4237,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Shutdown.
- /// </summary>
- public static string QueueView_Shutdown {
- get {
- return ResourceManager.GetString("QueueView_Shutdown", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Src: .
/// </summary>
public static string QueueView_Source {
@@ -4354,15 +4300,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Suspend.
- /// </summary>
- public static string QueueView_Suspend {
- get {
- return ResourceManager.GetString("QueueView_Suspend", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to Video:.
/// </summary>
public static string QueueView_Video {
@@ -5570,6 +5507,69 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Do nothing.
+ /// </summary>
+ public static string WhenDone_DoNothing {
+ get {
+ return ResourceManager.GetString("WhenDone_DoNothing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Hibernate.
+ /// </summary>
+ public static string WhenDone_Hibernate {
+ get {
+ return ResourceManager.GetString("WhenDone_Hibernate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Lock System.
+ /// </summary>
+ public static string WhenDone_LockSystem {
+ get {
+ return ResourceManager.GetString("WhenDone_LockSystem", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Log off.
+ /// </summary>
+ public static string WhenDone_Logoff {
+ get {
+ return ResourceManager.GetString("WhenDone_Logoff", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Quit HandBrake.
+ /// </summary>
+ public static string WhenDone_QuitHandBrake {
+ get {
+ return ResourceManager.GetString("WhenDone_QuitHandBrake", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Shutdown.
+ /// </summary>
+ public static string WhenDone_Shutdown {
+ get {
+ return ResourceManager.GetString("WhenDone_Shutdown", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Sleep.
+ /// </summary>
+ public static string WhenDone_Suspend {
+ get {
+ return ResourceManager.GetString("WhenDone_Suspend", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to {0} - ({1}%, Pass {2} of {3}).
/// </summary>
public static string WindowTitleStatus {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index f30ddce1a..6f5e4fdb2 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -1446,7 +1446,7 @@ This will not affect your current settings in the Subtitle tab.</value>
<data name="QueueView_Destination" xml:space="preserve">
<value>Dest: </value>
</data>
- <data name="QueueView_DoNothing" xml:space="preserve">
+ <data name="WhenDone_DoNothing" xml:space="preserve">
<value>Do nothing</value>
</data>
<data name="QueueView_Duration" xml:space="preserve">
@@ -1464,16 +1464,16 @@ This will not affect your current settings in the Subtitle tab.</value>
<data name="QueueView_FileSize" xml:space="preserve">
<value>Filesize: </value>
</data>
- <data name="QueueView_Hibernate" xml:space="preserve">
+ <data name="WhenDone_Hibernate" xml:space="preserve">
<value>Hibernate</value>
</data>
- <data name="QueueView_LockSystem" xml:space="preserve">
+ <data name="WhenDone_LockSystem" xml:space="preserve">
<value>Lock System</value>
</data>
<data name="QueueView_LogNotAvailableYet" xml:space="preserve">
<value>The log will be available after the encode completes.</value>
</data>
- <data name="QueueView_Logoff" xml:space="preserve">
+ <data name="WhenDone_Logoff" xml:space="preserve">
<value>Log off</value>
</data>
<data name="QueueView_OpenDestDir" xml:space="preserve">
@@ -1494,7 +1494,7 @@ This will not affect your current settings in the Subtitle tab.</value>
<data name="QueueView_PictureSettings" xml:space="preserve">
<value>Picture Settings:</value>
</data>
- <data name="QueueView_QuitHandBrake" xml:space="preserve">
+ <data name="WhenDone_QuitHandBrake" xml:space="preserve">
<value>Quit HandBrake</value>
</data>
<data name="QueueView_ResetAllJobs" xml:space="preserve">
@@ -1509,7 +1509,7 @@ This will not affect your current settings in the Subtitle tab.</value>
<data name="QueueView_Reset" xml:space="preserve">
<value>Reset</value>
</data>
- <data name="QueueView_Shutdown" xml:space="preserve">
+ <data name="WhenDone_Shutdown" xml:space="preserve">
<value>Shutdown</value>
</data>
<data name="QueueView_Source" xml:space="preserve">
@@ -1533,8 +1533,8 @@ This will not affect your current settings in the Subtitle tab.</value>
<data name="QueueView_Summary" xml:space="preserve">
<value>Summary</value>
</data>
- <data name="QueueView_Suspend" xml:space="preserve">
- <value>Suspend</value>
+ <data name="WhenDone_Suspend" xml:space="preserve">
+ <value>Sleep</value>
</data>
<data name="QueueView_Video" xml:space="preserve">
<value>Video:</value>
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
index 2dee3cde9..e2ce7530d 100644
--- a/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
+++ b/win/CS/HandBrakeWPF/Services/Interfaces/IUserSettingService.cs
@@ -51,15 +51,12 @@ namespace HandBrakeWPF.Services.Interfaces
/// <param name="name">
/// The name.
/// </param>
- /// <param name="convertType">
- /// The convert Type.
- /// </param>
/// <typeparam name="T">
/// The Type of the setting
/// </typeparam>
/// <returns>
/// The user setting
/// </returns>
- T GetUserSetting<T>(string name, Type convertType = null);
+ T GetUserSetting<T>(string name);
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
index 7d3233fc7..67b5cf263 100644
--- a/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
+++ b/win/CS/HandBrakeWPF/Services/PrePostActionService.cs
@@ -21,6 +21,7 @@ namespace HandBrakeWPF.Services
using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Instance;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Logging;
@@ -138,7 +139,7 @@ namespace HandBrakeWPF.Services
this.PlayWhenDoneSound();
}
- if (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction) == "Do nothing")
+ if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction) == (int)WhenDone.DoNothing)
{
return;
}
@@ -151,7 +152,7 @@ namespace HandBrakeWPF.Services
Execute.OnUIThread(
() =>
{
- titleSpecificView.SetAction(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction));
+ titleSpecificView.SetAction((WhenDone)this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction));
this.windowManager.ShowDialog(titleSpecificView);
isCancelled = titleSpecificView.IsCancelled;
});
@@ -159,36 +160,31 @@ namespace HandBrakeWPF.Services
if (!isCancelled)
{
- this.ServiceLogMessage(string.Format("Performing 'When Done' Action: {0}", this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction)));
+ this.ServiceLogMessage(string.Format("Performing 'When Done' Action: {0}", this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction)));
// Do something when the encode ends.
- switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction))
+ switch ((WhenDone)this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction))
{
- case "Shutdown":
- case "Herunterfahren":
+ case WhenDone.Shutdown:
ProcessStartInfo shutdown = new ProcessStartInfo("Shutdown", "-s -t 60");
shutdown.UseShellExecute = false;
Process.Start(shutdown);
Execute.OnUIThread(() => System.Windows.Application.Current.Shutdown());
break;
- case "Log off":
- case "Ausloggen":
+ case WhenDone.LogOff:
this.scanService.Dispose();
Win32.ExitWindowsEx(0, 0);
break;
- case "Suspend":
+ case WhenDone.Sleep:
Application.SetSuspendState(PowerState.Suspend, true, true);
break;
- case "Hibernate":
- case "Ruhezustand":
+ case WhenDone.Hibernate:
Application.SetSuspendState(PowerState.Hibernate, true, true);
break;
- case "Lock System":
- case "System sperren":
+ case WhenDone.LockSystem:
Win32.LockWorkStation();
break;
- case "Quit HandBrake":
- case "HandBrake beenden":
+ case WhenDone.QuickHandBrake:
Execute.OnUIThread(() => System.Windows.Application.Current.Shutdown());
break;
}
diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
index 37926a352..01dd40f51 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs
@@ -711,7 +711,7 @@ namespace HandBrakeWPF.Services.Presets
}
// Force Upgrade of presets
- if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.ForcePresetReset, typeof(int)) < ForcePresetReset)
+ if (this.userSettingService.GetUserSetting<int>(UserSettingConstants.ForcePresetReset) < ForcePresetReset)
{
this.userSettingService.SetUserSetting(UserSettingConstants.ForcePresetReset, ForcePresetReset);
diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs
index 64c909f4d..61c326455 100644
--- a/win/CS/HandBrakeWPF/Services/UpdateService.cs
+++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs
@@ -77,7 +77,7 @@ namespace HandBrakeWPF.Services
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UpdateStatus))
{
DateTime lastUpdateCheck = this.userSettingService.GetUserSetting<DateTime>(UserSettingConstants.LastUpdateCheckDate);
- int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int)) == 0 ? 7 : 30;
+ int checkFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30;
if (DateTime.Now.Subtract(lastUpdateCheck).TotalDays > checkFrequency)
{
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
index cc9e11145..9ae00d275 100644
--- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs
+++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
@@ -88,11 +88,11 @@ namespace HandBrakeWPF.Services
/// <returns>
/// The user setting
/// </returns>
- public T GetUserSetting<T>(string name, Type conversionType = null)
+ public T GetUserSetting<T>(string name)
{
if (this.userSettings.ContainsKey(name))
{
- if (conversionType != null && typeof(int) == conversionType)
+ if (typeof(T) == typeof(int))
{
object storedValue = this.userSettings[name];
object converted = storedValue?.ToString().ToInt();
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index c12a756ce..1f6ed72db 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -30,7 +30,7 @@ namespace HandBrakeWPF
public const string InstanceId = "InstanceId";
public const string X264Step = "X264Step";
public const string LastPreviewDuration = "LastPreviewDuration";
- public const string WhenCompleteAction = "WhenCompleteAction";
+ public const string WhenCompleteAction = "WhenCompletePerformAction";
public const string SendFile = "SendFile";
public const string SendFileTo = "SendFileTo";
public const string SendFileToArgs = "SendFileToArgs";
diff --git a/win/CS/HandBrakeWPF/ViewModels/CountdownAlertViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/CountdownAlertViewModel.cs
index ccee60870..a6d3ae2c7 100644
--- a/win/CS/HandBrakeWPF/ViewModels/CountdownAlertViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/CountdownAlertViewModel.cs
@@ -12,7 +12,9 @@ namespace HandBrakeWPF.ViewModels
using System;
using System.Windows.Threading;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Properties;
+ using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -115,12 +117,12 @@ namespace HandBrakeWPF.ViewModels
/// <param name="actionMsg">
/// The action.
/// </param>
- public void SetAction(string actionMsg)
+ public void SetAction(WhenDone actionMsg)
{
this.IsCancelled = false;
this.Ticks = 0;
timer.Start();
- this.action = actionMsg;
+ this.action = EnumHelper<WhenDone>.GetDisplay(actionMsg);
}
#endregion
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ICountdownAlertViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ICountdownAlertViewModel.cs
index 0dac356f3..e779921f8 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ICountdownAlertViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ICountdownAlertViewModel.cs
@@ -9,6 +9,8 @@
namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrakeWPF.Model.Options;
+
/// <summary>
/// The Countdown Alert View Model Interface
/// </summary>
@@ -25,6 +27,6 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// <param name="action">
/// The action.
/// </param>
- void SetAction(string action);
+ void SetAction(WhenDone action);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
index 07f2a06bf..0ee439e81 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs
@@ -9,6 +9,8 @@
namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrakeWPF.Model.Options;
+
/// <summary>
/// The Queue View Model Interface
/// </summary>
@@ -25,7 +27,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// <param name="saveChange">
/// Save the change to the setting. Use false when updating UI.
/// </param>
- void WhenDone(string action, bool saveChange);
+ void WhenDone(int action, bool saveChange);
/// <summary>
/// The import.
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index c93a005d3..c1cd1aafb 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1141,7 +1141,7 @@ namespace HandBrakeWPF.ViewModels
// Reset WhenDone if necessary.
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ResetWhenDoneAction))
{
- this.WhenDone("Do nothing");
+ this.WhenDone(0);
}
// Log Cleaning
@@ -1359,7 +1359,7 @@ namespace HandBrakeWPF.ViewModels
if (File.Exists(this.CurrentTask.Destination))
{
- FileOverwriteBehaviour behaviour = (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour, typeof(int));
+ FileOverwriteBehaviour behaviour = (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour);
if (behaviour == FileOverwriteBehaviour.Ask)
{
MessageBoxResult result = this.errorService.ShowMessageBox(string.Format(Resources.Main_QueueOverwritePrompt, Path.GetFileName(this.CurrentTask.Destination)), Resources.Question, MessageBoxButton.YesNo, MessageBoxImage.Question);
@@ -1694,7 +1694,7 @@ namespace HandBrakeWPF.ViewModels
/// Pass on the "When Done" Action to the queue view model.
/// </summary>
/// <param name="action">action</param>
- public void WhenDone(string action)
+ public void WhenDone(int action)
{
this.QueueViewModel?.WhenDone(action, true);
}
@@ -1766,9 +1766,7 @@ namespace HandBrakeWPF.ViewModels
};
saveFileDialog.OverwritePrompt =
- (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(
- UserSettingConstants.FileOverwriteBehaviour,
- typeof(int)) == FileOverwriteBehaviour.Ask;
+ (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour) == FileOverwriteBehaviour.Ask;
string extension = Path.GetExtension(this.CurrentTask.Destination);
@@ -2659,7 +2657,7 @@ namespace HandBrakeWPF.ViewModels
switch (e.Key)
{
case UserSettingConstants.WhenCompleteAction:
- this.QueueViewModel.WhenDone(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction), false);
+ this.QueueViewModel.WhenDone(this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction), false);
break;
case UserSettingConstants.ShowAddAllToQueue:
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 1fcb2379e..4375e2a08 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -80,8 +80,8 @@ namespace HandBrakeWPF.ViewModels
private string sendFileTo;
private string sendFileToPath;
private string vlcPath;
- private string whenDone;
- private BindingList<string> whenDoneOptions = new BindingList<string>();
+ private WhenDone whenDone;
+ private BindingList<WhenDone> whenDoneOptions = new BindingList<WhenDone>();
private bool clearQueueOnEncodeCompleted;
private OptionsTab selectedTab;
private string updateMessage;
@@ -351,7 +351,7 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Gets or sets WhenDone.
/// </summary>
- public string WhenDone
+ public WhenDone WhenDone
{
get
{
@@ -366,19 +366,13 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Gets or sets WhenDoneOptions.
+ /// Gets WhenDoneOptions.
/// </summary>
- public BindingList<string> WhenDoneOptions
+ public BindingList<WhenDone> WhenDoneOptions
{
get
{
- return this.whenDoneOptions;
- }
-
- set
- {
- this.whenDoneOptions = value;
- this.NotifyOfPropertyChange("WhenDoneOptions");
+ return new BindingList<WhenDone>(EnumHelper<WhenDone>.GetEnumList().ToList());
}
}
@@ -1470,7 +1464,7 @@ namespace HandBrakeWPF.ViewModels
this.checkForUpdatesFrequencies.Add("Weekly");
this.checkForUpdatesFrequencies.Add("Monthly");
- this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck, typeof(int));
+ this.CheckForUpdatesFrequency = this.userSettingService.GetUserSetting<int>(UserSettingConstants.DaysBetweenUpdateCheck);
if (this.CheckForUpdatesFrequency > 1)
{
this.CheckForUpdatesFrequency = 1;
@@ -1489,18 +1483,18 @@ namespace HandBrakeWPF.ViewModels
// On Encode Completion Action
this.whenDoneOptions.Clear();
- this.whenDoneOptions.Add("Do nothing");
- this.whenDoneOptions.Add("Shutdown");
- this.whenDoneOptions.Add("Suspend");
- this.whenDoneOptions.Add("Hibernate");
- this.whenDoneOptions.Add("Lock System");
- this.whenDoneOptions.Add("Log off");
- this.whenDoneOptions.Add("Quit HandBrake");
-
- this.WhenDone = userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
+ this.whenDoneOptions.Add(WhenDone.DoNothing);
+ this.whenDoneOptions.Add(WhenDone.Shutdown);
+ this.whenDoneOptions.Add(WhenDone.Sleep);
+ this.whenDoneOptions.Add(WhenDone.Hibernate);
+ this.whenDoneOptions.Add(WhenDone.LockSystem);
+ this.whenDoneOptions.Add(WhenDone.LogOff);
+ this.whenDoneOptions.Add(WhenDone.QuickHandBrake);
+
+ this.WhenDone = (WhenDone)this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction);
if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ResetWhenDoneAction))
{
- this.WhenDone = "Do nothing";
+ this.WhenDone = WhenDone.DoNothing;
}
this.SendFileAfterEncode = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.SendFile);
@@ -1535,7 +1529,7 @@ namespace HandBrakeWPF.ViewModels
this.mp4ExtensionOptions.Add("Automatic");
this.mp4ExtensionOptions.Add("Always use MP4");
this.mp4ExtensionOptions.Add("Always use M4V");
- this.SelectedMp4Extension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int));
+ this.SelectedMp4Extension = this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v);
// Remove Underscores
this.RemoveUnderscores = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore);
@@ -1548,11 +1542,11 @@ namespace HandBrakeWPF.ViewModels
this.FileOverwriteBehaviourList = new BindingList<FileOverwriteBehaviour>();
this.FileOverwriteBehaviourList.Add(FileOverwriteBehaviour.Ask);
this.FileOverwriteBehaviourList.Add(FileOverwriteBehaviour.ForceOverwrite);
- this.SelectedOverwriteBehaviour = this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour, typeof(int));
+ this.SelectedOverwriteBehaviour = this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour);
// Collision behaviour
this.AutonameFileCollisionBehaviours = new BindingList<AutonameFileCollisionBehaviour>() { AutonameFileCollisionBehaviour.AppendNumber, AutonameFileCollisionBehaviour.Prefix, AutonameFileCollisionBehaviour.Postfix };
- this.SelectedCollisionBehaviour = this.userSettingService.GetUserSetting<int>(UserSettingConstants.AutonameFileCollisionBehaviour, typeof(int));
+ this.SelectedCollisionBehaviour = this.userSettingService.GetUserSetting<int>(UserSettingConstants.AutonameFileCollisionBehaviour);
this.PrePostFilenameText = this.userSettingService.GetUserSetting<string>(UserSettingConstants.AutonameFilePrePostString);
// #############################
@@ -1566,7 +1560,7 @@ namespace HandBrakeWPF.ViewModels
// Video
// #############################
this.EnableQuickSyncDecoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncDecoding);
- this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode, typeof(int));
+ this.SelectedScalingMode = this.userSettingService.GetUserSetting<VideoScaler>(UserSettingConstants.ScalingMode);
this.UseQSVDecodeForNonQSVEnc = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.UseQSVDecodeForNonQSVEnc);
this.EnableQuickSyncEncoding = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableQuickSyncEncoding);
@@ -1595,7 +1589,7 @@ namespace HandBrakeWPF.ViewModels
this.logVerbosityOptions.Add(0);
this.logVerbosityOptions.Add(1);
this.logVerbosityOptions.Add(2);
- this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity, typeof(int));
+ this.SelectedVerbosity = userSettingService.GetUserSetting<int>(UserSettingConstants.Verbosity);
// Logs
this.CopyLogToEncodeDirectory = userSettingService.GetUserSetting<bool>(UserSettingConstants.SaveLogWithVideo);
@@ -1627,7 +1621,7 @@ namespace HandBrakeWPF.ViewModels
this.PreviewPicturesToScan.Add(50);
this.PreviewPicturesToScan.Add(55);
this.PreviewPicturesToScan.Add(60);
- this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
+ this.SelectedPreviewCount = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
// x264 step
this.ConstantQualityGranularity.Clear();
@@ -1637,7 +1631,7 @@ namespace HandBrakeWPF.ViewModels
this.SelectedGranulairty = userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step).ToString("0.00", CultureInfo.InvariantCulture);
// Min Title Length
- this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration, typeof(int));
+ this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);
// Use dvdnav
this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);
@@ -1648,7 +1642,7 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void UpdateSettings()
{
- this.WhenDone = userSettingService.GetUserSetting<string>("WhenCompleteAction");
+ this.WhenDone = (WhenDone)this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction);
}
/// <summary>
@@ -1693,7 +1687,7 @@ namespace HandBrakeWPF.ViewModels
this.userSettingService.SetUserSetting(UserSettingConstants.ShowQueueInline, this.ShowQueueInline);
/* When Done */
- this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, this.WhenDone);
+ this.userSettingService.SetUserSetting(UserSettingConstants.WhenCompleteAction, (int)this.WhenDone);
this.userSettingService.SetUserSetting(UserSettingConstants.ResetWhenDoneAction, this.ResetWhenDoneAction);
this.userSettingService.SetUserSetting(UserSettingConstants.WhenDonePerformActionImmediately, this.WhenDonePerformActionImmediately);
this.userSettingService.SetUserSetting(UserSettingConstants.PlaySoundWhenDone, this.PlaySoundWhenDone);
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
index 0415a8c95..e86d8f488 100644
--- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -23,6 +23,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.EventArgs;
using HandBrakeWPF.Extensions;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Queue.Interfaces;
@@ -47,7 +48,7 @@ namespace HandBrakeWPF.ViewModels
private readonly IQueueService queueProcessor;
private string jobStatus;
private string jobsPending;
- private string whenDoneAction;
+ private WhenDone whenDoneAction;
private QueueTask selectedTask;
private bool isQueueRunning;
private double progressValue;
@@ -82,7 +83,7 @@ namespace HandBrakeWPF.ViewModels
this.DisplayName = "Queue";
this.IsQueueRunning = false;
- this.WhenDoneAction = this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction);
+ this.WhenDoneAction = (WhenDone)this.userSettingService.GetUserSetting<int>(UserSettingConstants.WhenCompleteAction);
}
#endregion
@@ -147,7 +148,7 @@ namespace HandBrakeWPF.ViewModels
/// <summary>
/// Gets or sets WhenDoneAction.
/// </summary>
- public string WhenDoneAction
+ public WhenDone WhenDoneAction
{
get
{
@@ -273,7 +274,7 @@ namespace HandBrakeWPF.ViewModels
/// <param name="action">
/// The action.
/// </param>
- public void WhenDone(string action)
+ public void WhenDone(int action)
{
this.WhenDone(action, true);
}
@@ -287,9 +288,9 @@ namespace HandBrakeWPF.ViewModels
/// <param name="saveChange">
/// Save the change to the setting. Use false when updating UI.
/// </param>
- public void WhenDone(string action, bool saveChange)
+ public void WhenDone(int action, bool saveChange)
{
- this.WhenDoneAction = action;
+ this.WhenDoneAction = (WhenDone)action;
if (saveChange)
{
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
index 5a9c38383..afb3ea885 100644
--- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs
@@ -151,7 +151,7 @@ namespace HandBrakeWPF.ViewModels
this.CanPlay = true;
this.useSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
- this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration, typeof(int));
+ this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
}
#endregion
@@ -238,7 +238,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)) - 1;
+ return this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount) - 1;
}
}
@@ -345,7 +345,7 @@ namespace HandBrakeWPF.ViewModels
{
List<int> startPoints = new List<int>();
for (int i = 1;
- i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
+ i <= this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
i++)
{
startPoints.Add(i);
@@ -428,7 +428,7 @@ namespace HandBrakeWPF.ViewModels
public void NextPreview()
{
- int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
if ((this.SelectedPreviewImage + 1) == maxPreview)
{
return;
diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
index add04d299..771fbec6e 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
@@ -369,7 +369,7 @@ namespace HandBrakeWPF.ViewModels
public void NextPreview()
{
- int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
if (this.selectedPreview == maxPreview)
{
return;
@@ -385,7 +385,7 @@ namespace HandBrakeWPF.ViewModels
public void PreviousPreview()
{
- int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int));
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
if (this.selectedPreview <= 1)
{
return;
@@ -410,7 +410,7 @@ namespace HandBrakeWPF.ViewModels
this.IsPreviousPreviewControlVisible = false;
}
- if (this.selectedPreview < this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)))
+ if (this.selectedPreview < this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount))
{
this.IsNextPreviewControlVisible = true;
}
@@ -441,7 +441,7 @@ namespace HandBrakeWPF.ViewModels
// Make sure the output extension is set correctly based on the users preferences and selection.
if (newExtension == ".mp4" || newExtension == ".m4v")
{
- switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v, typeof(int)))
+ switch (this.userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Auto
newExtension = MP4Helper.RequiresM4v(this.Task) ? ".m4v" : ".mp4";
@@ -499,7 +499,7 @@ namespace HandBrakeWPF.ViewModels
this.FiltersInfo = this.GetFilterDescription();
this.NotifyOfPropertyChange(() => this.FiltersInfo);
- // Picutre Section
+ // Picture Section
this.DimensionInfo = string.Format("{0}x{1} {2}, {3}x{4} {5}", this.Task.Width, this.Task.Height, Resources.SummaryView_storage, this.Task.DisplayWidth, this.Task.Height, Resources.SummaryView_display);
this.NotifyOfPropertyChange(() => this.DimensionInfo);
@@ -507,7 +507,7 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.AspectInfo);
// Preview
- this.PreviewInfo = string.Format(Resources.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount, typeof(int)));
+ this.PreviewInfo = string.Format(Resources.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount));
this.NotifyOfPropertyChange(() => this.PreviewInfo);
this.ShowPreview = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowPreviewOnSummaryTab);
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index fecc7ffcf..dfa4da0df 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -24,6 +24,7 @@
<queue:InlineQueueConverter x:Key="InlineQueueConverter" />
<Converters:BooleanConverter x:Key="NotBooleanConverter" />
<Converters:ThemeImageConverter x:Key="themeConverter" />
+ <Converters:EnumComboConverter x:Key="enumComboConverter" />
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="8,2" />
@@ -833,7 +834,7 @@
<MenuItem.Header>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" MinHeight="26">
<TextBlock VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:Resources.QueueView_WhenDone}" />
- <TextBlock Margin="8,0,0,0" VerticalAlignment="Center" Text="{Binding QueueViewModel.WhenDoneAction}" />
+ <TextBlock Margin="8,0,0,0" VerticalAlignment="Center" Text="{Binding QueueViewModel.WhenDoneAction, Converter={StaticResource enumComboConverter}}" />
<Path Height="5"
Margin="2,2,2,0"
Data="M 0 0 L 4 4 L 8 0 Z"
@@ -842,26 +843,26 @@
</MenuItem.Header>
<MenuItem x:Name="doNothing"
- cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"
- Header="{x:Static Properties:Resources.QueueView_DoNothing}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(0)]"
+ Header="{x:Static Properties:Resources.WhenDone_DoNothing}" />
<MenuItem x:Name="shutdownSystem"
- cal:Message.Attach="[Event Click] = [Action WhenDone(shutdownSystem.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Shutdown}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(1)]"
+ Header="{x:Static Properties:Resources.WhenDone_Shutdown}" />
<MenuItem x:Name="suspend"
- cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Suspend}"/>
+ cal:Message.Attach="[Event Click] = [Action WhenDone(2)]"
+ Header="{x:Static Properties:Resources.WhenDone_Suspend}"/>
<MenuItem x:Name="hibernate"
- cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Hibernate}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(3)]"
+ Header="{x:Static Properties:Resources.WhenDone_Hibernate}" />
<MenuItem x:Name="lock"
- cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"
- Header="{x:Static Properties:Resources.QueueView_LockSystem}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(4)]"
+ Header="{x:Static Properties:Resources.WhenDone_LockSystem}" />
<MenuItem x:Name="logoff"
- cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Logoff}"/>
+ cal:Message.Attach="[Event Click] = [Action WhenDone(5)]"
+ Header="{x:Static Properties:Resources.WhenDone_Logoff}"/>
<MenuItem x:Name="quit"
- cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"
- Header="{x:Static Properties:Resources.QueueView_QuitHandBrake}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(6)]"
+ Header="{x:Static Properties:Resources.WhenDone_QuitHandBrake}" />
</MenuItem>
</Menu>
</StatusBarItem>
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 9a72fdf51..fc042d9f3 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -242,7 +242,7 @@
</Grid.RowDefinitions>
<TextBlock Text="{x:Static Properties:Resources.Options_WhenDoneColon}" Grid.Row="0" Grid.Column="0" />
- <ComboBox Name="whenDone" ItemsSource="{Binding WhenDoneOptions}" SelectedItem="{Binding WhenDone}" Width="120" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" />
+ <ComboBox Name="whenDone" ItemsSource="{Binding WhenDoneOptions, Converter={StaticResource enumComboConverter}}" SelectedItem="{Binding WhenDone, Converter={StaticResource enumComboConverter}}" Width="120" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="1" />
<CheckBox Content="{x:Static Properties:Resources.Options_ResetDoNothing}" VerticalAlignment="Center" Margin="0,5,0,0" Grid.Row="1" Grid.Column="1"
IsChecked="{Binding ResetWhenDoneAction}" />
<CheckBox Content="{x:Static Properties:Resources.Options_PromptBeforeAction}" VerticalAlignment="Center" Margin="0,5,0,0" Grid.Row="2" Grid.Column="1"
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml
index bc4f0e447..43f851028 100644
--- a/win/CS/HandBrakeWPF/Views/QueueView.xaml
+++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml
@@ -293,7 +293,7 @@
Text="{x:Static Properties:Resources.QueueView_WhenDone}" />
<Label Margin="8,0,0,0"
VerticalAlignment="Center"
- Content="{Binding WhenDoneAction}" />
+ Content="{Binding WhenDoneAction, Converter={StaticResource enumComboConverter}}" />
<Path Height="5"
Margin="2,2,2,0"
Data="M 0 0 L 4 4 L 8 0 Z"
@@ -302,26 +302,26 @@
</MenuItem.Header>
<MenuItem x:Name="doNothing"
- cal:Message.Attach="[Event Click] = [Action WhenDone(doNothing.Header)]"
- Header="{x:Static Properties:Resources.QueueView_DoNothing}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(0)]"
+ Header="{x:Static Properties:Resources.WhenDone_DoNothing}" />
<MenuItem x:Name="shutdown"
- cal:Message.Attach="[Event Click] = [Action WhenDone(shutdown.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Shutdown}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(1)]"
+ Header="{x:Static Properties:Resources.WhenDone_Shutdown}" />
<MenuItem x:Name="suspend"
- cal:Message.Attach="[Event Click] = [Action WhenDone(suspend.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Suspend}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(2)]"
+ Header="{x:Static Properties:Resources.WhenDone_Suspend}" />
<MenuItem x:Name="hibernate"
- cal:Message.Attach="[Event Click] = [Action WhenDone(hibernate.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Hibernate}"/>
+ cal:Message.Attach="[Event Click] = [Action WhenDone(3)]"
+ Header="{x:Static Properties:Resources.WhenDone_Hibernate}"/>
<MenuItem x:Name="lock"
- cal:Message.Attach="[Event Click] = [Action WhenDone(lock.Header)]"
- Header="{x:Static Properties:Resources.QueueView_LockSystem}" />
+ cal:Message.Attach="[Event Click] = [Action WhenDone(4)]"
+ Header="{x:Static Properties:Resources.WhenDone_LockSystem}" />
<MenuItem x:Name="logoff"
- cal:Message.Attach="[Event Click] = [Action WhenDone(logoff.Header)]"
- Header="{x:Static Properties:Resources.QueueView_Logoff}"/>
+ cal:Message.Attach="[Event Click] = [Action WhenDone(5)]"
+ Header="{x:Static Properties:Resources.WhenDone_Logoff}"/>
<MenuItem x:Name="quit"
- cal:Message.Attach="[Event Click] = [Action WhenDone(quit.Header)]"
- Header="{x:Static Properties:Resources.QueueView_QuitHandBrake}"/>
+ cal:Message.Attach="[Event Click] = [Action WhenDone(6)]"
+ Header="{x:Static Properties:Resources.WhenDone_QuitHandBrake}"/>
</MenuItem>
</Menu>
</Border>
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 22f5eb6ac..7f95105d9 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -18,10 +18,10 @@
</item>
<item>
<key>
- <string>WhenCompleteAction</string>
+ <string>WhenCompletePerformAction</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:string" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">Do nothing</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:int" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">0</anyType>
</value>
</item>
<item>