Plugin manager update

This commit is contained in:
Niels Laute
2021-08-11 21:51:46 +02:00
parent f65dd0a84f
commit d1a0a3b15e
5 changed files with 72 additions and 152 deletions

View File

@@ -139,21 +139,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
} }
} }
private bool _showAdditionalInfoPanel;
public bool ShowAdditionalInfoPanel
{
get => _showAdditionalInfoPanel;
set
{
if (value != _showAdditionalInfoPanel)
{
_showAdditionalInfoPanel = value;
NotifyPropertyChanged();
}
}
}
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")

View File

@@ -11,6 +11,7 @@
</ItemsPanelTemplate> </ItemsPanelTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="controls:SettingsGroup"> <ControlTemplate TargetType="controls:SettingsGroup">

View File

@@ -1053,7 +1053,7 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="PowerLauncher_Plugins.Header" xml:space="preserve"> <data name="PowerLauncher_Plugins.Header" xml:space="preserve">
<value>Plugins</value> <value>Plugins</value>
</data> </data>
<data name="PowerLauncher_ActionKeyword.Text" xml:space="preserve"> <data name="PowerLauncher_ActionKeyword.Header" xml:space="preserve">
<value>Direct activation phrase</value> <value>Direct activation phrase</value>
</data> </data>
<data name="PowerLauncher_AuthoredBy.Text" xml:space="preserve"> <data name="PowerLauncher_AuthoredBy.Text" xml:space="preserve">

View File

@@ -168,145 +168,88 @@
<muxc:ProgressRing IsActive="True" Width="20" Height="20" Margin="18,18" /> <muxc:ProgressRing IsActive="True" Width="20" Height="20" Margin="18,18" />
<TextBlock x:Uid="Run_PluginsLoading" Style="{ThemeResource SecondaryTextStyle}" VerticalAlignment="Center" /> <TextBlock x:Uid="Run_PluginsLoading" Style="{ThemeResource SecondaryTextStyle}" VerticalAlignment="Center" />
</StackPanel> </StackPanel>
<ListView ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"
IsItemClickEnabled="False" SelectionMode="None"
<ListView ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}" x:Name="PluginsListView">
IsItemClickEnabled="True" <ListView.ItemTemplate>
SelectionChanged="PluginsListView_SelectionChanged"
x:Name="PluginsListView"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
Margin="-12,12,0,0">
<ListView.Resources>
<SolidColorBrush x:Key="ListViewItemBackgroundSelected"
Color="{ThemeResource SystemChromeLowColor}" />
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver"
Color="{ThemeResource SystemChromeLowColor}" />
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPressed"
Color="{ThemeResource SystemChromeLowColor}" />
</ListView.Resources>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="VerticalContentAlignment"
Value="Stretch" />
<Setter Property="Padding"
Value="0,0,0,0" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay"> <DataTemplate x:DataType="ViewModels:PowerLauncherPluginViewModel" x:DefaultBindMode="OneWay">
<StackPanel Orientation="Vertical" Background="Transparent" <Grid>
Padding="0,12,12,12"> <muxc:Expander>
<Grid ColumnSpacing="0"> <muxc:Expander.Header>
<Grid.ColumnDefinitions> <controls:Setting Header="{x:Bind Path=Name}" Description="{x:Bind Description}" Style="{StaticResource ExpanderHeaderSettingStyle}">
<ColumnDefinition Width="60" /> <controls:Setting.Icon>
<ColumnDefinition Width="*" /> <Image Source="{x:Bind IconPath}"
<ColumnDefinition Width="52" /> Width="20"
</Grid.ColumnDefinitions> Opacity="{x:Bind DisabledOpacity, Mode=OneWay}"
Height="20" />
</controls:Setting.Icon>
<controls:Setting.ActionContent>
<ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle"
IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}"
FlowDirection="RightToLeft"/>
</controls:Setting.ActionContent>
</controls:Setting>
</muxc:Expander.Header>
<muxc:Expander.Content>
<StackPanel>
<controls:Setting x:Uid="PowerLauncher_ActionKeyword" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<TextBox Text="{x:Bind Path=ActionKeyword, Mode=TwoWay}"
Width="240"
IsEnabled="{x:Bind Enabled, Mode=OneWay}" />
</controls:Setting.ActionContent>
</controls:Setting>
<Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<CheckBox x:Uid="PowerLauncher_IncludeInGlobalResult"
IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"
IsEnabled="{x:Bind Enabled, Mode=OneWay}"
Margin="{StaticResource ExpanderSettingMargin}"/>
<ListView ItemsSource="{x:Bind Path=AdditionalOptions}"
SelectionMode="None"
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
<Image Source="{x:Bind IconPath}" <ListView.ItemTemplate>
Width="36" <DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel">
Opacity="{x:Bind DisabledOpacity, Mode=OneWay}" <StackPanel Orientation="Vertical">
HorizontalAlignment="Left" <Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
VerticalAlignment="Top" <CheckBox Content="{x:Bind Path=DisplayLabel}"
Margin="12,0,12,0" IsChecked="{x:Bind Path=Value, Mode=TwoWay}"
Height="36" /> Margin="{StaticResource ExpanderSettingMargin}"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackPanel Orientation="Vertical"
Grid.Column="1" Margin="0,0,16,0"> <Rectangle Style="{StaticResource ExpanderSeparatorStyle}" />
<TextBlock FontSize="18" <TextBlock Opacity="{x:Bind DisabledOpacity}"
Text="{x:Bind Path=Name}" Margin="{StaticResource ExpanderSettingMargin}">
Opacity="{x:Bind DisabledOpacity}"/> <Run x:Uid="PowerLauncher_AuthoredBy" />
<TextBlock <Run FontWeight="SemiBold" Text="{x:Bind Author}" />
Opacity="{x:Bind DisabledOpacity}" </TextBlock>
Foreground="{ThemeResource SystemBaseMediumColor}" </StackPanel>
Text="{x:Bind Description}"
TextWrapping="Wrap"/>
<TextBlock <!--<TextBlock
x:Uid="Run_NotAccessibleWarning" x:Uid="Run_NotAccessibleWarning"
Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}" Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}"
Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}" Visibility="{x:Bind ShowNotAccessibleWarning, Converter={StaticResource BoolToVisibilityConverter}}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<TextBlock <TextBlock
x:Uid="Run_NotAllowedActionKeyword" x:Uid="Run_NotAllowedActionKeyword"
Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}" Foreground="{ThemeResource SystemControlErrorTextForegroundBrush}"
Visibility="{x:Bind ShowNotAllowedKeywordWarning, Converter={StaticResource BoolToVisibilityConverter}}" Visibility="{x:Bind ShowNotAllowedKeywordWarning, Converter={StaticResource BoolToVisibilityConverter}}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />-->
</StackPanel>
</muxc:Expander.Content>
<ToggleSwitch x:Uid="PowerLauncher_EnablePluginToggle" </muxc:Expander>
x:Name="ToggleSwitch" </Grid>
OnContent="" </DataTemplate>
OffContent=""
IsOn="{x:Bind Path=Disabled, Converter={StaticResource BoolNegationConverter}, Mode=TwoWay}"
Grid.Column="2" />
</Grid>
<StackPanel Margin="60,0,0,0"
x:Name="AdditionalInfoPanel"
Visibility="{x:Bind ShowAdditionalInfoPanel, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
<TextBlock x:Uid="PowerLauncher_ActionKeyword"
x:Name="ActionKeywordHeaderTextBlock"
Margin="{StaticResource SmallTopMargin}"
Opacity="{x:Bind DisabledOpacity}" />
<TextBox x:Uid="PowerLauncher_ActionKeyword"
Text="{x:Bind Path=ActionKeyword, Mode=TwoWay}"
Width="86"
Margin="0,6,0,0"
AutomationProperties.LabeledBy="{Binding ElementName=ActionKeywordHeaderTextBlock}"
HorizontalAlignment="Left"
IsEnabled="{x:Bind Enabled, Mode=OneWay}" />
<CheckBox x:Uid="PowerLauncher_IncludeInGlobalResult"
IsChecked="{x:Bind Path=IsGlobal, Mode=TwoWay}"
IsEnabled="{x:Bind Enabled, Mode=OneWay}"
Margin="{StaticResource SmallTopMargin}"/>
<TextBlock x:Name="AdditionalOptionsTextBlock"
x:Uid="Run_AdditionalOptions"
Margin="{StaticResource SmallTopMargin}"
Visibility="{x:Bind ShowAdditionalOptions, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource SettingsGroupTitleStyle}"
Opacity="{x:Bind DisabledOpacity}"/>
<ListView ItemsSource="{x:Bind Path=AdditionalOptions}"
SelectionMode="None"
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="VerticalContentAlignment"
Value="Stretch" />
<Setter Property="Padding"
Value="0,0,0,0" />
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="ViewModels:PluginAdditionalOptionViewModel">
<CheckBox Content="{x:Bind Path=DisplayLabel}"
IsChecked="{x:Bind Path=Value, Mode=TwoWay}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<TextBlock Opacity="{x:Bind DisabledOpacity}"
Foreground="{ThemeResource SystemBaseMediumColor}"
HorizontalAlignment="Right"
Margin="0,0,12,0">
<Run x:Uid="PowerLauncher_AuthoredBy" />
<Run FontWeight="SemiBold" Text="{x:Bind Author}" />
</TextBlock>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
</controls:SettingsGroup> </controls:SettingsGroup>

View File

@@ -66,15 +66,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
Helpers.StartProcessHelper.Start(Helpers.StartProcessHelper.ColorsSettings); Helpers.StartProcessHelper.Start(Helpers.StartProcessHelper.ColorsSettings);
} }
private void PluginsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selectedPlugin = (sender as ListView)?.SelectedItem;
foreach (var plugin in ViewModel.Plugins)
{
plugin.ShowAdditionalInfoPanel = plugin == selectedPlugin;
}
}
/* /*
public Tuple<string, string> SelectedSearchResultPreference public Tuple<string, string> SelectedSearchResultPreference
{ {