[Settings][PTRun]Show plugin version and website (#36580)

This commit is contained in:
Heiko
2025-01-08 15:03:27 +01:00
committed by GitHub
parent cd2a88704d
commit a29ff07ec0
25 changed files with 95 additions and 25 deletions

View File

@@ -14,8 +14,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public string Description { get; set; }
public string Version { get; set; }
public string Author { get; set; }
public string Website { get; set; }
public bool Disabled { get; set; }
// Use to communicate the state to settings UI (Using int type because we can't reference GPOWrapper.)

View File

@@ -19,6 +19,11 @@
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
</Style>
<x:Double x:Key="SecondaryLinkFontSize">12</x:Double>
<Style x:Key="SecondaryLinkTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
</Style>
<x:Double x:Key="HeaderTextFontSize">12</x:Double>
<Style x:Key="HeaderTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource HeaderTextFontSize}" />

View File

@@ -687,11 +687,46 @@
<tkcontrols:SettingsCard
MinHeight="0"
BorderThickness="0"
ContentAlignment="Right">
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
<Run x:Uid="PowerLauncher_AuthoredBy" />
<Run FontWeight="SemiBold" Text="{x:Bind Author}" />
</TextBlock>
ContentAlignment="Right"
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
<StackPanel
HorizontalAlignment="Right"
Orientation="Horizontal"
Spacing="4">
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
<Run x:Uid="PowerLauncher_PluginVersion" />
<Run FontWeight="SemiBold" Text="{x:Bind Version}" />
</TextBlock>
<TextBlock
AutomationProperties.Name=","
IsTabStop="False"
Opacity="{x:Bind DisabledOpacity}"
Style="{ThemeResource SecondaryTextStyle}"
Text="|" />
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
<Run x:Uid="PowerLauncher_AuthoredBy" />
<Run FontWeight="SemiBold" Text="{x:Bind Author}" />
</TextBlock>
<TextBlock
AutomationProperties.Name=","
IsTabStop="False"
Opacity="{x:Bind DisabledOpacity}"
Style="{ThemeResource SecondaryTextStyle}"
Text="|"
Visibility="{x:Bind HasValidWebsiteUri, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
<HyperlinkButton
Margin="0"
Padding="0"
NavigateUri="{x:Bind WebsiteUri}"
Opacity="{x:Bind DisabledOpacity}"
Style="{StaticResource TextButtonStyle}"
Visibility="{x:Bind HasValidWebsiteUri, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBlock
x:Uid="PowerLauncher_PluginWebsite"
FontWeight="SemiBold"
Style="{ThemeResource SecondaryLinkTextStyle}" />
</HyperlinkButton>
</StackPanel>
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>

View File

@@ -3969,7 +3969,7 @@ Activate by holding the key for the character you want to add an accent to, then
</data>
<data name="AdvancedPaste_EnableAdvancedAI.Description" xml:space="preserve">
<value>Add advanced capabilities when using 'Paste with AI' including the power to 'chain' multiple transformations together and work with images and files. This feature may consume more API credits when used.</value>
</data>
</data>
<data name="Oobe_AdvancedPaste.Description" xml:space="preserve">
<value>Advanced Paste is a tool to put your clipboard content into any format you need, focused towards developer workflows. It can paste as plain text, markdown, or json directly with the UX or with a direct keystroke invoke. These are fully locally executed. In addition, it has an AI powered option that is 100% opt-in and requires an Open AI key. Note: this will replace the formatted text in your clipboard with the selected format.</value>
</data>
@@ -4698,4 +4698,10 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="Enable_Module.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Enable module</value>
</data>
<data name="PowerLauncher_PluginVersion.Text" xml:space="preserve">
<value>Version</value>
</data>
<data name="PowerLauncher_PluginWebsite.Text" xml:space="preserve">
<value>Project website</value>
</data>
</root>

View File

@@ -38,6 +38,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_enabledGpoRuleConfiguration = (GpoRuleConfigured)settings.EnabledPolicyUiState;
_enabledGpoRuleIsConfigured = _enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
_hasValidWebsiteUri = Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute);
_websiteUri = _hasValidWebsiteUri ? settings.Website : WebsiteFallbackUri;
}
public string Id { get => settings.Id; }
@@ -46,8 +49,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public string Description { get => settings.Description; }
public string Version { get => settings.Version; }
public string Author { get => settings.Author; }
// Fallback value for the website in case the uri from json is not well formatted
private const string WebsiteFallbackUri = "https://aka.ms/PowerToys";
private string _websiteUri;
private bool _hasValidWebsiteUri;
public string WebsiteUri => _websiteUri;
public bool HasValidWebsiteUri => _hasValidWebsiteUri;
private GpoRuleConfigured _enabledGpoRuleConfiguration;
private bool _enabledGpoRuleIsConfigured;