PowerRename

This commit is contained in:
Niels Laute
2021-08-01 21:17:27 +02:00
parent 7d831f4ced
commit bb181d957c
7 changed files with 92 additions and 73 deletions

View File

@@ -23,8 +23,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
this.DefaultStyleKey = typeof(Setting); this.DefaultStyleKey = typeof(Setting);
} }
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
"Title", "Header",
typeof(string), typeof(string),
typeof(Setting), typeof(Setting),
new PropertyMetadata(default(string))); new PropertyMetadata(default(string)));
@@ -48,10 +48,10 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
null); null);
[Localizable(true)] [Localizable(true)]
public string Title public string Header
{ {
get => (string)GetValue(TitleProperty); get => (string)GetValue(HeaderProperty);
set => SetValue(TitleProperty, value); set => SetValue(HeaderProperty, value);
} }
[Localizable(true)] [Localizable(true)]

View File

@@ -27,7 +27,7 @@
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<!-- Icon --> <!-- Icon -->
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<!-- Title and subtitle --> <!-- Header and subtitle -->
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<!-- Action control --> <!-- Action control -->
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@@ -44,16 +44,15 @@
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
<StackPanel x:Name="TitleDescriptionPanel" <StackPanel
VerticalAlignment="Center" VerticalAlignment="Center"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Margin="0,0,16,0"> Margin="0,0,16,0">
<TextBlock <TextBlock
x:Name="TitlePresenter" x:Name="HeaderPresenter"
Text="{TemplateBinding Title}" Text="{TemplateBinding Header}"
FontWeight="SemiBold"
VerticalAlignment="Center" VerticalAlignment="Center"
Foreground="{ThemeResource CardPrimaryForegroundBrush}" /> Foreground="{ThemeResource CardPrimaryForegroundBrush}" />

View File

@@ -66,9 +66,10 @@
<ContentPresenter x:Name="ModuleContentPresenter" <ContentPresenter x:Name="ModuleContentPresenter"
Content="{x:Bind ModuleContent}" Content="{x:Bind ModuleContent}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Margin="48,12,48,0" Margin="48,12,48,0"
HorizontalAlignment="Left" />
MaxWidth="{StaticResource MaxContentWidth}"/>
<RelativePanel Grid.Column="1" <RelativePanel Grid.Column="1"
x:Name="SidePanel" x:Name="SidePanel"

View File

@@ -514,7 +514,7 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
<data name="PowerRename.ModuleDescription" xml:space="preserve"> <data name="PowerRename.ModuleDescription" xml:space="preserve">
<value>A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions.</value> <value>A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions.</value>
</data> </data>
<data name="PowerRename_ShellIntegration.Text" xml:space="preserve"> <data name="PowerRename_ShellIntegration.Header" xml:space="preserve">
<value>Shell integration</value> <value>Shell integration</value>
<comment>This refers to directly integrating in with Windows</comment> <comment>This refers to directly integrating in with Windows</comment>
</data> </data>
@@ -526,10 +526,10 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
<value>Settings theme</value> <value>Settings theme</value>
</data> </data>
<data name="PowerRename_Toggle_EnableOnContextMenu.Header" xml:space="preserve"> <data name="PowerRename_Toggle_EnableOnContextMenu.Header" xml:space="preserve">
<value>Show icon on context menu</value> <value>Show PowerRename in right-click context menu</value>
</data> </data>
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve"> <data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Content" xml:space="preserve">
<value>Appear only in extended context menu (Shift + Right-click)</value> <value>Only appear in the extended context menu (Shift + Right-click)</value>
</data> </data>
<data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve"> <data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve">
<value>Maximum number of items</value> <value>Maximum number of items</value>
@@ -552,13 +552,13 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
<data name="FileExplorerPreview.ModuleDescription" xml:space="preserve"> <data name="FileExplorerPreview.ModuleDescription" xml:space="preserve">
<value>These settings allow you to manage your Windows File Explorer custom preview handlers.</value> <value>These settings allow you to manage your Windows File Explorer custom preview handlers.</value>
</data> </data>
<data name="PowerRename_AutoCompleteHeader.Text" xml:space="preserve"> <data name="PowerRename_AutoCompleteHeader.Header" xml:space="preserve">
<value>Autocomplete</value> <value>Autocomplete</value>
</data> </data>
<data name="OpenSource_Notice.Label" xml:space="preserve"> <data name="OpenSource_Notice.Label" xml:space="preserve">
<value>Open-source notice</value> <value>Open-source notice</value>
</data> </data>
<data name="PowerRename_Toggle_AutoComplete.Content" xml:space="preserve"> <data name="PowerRename_Toggle_AutoComplete.Header" xml:space="preserve">
<value>Enable autocomplete for the search and replace fields</value> <value>Enable autocomplete for the search and replace fields</value>
</data> </data>
<data name="FancyZones_BorderColor.Text" xml:space="preserve"> <data name="FancyZones_BorderColor.Text" xml:space="preserve">
@@ -951,11 +951,15 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="FancyZones_WindowBehavior_GroupSettings.Text" xml:space="preserve"> <data name="FancyZones_WindowBehavior_GroupSettings.Text" xml:space="preserve">
<value>Window behavior</value> <value>Window behavior</value>
</data> </data>
<data name="PowerRename_BehaviorHeader.Text" xml:space="preserve"> <data name="PowerRename_BehaviorHeader.Header" xml:space="preserve">
<value>Behavior</value> <value>Behavior</value>
</data> </data>
<data name="PowerRename_Toggle_UseBoostLib.Content" xml:space="preserve"> <data name="PowerRename_Toggle_UseBoostLib.Header" xml:space="preserve">
<value>Use Boost library (provides extended features but may use different regex syntax)</value> <value>Use Boost library</value>
<comment>Boost is a product name, should not be translated</comment>
</data>
<data name="PowerRename_Toggle_UseBoostLib.Description" xml:space="preserve">
<value>Provides extended features but may use different regex syntax</value>
<comment>Boost is a product name, should not be translated</comment> <comment>Boost is a product name, should not be translated</comment>
</data> </data>
<data name="MadeWithOssLove.Text" xml:space="preserve"> <data name="MadeWithOssLove.Text" xml:space="preserve">

View File

@@ -6,7 +6,6 @@
<!-- Thickness --> <!-- Thickness -->
<Thickness x:Key="ExpanderContentPadding">0</Thickness> <Thickness x:Key="ExpanderContentPadding">0</Thickness>
<Thickness x:Key="ExpanderSettingMargin">56, 12, 40, 12</Thickness> <Thickness x:Key="ExpanderSettingMargin">56, 12, 40, 12</Thickness>
<!-- Styles --> <!-- Styles -->
@@ -17,6 +16,7 @@
<Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Padding" Value="0, 14, 0, 14" /> <Setter Property="Padding" Value="0, 14, 0, 14" />
<Setter Property="Margin" Value="0"/> <Setter Property="Margin" Value="0"/>
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style> </Style>
<Thickness x:Key="ExpanderChevronMargin">0,0,8,0</Thickness> <Thickness x:Key="ExpanderChevronMargin">0,0,8,0</Thickness>
@@ -28,6 +28,7 @@
<Setter Property="BorderBrush" Value="{ThemeResource CardBorderBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource CardBorderBrush}" />
<Setter Property="CornerRadius" Value="0" /> <Setter Property="CornerRadius" Value="0" />
<Setter Property="Padding" Value="{StaticResource ExpanderSettingMargin}" /> <Setter Property="Padding" Value="{StaticResource ExpanderSettingMargin}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style> </Style>
<!-- Setting expander style --> <!-- Setting expander style -->
@@ -35,6 +36,8 @@
<Setter Property="Background" Value="{ThemeResource CardBackgroundBrush}" /> <Setter Property="Background" Value="{ThemeResource CardBackgroundBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource CardBorderThickness}" /> <Setter Property="BorderThickness" Value="{ThemeResource CardBorderThickness}" />
<Setter Property="BorderBrush" Value="{ThemeResource CardBorderBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource CardBorderBrush}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -25,7 +25,7 @@
<controls:SettingsPageControl.ModuleContent> <controls:SettingsPageControl.ModuleContent>
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<controls:Setting/>
<TextBlock x:Uid="Admin_Mode" <TextBlock x:Uid="Admin_Mode"
FontWeight="SemiBold" FontWeight="SemiBold"
TextWrapping="Wrap" TextWrapping="Wrap"

View File

@@ -6,6 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d" mc:Ignorable="d"
AutomationProperties.LandmarkType="Main"> AutomationProperties.LandmarkType="Main">
@@ -17,64 +18,75 @@
<StackPanel Orientation="Vertical" <StackPanel Orientation="Vertical"
x:Name="PowerRenameView" x:Name="PowerRenameView"
HorizontalAlignment="Left" HorizontalAlignment="Stretch"
Margin="0,0,48,0"> Margin="0,0,48,0">
<controls:Setting Title="Enable PowerRename" /> <controls:Setting x:Uid="PowerRename_Toggle_Enable">
<controls:Setting.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsColorPicker.png" ShowAsMonochrome="False" />
</controls:Setting.Icon>
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}" FlowDirection="RightToLeft" />
</controls:Setting.ActionContent>
</controls:Setting>
<ToggleSwitch x:Uid="PowerRename_Toggle_Enable" <toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_ShellIntegration">
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}" <muxc:Expander IsExpanded="True" Style="{StaticResource SettingsExpanderStyle}">
/> <muxc:Expander.Header>
<controls:Setting x:Uid="PowerRename_Toggle_EnableOnContextMenu" Icon="&#xE14C;" Style="{StaticResource ExpanderHeaderSettingStyle}">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextMenu}" FlowDirection="RightToLeft" />
</controls:Setting.ActionContent>
</controls:Setting>
</muxc:Expander.Header>
<muxc:Expander.Content>
<CheckBox x:Uid="PowerRename_Toggle_EnableOnExtendedContextMenu"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextExtendedMenu}"
Margin="{StaticResource ExpanderSettingMargin}" />
</muxc:Expander.Content>
</muxc:Expander>
</toolkitcontrols:HeaderedItemsControl>
<TextBlock x:Uid="PowerRename_ShellIntegration" <toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_AutoCompleteHeader">
Style="{StaticResource SettingsGroupTitleStyle}" <muxc:Expander IsExpanded="True" Style="{StaticResource SettingsExpanderStyle}">
Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/> <muxc:Expander.Header>
<controls:Setting x:Uid="PowerRename_Toggle_AutoComplete" Style="{StaticResource ExpanderHeaderSettingStyle}">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.MRUEnabled}" FlowDirection="RightToLeft" />
</controls:Setting.ActionContent>
</controls:Setting>
</muxc:Expander.Header>
<muxc:Expander.Content>
<StackPanel HorizontalAlignment="Stretch">
<CheckBox x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.RestoreFlagsOnLaunch}"
Margin="{StaticResource ExpanderSettingMargin}" />
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnContextMenu" <controls:Setting x:Uid="PowerRename_Toggle_MaxDispListNum" Style="{StaticResource ExpanderContentSettingStyle}">
Margin="{StaticResource SmallTopMargin}" <controls:Setting.ActionContent>
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextMenu}" <muxc:NumberBox SpinButtonPlacementMode="Compact"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" HorizontalAlignment="Left"
/> Value="{x:Bind Mode=TwoWay, Path=ViewModel.MaxDispListNum}"
Minimum="0"
Maximum="20"
Width="180"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.GlobalAndMruEnabled}"/>
</controls:Setting.ActionContent>
</controls:Setting>
</StackPanel>
</muxc:Expander.Content>
</muxc:Expander>
</toolkitcontrols:HeaderedItemsControl>
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnExtendedContextMenu"
Margin="{StaticResource SmallTopMargin}"
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextExtendedMenu}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
/>
<TextBlock x:Uid="PowerRename_AutoCompleteHeader"
Style="{StaticResource SettingsGroupTitleStyle}"
Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/>
<CheckBox x:Uid="PowerRename_Toggle_AutoComplete" <toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_BehaviorHeader">
Margin="{StaticResource SmallTopMargin}" <controls:Setting x:Uid="PowerRename_Toggle_UseBoostLib">
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MRUEnabled}" <controls:Setting.ActionContent>
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" <ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.UseBoostLib}" FlowDirection="RightToLeft" />
/> </controls:Setting.ActionContent>
</controls:Setting>
<muxc:NumberBox x:Uid="PowerRename_Toggle_MaxDispListNum" </toolkitcontrols:HeaderedItemsControl>
SpinButtonPlacementMode="Compact"
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MaxDispListNum}"
Minimum="0"
Width="240"
Maximum="20"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.GlobalAndMruEnabled}"/>
<CheckBox x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
Margin="0, 17, 0, 0"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.RestoreFlagsOnLaunch}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
<TextBlock x:Uid="PowerRename_BehaviorHeader"
Style="{StaticResource SettingsGroupTitleStyle}"
Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/>
<CheckBox x:Uid="PowerRename_Toggle_UseBoostLib"
Margin="{StaticResource SmallTopMargin}"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.UseBoostLib}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
</StackPanel> </StackPanel>
</controls:SettingsPageControl.ModuleContent> </controls:SettingsPageControl.ModuleContent>