mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[FileExplorer]Add QoiThumbnailProvider and QoiPreviewHandler (#29735)
* [FileExplorer]QoiThumbnailProvider * Corrects code documentation * Adds QoiPreviewHandler * Corrects GUIDs * Ensure returned thumbnail image is 32bit ARGB * Updates following review comments * More updates following review comments * Updates following PR comments * Fix dark theme background in QoiPreviewHandler * Updates attribution text
This commit is contained in:
@@ -131,6 +131,18 @@
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsGCODERenderEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsGCODERenderEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
<controls:SettingsCard
|
||||
x:Uid="FileExplorerPreview_ToggleSwitch_Preview_QOI"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIRenderEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.QOIRenderIsEnabled}" />
|
||||
</controls:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_IsSettingForced"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIRenderEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIRenderEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
</custom:SettingsGroup>
|
||||
|
||||
<custom:SettingsGroup x:Uid="FileExplorerPreview_IconThumbnail_GroupSettings">
|
||||
@@ -201,6 +213,19 @@
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsSTLThumbnailEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsSTLThumbnailEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
|
||||
<controls:SettingsCard
|
||||
x:Uid="FileExplorerPreview_ToggleSwitch_Thumbnail_QOI"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIThumbnailEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.QOIThumbnailIsEnabled}" />
|
||||
</controls:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_IsSettingForced"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIThumbnailEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsQOIThumbnailEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
</custom:SettingsGroup>
|
||||
</StackPanel>
|
||||
</custom:SettingsPageControl.ModuleContent>
|
||||
@@ -210,7 +235,7 @@
|
||||
</custom:SettingsPageControl.PrimaryLinks>
|
||||
<custom:SettingsPageControl.SecondaryLinks>
|
||||
<custom:PageLink Link="https://blog.aaron-junker.ch" Text="Aaron Junker's work on developer file preview" />
|
||||
<custom:PageLink Link="https://www.pedrolamas.com" Text="Pedro Lamas's work on G-Code and STL" />
|
||||
<custom:PageLink Link="https://www.pedrolamas.com" Text="Pedro Lamas's work on G-Code, STL, and QOI" />
|
||||
</custom:SettingsPageControl.SecondaryLinks>
|
||||
</custom:SettingsPageControl>
|
||||
</Page>
|
||||
|
||||
@@ -1135,6 +1135,21 @@
|
||||
<data name="FileExplorerPreview_Color_Thumbnail_STL.Header" xml:space="preserve">
|
||||
<value>Color</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Preview_QOI.Header" xml:space="preserve">
|
||||
<value>Quite Ok Image</value>
|
||||
<comment>File type, do not translate</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Preview_QOI.Description" xml:space="preserve">
|
||||
<value>.qoi</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_QOI.Header" xml:space="preserve">
|
||||
<value>Quite OK Image</value>
|
||||
<comment>File type, do not translate</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_QOI.Description" xml:space="preserve">
|
||||
<value>.qoi</value>
|
||||
<comment>File extension, should not be altered</comment>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_PDF.Header" xml:space="preserve">
|
||||
<value>Portable Document Format</value>
|
||||
<comment>File type, do not translate</comment>
|
||||
|
||||
@@ -129,6 +129,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_gcodeRenderIsEnabled = Settings.Properties.EnableGcodePreview;
|
||||
}
|
||||
|
||||
_qoiRenderEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredQoiPreviewEnabledValue();
|
||||
if (_qoiRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _qoiRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_qoiRenderEnabledStateIsGPOConfigured = true;
|
||||
_qoiRenderIsEnabled = _qoiRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_qoiRenderIsEnabled = Settings.Properties.EnableQoiPreview;
|
||||
}
|
||||
|
||||
_pdfThumbnailEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredPdfThumbnailsEnabledValue();
|
||||
if (_pdfThumbnailEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _pdfThumbnailEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
@@ -166,6 +178,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
|
||||
_stlThumbnailColor = Settings.Properties.StlThumbnailColor.Value;
|
||||
|
||||
_qoiThumbnailEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredQoiThumbnailsEnabledValue();
|
||||
if (_qoiThumbnailEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _qoiThumbnailEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_qoiThumbnailEnabledStateIsGPOConfigured = true;
|
||||
_qoiThumbnailIsEnabled = _qoiThumbnailEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_qoiThumbnailIsEnabled = Settings.Properties.EnableQoiThumbnail;
|
||||
}
|
||||
}
|
||||
|
||||
private GpoRuleConfigured _svgRenderEnabledGpoRuleConfiguration;
|
||||
@@ -194,6 +218,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _gcodeRenderEnabledStateIsGPOConfigured;
|
||||
private bool _gcodeRenderIsEnabled;
|
||||
|
||||
private GpoRuleConfigured _qoiRenderEnabledGpoRuleConfiguration;
|
||||
private bool _qoiRenderEnabledStateIsGPOConfigured;
|
||||
private bool _qoiRenderIsEnabled;
|
||||
|
||||
private GpoRuleConfigured _svgThumbnailEnabledGpoRuleConfiguration;
|
||||
private bool _svgThumbnailEnabledStateIsGPOConfigured;
|
||||
private bool _svgThumbnailIsEnabled;
|
||||
@@ -211,6 +239,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _stlThumbnailIsEnabled;
|
||||
private string _stlThumbnailColor;
|
||||
|
||||
private GpoRuleConfigured _qoiThumbnailEnabledGpoRuleConfiguration;
|
||||
private bool _qoiThumbnailEnabledStateIsGPOConfigured;
|
||||
private bool _qoiThumbnailIsEnabled;
|
||||
|
||||
public bool SVGRenderIsEnabled
|
||||
{
|
||||
get
|
||||
@@ -616,6 +648,64 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool QOIRenderIsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _qoiRenderIsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_qoiRenderEnabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (value != _qoiRenderIsEnabled)
|
||||
{
|
||||
_qoiRenderIsEnabled = value;
|
||||
Settings.Properties.EnableQoiPreview = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsQOIRenderEnabledGpoConfigured
|
||||
{
|
||||
get => _qoiRenderEnabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public bool QOIThumbnailIsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _qoiThumbnailIsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_qoiThumbnailEnabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (value != _qoiThumbnailIsEnabled)
|
||||
{
|
||||
_qoiThumbnailIsEnabled = value;
|
||||
Settings.Properties.EnableQoiThumbnail = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsQOIThumbnailEnabledGpoConfigured
|
||||
{
|
||||
get => _qoiThumbnailEnabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public string GetSettingsSubPath()
|
||||
{
|
||||
return _settingsConfigFileFolder + "\\" + ModuleName;
|
||||
|
||||
Reference in New Issue
Block a user