mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-19 09:01:32 +01:00
Merge pull request #85 from Tichau/feature/preset-category-ui
Preset category UI
This commit is contained in:
28 files changed
+2324
-498
No files matched your search
@@ -391,7 +391,7 @@ namespace FileConverter
|
||||
IConversionService conversionService = SimpleIoc.Default.GetInstance<IConversionService>();
|
||||
|
||||
// Create conversion jobs.
|
||||
Debug.Log("Create jobs for conversion preset: '{0}'", conversionPreset.Name);
|
||||
Debug.Log("Create jobs for conversion preset: '{0}'", conversionPreset.FullName);
|
||||
try
|
||||
{
|
||||
for (int index = 0; index < filePaths.Count; index++)
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace FileConverter.ConversionJobs
|
||||
this.State = ConversionState.Ready;
|
||||
}
|
||||
|
||||
Debug.Log("Job initialized: Preset: '{0}' Input: {1} Output: {2}", this.ConversionPreset.Name, this.InputFilePath, this.OutputFilePath);
|
||||
Debug.Log("Job initialized: Preset: '{0}' Input: {1} Output: {2}", this.ConversionPreset.FullName, this.InputFilePath, this.OutputFilePath);
|
||||
|
||||
if (this.State != ConversionState.Failed)
|
||||
{
|
||||
|
||||
@@ -7,20 +7,20 @@ namespace FileConverter
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
using FileConverter.Controls;
|
||||
using FileConverter.Services;
|
||||
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
|
||||
[XmlRoot]
|
||||
[XmlType]
|
||||
public class ConversionPreset : INotifyPropertyChanged, IDataErrorInfo, IXmlSerializable
|
||||
public class ConversionPreset : ObservableObject, IXmlSerializable
|
||||
{
|
||||
private string name;
|
||||
private string shortName;
|
||||
|
||||
private OutputType outputType;
|
||||
private List<string> inputTypes;
|
||||
private InputPostConversionAction inputPostConversionAction;
|
||||
@@ -29,12 +29,12 @@ namespace FileConverter
|
||||
|
||||
public ConversionPreset()
|
||||
{
|
||||
this.Name = Properties.Resources.DefaultPresetName;
|
||||
this.FullName = Properties.Resources.DefaultPresetName;
|
||||
}
|
||||
|
||||
public ConversionPreset(string name, OutputType outputType, params string[] inputTypes)
|
||||
public ConversionPreset(string shortName, OutputType outputType, params string[] inputTypes)
|
||||
{
|
||||
this.Name = name;
|
||||
this.ShortName = shortName;
|
||||
this.OutputType = outputType;
|
||||
List<string> inputTypeList = new List<string>();
|
||||
inputTypeList.AddRange(inputTypes);
|
||||
@@ -43,9 +43,10 @@ namespace FileConverter
|
||||
this.outputFileNameTemplate = "(p)(f)";
|
||||
}
|
||||
|
||||
public ConversionPreset(string name, ConversionPreset source, params string[] additionalInputTypes)
|
||||
public ConversionPreset(string shortName, ConversionPreset source, params string[] additionalInputTypes)
|
||||
{
|
||||
this.Name = name;
|
||||
this.ShortName = shortName;
|
||||
this.ParentFoldersNames = source.ParentFoldersNames;
|
||||
this.OutputType = source.outputType;
|
||||
List<string> inputTypeList = new List<string>();
|
||||
if (source.inputTypes != null)
|
||||
@@ -68,23 +69,61 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name
|
||||
[XmlAttribute("Name")]
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
string fullName = string.Empty;
|
||||
if (this.ParentFoldersNames != null)
|
||||
{
|
||||
foreach (string folder in this.ParentFoldersNames)
|
||||
{
|
||||
fullName += $"{folder}/";
|
||||
}
|
||||
}
|
||||
|
||||
fullName += this.shortName;
|
||||
|
||||
return fullName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
string[] folders = value.Split('/');
|
||||
if (folders.Length == 0)
|
||||
{
|
||||
Diagnostics.Debug.Log("Invalid full name.");
|
||||
this.ShortName = value;
|
||||
return;
|
||||
}
|
||||
|
||||
this.ShortName = folders[folders.Length - 1];
|
||||
Array.Resize(ref folders, folders.Length - 1);
|
||||
|
||||
this.ParentFoldersNames = folders;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string ShortName
|
||||
{
|
||||
get => this.shortName;
|
||||
|
||||
set
|
||||
{
|
||||
this.shortName = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string[] ParentFoldersNames
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public OutputType OutputType
|
||||
{
|
||||
@@ -97,7 +136,7 @@ namespace FileConverter
|
||||
{
|
||||
this.outputType = value;
|
||||
this.InitializeDefaultSettings(this.outputType);
|
||||
this.OnPropertyChanged();
|
||||
this.RaisePropertyChanged();
|
||||
this.CoerceInputTypes();
|
||||
}
|
||||
}
|
||||
@@ -125,7 +164,7 @@ namespace FileConverter
|
||||
this.inputTypes[index] = this.inputTypes[index].ToLowerInvariant();
|
||||
}
|
||||
|
||||
this.OnPropertyChanged();
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +179,7 @@ namespace FileConverter
|
||||
set
|
||||
{
|
||||
this.inputPostConversionAction = value;
|
||||
this.OnPropertyChanged();
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +223,7 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
this.RaisePropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +238,7 @@ namespace FileConverter
|
||||
set
|
||||
{
|
||||
this.outputFileNameTemplate = value;
|
||||
this.OnPropertyChanged();
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,35 +278,7 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
this.OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
string errorString = this.Validate("Name");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
errorString = this.Validate("OutputFileNameTemplate");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Validate(columnName);
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,14 +318,14 @@ namespace FileConverter
|
||||
}
|
||||
|
||||
this.inputTypes.Add(inputType);
|
||||
this.OnPropertyChanged(nameof(this.InputTypes));
|
||||
this.RaisePropertyChanged(nameof(this.InputTypes));
|
||||
}
|
||||
|
||||
public void RemoveInputType(string inputType)
|
||||
{
|
||||
if (this.inputTypes.Remove(inputType))
|
||||
{
|
||||
this.OnPropertyChanged(nameof(this.InputTypes));
|
||||
this.RaisePropertyChanged(nameof(this.InputTypes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +358,7 @@ namespace FileConverter
|
||||
|
||||
this.settings[settingsKey] = value;
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
this.RaisePropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
|
||||
public string GetSettingsValue(string settingsKey)
|
||||
@@ -388,12 +399,6 @@ namespace FileConverter
|
||||
return this.Settings.ContainsKey(settingsKey);
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void CoerceInputTypes()
|
||||
{
|
||||
if (this.inputTypes == null)
|
||||
@@ -529,7 +534,7 @@ namespace FileConverter
|
||||
throw new System.Exception("Missing default settings for type " + outputType);
|
||||
}
|
||||
|
||||
this.OnPropertyChanged(nameof(this.Settings));
|
||||
this.RaisePropertyChanged(nameof(this.Settings));
|
||||
}
|
||||
|
||||
private void InitializeSettingsValue(string settingsKey, string value, bool force = false)
|
||||
@@ -554,102 +559,6 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
private string Validate(string propertyName)
|
||||
{
|
||||
// Return error message if there is an error, else return empty or null string.
|
||||
switch (propertyName)
|
||||
{
|
||||
case "Name":
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.Name))
|
||||
{
|
||||
return "The preset name can't be empty.";
|
||||
}
|
||||
|
||||
if (this.Name.Contains(";"))
|
||||
{
|
||||
return "The preset name can't contains the character ';'.";
|
||||
}
|
||||
|
||||
ISettingsService settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
|
||||
int? count = settingsService.Settings?.ConversionPresets?.Count(match => match?.name == this.Name);
|
||||
if (count > 1)
|
||||
{
|
||||
return "The preset name is already used.";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "OutputFileNameTemplate":
|
||||
{
|
||||
string sampleOutputFilePath = this.GenerateOutputFilePath(FileConverter.Properties.Resources.OuputFileNameTemplateSample, 1, 3);
|
||||
if (string.IsNullOrEmpty(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must produce a non empty result.";
|
||||
}
|
||||
|
||||
if (!PathHelpers.IsPathValid(sampleOutputFilePath))
|
||||
{
|
||||
// Diagnostic to feedback purpose.
|
||||
// Drive letter.
|
||||
if (!PathHelpers.IsPathDriveLetterValid(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must define a root (for example c:\\, use (p) to use the input file path).";
|
||||
}
|
||||
|
||||
// File name.
|
||||
string filename = PathHelpers.GetFileName(sampleOutputFilePath);
|
||||
if (filename == null)
|
||||
{
|
||||
return "The output file name must not be empty (use (f) to use the name of the input file).";
|
||||
}
|
||||
|
||||
char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
for (int index = 0; index < invalidFileNameChars.Length; index++)
|
||||
{
|
||||
if (filename.Contains(invalidFileNameChars[index]))
|
||||
{
|
||||
return "The output file name must not contains the character '" + invalidFileNameChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
// Directory names.
|
||||
string path = sampleOutputFilePath.Substring(3, sampleOutputFilePath.Length - 3 - filename.Length);
|
||||
char[] invalidPathChars = System.IO.Path.GetInvalidPathChars();
|
||||
for (int index = 0; index < invalidPathChars.Length; index++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
|
||||
if (path.Contains(invalidPathChars[index]))
|
||||
{
|
||||
return "The output directory name must not contains the character '" + invalidPathChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
string[] directories = path.Split('\\');
|
||||
for (int index = 0; index < directories.Length; ++index)
|
||||
{
|
||||
string directoryName = directories[index];
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
}
|
||||
|
||||
return "The output filename template is invalid";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public struct ConversionSetting
|
||||
{
|
||||
public ConversionSetting(KeyValuePair<string, string> keyValuePair)
|
||||
|
||||
@@ -222,11 +222,14 @@
|
||||
<Compile Include="ValueConverters\Generic\StringToEnum.cs" />
|
||||
<Compile Include="ValueConverters\Generic\ValueConverterGroup.cs" />
|
||||
<Compile Include="ViewModels\DiagnosticsViewModel.cs" />
|
||||
<Compile Include="ViewModels\PresetNode.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
<Compile Include="ViewModels\HelpViewModel.cs" />
|
||||
<Compile Include="ViewModels\UpgradeViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainViewModel.cs" />
|
||||
<Compile Include="ViewModels\ViewModelLocator.cs" />
|
||||
<Compile Include="Views\BindableSelectedItemBehavior.cs" />
|
||||
<Compile Include="Views\DragDropExtension.cs" />
|
||||
<Compile Include="Views\HelpWindow.xaml.cs">
|
||||
<DependentUpon>HelpWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -257,6 +260,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</DesignData>
|
||||
<Page Include="SampleData\SettingsSampleData.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\HelpWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -392,6 +399,9 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\SettingsIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\FolderIcon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>copy /Y "$(SolutionDir)Middleware\ffmpeg\$(PlatformName)\ffmpeg.exe" "$(TargetDir)ffmpeg.exe"
|
||||
|
||||
+45
-9
@@ -303,6 +303,24 @@ namespace FileConverter.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create a new folder..
|
||||
/// </summary>
|
||||
public static string CreateANewFolder {
|
||||
get {
|
||||
return ResourceManager.GetString("CreateANewFolder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New folder.
|
||||
/// </summary>
|
||||
public static string DefaultFolderName {
|
||||
get {
|
||||
return ResourceManager.GetString("DefaultFolderName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New preset.
|
||||
/// </summary>
|
||||
@@ -879,15 +897,6 @@ namespace FileConverter.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to C:\Music\Artist\Album\Song.wav.
|
||||
/// </summary>
|
||||
public static string OuputFileNameTemplateSample {
|
||||
get {
|
||||
return ResourceManager.GetString("OuputFileNameTemplateSample", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Output.
|
||||
/// </summary>
|
||||
@@ -897,6 +906,15 @@ namespace FileConverter.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to C:\Music\Artist\Album\Song.wav.
|
||||
/// </summary>
|
||||
public static string OutputFileNameTemplateSample {
|
||||
get {
|
||||
return ResourceManager.GetString("OutputFileNameTemplateSample", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (p): input file path
|
||||
///(f): input filename
|
||||
@@ -940,6 +958,24 @@ namespace FileConverter.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Folder.
|
||||
/// </summary>
|
||||
public static string PresetFolder {
|
||||
get {
|
||||
return ResourceManager.GetString("PresetFolder", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Folder Name.
|
||||
/// </summary>
|
||||
public static string PresetFolderName {
|
||||
get {
|
||||
return ResourceManager.GetString("PresetFolderName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Preset Name.
|
||||
/// </summary>
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>180° rotation</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Music\Artist\Album\Song.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotación de 180° en el sentido del reloj</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Música\Artista\Album\Canción.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
|
||||
@@ -263,7 +263,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>rotation de 180°</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Musique\Artiste\Album\Chanson.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
<value>Rotazione di 180°</value>
|
||||
<comment>180° rotation</comment>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Musica\Artista\Album\Canzone.wav</value>
|
||||
<comment>C:\Music\Artist\Album\Song.wav</comment>
|
||||
</data>
|
||||
@@ -705,4 +705,4 @@ use maj for uppercase version</comment>
|
||||
<value>Errore durante l'inizializzazione del processo di conversione.</value>
|
||||
<comment>Error during conversion job initialization.</comment>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
@@ -255,7 +255,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotacionar 180°</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Música\Artista\Álbum\música.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>Rotacionar 180°</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Música\Artista\Álbum\música.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
<data name="OneEightyDegreesRotationTooltip" xml:space="preserve">
|
||||
<value>180° rotation</value>
|
||||
</data>
|
||||
<data name="OuputFileNameTemplateSample" xml:space="preserve">
|
||||
<data name="OutputFileNameTemplateSample" xml:space="preserve">
|
||||
<value>C:\Music\Artist\Album\Song.wav</value>
|
||||
</data>
|
||||
<data name="OutputExample" xml:space="preserve">
|
||||
@@ -550,4 +550,16 @@ use maj for uppercase version</value>
|
||||
<data name="ErrorDuringJobInitialization" xml:space="preserve">
|
||||
<value>Error during conversion job initialization.</value>
|
||||
</data>
|
||||
<data name="CreateANewFolder" xml:space="preserve">
|
||||
<value>Create a new folder.</value>
|
||||
</data>
|
||||
<data name="DefaultFolderName" xml:space="preserve">
|
||||
<value>New folder</value>
|
||||
</data>
|
||||
<data name="PresetFolder" xml:space="preserve">
|
||||
<value>Folder</value>
|
||||
</data>
|
||||
<data name="PresetFolderName" xml:space="preserve">
|
||||
<value>Folder Name</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -3,7 +3,6 @@
|
||||
ErrorMessage="There is no error for now"
|
||||
InputFilePath="C:\Path\To\AVery\Long\Location\WithAVeryNiceFile.png"
|
||||
OutputFilePath="C:\Path\To\AVery\Long\Location\WithAVeryNiceFile.jpg"
|
||||
IsCancelable="False"
|
||||
StartTime="08/07/2018 22:10:55"
|
||||
State="InProgress"
|
||||
StateFlags="None"
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<viewModels:SettingsViewModel
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:viewModels="clr-namespace:FileConverter.ViewModels"
|
||||
xmlns:fileConverter="clr-namespace:FileConverter">
|
||||
|
||||
<viewModels:SettingsViewModel.Settings>
|
||||
<fileConverter:Settings>
|
||||
<fileConverter:Settings.ConversionPresets>
|
||||
<fileConverter:ConversionPreset ShortName="To Avi" OutputType="Avi" OutputFileNameTemplate="(p)(f)"/>
|
||||
<fileConverter:ConversionPreset ShortName="To Mp4" OutputType="Mp4"></fileConverter:ConversionPreset>
|
||||
<fileConverter:ConversionPreset ShortName="To Mp3" OutputType="Mp3"></fileConverter:ConversionPreset>
|
||||
<fileConverter:ConversionPreset ShortName="To Png" OutputType="Png"></fileConverter:ConversionPreset>
|
||||
</fileConverter:Settings.ConversionPresets>
|
||||
</fileConverter:Settings>
|
||||
</viewModels:SettingsViewModel.Settings>
|
||||
|
||||
<viewModels:SettingsViewModel.PresetsRootFolder>
|
||||
<viewModels:PresetFolderNode Name="Root">
|
||||
<viewModels:PresetFolderNode.Children>
|
||||
<viewModels:PresetFolderNode Name="Advanced">
|
||||
<viewModels:PresetFolderNode.Children>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Small Avi" OutputType="Avi" OutputFileNameTemplate="(p)(f)"/>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Small Png" OutputType="Png"></fileConverter:ConversionPreset>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
</viewModels:PresetFolderNode.Children>
|
||||
</viewModels:PresetFolderNode>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Avi" OutputType="Avi" OutputFileNameTemplate="(p)(f)"/>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Mp4" OutputType="Mp4"></fileConverter:ConversionPreset>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Mp3" OutputType="Mp3"></fileConverter:ConversionPreset>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Png" OutputType="Png"></fileConverter:ConversionPreset>
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
</viewModels:PresetFolderNode.Children>
|
||||
</viewModels:PresetFolderNode>
|
||||
</viewModels:SettingsViewModel.PresetsRootFolder>
|
||||
|
||||
<viewModels:SettingsViewModel.SelectedPreset>
|
||||
<viewModels:PresetNode>
|
||||
<viewModels:PresetNode.Preset>
|
||||
<fileConverter:ConversionPreset ShortName="To Avi"
|
||||
OutputType="Avi"
|
||||
OutputFileNameTemplate="(p)(f)"
|
||||
InputPostConversionAction="None" />
|
||||
</viewModels:PresetNode.Preset>
|
||||
</viewModels:PresetNode>
|
||||
</viewModels:SettingsViewModel.SelectedPreset>
|
||||
</viewModels:SettingsViewModel>
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace FileConverter.Services
|
||||
registryEntries.Add(inputType, new List<string>());
|
||||
}
|
||||
|
||||
registryEntries[inputType].Add(conversionPreset.Name);
|
||||
registryEntries[inputType].Add(conversionPreset.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace FileConverter
|
||||
|
||||
[XmlRoot]
|
||||
[XmlType]
|
||||
public class Settings : ObservableObject, IDataErrorInfo, IXmlSerializable
|
||||
public class Settings : ObservableObject, IXmlSerializable
|
||||
{
|
||||
public const int Version = 4;
|
||||
|
||||
@@ -22,37 +22,10 @@ namespace FileConverter
|
||||
private bool checkUpgradeAtStartup = true;
|
||||
private CultureInfo applicationLanguage;
|
||||
private int maximumNumberOfSimultaneousConversions;
|
||||
|
||||
[XmlIgnore]
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int index = 0; index < this.ConversionPresets.Count; index++)
|
||||
{
|
||||
string error = this.ConversionPresets[index].Error;
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Error;
|
||||
}
|
||||
}
|
||||
|
||||
public ConversionPreset GetPresetFromName(string presetName)
|
||||
{
|
||||
return this.conversionPresets.FirstOrDefault(match => match.Name == presetName);
|
||||
return this.conversionPresets.FirstOrDefault(match => match.FullName == presetName);
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
@@ -73,7 +46,7 @@ namespace FileConverter
|
||||
for (int index = 0; index < settings.conversionPresets.Count; index++)
|
||||
{
|
||||
ConversionPreset conversionPreset = settings.conversionPresets[index];
|
||||
if (this.conversionPresets.Any(match => match.Name == conversionPreset.Name))
|
||||
if (this.conversionPresets.Any(match => match.FullName == conversionPreset.FullName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -72,52 +72,6 @@
|
||||
<Settings Key="AudioBitrate" Value="96" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4 (rotate left)" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Mp4 (rotate right)" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Webm" OutputType="Webm" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
@@ -506,76 +460,6 @@
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To small Png (25%)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="0.25" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)-small</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png (rotate left)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="90" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Png (rotate right)" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="270" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="To Jpg" OutputType="Jpg" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
@@ -647,5 +531,743 @@
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Mkv" OutputType="Mkv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Mp4" OutputType="Mp4" IsDefaultSettings="false">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Webm" OutputType="Webm" IsDefaultSettings="false">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="VideoQuality" Value="40" />
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Ogv" OutputType="Ogv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="8" />
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Avi" OutputType="Avi" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="27" />
|
||||
<Settings Key="VideoScale" Value="0.75" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Png" OutputType="Png" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="0.75" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)-small</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Webp" OutputType="Webp" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="0.75" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 75%/To Jpg" OutputType="Jpg" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="0.75" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Mkv" OutputType="Mkv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="0.25" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Mp4" OutputType="Mp4" IsDefaultSettings="false">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="0.25" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Webm" OutputType="Webm" IsDefaultSettings="false">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="VideoQuality" Value="40" />
|
||||
<Settings Key="VideoScale" Value="0.25" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Ogv" OutputType="Ogv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="8" />
|
||||
<Settings Key="VideoScale" Value="0.25" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Avi" OutputType="Avi" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="27" />
|
||||
<Settings Key="VideoScale" Value="0.25" />
|
||||
<Settings Key="VideoRotation" Value="0" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Png" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="0.25" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)-small</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Webp" OutputType="Webp" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="0.25" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Scale 25%/To Jpg" OutputType="Jpg" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="0.25" />
|
||||
<Settings Key="ImageRotation" Value="0" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Mkv" OutputType="Mkv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Mp4" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Mp4 (low quality)" OutputType="Mp4" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="20" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="96" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Webm" OutputType="Webm" IsDefaultSettings="false">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="VideoQuality" Value="40" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Ogv" OutputType="Ogv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="8" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Avi" OutputType="Avi" IsDefaultSettings="false">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="27" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="90" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Png" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="90" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate left/To Jpg" OutputType="Jpg" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="90" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Mkv" OutputType="Mkv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Mp4" OutputType="Mp4" IsDefaultSettings="true">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="30" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="155" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Mp4 (low quality)" OutputType="Mp4" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="20" />
|
||||
<Settings Key="VideoEncodingSpeed" Value="Medium" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="96" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Webm" OutputType="Webm" IsDefaultSettings="false">
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<Settings Key="VideoQuality" Value="40" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Ogv" OutputType="Ogv" IsDefaultSettings="false">
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="8" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="160" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Avi" OutputType="Avi" IsDefaultSettings="false">
|
||||
<InputTypes>gif</InputTypes>
|
||||
<InputTypes>3gp</InputTypes>
|
||||
<InputTypes>avi</InputTypes>
|
||||
<InputTypes>bik</InputTypes>
|
||||
<InputTypes>flv</InputTypes>
|
||||
<InputTypes>m4v</InputTypes>
|
||||
<InputTypes>mkv</InputTypes>
|
||||
<InputTypes>mov</InputTypes>
|
||||
<InputTypes>mp4</InputTypes>
|
||||
<InputTypes>mpeg</InputTypes>
|
||||
<InputTypes>ogv</InputTypes>
|
||||
<InputTypes>webm</InputTypes>
|
||||
<InputTypes>wmv</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="EnableAudio" Value="True" />
|
||||
<Settings Key="VideoQuality" Value="27" />
|
||||
<Settings Key="VideoScale" Value="1" />
|
||||
<Settings Key="VideoRotation" Value="270" />
|
||||
<Settings Key="AudioBitrate" Value="190" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Png" OutputType="Png" IsDefaultSettings="true">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="270" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<ConversionPreset Name="Rotate right/To Jpg" OutputType="Jpg" IsDefaultSettings="false">
|
||||
<InputTypes>arw</InputTypes>
|
||||
<InputTypes>bmp</InputTypes>
|
||||
<InputTypes>cr2</InputTypes>
|
||||
<InputTypes>exr</InputTypes>
|
||||
<InputTypes>ico</InputTypes>
|
||||
<InputTypes>jpg</InputTypes>
|
||||
<InputTypes>jpeg</InputTypes>
|
||||
<InputTypes>raf</InputTypes>
|
||||
<InputTypes>png</InputTypes>
|
||||
<InputTypes>psd</InputTypes>
|
||||
<InputTypes>svg</InputTypes>
|
||||
<InputTypes>tga</InputTypes>
|
||||
<InputTypes>tif</InputTypes>
|
||||
<InputTypes>tiff</InputTypes>
|
||||
<InputTypes>xcf</InputTypes>
|
||||
<InputTypes>webp</InputTypes>
|
||||
<InputPostConversionAction>None</InputPostConversionAction>
|
||||
<Settings Key="ImageQuality" Value="40" />
|
||||
<Settings Key="ImageScale" Value="1" />
|
||||
<Settings Key="ImageRotation" Value="270" />
|
||||
<Settings Key="ImageClampSizePowerOf2" Value="False" />
|
||||
<Settings Key="ImageMaximumSize" Value="0" />
|
||||
<OutputFileNameTemplate>(p)(f)</OutputFileNameTemplate>
|
||||
</ConversionPreset>
|
||||
<CheckUpgradeAtStartup>true</CheckUpgradeAtStartup>
|
||||
</Settings>
|
||||
@@ -3,12 +3,9 @@
|
||||
namespace FileConverter.ViewModels
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public class InputExtensionCategory : INotifyPropertyChanged
|
||||
public class InputExtensionCategory : ObservableObject
|
||||
{
|
||||
private string name;
|
||||
private List<InputExtension> inputExtensions = new List<InputExtension>();
|
||||
@@ -18,8 +15,6 @@ namespace FileConverter.ViewModels
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
@@ -30,7 +25,7 @@ namespace FileConverter.ViewModels
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.OnPropertyChanged();
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,15 +55,9 @@ namespace FileConverter.ViewModels
|
||||
{
|
||||
inputExtension = new InputExtension(extension);
|
||||
this.inputExtensions.Add(inputExtension);
|
||||
this.OnPropertyChanged("InputExtensions");
|
||||
this.OnPropertyChanged("InputExtensionNames");
|
||||
this.RaisePropertyChanged("InputExtensions");
|
||||
this.RaisePropertyChanged("InputExtensionNames");
|
||||
}
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
// <copyright file="PresetNode.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace FileConverter.ViewModels
|
||||
{
|
||||
public abstract class AbstractTreeNode : ObservableObject, IDataErrorInfo
|
||||
{
|
||||
private PresetFolderNode parent;
|
||||
|
||||
protected AbstractTreeNode(PresetFolderNode parent)
|
||||
{
|
||||
this.Parent = parent;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
protected AbstractTreeNode()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public PresetFolderNode Parent
|
||||
{
|
||||
get => this.parent;
|
||||
set
|
||||
{
|
||||
this.parent = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string this[string columnName] => this.Validate(columnName);
|
||||
|
||||
public bool HasError => !string.IsNullOrEmpty(this.Error);
|
||||
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.Parent == null)
|
||||
{
|
||||
// This is the root folder. Don't check rules on this specific folder.
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string errorString = this.Validate("Name");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
errorString = this.Validate("OutputFileNameTemplate");
|
||||
if (!string.IsNullOrEmpty(errorString))
|
||||
{
|
||||
return errorString;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual string Validate(string propertyName)
|
||||
{
|
||||
// Return error message if there is an error, else return empty or null string.
|
||||
switch (propertyName)
|
||||
{
|
||||
case "Name":
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.Name))
|
||||
{
|
||||
return "The preset name can't be empty.";
|
||||
}
|
||||
|
||||
if (this.Name.Contains(";"))
|
||||
{
|
||||
return "The preset name can't contains the character ';'.";
|
||||
}
|
||||
|
||||
if (this.Name.Contains("/"))
|
||||
{
|
||||
return "The preset name can't contains the character '/'.";
|
||||
}
|
||||
|
||||
if (this.Parent != null)
|
||||
{
|
||||
int count = this.Parent.Children.Count(node => node.Name == this.Name);
|
||||
if (count > 1)
|
||||
{
|
||||
return "The preset name is already used.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public class PresetNode : AbstractTreeNode
|
||||
{
|
||||
public PresetNode(ConversionPreset preset, PresetFolderNode parent) : base(parent)
|
||||
{
|
||||
this.Preset = preset;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public PresetNode() : base()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public ConversionPreset Preset
|
||||
{
|
||||
get;
|
||||
#if DEBUG
|
||||
set;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get => this.Preset.ShortName;
|
||||
|
||||
set
|
||||
{
|
||||
this.Preset.ShortName = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.HasError));
|
||||
}
|
||||
}
|
||||
|
||||
public string OutputFileNameTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Preset.OutputFileNameTemplate;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.Preset.OutputFileNameTemplate = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected override string Validate(string propertyName)
|
||||
{
|
||||
string error = base.Validate(propertyName);
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
// Return error message if there is an error, else return empty or null string.
|
||||
switch (propertyName)
|
||||
{
|
||||
case "OutputFileNameTemplate":
|
||||
{
|
||||
string sampleOutputFilePath = this.Preset.GenerateOutputFilePath(FileConverter.Properties.Resources.OutputFileNameTemplateSample, 1, 3);
|
||||
if (string.IsNullOrEmpty(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must produce a non empty result.";
|
||||
}
|
||||
|
||||
if (!PathHelpers.IsPathValid(sampleOutputFilePath))
|
||||
{
|
||||
// Diagnostic to feedback purpose.
|
||||
// Drive letter.
|
||||
if (!PathHelpers.IsPathDriveLetterValid(sampleOutputFilePath))
|
||||
{
|
||||
return "The output filename template must define a root (for example c:\\, use (p) to use the input file path).";
|
||||
}
|
||||
|
||||
// File name.
|
||||
string filename = PathHelpers.GetFileName(sampleOutputFilePath);
|
||||
if (filename == null)
|
||||
{
|
||||
return "The output file name must not be empty (use (f) to use the name of the input file).";
|
||||
}
|
||||
|
||||
char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars();
|
||||
for (int index = 0; index < invalidFileNameChars.Length; index++)
|
||||
{
|
||||
if (filename.Contains(invalidFileNameChars[index]))
|
||||
{
|
||||
return "The output file name must not contains the character '" + invalidFileNameChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
// Directory names.
|
||||
string path = sampleOutputFilePath.Substring(3, sampleOutputFilePath.Length - 3 - filename.Length);
|
||||
char[] invalidPathChars = System.IO.Path.GetInvalidPathChars();
|
||||
for (int index = 0; index < invalidPathChars.Length; index++)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
|
||||
if (path.Contains(invalidPathChars[index]))
|
||||
{
|
||||
return "The output directory name must not contains the character '" + invalidPathChars[index] + "'.";
|
||||
}
|
||||
}
|
||||
|
||||
string[] directories = path.Split('\\');
|
||||
for (int index = 0; index < directories.Length; ++index)
|
||||
{
|
||||
string directoryName = directories[index];
|
||||
if (string.IsNullOrEmpty(directoryName))
|
||||
{
|
||||
return "The output directory name must not be empty (use (d0), (d1), ... to use the name of the parent directories of the input file).";
|
||||
}
|
||||
}
|
||||
|
||||
return "The output filename template is invalid";
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public class PresetFolderNode : AbstractTreeNode
|
||||
{
|
||||
private string name;
|
||||
private ObservableCollection<AbstractTreeNode> children = new ObservableCollection<AbstractTreeNode>();
|
||||
|
||||
public PresetFolderNode(string name, PresetFolderNode parent) : base(parent)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public PresetFolderNode() : base()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get => this.name;
|
||||
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.HasError));
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<AbstractTreeNode> Children
|
||||
{
|
||||
get => this.children;
|
||||
|
||||
set
|
||||
{
|
||||
this.children = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNodeInHierarchy(AbstractTreeNode node, bool recurse)
|
||||
{
|
||||
Diagnostics.Debug.Assert(node != null, "node != null");
|
||||
foreach (ObservableObject child in this.Children)
|
||||
{
|
||||
if (child == node)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (recurse && child is PresetFolderNode subFolder)
|
||||
{
|
||||
if (subFolder.IsNodeInHierarchy(node, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ namespace FileConverter.ViewModels
|
||||
using System.Windows.Input;
|
||||
|
||||
using FileConverter.Services;
|
||||
using FileConverter.Views;
|
||||
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
@@ -32,15 +33,18 @@ namespace FileConverter.ViewModels
|
||||
/// See http://www.galasoft.ch/mvvm
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class SettingsViewModel : ViewModelBase
|
||||
public class SettingsViewModel : ViewModelBase, IDataErrorInfo
|
||||
{
|
||||
private InputExtensionCategory[] inputCategories;
|
||||
private ConversionPreset selectedPreset;
|
||||
private PresetFolderNode presetsRootFolder;
|
||||
private PresetFolderNode selectedFolder;
|
||||
private PresetNode selectedPreset;
|
||||
private Settings settings;
|
||||
private bool displaySeeChangeLogLink = true;
|
||||
|
||||
private RelayCommand<string> openUrlCommand;
|
||||
private RelayCommand getChangeLogContentCommand;
|
||||
private RelayCommand createFolderCommand;
|
||||
private RelayCommand movePresetUpCommand;
|
||||
private RelayCommand movePresetDownCommand;
|
||||
private RelayCommand addNewPresetCommand;
|
||||
@@ -56,12 +60,21 @@ namespace FileConverter.ViewModels
|
||||
/// </summary>
|
||||
public SettingsViewModel()
|
||||
{
|
||||
this.getChangeLogContentCommand = new RelayCommand(this.DownloadChangeLogAction);
|
||||
this.openUrlCommand = new RelayCommand<string>((url) => Process.Start(url));
|
||||
this.createFolderCommand = new RelayCommand(this.CreateFolder);
|
||||
this.movePresetUpCommand = new RelayCommand(this.MoveSelectedPresetUp, this.CanMoveSelectedPresetUp);
|
||||
this.movePresetDownCommand = new RelayCommand(this.MoveSelectedPresetDown, this.CanMoveSelectedPresetDown);
|
||||
this.addNewPresetCommand = new RelayCommand(this.AddNewPreset);
|
||||
this.removePresetCommand = new RelayCommand(this.RemoveSelectedPreset, this.CanRemoveSelectedPreset);
|
||||
this.saveCommand = new RelayCommand(this.SaveSettings, this.CanSaveSettings);
|
||||
this.closeCommand = new RelayCommand<CancelEventArgs>(this.CloseSettings);
|
||||
|
||||
if (this.IsInDesignMode)
|
||||
{
|
||||
// Code runs in Blend --> create design time data.
|
||||
this.Settings = new Settings();
|
||||
this.Settings.ConversionPresets.Add(new ConversionPreset("Test", OutputType.Mp3));
|
||||
this.SelectedPreset = new ConversionPreset("Test", OutputType.Mp3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -91,6 +104,7 @@ namespace FileConverter.ViewModels
|
||||
this.SupportedCultures = Helpers.GetSupportedCultures().ToArray();
|
||||
|
||||
this.InitializeCompatibleInputExtensions();
|
||||
this.InitializePresetFolders();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +120,7 @@ namespace FileConverter.ViewModels
|
||||
for (int index = 0; index < this.inputCategories.Length; index++)
|
||||
{
|
||||
InputExtensionCategory category = this.inputCategories[index];
|
||||
if (this.SelectedPreset == null || Helpers.IsOutputTypeCompatibleWithCategory(this.SelectedPreset.OutputType, category.Name))
|
||||
if (this.SelectedPreset == null || Helpers.IsOutputTypeCompatibleWithCategory(this.SelectedPreset.Preset.OutputType, category.Name))
|
||||
{
|
||||
yield return category;
|
||||
}
|
||||
@@ -121,7 +135,68 @@ namespace FileConverter.ViewModels
|
||||
InputPostConversionAction.Delete,
|
||||
};
|
||||
|
||||
public ConversionPreset SelectedPreset
|
||||
public PresetFolderNode PresetsRootFolder
|
||||
{
|
||||
get => this.presetsRootFolder;
|
||||
|
||||
set
|
||||
{
|
||||
this.presetsRootFolder = value;
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractTreeNode SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.SelectedFolder != null)
|
||||
{
|
||||
return this.SelectedFolder;
|
||||
}
|
||||
|
||||
return this.SelectedPreset;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value is PresetNode preset)
|
||||
{
|
||||
this.SelectedPreset = preset;
|
||||
this.SelectedFolder = null;
|
||||
}
|
||||
else if (value is PresetFolderNode folder)
|
||||
{
|
||||
this.SelectedFolder = folder;
|
||||
this.SelectedPreset = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SelectedPreset = null;
|
||||
this.SelectedFolder = null;
|
||||
}
|
||||
|
||||
this.RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public PresetFolderNode SelectedFolder
|
||||
{
|
||||
get => this.selectedFolder;
|
||||
|
||||
set
|
||||
{
|
||||
this.selectedFolder = value;
|
||||
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.SelectedItem));
|
||||
this.movePresetUpCommand?.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand?.RaiseCanExecuteChanged();
|
||||
this.removePresetCommand?.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public PresetNode SelectedPreset
|
||||
{
|
||||
get => this.selectedPreset;
|
||||
|
||||
@@ -129,20 +204,22 @@ namespace FileConverter.ViewModels
|
||||
{
|
||||
if (this.selectedPreset != null)
|
||||
{
|
||||
this.selectedPreset.PropertyChanged -= this.SelectedPresetPropertyChanged;
|
||||
this.selectedPreset.Preset.PropertyChanged -= this.SelectedPresetPropertyChanged;
|
||||
}
|
||||
|
||||
this.selectedPreset = value;
|
||||
|
||||
if (this.selectedPreset != null)
|
||||
{
|
||||
this.selectedPreset.PropertyChanged += this.SelectedPresetPropertyChanged;
|
||||
this.selectedPreset.Preset.PropertyChanged += this.SelectedPresetPropertyChanged;
|
||||
}
|
||||
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.SelectedItem));
|
||||
this.RaisePropertyChanged(nameof(this.InputCategories));
|
||||
this.movePresetUpCommand?.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand?.RaiseCanExecuteChanged();
|
||||
this.removePresetCommand?.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,108 +269,74 @@ namespace FileConverter.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand GetChangeLogContentCommand
|
||||
public ICommand GetChangeLogContentCommand => this.getChangeLogContentCommand;
|
||||
|
||||
public ICommand OpenUrlCommand => this.openUrlCommand;
|
||||
|
||||
public ICommand CreateFolderCommand => this.createFolderCommand;
|
||||
|
||||
public ICommand MovePresetUpCommand => this.movePresetUpCommand;
|
||||
|
||||
public ICommand MovePresetDownCommand => this.movePresetDownCommand;
|
||||
|
||||
public ICommand AddNewPresetCommand => this.addNewPresetCommand;
|
||||
|
||||
public ICommand RemoveSelectedPresetCommand => this.removePresetCommand;
|
||||
|
||||
public ICommand SaveCommand => this.saveCommand;
|
||||
|
||||
public ICommand CloseCommand => this.closeCommand;
|
||||
|
||||
public TreeViewSelectionBehavior.IsChildOfPredicate PresetsHierarchyPredicate => (object nodeA, object nodeB) =>
|
||||
{
|
||||
if (nodeA is PresetNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PresetFolderNode parentFolder = nodeA as PresetFolderNode;
|
||||
Diagnostics.Debug.Assert(parentFolder != null, "Node should be a preset folder.");
|
||||
|
||||
return parentFolder.IsNodeInHierarchy(nodeB as AbstractTreeNode, true);
|
||||
};
|
||||
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.getChangeLogContentCommand == null)
|
||||
string nodeError = this.CheckErrorRecursively(this.presetsRootFolder);
|
||||
if (!string.IsNullOrEmpty(nodeError))
|
||||
{
|
||||
this.getChangeLogContentCommand = new RelayCommand(this.DownloadChangeLogAction);
|
||||
return nodeError;
|
||||
}
|
||||
|
||||
return this.getChangeLogContentCommand;
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand OpenUrlCommand
|
||||
public string this[string columnName] => this.Error;
|
||||
|
||||
private string CheckErrorRecursively(AbstractTreeNode node)
|
||||
{
|
||||
get
|
||||
string nodeError = node.Error;
|
||||
if (!string.IsNullOrEmpty(nodeError))
|
||||
{
|
||||
if (this.openUrlCommand == null)
|
||||
{
|
||||
this.openUrlCommand = new RelayCommand<string>((url) => Process.Start(url));
|
||||
}
|
||||
|
||||
return this.openUrlCommand;
|
||||
return nodeError;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand MovePresetUpCommand
|
||||
{
|
||||
get
|
||||
if (node is PresetFolderNode folder)
|
||||
{
|
||||
if (this.movePresetUpCommand == null)
|
||||
foreach (AbstractTreeNode child in folder.Children)
|
||||
{
|
||||
this.movePresetUpCommand = new RelayCommand(this.MoveSelectedPresetUp, this.CanMoveSelectedPresetUp);
|
||||
nodeError = this.CheckErrorRecursively(child);
|
||||
if (!string.IsNullOrEmpty(nodeError))
|
||||
{
|
||||
return nodeError;
|
||||
}
|
||||
}
|
||||
|
||||
return this.movePresetUpCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand MovePresetDownCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.movePresetDownCommand == null)
|
||||
{
|
||||
this.movePresetDownCommand = new RelayCommand(this.MoveSelectedPresetDown, this.CanMoveSelectedPresetDown);
|
||||
}
|
||||
|
||||
return this.movePresetDownCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand AddNewPresetCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.addNewPresetCommand == null)
|
||||
{
|
||||
this.addNewPresetCommand = new RelayCommand(this.AddNewPreset);
|
||||
}
|
||||
|
||||
return this.addNewPresetCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand RemoveSelectedPresetCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.removePresetCommand == null)
|
||||
{
|
||||
this.removePresetCommand = new RelayCommand(this.RemoveSelectedPreset, this.CanRemoveSelectedPreset);
|
||||
}
|
||||
|
||||
return this.removePresetCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand SaveCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.saveCommand == null)
|
||||
{
|
||||
this.saveCommand = new RelayCommand(this.SaveSettings, this.CanSaveSettings);
|
||||
}
|
||||
|
||||
return this.saveCommand;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand CloseCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.closeCommand == null)
|
||||
{
|
||||
this.closeCommand = new RelayCommand<CancelEventArgs>(this.CloseSettings);
|
||||
}
|
||||
|
||||
return this.closeCommand;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private void SelectedPresetPropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
|
||||
@@ -306,6 +349,11 @@ namespace FileConverter.ViewModels
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private void NodePropertyChanged(object sender, PropertyChangedEventArgs eventArgs)
|
||||
{
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private void DownloadChangeLogAction()
|
||||
{
|
||||
IUpgradeService upgradeService = SimpleIoc.Default.GetInstance<IUpgradeService>();
|
||||
@@ -349,7 +397,62 @@ namespace FileConverter.ViewModels
|
||||
this.inputCategories = categories.ToArray();
|
||||
this.RaisePropertyChanged(nameof(this.InputCategories));
|
||||
}
|
||||
|
||||
|
||||
private void InitializePresetFolders()
|
||||
{
|
||||
this.presetsRootFolder = new PresetFolderNode(null, null);
|
||||
foreach (ConversionPreset preset in this.Settings.ConversionPresets)
|
||||
{
|
||||
PresetFolderNode parent = this.presetsRootFolder;
|
||||
foreach (string folderName in preset.ParentFoldersNames)
|
||||
{
|
||||
PresetFolderNode subFolder = parent.Children.FirstOrDefault(match => match is PresetFolderNode && ((PresetFolderNode)match).Name == folderName) as PresetFolderNode;
|
||||
if (subFolder == null)
|
||||
{
|
||||
subFolder = new PresetFolderNode(folderName, parent);
|
||||
parent.Children.Add(subFolder);
|
||||
|
||||
subFolder.PropertyChanged += this.NodePropertyChanged;
|
||||
}
|
||||
|
||||
parent = subFolder;
|
||||
}
|
||||
|
||||
PresetNode presetNode = new PresetNode(preset, parent);
|
||||
parent.Children.Add(presetNode);
|
||||
|
||||
presetNode.PropertyChanged += this.NodePropertyChanged;
|
||||
}
|
||||
|
||||
this.RaisePropertyChanged(nameof(this.PresetsRootFolder));
|
||||
}
|
||||
|
||||
private void ComputePresetsParentFoldersNamesAndFillSettings(AbstractTreeNode node, List<string> folderNamesCache)
|
||||
{
|
||||
if (node is PresetFolderNode folder)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(folder.Name))
|
||||
{
|
||||
folderNamesCache.Add(folder.Name);
|
||||
}
|
||||
|
||||
foreach (var child in folder.Children)
|
||||
{
|
||||
this.ComputePresetsParentFoldersNamesAndFillSettings(child, folderNamesCache);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(folder.Name))
|
||||
{
|
||||
folderNamesCache.RemoveAt(folderNamesCache.Count - 1);
|
||||
}
|
||||
}
|
||||
else if (node is PresetNode preset)
|
||||
{
|
||||
preset.Preset.ParentFoldersNames = folderNamesCache.ToArray();
|
||||
this.settings.ConversionPresets.Add(preset.Preset);
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseSettings(CancelEventArgs args)
|
||||
{
|
||||
ISettingsService settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
|
||||
@@ -361,11 +464,15 @@ namespace FileConverter.ViewModels
|
||||
|
||||
private bool CanSaveSettings()
|
||||
{
|
||||
return this.settings != null && string.IsNullOrEmpty(this.settings.Error);
|
||||
return string.IsNullOrEmpty(this.Error);
|
||||
}
|
||||
|
||||
private void SaveSettings()
|
||||
{
|
||||
// Compute parent folder names.
|
||||
this.settings.ConversionPresets.Clear();
|
||||
this.ComputePresetsParentFoldersNamesAndFillSettings(this.presetsRootFolder, new List<string>());
|
||||
|
||||
// Save changes.
|
||||
ISettingsService settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
|
||||
settingsService.SaveSettings();
|
||||
@@ -373,108 +480,255 @@ namespace FileConverter.ViewModels
|
||||
INavigationService navigationService = SimpleIoc.Default.GetInstance<INavigationService>();
|
||||
navigationService.Close(Pages.Settings, false);
|
||||
}
|
||||
|
||||
|
||||
private void CreateFolder()
|
||||
{
|
||||
PresetFolderNode parent;
|
||||
if (this.SelectedFolder != null)
|
||||
{
|
||||
parent = this.SelectedFolder;
|
||||
}
|
||||
else if (this.SelectedItem != null)
|
||||
{
|
||||
parent = this.SelectedItem.Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = this.presetsRootFolder;
|
||||
}
|
||||
|
||||
int insertIndex = parent.Children.IndexOf(this.SelectedItem) + 1;
|
||||
if (insertIndex < 0)
|
||||
{
|
||||
insertIndex = parent.Children.Count;
|
||||
}
|
||||
|
||||
// Generate a unique folder name.
|
||||
string folderName = Properties.Resources.DefaultFolderName;
|
||||
int index = 1;
|
||||
while (parent.Children.Any(match => match is PresetFolderNode folder && folder.Name == folderName))
|
||||
{
|
||||
index++;
|
||||
folderName = $"{Properties.Resources.DefaultFolderName} ({index})";
|
||||
}
|
||||
|
||||
PresetFolderNode newFolder = new PresetFolderNode(folderName, parent);
|
||||
|
||||
parent.Children.Insert(insertIndex, newFolder);
|
||||
|
||||
newFolder.PropertyChanged += this.NodePropertyChanged;
|
||||
|
||||
this.SelectedItem = newFolder;
|
||||
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
|
||||
Messenger.Default.Send<string>("FolderName", "DoFocus");
|
||||
}
|
||||
|
||||
private bool CanMoveSelectedPresetUp()
|
||||
{
|
||||
ConversionPreset presetToMove = this.SelectedPreset;
|
||||
if (presetToMove == null)
|
||||
if (this.SelectedItem == null)
|
||||
{
|
||||
// no preset selected.
|
||||
return false;
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.settings.ConversionPresets.IndexOf(presetToMove);
|
||||
if (this.SelectedItem.Parent != this.presetsRootFolder)
|
||||
{
|
||||
// The parent is not the root, we can move the preset up.
|
||||
return true;
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.SelectedItem.Parent.Children.IndexOf(this.SelectedItem);
|
||||
return indexOfSelectedPreset > 0;
|
||||
}
|
||||
|
||||
private void MoveSelectedPresetUp()
|
||||
{
|
||||
ConversionPreset presetToMove = this.SelectedPreset;
|
||||
if (presetToMove == null)
|
||||
Diagnostics.Debug.Assert(this.SelectedItem != null, "this.SelectedItem != null");
|
||||
|
||||
AbstractTreeNode itemToMoveUp = this.SelectedItem;
|
||||
PresetFolderNode currentParent = itemToMoveUp.Parent;
|
||||
int indexOfSelectedPreset = currentParent.Children.IndexOf(itemToMoveUp);
|
||||
if (indexOfSelectedPreset == 0)
|
||||
{
|
||||
return;
|
||||
// Move to the parent folder.
|
||||
int indexOfFolder = currentParent.Parent.Children.IndexOf(currentParent);
|
||||
currentParent.Children.RemoveAt(indexOfSelectedPreset);
|
||||
currentParent.Parent.Children.Insert(indexOfFolder, itemToMoveUp);
|
||||
itemToMoveUp.Parent = currentParent.Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
int newIndexOfSelectedPreset = System.Math.Max(0, indexOfSelectedPreset - 1);
|
||||
if (currentParent.Children[newIndexOfSelectedPreset] is PresetFolderNode newParent)
|
||||
{
|
||||
// Move to child folder.
|
||||
currentParent.Children.RemoveAt(indexOfSelectedPreset);
|
||||
newParent.Children.Add(itemToMoveUp);
|
||||
itemToMoveUp.Parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Swap nodes.
|
||||
currentParent.Children.Move(indexOfSelectedPreset, newIndexOfSelectedPreset);
|
||||
}
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.settings.ConversionPresets.IndexOf(presetToMove);
|
||||
int newIndexOfSelectedPreset = System.Math.Max(0, indexOfSelectedPreset - 1);
|
||||
|
||||
this.settings.ConversionPresets.Move(indexOfSelectedPreset, newIndexOfSelectedPreset);
|
||||
this.movePresetUpCommand?.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand?.RaiseCanExecuteChanged();
|
||||
this.SelectedItem = itemToMoveUp;
|
||||
this.movePresetUpCommand.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand.RaiseCanExecuteChanged();
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private bool CanMoveSelectedPresetDown()
|
||||
{
|
||||
ConversionPreset presetToMove = this.SelectedPreset;
|
||||
if (presetToMove == null)
|
||||
if (this.SelectedItem == null)
|
||||
{
|
||||
// no preset selected.
|
||||
return false;
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.settings.ConversionPresets.IndexOf(presetToMove);
|
||||
return indexOfSelectedPreset < this.settings.ConversionPresets.Count - 1;
|
||||
if (this.SelectedItem.Parent != this.presetsRootFolder)
|
||||
{
|
||||
// The parent is not the root, we can move the preset down.
|
||||
return true;
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.SelectedItem.Parent.Children.IndexOf(this.SelectedItem);
|
||||
return indexOfSelectedPreset < this.SelectedItem.Parent.Children.Count - 1;
|
||||
}
|
||||
|
||||
private void MoveSelectedPresetDown()
|
||||
{
|
||||
ConversionPreset presetToMove = this.SelectedPreset;
|
||||
if (presetToMove == null)
|
||||
Diagnostics.Debug.Assert(this.SelectedItem != null, "this.SelectedItem != null");
|
||||
|
||||
AbstractTreeNode itemToMoveDown = this.SelectedItem;
|
||||
PresetFolderNode currentParent = itemToMoveDown.Parent;
|
||||
int indexOfSelectedPreset = currentParent.Children.IndexOf(itemToMoveDown);
|
||||
if (indexOfSelectedPreset == currentParent.Children.Count - 1)
|
||||
{
|
||||
return;
|
||||
// Move to the parent folder.
|
||||
int indexOfFolder = currentParent.Parent.Children.IndexOf(currentParent);
|
||||
currentParent.Children.RemoveAt(indexOfSelectedPreset);
|
||||
currentParent.Parent.Children.Insert(indexOfFolder + 1, itemToMoveDown);
|
||||
itemToMoveDown.Parent = currentParent.Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
int newIndexOfSelectedPreset = System.Math.Min(this.SelectedItem.Parent.Children.Count - 1, indexOfSelectedPreset + 1);
|
||||
if (currentParent.Children[newIndexOfSelectedPreset] is PresetFolderNode newParent)
|
||||
{
|
||||
// Move to child folder.
|
||||
currentParent.Children.RemoveAt(indexOfSelectedPreset);
|
||||
newParent.Children.Insert(0, itemToMoveDown);
|
||||
itemToMoveDown.Parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Swap nodes.
|
||||
currentParent.Children.Move(indexOfSelectedPreset, newIndexOfSelectedPreset);
|
||||
}
|
||||
}
|
||||
|
||||
int indexOfSelectedPreset = this.settings.ConversionPresets.IndexOf(presetToMove);
|
||||
int newIndexOfSelectedPreset = System.Math.Min(this.settings.ConversionPresets.Count - 1, indexOfSelectedPreset + 1);
|
||||
this.SelectedItem = itemToMoveDown;
|
||||
|
||||
this.settings.ConversionPresets.Move(indexOfSelectedPreset, newIndexOfSelectedPreset);
|
||||
this.movePresetUpCommand?.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand?.RaiseCanExecuteChanged();
|
||||
this.movePresetUpCommand.RaiseCanExecuteChanged();
|
||||
this.movePresetDownCommand.RaiseCanExecuteChanged();
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private void AddNewPreset()
|
||||
{
|
||||
PresetFolderNode parent;
|
||||
if (this.SelectedFolder != null)
|
||||
{
|
||||
parent = this.SelectedFolder;
|
||||
}
|
||||
else if (this.SelectedItem != null)
|
||||
{
|
||||
parent = this.SelectedItem.Parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
parent = this.presetsRootFolder;
|
||||
}
|
||||
|
||||
int insertIndex = parent.Children.IndexOf(this.SelectedItem) + 1;
|
||||
if (insertIndex < 0)
|
||||
{
|
||||
insertIndex = parent.Children.Count;
|
||||
}
|
||||
|
||||
// Generate a unique preset name.
|
||||
ISettingsService settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
|
||||
string presetName = Properties.Resources.DefaultPresetName;
|
||||
int index = 1;
|
||||
while (settingsService.Settings.ConversionPresets.Any(match => match.Name == presetName))
|
||||
while (parent.Children.Any(match => match is PresetNode folder && folder.Preset.ShortName == presetName))
|
||||
{
|
||||
index++;
|
||||
presetName = $"{Properties.Resources.DefaultPresetName} ({index})";
|
||||
}
|
||||
|
||||
// Create preset by coping the selected one.
|
||||
int insertIndex = 0;
|
||||
// Create preset by copying the selected one.
|
||||
ConversionPreset newPreset = null;
|
||||
if (this.SelectedPreset != null)
|
||||
{
|
||||
newPreset = new ConversionPreset(presetName, this.SelectedPreset);
|
||||
insertIndex = this.settings.ConversionPresets.IndexOf(this.SelectedPreset) + 1;
|
||||
newPreset = new ConversionPreset(presetName, this.SelectedPreset.Preset);
|
||||
}
|
||||
else
|
||||
{
|
||||
newPreset = new ConversionPreset(presetName, OutputType.Mkv, new string[0]);
|
||||
insertIndex = this.settings.ConversionPresets.Count;
|
||||
}
|
||||
|
||||
settingsService.Settings.ConversionPresets.Insert(insertIndex, newPreset);
|
||||
this.SelectedPreset = newPreset;
|
||||
PresetNode node = new PresetNode(newPreset, parent);
|
||||
|
||||
parent.Children.Insert(insertIndex, node);
|
||||
|
||||
node.PropertyChanged += this.NodePropertyChanged;
|
||||
|
||||
this.SelectedItem = node;
|
||||
|
||||
Messenger.Default.Send<string>("PresetName", "DoFocus");
|
||||
|
||||
this.removePresetCommand.RaiseCanExecuteChanged();
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private void RemoveSelectedPreset()
|
||||
{
|
||||
ISettingsService settingsService = SimpleIoc.Default.GetInstance<ISettingsService>();
|
||||
settingsService.Settings.ConversionPresets.Remove(this.selectedPreset);
|
||||
this.SelectedItem.PropertyChanged -= this.NodePropertyChanged;
|
||||
|
||||
this.SelectedItem.Parent.Children.Remove(this.SelectedItem);
|
||||
|
||||
this.SelectedItem = null;
|
||||
|
||||
this.removePresetCommand.RaiseCanExecuteChanged();
|
||||
this.saveCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
private bool CanRemoveSelectedPreset()
|
||||
{
|
||||
return this.SelectedPreset != null;
|
||||
return this.SelectedItem != null;
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
this.UnbindNode(this.presetsRootFolder);
|
||||
}
|
||||
|
||||
private void UnbindNode(AbstractTreeNode node)
|
||||
{
|
||||
node.PropertyChanged -= this.NodePropertyChanged;
|
||||
|
||||
if (node is PresetFolderNode folder)
|
||||
{
|
||||
foreach (AbstractTreeNode child in folder.Children)
|
||||
{
|
||||
this.UnbindNode(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
// Source: https://tyrrrz.me/Blog/WPF-TreeView-SelectedItem-TwoWay-binding
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace FileConverter.Views
|
||||
{
|
||||
public class TreeViewSelectionBehavior : Behavior<TreeView>
|
||||
{
|
||||
public delegate bool IsChildOfPredicate(object nodeA, object nodeB);
|
||||
|
||||
public static readonly DependencyProperty SelectedItemProperty =
|
||||
DependencyProperty.Register(nameof(SelectedItem), typeof(object),
|
||||
typeof(TreeViewSelectionBehavior),
|
||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
OnSelectedItemChanged));
|
||||
|
||||
public static readonly DependencyProperty HierarchyPredicateProperty =
|
||||
DependencyProperty.Register(nameof(HierarchyPredicate), typeof(IsChildOfPredicate),
|
||||
typeof(TreeViewSelectionBehavior),
|
||||
new FrameworkPropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty ExpandSelectedProperty =
|
||||
DependencyProperty.Register(nameof(ExpandSelected), typeof(bool),
|
||||
typeof(TreeViewSelectionBehavior),
|
||||
new FrameworkPropertyMetadata(false));
|
||||
|
||||
private readonly EventSetter treeViewItemEventSetter;
|
||||
private bool modelHandled;
|
||||
|
||||
public TreeViewSelectionBehavior()
|
||||
{
|
||||
this.treeViewItemEventSetter = new EventSetter(FrameworkElement.LoadedEvent, new RoutedEventHandler(this.OnTreeViewItemLoaded));
|
||||
}
|
||||
|
||||
// Bindable selected item
|
||||
public object SelectedItem
|
||||
{
|
||||
get => this.GetValue(SelectedItemProperty);
|
||||
set => this.SetValue(SelectedItemProperty, value);
|
||||
}
|
||||
|
||||
// Predicate that checks if two items are hierarchically related
|
||||
public IsChildOfPredicate HierarchyPredicate
|
||||
{
|
||||
get => (IsChildOfPredicate)this.GetValue(HierarchyPredicateProperty);
|
||||
set => this.SetValue(HierarchyPredicateProperty, value);
|
||||
}
|
||||
|
||||
// Should expand selected?
|
||||
public bool ExpandSelected
|
||||
{
|
||||
get => (bool)this.GetValue(ExpandSelectedProperty);
|
||||
set => this.SetValue(ExpandSelectedProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
this.AssociatedObject.SelectedItemChanged += this.OnTreeViewSelectedItemChanged;
|
||||
((INotifyCollectionChanged)this.AssociatedObject.Items).CollectionChanged += this.OnTreeViewItemsChanged;
|
||||
|
||||
this.UpdateTreeViewItemStyle();
|
||||
this.modelHandled = true;
|
||||
this.UpdateAllTreeViewItems();
|
||||
this.modelHandled = false;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
if (this.AssociatedObject != null)
|
||||
{
|
||||
this.AssociatedObject.ItemContainerStyle?.Setters?.Remove(this.treeViewItemEventSetter);
|
||||
this.AssociatedObject.SelectedItemChanged -= this.OnTreeViewSelectedItemChanged;
|
||||
((INotifyCollectionChanged)this.AssociatedObject.Items).CollectionChanged -= this.OnTreeViewItemsChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
var behavior = (TreeViewSelectionBehavior)sender;
|
||||
if (behavior.modelHandled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (behavior.AssociatedObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
behavior.modelHandled = true;
|
||||
behavior.UpdateAllTreeViewItems();
|
||||
behavior.modelHandled = false;
|
||||
}
|
||||
|
||||
// Update state of all items starting with given, with optional recursion
|
||||
private void UpdateTreeViewItem(TreeViewItem item, bool recurse)
|
||||
{
|
||||
if (this.SelectedItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var model = item.DataContext;
|
||||
|
||||
// If the selected item is this model and is not yet selected - select and return
|
||||
if (this.SelectedItem == model && !item.IsSelected)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
}
|
||||
// If the selected item is a parent of this model - expand
|
||||
else
|
||||
{
|
||||
bool isParentOfModel = this.HierarchyPredicate?.Invoke(this.SelectedItem, model) ?? true;
|
||||
if (isParentOfModel)
|
||||
{
|
||||
item.IsExpanded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.IsSelected && this.ExpandSelected)
|
||||
{
|
||||
item.IsExpanded = true;
|
||||
}
|
||||
|
||||
// Recurse into children
|
||||
if (recurse)
|
||||
{
|
||||
foreach (var subitem in item.Items)
|
||||
{
|
||||
if (item.ItemContainerGenerator.ContainerFromItem(subitem) is TreeViewItem tvi)
|
||||
{
|
||||
this.UpdateTreeViewItem(tvi, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update state of all items
|
||||
private void UpdateAllTreeViewItems()
|
||||
{
|
||||
var treeView = this.AssociatedObject;
|
||||
foreach (var item in treeView.Items)
|
||||
{
|
||||
if (treeView.ItemContainerGenerator.ContainerFromItem(item) is TreeViewItem tvi)
|
||||
{
|
||||
this.UpdateTreeViewItem(tvi, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inject Loaded event handler into ItemContainerStyle
|
||||
private void UpdateTreeViewItemStyle()
|
||||
{
|
||||
if (this.AssociatedObject.ItemContainerStyle == null)
|
||||
{
|
||||
this.AssociatedObject.ItemContainerStyle = new Style(
|
||||
typeof(TreeViewItem),
|
||||
Application.Current.TryFindResource(typeof(TreeViewItem)) as Style);
|
||||
}
|
||||
|
||||
if (!this.AssociatedObject.ItemContainerStyle.Setters.Contains(this.treeViewItemEventSetter))
|
||||
{
|
||||
this.AssociatedObject.ItemContainerStyle.Setters.Add(this.treeViewItemEventSetter);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTreeViewItemsChanged(object sender,
|
||||
NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
this.UpdateAllTreeViewItems();
|
||||
}
|
||||
|
||||
private void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> args)
|
||||
{
|
||||
if (this.modelHandled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.AssociatedObject.Items.SourceCollection == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SelectedItem = args.NewValue;
|
||||
}
|
||||
|
||||
private void OnTreeViewItemLoaded(object sender, RoutedEventArgs args)
|
||||
{
|
||||
this.UpdateTreeViewItem((TreeViewItem)sender, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// <copyright file="DragDropExtension.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
||||
|
||||
namespace FileConverter.Views
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
/// <summary>
|
||||
/// Provides extended support for drag drop operation
|
||||
/// </summary>
|
||||
public static class DragDropExtension
|
||||
{
|
||||
public static readonly DependencyProperty ScrollOnDragDropProperty = DependencyProperty.RegisterAttached("ScrollOnDragDrop", typeof(bool), typeof(DragDropExtension), new PropertyMetadata(false, HandleScrollOnDragDropChanged));
|
||||
|
||||
public static bool GetScrollOnDragDrop(DependencyObject element)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(element));
|
||||
}
|
||||
|
||||
return (bool)element.GetValue(ScrollOnDragDropProperty);
|
||||
}
|
||||
|
||||
public static void SetScrollOnDragDrop(DependencyObject element, bool value)
|
||||
{
|
||||
if (element == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(element));
|
||||
}
|
||||
|
||||
element.SetValue(ScrollOnDragDropProperty, value);
|
||||
}
|
||||
|
||||
private static void HandleScrollOnDragDropChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (dependencyObject == null)
|
||||
{
|
||||
Diagnostics.Debug.LogError("Invalid types!");
|
||||
return;
|
||||
}
|
||||
|
||||
FrameworkElement container = dependencyObject as FrameworkElement;
|
||||
|
||||
Unsubscribe(container);
|
||||
|
||||
if (true.Equals(args.NewValue))
|
||||
{
|
||||
Subscribe(container);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Subscribe(FrameworkElement container)
|
||||
{
|
||||
container.PreviewDragOver += OnContainerPreviewDragOver;
|
||||
}
|
||||
|
||||
private static void OnContainerPreviewDragOver(object sender, DragEventArgs args)
|
||||
{
|
||||
const double Tolerance = 60;
|
||||
const double Offset = 20;
|
||||
|
||||
FrameworkElement container = sender as FrameworkElement;
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScrollViewer scrollViewer = GetFirstVisualChild<ScrollViewer>(container);
|
||||
if (scrollViewer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double verticalPos = args.GetPosition(container).Y;
|
||||
|
||||
if (verticalPos < Tolerance) // Top of visible list?
|
||||
{
|
||||
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - Offset); //Scroll up.
|
||||
}
|
||||
else if (verticalPos > container.ActualHeight - Tolerance) // Bottom of visible list?
|
||||
{
|
||||
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + Offset); //Scroll down.
|
||||
}
|
||||
}
|
||||
|
||||
private static void Unsubscribe(FrameworkElement container)
|
||||
{
|
||||
container.PreviewDragOver -= OnContainerPreviewDragOver;
|
||||
}
|
||||
|
||||
public static T GetFirstVisualChild<T>(DependencyObject dependencyObject) where T : DependencyObject
|
||||
{
|
||||
if (dependencyObject != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(dependencyObject); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(dependencyObject, i);
|
||||
if (child is T visualChild)
|
||||
{
|
||||
return visualChild;
|
||||
}
|
||||
|
||||
T childItem = GetFirstVisualChild<T>(child);
|
||||
if (childItem != null)
|
||||
{
|
||||
return childItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,13 +89,13 @@
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static project:Resources.Encoding}" />
|
||||
<DockPanel Grid.Row="0" Grid.Column="1">
|
||||
<RadioButton x:Name="VBRradioButton" Content="VBR" ToolTip="{x:Static project:Resources.Mp3VbrDescription}" Margin="5" IsChecked="{Binding Settings, ConverterParameter=AudioEncodingMode|Mp3VBR, Converter={StaticResource ConversionSettingsEquals}, Mode=TwoWay}" />
|
||||
<RadioButton x:Name="CBRradioButton" Content="CBR" ToolTip="{x:Static project:Resources.Mp3CbrDescription}" Margin="5" IsChecked="{Binding Settings, ConverterParameter=AudioEncodingMode|Mp3CBR, Converter={StaticResource ConversionSettingsEquals}, Mode=TwoWay}"/>
|
||||
<RadioButton Content="VBR" ToolTip="{x:Static project:Resources.Mp3VbrDescription}" Margin="5" IsChecked="{Binding Settings, ConverterParameter=AudioEncodingMode|Mp3VBR, Converter={StaticResource ConversionSettingsEquals}, Mode=TwoWay}" />
|
||||
<RadioButton Content="CBR" ToolTip="{x:Static project:Resources.Mp3CbrDescription}" Margin="5" IsChecked="{Binding Settings, ConverterParameter=AudioEncodingMode|Mp3CBR, Converter={StaticResource ConversionSettingsEquals}, Mode=TwoWay}"/>
|
||||
</DockPanel>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static project:Resources.Quality}" />
|
||||
<controls:EncodingQualitySliderControl Grid.Row="1" Grid.Column="1"
|
||||
EncodingMode="{Binding Settings, ConverterParameter=AudioEncodingMode|FileConverter.Controls.EncodingMode, Converter={StaticResource ConversionSettingsToEnum}, Mode=OneWay, TargetNullValue=VBR}"
|
||||
EncodingMode="{Binding Settings, ConverterParameter=AudioEncodingMode|FileConverter.Controls.EncodingMode, Converter={StaticResource ConversionSettingsToEnum}, Mode=OneWay}"
|
||||
Bitrate="{Binding Settings, ConverterParameter=AudioBitrate|System.Double, Converter={StaticResource ConversionSettingsToValueType}, Mode=TwoWay, TargetNullValue=190}" />
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static project:Resources.ChannelCountTitle}" ToolTip="{x:Static project:Resources.ChannelCountTooltip}" />
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Data validation styles -->
|
||||
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Validation.ErrorTemplate">
|
||||
<Setter.Value>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:FileConverter"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:project="clr-namespace:FileConverter.Properties"
|
||||
xmlns:views="clr-namespace:FileConverter.Views"
|
||||
xmlns:viewModels="clr-namespace:FileConverter.ViewModels"
|
||||
@@ -11,7 +13,9 @@
|
||||
MinWidth="640" MinHeight="480"
|
||||
Width="920" Height="675"
|
||||
WindowStartupLocation="CenterScreen" Icon="/FileConverter;component/Resources/ApplicationIcon.ico"
|
||||
DataContext="{Binding Settings, Source={StaticResource Locator}}">
|
||||
mc:Ignorable="d"
|
||||
DataContext="{Binding Settings, Source={StaticResource Locator}}"
|
||||
d:DataContext="{d:DesignData /SampleData/SettingsSampleData.xaml}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Closing">
|
||||
<command:EventToCommand Command="{Binding CloseCommand}" PassEventArgsToCommand="True" />
|
||||
@@ -78,19 +82,61 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox x:Name="PresetList" Grid.Row="0" HorizontalAlignment="Left" IsSynchronizedWithCurrentItem="True"
|
||||
ItemsSource="{Binding Settings.ConversionPresets}"
|
||||
SelectedItem="{Binding SelectedPreset}"
|
||||
Width="{Binding ActualWidth, ElementName=PresetListGrid, Mode=OneWay}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Label Content="{Binding Name}"/>
|
||||
|
||||
<TreeView Name="PresetTreeView" Grid.Row="0"
|
||||
ItemsSource="{Binding PresetsRootFolder.Children}"
|
||||
Width="{Binding ActualWidth, ElementName=PresetListGrid, Mode=OneWay}" AllowDrop="True"
|
||||
views:DragDropExtension.ScrollOnDragDrop="True">
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type viewModels:PresetFolderNode}" ItemsSource="{Binding Children}">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Image HorizontalAlignment="Left" Height="24" Width="24" VerticalAlignment="Top" Margin="5"
|
||||
Source="{Binding Source=/FileConverter;component/Resources/FolderIcon.ico, Converter={StaticResource IcoFileSizeSelector}, ConverterParameter=48}">
|
||||
</Image>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" FontSize="14" VerticalAlignment="Center" Margin="5,0"/>
|
||||
</StackPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:PresetNode}">
|
||||
<TextBlock Text="{Binding Name}" FontSize="12" Margin="5" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</TreeView.Resources>
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasError, FallbackValue=False}" Value="True">
|
||||
<Setter Property="Background" Value="#F44336"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#86C8F6" />
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#074078" />
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#DFE0E0" />
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#4B5762" />
|
||||
</Style.Resources>
|
||||
|
||||
<Setter Property="IsExpanded" Value="True"/>
|
||||
<Setter Property="BorderBrush" Value="#1E6BB8"/>
|
||||
|
||||
<EventSetter Event="TreeViewItem.DragOver" Handler="TreeView_DragOver"/>
|
||||
<EventSetter Event="TreeViewItem.Drop" Handler="TreeView_Drop"/>
|
||||
<EventSetter Event="TreeViewItem.MouseMove" Handler="TreeView_MouseMove"/>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<i:Interaction.Behaviors>
|
||||
<views:TreeViewSelectionBehavior
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
||||
HierarchyPredicate="{Binding PresetsHierarchyPredicate}"
|
||||
ExpandSelected="False"/>
|
||||
</i:Interaction.Behaviors>
|
||||
</TreeView>
|
||||
|
||||
<DockPanel Grid.Row="1" Margin="0,5,0,0" HorizontalAlignment="Center">
|
||||
<Button Content="^" HorizontalAlignment="Left" Width="25" Margin="0,0,2,0"
|
||||
<Button HorizontalAlignment="Left" Width="25" Margin="0,0,2,0"
|
||||
ToolTip="{x:Static project:Resources.CreateANewFolder}"
|
||||
Command="{Binding CreateFolderCommand}">
|
||||
<Image Source="{Binding Source=/FileConverter;component/Resources/FolderIcon.ico, Converter={StaticResource IcoFileSizeSelector}, ConverterParameter=48}" />
|
||||
</Button>
|
||||
<Button Content="^" HorizontalAlignment="Left" Width="25" Margin="2,0"
|
||||
ToolTip="{x:Static project:Resources.MoveUpSelectedPreset}"
|
||||
Command="{Binding MovePresetUpCommand}"/>
|
||||
<Button Content="+" HorizontalAlignment="Left" Width="25" Margin="2,0"
|
||||
@@ -108,6 +154,25 @@
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Folder settings -->
|
||||
<GroupBox Header="{x:Static project:Resources.PresetFolder}" Margin="5,5,0,0" Grid.Column="1"
|
||||
Visibility="{Binding SelectedFolder, Converter={StaticResource ReferenceToVisibility}}">
|
||||
<Grid DataContext="{Binding SelectedFolder}" Margin="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MaxWidth="240"/>
|
||||
<ColumnDefinition Width="2.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Content="{x:Static project:Resources.PresetFolderName}" Grid.Row="0" HorizontalContentAlignment="Right" Margin="0,0,5,0"/>
|
||||
<TextBox x:Name="FolderNameTextBox" Grid.Row="0" Grid.Column="1" Margin="5,2,25,2" TextWrapping="Wrap" Width="Auto" FontSize="15"
|
||||
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Preset settings -->
|
||||
<GroupBox Header="{x:Static project:Resources.Preset}" Margin="5,5,0,0" Grid.Column="1"
|
||||
Visibility="{Binding SelectedPreset, Converter={StaticResource ReferenceToVisibility}}">
|
||||
@@ -143,7 +208,7 @@
|
||||
<CheckBox Content="{Binding Name, Converter={StaticResource ObjectToLocalizedString}}" Height="20" VerticalAlignment="Top" Margin="2" Checked="OnInputTypeCategoryChecked" Unchecked="OnInputTypeCategoryUnchecked" IsThreeState="True" >
|
||||
<CheckBox.IsChecked>
|
||||
<MultiBinding Converter="{StaticResource CollectionContainsElementToBool}" Mode="OneWay">
|
||||
<Binding RelativeSource="{RelativeSource AncestorType={x:Type views:SettingsWindow}}" Path="DataContext.SelectedPreset.InputTypes" Mode="OneWay"/>
|
||||
<Binding RelativeSource="{RelativeSource AncestorType={x:Type Window}}" Path="DataContext.SelectedPreset.Preset.InputTypes" Mode="OneWay"/>
|
||||
<Binding Path="InputExtensionNames" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</CheckBox.IsChecked>
|
||||
@@ -153,7 +218,7 @@
|
||||
<CheckBox Content="{Binding Name}" Foreground="{Binding ForegroundBrush}" ToolTip="{Binding ToolTip}" Height="20" VerticalAlignment="Top" Margin="2" Checked="OnInputTypeChecked" Unchecked="OnInputTypeUnchecked">
|
||||
<CheckBox.IsChecked>
|
||||
<MultiBinding Converter="{StaticResource CollectionContainsElementToBool}" Mode="OneWay">
|
||||
<Binding RelativeSource="{RelativeSource AncestorType={x:Type views:SettingsWindow}}" Path="DataContext.SelectedPreset.InputTypes" Mode="OneWay"/>
|
||||
<Binding RelativeSource="{RelativeSource AncestorType={x:Type Window}}" Path="DataContext.SelectedPreset.Preset.InputTypes" Mode="OneWay"/>
|
||||
<Binding Path="Name" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</CheckBox.IsChecked>
|
||||
@@ -169,7 +234,7 @@
|
||||
|
||||
<Label Grid.Row="1" Content="{x:Static project:Resources.ActionWhenConversionSucceedTitle}" ToolTip="{x:Static project:Resources.ActionWhenConversionSucceedDescription}" />
|
||||
<ComboBox Grid.Row="2" ItemsSource="{Binding InputPostConversionActions, Mode=OneTime}"
|
||||
SelectedItem="{Binding SelectedPreset.InputPostConversionAction, Mode=TwoWay}">
|
||||
SelectedItem="{Binding SelectedPreset.Preset.InputPostConversionAction, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentPresenter Content="{Binding Converter={StaticResource ObjectToLocalizedString}}" />
|
||||
@@ -187,7 +252,7 @@
|
||||
<StackPanel>
|
||||
<ComboBox Margin="5" Height="29" VerticalAlignment="Top"
|
||||
ItemsSource="{Binding OutputTypes}"
|
||||
SelectedItem="{Binding SelectedPreset.OutputType, Converter={StaticResource OutputTypeEnumToViewModel}, Mode=TwoWay}">
|
||||
SelectedItem="{Binding SelectedPreset.Preset.OutputType, Converter={StaticResource OutputTypeEnumToViewModel}, Mode=TwoWay}">
|
||||
<ComboBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
@@ -206,7 +271,7 @@
|
||||
</ComboBox>
|
||||
|
||||
<ContentControl ContentTemplateSelector="{StaticResource ResourceKey=ConversionSettingsSelector}"
|
||||
Content="{Binding SelectedPreset, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Content="{Binding SelectedPreset.Preset, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Separator/>
|
||||
|
||||
<!-- Output file name template -->
|
||||
@@ -222,17 +287,18 @@
|
||||
<RowDefinition Height="23"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="{x:Static project:Resources.FileNameTemplate}" Grid.Row="0" HorizontalContentAlignment="Right" Margin="0,0,5,0"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5,2,25,2" TextWrapping="Wrap" Width="Auto" ToolTip="{x:Static project:Resources.OutputFilePathTemplateHelp}"
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5,2,25,2" TextWrapping="Wrap" Width="Auto"
|
||||
ToolTip="{x:Static project:Resources.OutputFilePathTemplateHelp}"
|
||||
Text="{Binding SelectedPreset.OutputFileNameTemplate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||
<Label Content="{x:Static project:Resources.InputExample}" Grid.Row="1" Grid.Column="0" HorizontalContentAlignment="Right" Margin="0,0,5,0" Foreground="Gray" FontSize="10"/>
|
||||
<TextBlock Text="{x:Static project:Resources.OuputFileNameTemplateSample}" Grid.Row="1" Grid.Column="1" Margin="5,0,5,0" Foreground="Gray" FontSize="10" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{x:Static project:Resources.OutputFileNameTemplateSample}" Grid.Row="1" Grid.Column="1" Margin="5,0,5,0" Foreground="Gray" FontSize="10" VerticalAlignment="Center"/>
|
||||
<Label Content="{x:Static project:Resources.OutputExample}" Grid.Row="2" Grid.Column="0" HorizontalContentAlignment="Right" Margin="0,0,5,0" Foreground="Gray" FontSize="10"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Margin="5,0,5,0" Foreground="Gray" FontSize="10" VerticalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource FileNameConverter}">
|
||||
<Binding Source="{x:Static project:Resources.OuputFileNameTemplateSample}"/>
|
||||
<Binding Path="SelectedPreset.OutputType" Mode="OneWay"/>
|
||||
<Binding Path="SelectedPreset.OutputFileNameTemplate" Mode="OneWay"/>
|
||||
<Binding Source="{x:Static project:Resources.OutputFileNameTemplateSample}"/>
|
||||
<Binding Path="SelectedPreset.Preset.OutputType" Mode="OneWay"/>
|
||||
<Binding Path="SelectedPreset.Preset.OutputFileNameTemplate" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
|
||||
namespace FileConverter.Views
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
using FileConverter.Diagnostics;
|
||||
using FileConverter.ViewModels;
|
||||
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
@@ -15,6 +19,13 @@ namespace FileConverter.Views
|
||||
/// </summary>
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
private enum DragDropTargetPosition
|
||||
{
|
||||
Before,
|
||||
In,
|
||||
After,
|
||||
}
|
||||
|
||||
public SettingsWindow()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
@@ -30,6 +41,11 @@ namespace FileConverter.Views
|
||||
this.PresetNameTextBox.Focus();
|
||||
this.PresetNameTextBox.SelectAll();
|
||||
break;
|
||||
|
||||
case "FolderName":
|
||||
this.FolderNameTextBox.Focus();
|
||||
this.FolderNameTextBox.SelectAll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +65,7 @@ namespace FileConverter.Views
|
||||
|
||||
string inputFormat = (checkBox.Content as string).ToLowerInvariant();
|
||||
|
||||
dataContext.SelectedPreset.AddInputType(inputFormat);
|
||||
dataContext.SelectedPreset.Preset.AddInputType(inputFormat);
|
||||
}
|
||||
|
||||
private void OnInputTypeUnchecked(object sender, RoutedEventArgs e)
|
||||
@@ -68,7 +84,7 @@ namespace FileConverter.Views
|
||||
|
||||
string inputFormat = (checkBox.Content as string).ToLowerInvariant();
|
||||
|
||||
dataContext.SelectedPreset.RemoveInputType(inputFormat);
|
||||
dataContext.SelectedPreset.Preset.RemoveInputType(inputFormat);
|
||||
}
|
||||
|
||||
private void OnInputTypeCategoryChecked(object sender, RoutedEventArgs e)
|
||||
@@ -89,7 +105,7 @@ namespace FileConverter.Views
|
||||
|
||||
foreach (string inputExtension in category.InputExtensionNames)
|
||||
{
|
||||
dataContext.SelectedPreset.AddInputType(inputExtension);
|
||||
dataContext.SelectedPreset.Preset.AddInputType(inputExtension);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,8 +127,258 @@ namespace FileConverter.Views
|
||||
|
||||
foreach (string inputExtension in category.InputExtensionNames)
|
||||
{
|
||||
dataContext.SelectedPreset.RemoveInputType(inputExtension);
|
||||
dataContext.SelectedPreset.Preset.RemoveInputType(inputExtension);
|
||||
}
|
||||
}
|
||||
|
||||
private void TreeView_MouseMove(object sender, MouseEventArgs args)
|
||||
{
|
||||
if (args.LeftButton == MouseButtonState.Pressed &&
|
||||
this.PresetTreeView.SelectedItem is AbstractTreeNode nodeToDrag)
|
||||
{
|
||||
var dataObj = new DataObject();
|
||||
dataObj.SetData("DragSource", nodeToDrag);
|
||||
|
||||
DragDropEffects dropEffect = DragDrop.DoDragDrop(this.PresetTreeView, dataObj, DragDropEffects.Move);
|
||||
if (dropEffect == DragDropEffects.Move)
|
||||
{
|
||||
TreeViewItem draggedItemParent = this.GetTreeViewItem(this.PresetTreeView, nodeToDrag.Parent);
|
||||
if (draggedItemParent != null)
|
||||
{
|
||||
draggedItemParent.IsExpanded = true;
|
||||
}
|
||||
|
||||
TreeViewItem draggedItem = this.GetTreeViewItem(this.PresetTreeView, nodeToDrag);
|
||||
Debug.Assert(draggedItem != null, "draggedItem != null");
|
||||
draggedItem.IsSelected = true;
|
||||
}
|
||||
|
||||
if (dataObj.GetData("HighlightedItem") is TreeViewItem highlightedItem)
|
||||
{
|
||||
highlightedItem.BorderThickness = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TreeView_DragOver(object sender, DragEventArgs args)
|
||||
{
|
||||
args.Effects = DragDropEffects.None;
|
||||
args.Handled = true;
|
||||
|
||||
if (args.Data.GetData("HighlightedItem") is TreeViewItem highlightedItem)
|
||||
{
|
||||
highlightedItem.BorderThickness = new Thickness(0);
|
||||
}
|
||||
|
||||
if (this.TryComputeDropTarget(args, out AbstractTreeNode target, out DragDropTargetPosition position))
|
||||
{
|
||||
args.Effects = DragDropEffects.Move;
|
||||
args.Handled = true;
|
||||
|
||||
FrameworkElement element = args.OriginalSource as FrameworkElement;
|
||||
TreeViewItem item = this.GetNearestContainer(element);
|
||||
|
||||
args.Data.SetData("HighlightedItem", item);
|
||||
|
||||
switch (position)
|
||||
{
|
||||
case DragDropTargetPosition.Before:
|
||||
item.BorderThickness = new Thickness(0, 2, 0, 0);
|
||||
break;
|
||||
|
||||
case DragDropTargetPosition.In:
|
||||
item.BorderThickness = new Thickness(2, 2, 2, 2);
|
||||
break;
|
||||
|
||||
case DragDropTargetPosition.After:
|
||||
item.BorderThickness = new Thickness(0, 0, 0, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TreeView_Drop(object sender, DragEventArgs args)
|
||||
{
|
||||
args.Effects = DragDropEffects.None;
|
||||
args.Handled = true;
|
||||
|
||||
if (this.TryComputeDropTarget(args, out AbstractTreeNode target, out DragDropTargetPosition position))
|
||||
{
|
||||
AbstractTreeNode nodeToDrag = (AbstractTreeNode)args.Data.GetData("DragSource");
|
||||
Debug.Assert(nodeToDrag != null, "nodeToDrag != null");
|
||||
|
||||
this.MoveItem(nodeToDrag, target, position);
|
||||
|
||||
args.Effects = DragDropEffects.Move;
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryComputeDropTarget(DragEventArgs args, out AbstractTreeNode target, out DragDropTargetPosition position)
|
||||
{
|
||||
FrameworkElement source = args.OriginalSource as FrameworkElement;
|
||||
TreeViewItem item = this.GetNearestContainer(source);
|
||||
|
||||
target = item?.DataContext as AbstractTreeNode;
|
||||
|
||||
Debug.Assert(source != null, "source should not be null");
|
||||
Point relativePosition = args.GetPosition(source);
|
||||
|
||||
if (target is PresetFolderNode)
|
||||
{
|
||||
if (item.IsExpanded)
|
||||
{
|
||||
if (relativePosition.Y - (source.ActualHeight / 2) < 0)
|
||||
{
|
||||
position = DragDropTargetPosition.Before;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = DragDropTargetPosition.In;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relativePosition.Y < source.ActualHeight / 3)
|
||||
{
|
||||
position = DragDropTargetPosition.Before;
|
||||
}
|
||||
else if (relativePosition.Y < 2 * (source.ActualHeight / 3))
|
||||
{
|
||||
position = DragDropTargetPosition.In;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = DragDropTargetPosition.After;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relativePosition.Y - (source.ActualHeight / 2) < 0)
|
||||
{
|
||||
position = DragDropTargetPosition.Before;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = DragDropTargetPosition.After;
|
||||
}
|
||||
}
|
||||
|
||||
AbstractTreeNode nodeToDrag = (AbstractTreeNode)args.Data.GetData("DragSource");
|
||||
Debug.Assert(nodeToDrag != null, "nodeToDrag != null");
|
||||
|
||||
return target != null && this.CheckDropTarget(nodeToDrag, target);
|
||||
}
|
||||
|
||||
private bool CheckDropTarget(AbstractTreeNode sourceItem, AbstractTreeNode targetItem)
|
||||
{
|
||||
// Check whether the target item is meeting your condition
|
||||
if (targetItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AbstractTreeNode folder = targetItem;
|
||||
while (folder != null)
|
||||
{
|
||||
if (folder == sourceItem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
folder = folder.Parent;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void MoveItem(AbstractTreeNode sourceItem, AbstractTreeNode targetItem, DragDropTargetPosition targetPosition)
|
||||
{
|
||||
switch (targetPosition)
|
||||
{
|
||||
case DragDropTargetPosition.Before:
|
||||
{
|
||||
sourceItem.Parent.Children.Remove(sourceItem);
|
||||
int indexOfNode = targetItem.Parent.Children.IndexOf(targetItem);
|
||||
targetItem.Parent.Children.Insert(indexOfNode, sourceItem);
|
||||
sourceItem.Parent = targetItem.Parent;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DragDropTargetPosition.In:
|
||||
{
|
||||
if (targetItem is PresetFolderNode newParent)
|
||||
{
|
||||
sourceItem.Parent.Children.Remove(sourceItem);
|
||||
newParent.Children.Insert(0, sourceItem);
|
||||
sourceItem.Parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Can move element in target.");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DragDropTargetPosition.After:
|
||||
{
|
||||
sourceItem.Parent.Children.Remove(sourceItem);
|
||||
int indexOfNode = targetItem.Parent.Children.IndexOf(targetItem);
|
||||
targetItem.Parent.Children.Insert(indexOfNode + 1, sourceItem);
|
||||
sourceItem.Parent = targetItem.Parent;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private TreeViewItem GetNearestContainer(UIElement element)
|
||||
{
|
||||
// Walk up the element tree to the nearest tree view item.
|
||||
TreeViewItem container = element as TreeViewItem;
|
||||
while (container == null && element != null)
|
||||
{
|
||||
element = VisualTreeHelper.GetParent(element) as UIElement;
|
||||
container = element as TreeViewItem;
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursively search for an item in this subtree.
|
||||
/// </summary>
|
||||
/// <param name="container">The parent ItemsControl. This can be a TreeView or a TreeViewItem.</param>
|
||||
/// <param name="item">The item to search for.</param>
|
||||
/// <returns>The TreeViewItem that contains the specified item.</returns>
|
||||
/// Source: https://docs.microsoft.com/fr-fr/dotnet/framework/wpf/controls/how-to-find-a-treeviewitem-in-a-treeview
|
||||
private TreeViewItem GetTreeViewItem(ItemsControl container, object item)
|
||||
{
|
||||
if (container != null)
|
||||
{
|
||||
if (container.DataContext == item)
|
||||
{
|
||||
return container as TreeViewItem;
|
||||
}
|
||||
|
||||
for (int i = 0, count = container.Items.Count; i < count; i++)
|
||||
{
|
||||
TreeViewItem subContainer = (TreeViewItem)container.ItemContainerGenerator.ContainerFromIndex(i);
|
||||
if (subContainer != null)
|
||||
{
|
||||
// Search the next level for the object.
|
||||
TreeViewItem resultContainer = this.GetTreeViewItem(subContainer, item);
|
||||
if (resultContainer != null)
|
||||
{
|
||||
return resultContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,16 +1,19 @@
|
||||
# Change Log
|
||||
|
||||
## Next version
|
||||
- Added: Possibility to create preset folders in File Converter context menu.
|
||||
- Added: Ability to drag and drop to move conversion presets.
|
||||
- Added: Brazilian Portuguese translation (thanks to Marhc).
|
||||
- Added: Spanish translation (thanks to Chachak).
|
||||
- Added: Italian translation (thanks to Davide).
|
||||
- Added: More presets for scale and rotation in File Converter default configuration.
|
||||
- Added: Support new raw image input formats: arw, raf and cr2.
|
||||
- Added: Possibility to create preset folders in File Converter context menu.
|
||||
- Added: Display conversion progress on the Windows taskbar item.
|
||||
- Added: Display estimated remaining time for each jobs.
|
||||
- Added: Support tif input extension (only tiff was handled) (github issue #29).
|
||||
- Added: Icons on context menu elements.
|
||||
- Added: Remove the need to ask administrator privileges to edit File Converter settings (github issue #4 #30 #32).
|
||||
- Added: Highlight in red elements that contains errors in the preset list.
|
||||
- Added: "Say thanks" button if you can't donate and want to keep my motivation up :).
|
||||
- Added: Messages logged from main thread are now displayed in the console standard output.
|
||||
- Change: Replace Pledgie donation button by Itch.io donation button since Pledgie does not exist anymore.
|
||||
|
||||
Reference in new issue
Block a user