mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
* [DSC] Microsoft.PowerToys.Configure module + winget configuration file support
* f: fix for an incorrect directory id reference
* f: update comment
* f: address review comments
* f: file locksmith bug fix
* f: add explorer preview switches in samples
* f: remove debug
* Sign DSC files
* f: implement docs/samples generator
* [ci]Sign FancyZonesEditorCommon.dll
* Sign DSC files in the Generated folder
* f: address review comments
* f: update usable options
* f: add autogenerated sample
* [Installer] Don't use same GUID for different components
* [Installer]Don't remove folders shared by other modules
* Allow configuring PTRun MaximumNumberOfResults
* Remove all settings DSC sample. Just random data
* Allow configuring Hosts Run as Administrator
* Revert "[Installer]Don't remove folders shared by other modules"
This reverts commit 6da3d6cfd5.
* Add all PTRun plugins and Global and keyboard to DSC sample
* Fix issues with context menu modules not disabling
* Fix default enabled values when setting with DSC
* Fix tests regarding default modules in Settings
* Fix merge error
* Restart PowerToys process if we stopped it
---------
Co-authored-by: Andrey Nekrasov <1828123+yuyoyuppe@users.noreply.github.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
125 lines
4.4 KiB
C#
125 lines
4.4 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using Settings.UI.Library.Attributes;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
|
{
|
|
public class ImageResizerProperties
|
|
{
|
|
public ImageResizerProperties()
|
|
{
|
|
ImageresizerSelectedSizeIndex = new IntProperty(0);
|
|
ImageresizerShrinkOnly = new BoolProperty(false);
|
|
ImageresizerReplace = new BoolProperty(false);
|
|
ImageresizerIgnoreOrientation = new BoolProperty(true);
|
|
ImageresizerJpegQualityLevel = new IntProperty(90);
|
|
ImageresizerPngInterlaceOption = new IntProperty();
|
|
ImageresizerTiffCompressOption = new IntProperty();
|
|
ImageresizerFileName = new StringProperty("%1 (%2)");
|
|
ImageresizerSizes = new ImageResizerSizes();
|
|
ImageresizerKeepDateModified = new BoolProperty();
|
|
ImageresizerFallbackEncoder = new StringProperty(new System.Guid("19e4a5aa-5662-4fc5-a0c0-1758028e1057").ToString());
|
|
ImageresizerCustomSize = new ImageResizerCustomSizeProperty(new ImageSize(4, "custom", ResizeFit.Fit, 1024, 640, ResizeUnit.Pixel));
|
|
}
|
|
|
|
public ImageResizerProperties(Func<string, string> resourceLoader)
|
|
: this()
|
|
{
|
|
if (resourceLoader == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(resourceLoader), "Resource loader is null");
|
|
}
|
|
|
|
ImageresizerSizes = new ImageResizerSizes(new ObservableCollection<ImageSize>()
|
|
{
|
|
new ImageSize(0, resourceLoader("ImageResizer_DefaultSize_Small"), ResizeFit.Fit, 854, 480, ResizeUnit.Pixel),
|
|
new ImageSize(1, resourceLoader("ImageResizer_DefaultSize_Medium"), ResizeFit.Fit, 1366, 768, ResizeUnit.Pixel),
|
|
new ImageSize(2, resourceLoader("ImageResizer_DefaultSize_Large"), ResizeFit.Fit, 1920, 1080, ResizeUnit.Pixel),
|
|
new ImageSize(3, resourceLoader("ImageResizer_DefaultSize_Phone"), ResizeFit.Fit, 320, 568, ResizeUnit.Pixel),
|
|
});
|
|
}
|
|
|
|
[JsonPropertyName("imageresizer_selectedSizeIndex")]
|
|
public IntProperty ImageresizerSelectedSizeIndex { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_shrinkOnly")]
|
|
public BoolProperty ImageresizerShrinkOnly { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_replace")]
|
|
public BoolProperty ImageresizerReplace { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_ignoreOrientation")]
|
|
public BoolProperty ImageresizerIgnoreOrientation { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_jpegQualityLevel")]
|
|
public IntProperty ImageresizerJpegQualityLevel { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_pngInterlaceOption")]
|
|
public IntProperty ImageresizerPngInterlaceOption { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_tiffCompressOption")]
|
|
public IntProperty ImageresizerTiffCompressOption { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_fileName")]
|
|
public StringProperty ImageresizerFileName { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_sizes")]
|
|
[CmdConfigureIgnoreAttribute]
|
|
public ImageResizerSizes ImageresizerSizes { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_keepDateModified")]
|
|
public BoolProperty ImageresizerKeepDateModified { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_fallbackEncoder")]
|
|
public StringProperty ImageresizerFallbackEncoder { get; set; }
|
|
|
|
[JsonPropertyName("imageresizer_customSize")]
|
|
[CmdConfigureIgnoreAttribute]
|
|
public ImageResizerCustomSizeProperty ImageresizerCustomSize { get; set; }
|
|
|
|
public string ToJsonString()
|
|
{
|
|
return JsonSerializer.Serialize(this);
|
|
}
|
|
}
|
|
|
|
public enum ResizeFit
|
|
{
|
|
Fill = 0,
|
|
Fit = 1,
|
|
Stretch = 2,
|
|
}
|
|
|
|
public enum ResizeUnit
|
|
{
|
|
Centimeter = 0,
|
|
Inch = 1,
|
|
Percent = 2,
|
|
Pixel = 3,
|
|
}
|
|
|
|
public enum PngInterlaceOption
|
|
{
|
|
Default = 0,
|
|
On = 1,
|
|
Off = 2,
|
|
}
|
|
|
|
public enum TiffCompressOption
|
|
{
|
|
Default = 0,
|
|
None = 1,
|
|
Ccitt3 = 2,
|
|
Ccitt4 = 3,
|
|
Lzw = 4,
|
|
Rle = 5,
|
|
Zip = 6,
|
|
}
|
|
}
|