summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.Interop/Attributes/DisplayName.cs34
-rw-r--r--win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs38
-rw-r--r--win/CS/HandBrake.Interop/HandBrake.Interop.csproj1
-rw-r--r--win/CS/HandBrake.Interop/Properties/Resources.Designer.cs2
-rw-r--r--win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs11
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs24
-rw-r--r--win/CS/HandBrakeWPF/Model/Options/FileOverwriteBehaviour.cs25
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs65
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.de.resx8
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx23
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.zh.resx8
-rw-r--r--win/CS/HandBrakeWPF/Services/UserSettingService.cs2
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs21
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs26
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml31
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml9
18 files changed, 238 insertions, 92 deletions
diff --git a/win/CS/HandBrake.Interop/Attributes/DisplayName.cs b/win/CS/HandBrake.Interop/Attributes/DisplayName.cs
index a890d97f1..07512fc3a 100644
--- a/win/CS/HandBrake.Interop/Attributes/DisplayName.cs
+++ b/win/CS/HandBrake.Interop/Attributes/DisplayName.cs
@@ -10,26 +10,34 @@
namespace HandBrake.Interop.Attributes
{
using System;
+ using System.Reflection;
- /// <summary>
- /// A Short Name for an enum value
- /// </summary>
public class DisplayName : Attribute
{
- /// <summary>
- /// Initializes a new instance of the <see cref="DisplayName"/> class.
- /// </summary>
- /// <param name="displayName">
- /// The name name.
- /// </param>
public DisplayName(string displayName)
{
this.Name = displayName;
}
- /// <summary>
- /// Gets the short name.
- /// </summary>
- public string Name { get; private set; }
+ public DisplayName(Type resourceManagerProvider, string resourceKey)
+ {
+ this.Name = LookupResource(resourceManagerProvider, resourceKey);
+ }
+
+ public string Name { get; }
+
+ internal static string LookupResource(Type resourceManagerProvider, string resourceKey)
+ {
+ foreach (PropertyInfo staticProperty in resourceManagerProvider.GetProperties(BindingFlags.Static | BindingFlags.Public))
+ {
+ if (staticProperty.PropertyType == typeof(System.Resources.ResourceManager))
+ {
+ System.Resources.ResourceManager resourceManager = (System.Resources.ResourceManager)staticProperty.GetValue(null, null);
+ return resourceManager.GetString(resourceKey);
+ }
+ }
+
+ return resourceKey;
+ }
}
}
diff --git a/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs b/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs
new file mode 100644
index 000000000..849aff069
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs
@@ -0,0 +1,38 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DisplayNameLocalized.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>
+// Localised version of teh DisplayName attribute.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Attributes
+{
+ using System;
+ using System.ComponentModel;
+ using System.Reflection;
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.All)]
+ public class DisplayNameLocalized : DisplayNameAttribute
+ {
+ public DisplayNameLocalized(Type resourceManagerProvider, string resourceKey)
+ : base(LookupResource(resourceManagerProvider, resourceKey))
+ {
+ }
+
+ internal static string LookupResource(Type resourceManagerProvider, string resourceKey)
+ {
+ foreach (PropertyInfo staticProperty in resourceManagerProvider.GetProperties(BindingFlags.Static | BindingFlags.NonPublic))
+ {
+ if (staticProperty.PropertyType == typeof(System.Resources.ResourceManager))
+ {
+ System.Resources.ResourceManager resourceManager = (System.Resources.ResourceManager)staticProperty.GetValue(null, null);
+ return resourceManager.GetString(resourceKey);
+ }
+ }
+
+ return resourceKey;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj
index 5bf710caa..d73d4dcbc 100644
--- a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj
+++ b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj
@@ -50,6 +50,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\DisplayName.cs" />
+ <Compile Include="Attributes\DisplayNameLocalized.cs" />
<Compile Include="Attributes\ShortName.cs" />
<Compile Include="Interop\EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="Interop\EventArgs\EncodeProgressEventArgs.cs" />
diff --git a/win/CS/HandBrake.Interop/Properties/Resources.Designer.cs b/win/CS/HandBrake.Interop/Properties/Resources.Designer.cs
index c288971f6..bb3488fae 100644
--- a/win/CS/HandBrake.Interop/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrake.Interop/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace HandBrake.Interop.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
index 644417b26..8d52ec954 100644
--- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
@@ -15,6 +15,8 @@ namespace HandBrakeWPF.Converters
using System.Windows.Data;
using HandBrake.Interop.Interop.Model.Encoding;
using HandBrake.Interop.Model;
+
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Services.Queue.Model;
using HandBrakeWPF.Utilities;
using OutputFormat = HandBrakeWPF.Services.Encode.Model.Models.OutputFormat;
@@ -87,6 +89,11 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<Sharpen>.GetEnumDisplayValues(typeof(Sharpen));
}
+ if (value is IEnumerable<FileOverwriteBehaviour>)
+ {
+ return EnumHelper<FileOverwriteBehaviour>.GetEnumDisplayValues(typeof(FileOverwriteBehaviour));
+ }
+
// Single Items
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
@@ -132,6 +139,10 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<Sharpen>.GetDisplay((Sharpen)value);
}
+ if (targetType == typeof(FileOverwriteBehaviour) || value.GetType() == typeof(FileOverwriteBehaviour))
+ {
+ return EnumHelper<FileOverwriteBehaviour>.GetDisplay((FileOverwriteBehaviour)value);
+ }
return null;
}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 9ea38eacd..aa076610e 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -165,6 +165,7 @@
<Compile Include="Model\Audio\AudioBehaviourModes.cs" />
<Compile Include="Model\Audio\AudioBehaviours.cs" />
<Compile Include="Model\DriveInformation.cs" />
+ <Compile Include="Model\Options\FileOverwriteBehaviour.cs" />
<Compile Include="Model\Filters\FilterTune.cs" />
<Compile Include="Model\Filters\FilterPreset.cs" />
<Compile Include="Model\InterfaceLanguage.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index b1333dcaa..4a1e96b50 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -12,12 +12,14 @@ namespace HandBrakeWPF.Helpers
using System;
using System.IO;
using System.Linq;
+ using System.Runtime.CompilerServices;
using Caliburn.Micro;
using HandBrake.Interop.Interop.Model.Encoding;
using HandBrakeWPF.Extensions;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Services.Encode.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
@@ -227,17 +229,21 @@ namespace HandBrakeWPF.Helpers
}
// Append out_ to files that already exist or is the source file
- if (autoNamePath?.ToLower() == task.Source?.ToLower())
- {
- autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), "output_" + destinationFilename);
-
- int counter = 1;
- while (autoNamePath == task.Source)
+ //FileOverwriteBehaviour behaviour = (FileOverwriteBehaviour)userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour, typeof(int));
+ //if (behaviour == FileOverwriteBehaviour.Autoname)
+ //{
+ if (autoNamePath?.ToLower() == task.Source?.ToLower())
{
- autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), string.Format("output{0}_", counter) + destinationFilename);
- counter = counter + 1;
+ autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), "output_" + destinationFilename);
+
+ int counter = 1;
+ while (autoNamePath == task.Source)
+ {
+ autoNamePath = Path.Combine(Path.GetDirectoryName(task.Source), string.Format("output{0}_", counter) + destinationFilename);
+ counter = counter + 1;
+ }
}
- }
+ //}
}
return autoNamePath;
diff --git a/win/CS/HandBrakeWPF/Model/Options/FileOverwriteBehaviour.cs b/win/CS/HandBrakeWPF/Model/Options/FileOverwriteBehaviour.cs
new file mode 100644
index 000000000..b01ef081e
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Model/Options/FileOverwriteBehaviour.cs
@@ -0,0 +1,25 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FileOverwriteBehaviour.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>
+// File Overwrite Behaviour options
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Model.Options
+{
+ using HandBrake.Interop.Attributes;
+
+ using HandBrakeWPF.Properties;
+
+ public enum FileOverwriteBehaviour
+ {
+ [DisplayName(typeof(Resources), "FileOverwriteBehaviours_Ask")]
+ Ask = 0,
+ [DisplayName(typeof(Resources), "FileOverwriteBehaviours_Overwrite")]
+ ForceOverwrite = 1,
+ // [DisplayName(typeof(Resources), "FileOverwriteBehaviours_Autoname")]
+ //Autoname = 2,
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index 062dd694a..88d9ba549 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -800,6 +800,33 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to Ask to overwrite file.
+ /// </summary>
+ public static string FileOverwriteBehaviours_Ask {
+ get {
+ return ResourceManager.GetString("FileOverwriteBehaviours_Ask", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Try to automatically rename file.
+ /// </summary>
+ public static string FileOverwriteBehaviours_Autoname {
+ get {
+ return ResourceManager.GetString("FileOverwriteBehaviours_Autoname", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Overwrite the file.
+ /// </summary>
+ public static string FileOverwriteBehaviours_Overwrite {
+ get {
+ return ResourceManager.GetString("FileOverwriteBehaviours_Overwrite", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Custom:.
/// </summary>
public static string FiltersView_Custom {
@@ -2608,24 +2635,6 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Experimental Features.
- /// </summary>
- public static string Options_Experimental {
- get {
- return ResourceManager.GetString("Options_Experimental", resourceCulture);
- }
- }
-
- /// <summary>
- /// Looks up a localized string similar to Experimental features are ideas we are working on. These may or may not make it into a final release and may not work!.
- /// </summary>
- public static string Options_ExperimentalFeatures {
- get {
- return ResourceManager.GetString("Options_ExperimentalFeatures", resourceCulture);
- }
- }
-
- /// <summary>
/// Looks up a localized string similar to File Format:.
/// </summary>
public static string Options_Format {
@@ -2860,7 +2869,7 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
- /// Looks up a localized string similar to Show Queue in line with the main UI..
+ /// Looks up a localized string similar to Show Queue in line with the main UI. (Experimental Feature).
/// </summary>
public static string Options_ShowQueueInline {
get {
@@ -2896,6 +2905,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to User Interface Behaviour.
+ /// </summary>
+ public static string Options_UIBehaviour {
+ get {
+ return ResourceManager.GetString("Options_UIBehaviour", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Updates.
/// </summary>
public static string Options_Updates {
@@ -3040,6 +3058,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to File overwrite behaviour:.
+ /// </summary>
+ public static string OptionsView_FileOverwriteBehaviour {
+ get {
+ return ResourceManager.GetString("OptionsView_FileOverwriteBehaviour", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Live Update Options: {source} {title} {chapters}
///Non-Live Options: {date} {time} {creation-date} {creation-time} {quality} {bitrate} (These only change if you scan a new source, change title or chapters).
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.de.resx b/win/CS/HandBrakeWPF/Properties/Resources.de.resx
index 2821b1713..c4043d20a 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.de.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.de.resx
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
@@ -1215,12 +1215,6 @@ Soll sie überschrieben werden?</value>
<data name="Options_Encoding" xml:space="preserve">
<value>Enkodieren</value>
</data>
- <data name="Options_Experimental" xml:space="preserve">
- <value>Experimentelle Funktionen</value>
- </data>
- <data name="Options_ExperimentalFeatures" xml:space="preserve">
- <value>Experimentelle Funktionen sind Ideen an denen wir zur Zeit arbeiten. Dies kann es in eine finale Version schaffen, muss es aber nicht und es kann sein, dass es nicht korrekt funktioniert!</value>
- </data>
<data name="Options_Format" xml:space="preserve">
<value>Dateiformat:</value>
</data>
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index fca7a267f..b81d9dbe2 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -1230,12 +1230,6 @@ Would you like to overwrite it?</value>
<data name="Options_Encoding" xml:space="preserve">
<value>Encoding</value>
</data>
- <data name="Options_Experimental" xml:space="preserve">
- <value>Experimental Features</value>
- </data>
- <data name="Options_ExperimentalFeatures" xml:space="preserve">
- <value>Experimental features are ideas we are working on. These may or may not make it into a final release and may not work!</value>
- </data>
<data name="Options_Format" xml:space="preserve">
<value>File Format:</value>
</data>
@@ -1315,7 +1309,7 @@ Would you like to overwrite it?</value>
<value>Show the new experimental queue design.</value>
</data>
<data name="Options_ShowQueueInline" xml:space="preserve">
- <value>Show Queue in line with the main UI.</value>
+ <value>Show Queue in line with the main UI. (Experimental Feature)</value>
</data>
<data name="Options_TitleCase" xml:space="preserve">
<value>Change case to Title Case</value>
@@ -1945,4 +1939,19 @@ Non-Live Options: {date} {time} {creation-date} {creation-time} {quality} {bitra
<data name="OptionsView_PathOptions" xml:space="preserve">
<value>Available Options: {source_path} {source_folder_name} (Not both at the same time!)</value>
</data>
+ <data name="FileOverwriteBehaviours_Ask" xml:space="preserve">
+ <value>Ask to overwrite file</value>
+ </data>
+ <data name="FileOverwriteBehaviours_Autoname" xml:space="preserve">
+ <value>Try to automatically rename file</value>
+ </data>
+ <data name="FileOverwriteBehaviours_Overwrite" xml:space="preserve">
+ <value>Overwrite the file</value>
+ </data>
+ <data name="Options_UIBehaviour" xml:space="preserve">
+ <value>User Interface Behaviour</value>
+ </data>
+ <data name="OptionsView_FileOverwriteBehaviour" xml:space="preserve">
+ <value>File overwrite behaviour:</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.zh.resx b/win/CS/HandBrakeWPF/Properties/Resources.zh.resx
index ba8824273..d691e981a 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.zh.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.zh.resx
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
@@ -1219,12 +1219,6 @@ FPS: {3:000.0}, 平均FPS: {4:000.0}
<data name="Options_Encoding" xml:space="preserve">
<value>编码中</value>
</data>
- <data name="Options_Experimental" xml:space="preserve">
- <value>实验功能</value>
- </data>
- <data name="Options_ExperimentalFeatures" xml:space="preserve">
- <value>实验特性是我们正在研究的想法。这些可能或不可能使其成为最终版本,也可能不起作用!</value>
- </data>
<data name="Options_Format" xml:space="preserve">
<value>文件格式:</value>
</data>
diff --git a/win/CS/HandBrakeWPF/Services/UserSettingService.cs b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
index 8583787df..cc9e11145 100644
--- a/win/CS/HandBrakeWPF/Services/UserSettingService.cs
+++ b/win/CS/HandBrakeWPF/Services/UserSettingService.cs
@@ -176,7 +176,7 @@ namespace HandBrakeWPF.Services
using (StreamReader reader = new StreamReader(this.settingsFile))
{
string appSettings = reader.ReadToEnd();
- Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject< Dictionary<string, object>>(appSettings);
+ Dictionary<string, object> deserialisedSettings = JsonConvert.DeserializeObject<Dictionary<string, object>>(appSettings);
this.userSettings = deserialisedSettings;
}
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index a646fba53..28136a341 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -70,6 +70,7 @@ namespace HandBrakeWPF
public const string UiLanguage = "UiLanguage";
public const string ShowAddAllToQueue = "ShowAddAllToQueue";
public const string ShowAddSelectionToQueue = "ShowAddSelectionToQueue";
+ public const string FileOverwriteBehaviour = "FileOverwriteBehaviour";
#endregion
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 65fb6805e..6e9956645 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -32,6 +32,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Model.Audio;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Model.Subtitles;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Encode.EventArgs;
@@ -1358,10 +1359,14 @@ namespace HandBrakeWPF.ViewModels
if (File.Exists(this.CurrentTask.Destination))
{
- MessageBoxResult result = this.errorService.ShowMessageBox(string.Format(Resources.Main_QueueOverwritePrompt, Path.GetFileName(this.CurrentTask.Destination)), Resources.Question, MessageBoxButton.YesNo, MessageBoxImage.Question);
- if (result == MessageBoxResult.No)
+ FileOverwriteBehaviour behaviour = (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour, typeof(int));
+ if (behaviour == FileOverwriteBehaviour.Ask)
{
- return null; // Handled by the above action.
+ MessageBoxResult result = this.errorService.ShowMessageBox(string.Format(Resources.Main_QueueOverwritePrompt, Path.GetFileName(this.CurrentTask.Destination)), Resources.Question, MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if (result == MessageBoxResult.No)
+ {
+ return null; // Handled by the above action.
+ }
}
}
@@ -1543,7 +1548,7 @@ namespace HandBrakeWPF.ViewModels
{
dialog.InitialDirectory = mruDir;
}
-
+
bool? dialogResult = dialog.ShowDialog();
if (dialogResult.HasValue && dialogResult.Value)
@@ -1756,10 +1761,14 @@ namespace HandBrakeWPF.ViewModels
Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv|webm|*.webm",
CheckPathExists = true,
AddExtension = true,
- DefaultExt = ".mp4",
- OverwritePrompt = true,
+ DefaultExt = ".mp4",
};
+ saveFileDialog.OverwritePrompt =
+ (FileOverwriteBehaviour)this.userSettingService.GetUserSetting<int>(
+ UserSettingConstants.FileOverwriteBehaviour,
+ typeof(int)) == FileOverwriteBehaviour.Ask;
+
string extension = Path.GetExtension(this.CurrentTask.Destination);
saveFileDialog.FilterIndex = !string.IsNullOrEmpty(this.CurrentTask.Destination)
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 374b1bcee..f04ecbff9 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -24,6 +24,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.Interop.Utilities;
using HandBrakeWPF.Model;
+ using HandBrakeWPF.Model.Options;
using HandBrakeWPF.Properties;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Utilities;
@@ -101,12 +102,10 @@ namespace HandBrakeWPF.ViewModels
private bool enableQuickSyncEncoding;
private bool enableVceEncoder;
private bool enableNvencEncoder;
-
private InterfaceLanguage selectedLanguage;
-
private bool showAddSelectionToQueue;
-
private bool showAddAllToQueue;
+ private int selectedOverwriteBehaviour;
#endregion
@@ -649,6 +648,19 @@ namespace HandBrakeWPF.ViewModels
}
}
+ public BindingList<FileOverwriteBehaviour> FileOverwriteBehaviourList { get; set; }
+
+ public int SelectedOverwriteBehaviour
+ {
+ get => this.selectedOverwriteBehaviour;
+ set
+ {
+ if (value == this.selectedOverwriteBehaviour) return;
+ this.selectedOverwriteBehaviour = value;
+ this.NotifyOfPropertyChange(() => this.SelectedOverwriteBehaviour);
+ }
+ }
+
#endregion
#region Preview
@@ -1429,6 +1441,13 @@ namespace HandBrakeWPF.ViewModels
this.ChangeToTitleCase = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase);
this.RemovePunctuation = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.RemovePunctuation);
+ // File Overwrite
+ this.FileOverwriteBehaviourList = new BindingList<FileOverwriteBehaviour>();
+ this.FileOverwriteBehaviourList.Add(FileOverwriteBehaviour.Ask);
+ this.FileOverwriteBehaviourList.Add(FileOverwriteBehaviour.ForceOverwrite);
+ // this.FileOverwriteBehaviourList.Add(FileOverwriteBehaviour.Autoname);
+ this.SelectedOverwriteBehaviour = this.userSettingService.GetUserSetting<int>(UserSettingConstants.FileOverwriteBehaviour, typeof(int));
+
// #############################
// Picture Tab
// #############################
@@ -1578,6 +1597,7 @@ namespace HandBrakeWPF.ViewModels
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameRemoveUnderscore, this.RemoveUnderscores);
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNameTitleCase, this.ChangeToTitleCase);
this.userSettingService.SetUserSetting(UserSettingConstants.RemovePunctuation, this.RemovePunctuation);
+ this.userSettingService.SetUserSetting(UserSettingConstants.FileOverwriteBehaviour, this.SelectedOverwriteBehaviour);
/* Previews */
this.userSettingService.SetUserSetting(UserSettingConstants.VLCPath, this.VLCPath);
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 271b97421..690a1c341 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -120,6 +120,7 @@
<CheckBox Content="{x:Static Properties:Resources.Options_ClearCompleted}" IsChecked="{Binding ClearQueueOnEncodeCompleted}" />
<CheckBox Content="{x:Static Properties:Resources.OptionsView_ShowStatusInTitleBar}" IsChecked="{Binding ShowStatusInTitleBar}" />
<CheckBox Content="{x:Static Properties:Resources.OptionsView_ShowPreviewOnSummaryTab}" IsChecked="{Binding ShowPreviewOnSummaryTab}" />
+ <CheckBox Content="{x:Static Properties:Resources.Options_ShowQueueInline}" IsChecked="{Binding ShowQueueInline}" />
</StackPanel>
@@ -191,16 +192,6 @@
</StackPanel>
</StackPanel>
- <StackPanel Orientation="Vertical" Margin="0,0,0,10" Visibility="{Binding IsNightly, Converter={StaticResource boolToVisConverter}}">
-
- <TextBlock Text="{x:Static Properties:Resources.Options_Experimental}" FontSize="14" Margin="0,0,0,10"/>
-
- <StackPanel Orientation="Vertical" Margin="20,0,0,0">
- <TextBlock Text="{x:Static Properties:Resources.Options_ExperimentalFeatures}" Margin="0,0,0,10" TextWrapping="Wrap" />
-
- <CheckBox Content="{x:Static Properties:Resources.Options_ShowQueueInline}" IsChecked="{Binding ShowQueueInline}" Margin="20,5,0,0" />
- </StackPanel>
- </StackPanel>
</StackPanel>
<StackPanel Name="Output" Orientation="Vertical" Margin="10,5,0,0"
@@ -253,6 +244,16 @@
<TextBlock VerticalAlignment="Center" Text="{x:Static Properties:Resources.Options_MP4FileExtension}" />
<ComboBox Name="mp4FileExtension" Width="120" ItemsSource="{Binding Mp4ExtensionOptions}" SelectedIndex="{Binding SelectedMp4Extension}" HorizontalAlignment="Left" />
</StackPanel>
+
+ </StackPanel>
+
+ <TextBlock Text="{x:Static Properties:Resources.Options_UIBehaviour}" FontSize="14" Margin="0,20,0,10"/>
+ <StackPanel Orientation="Vertical" Margin="20,0,0,0">
+ <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
+
+ <TextBlock VerticalAlignment="Center" Text="{x:Static Properties:Resources.OptionsView_FileOverwriteBehaviour}" />
+ <ComboBox Width="200" ItemsSource="{Binding FileOverwriteBehaviourList, Converter={StaticResource enumComboConverter}}" SelectedIndex="{Binding SelectedOverwriteBehaviour}" HorizontalAlignment="Left" />
+ </StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
@@ -315,6 +316,7 @@
<CheckBox Content="{x:Static Properties:Resources.Options_PreventSleep}" IsChecked="{Binding PreventSleep}" />
<CheckBox Content="{x:Static Properties:Resources.Options_PauseQueueOnLowDiskSpace}"
IsChecked="{Binding PauseOnLowDiskspace}" />
+ <CheckBox Content="{x:Static Properties:Resources.Options_DvdRead}" IsChecked="{Binding DisableLibdvdNav}" />
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock Text="{x:Static Properties:Resources.Options_LowDiskspaceSize}" VerticalAlignment="Center" Width="250" />
<TextBox x:Name="PauseOnLowDiskspaceLEvel" Text="{Binding PauseOnLowDiskspaceLevel, Converter={StaticResource fileSizeConverter}, UpdateSourceTrigger=PropertyChanged}" Width="120"/>
@@ -343,15 +345,6 @@
</StackPanel>
</StackPanel>
- <StackPanel Orientation="Vertical" Margin="0,10,0,10">
-
- <TextBlock Text="{x:Static Properties:Resources.Options_DVD}" FontSize="14" Margin="0,0,0,10"/>
-
- <StackPanel Orientation="Vertical" Margin="20,0,0,0">
- <CheckBox Content="{x:Static Properties:Resources.Options_DvdRead}" IsChecked="{Binding DisableLibdvdNav}" />
- </StackPanel>
-
- </StackPanel>
<StackPanel Orientation="Vertical" Margin="0,10,0,10">
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 4667abb27..53e077ea4 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -521,4 +521,13 @@
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
</value>
</item>
+ <item>
+ <key>
+ <string>FileOverwriteBehaviour</string>
+ </key>
+ <value>
+ <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>
+
</dictionary> \ No newline at end of file