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

View File

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

View File

@@ -66,9 +66,10 @@
<ContentPresenter x:Name="ModuleContentPresenter"
Content="{x:Bind ModuleContent}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Margin="48,12,48,0"
HorizontalAlignment="Left"
MaxWidth="{StaticResource MaxContentWidth}"/>
/>
<RelativePanel Grid.Column="1"
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">
<value>A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions.</value>
</data>
<data name="PowerRename_ShellIntegration.Text" xml:space="preserve">
<data name="PowerRename_ShellIntegration.Header" xml:space="preserve">
<value>Shell integration</value>
<comment>This refers to directly integrating in with Windows</comment>
</data>
@@ -526,10 +526,10 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
<value>Settings theme</value>
</data>
<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 name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve">
<value>Appear only in extended context menu (Shift + Right-click)</value>
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Content" xml:space="preserve">
<value>Only appear in the extended context menu (Shift + Right-click)</value>
</data>
<data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve">
<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">
<value>These settings allow you to manage your Windows File Explorer custom preview handlers.</value>
</data>
<data name="PowerRename_AutoCompleteHeader.Text" xml:space="preserve">
<data name="PowerRename_AutoCompleteHeader.Header" xml:space="preserve">
<value>Autocomplete</value>
</data>
<data name="OpenSource_Notice.Label" xml:space="preserve">
<value>Open-source notice</value>
</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>
</data>
<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">
<value>Window behavior</value>
</data>
<data name="PowerRename_BehaviorHeader.Text" xml:space="preserve">
<data name="PowerRename_BehaviorHeader.Header" xml:space="preserve">
<value>Behavior</value>
</data>
<data name="PowerRename_Toggle_UseBoostLib.Content" xml:space="preserve">
<value>Use Boost library (provides extended features but may use different regex syntax)</value>
<data name="PowerRename_Toggle_UseBoostLib.Header" xml:space="preserve">
<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>
</data>
<data name="MadeWithOssLove.Text" xml:space="preserve">

View File

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

View File

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

View File

@@ -6,6 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d"
AutomationProperties.LandmarkType="Main">
@@ -17,64 +18,75 @@
<StackPanel Orientation="Vertical"
x:Name="PowerRenameView"
HorizontalAlignment="Left"
HorizontalAlignment="Stretch"
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"
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.IsEnabled}"
/>
<toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_ShellIntegration">
<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"
Style="{StaticResource SettingsGroupTitleStyle}"
Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/>
<toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_AutoCompleteHeader">
<muxc:Expander IsExpanded="True" Style="{StaticResource SettingsExpanderStyle}">
<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"
Margin="{StaticResource SmallTopMargin}"
IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.EnabledOnContextMenu}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
/>
<controls:Setting x:Uid="PowerRename_Toggle_MaxDispListNum" Style="{StaticResource ExpanderContentSettingStyle}">
<controls:Setting.ActionContent>
<muxc:NumberBox SpinButtonPlacementMode="Compact"
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"
Margin="{StaticResource SmallTopMargin}"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.MRUEnabled}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
/>
<muxc:NumberBox x:Uid="PowerRename_Toggle_MaxDispListNum"
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}"/>
<toolkitcontrols:HeaderedItemsControl x:Uid="PowerRename_BehaviorHeader">
<controls:Setting x:Uid="PowerRename_Toggle_UseBoostLib">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.UseBoostLib}" FlowDirection="RightToLeft" />
</controls:Setting.ActionContent>
</controls:Setting>
</toolkitcontrols:HeaderedItemsControl>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>