[Run] Adding configurable fontsizes (#30541)

* Adding configurable fontsize for result titles

* Update src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>

* Updating strings

* XAML styler

* CI fix

* PowerLauncher images

* update results height on font change

* Revert "update results height on font change"

This reverts commit 459f57c647.

---------

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
Niels Laute
2023-12-26 14:49:50 +01:00
committed by GitHub
parent c098cfb193
commit ccd401fc16
16 changed files with 115 additions and 40 deletions

View File

@@ -51,6 +51,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("show_plugins_overview")]
public int ShowPluginsOverview { get; set; }
[JsonPropertyName("title_fontsize")]
public int TitleFontSize { get; set; }
[JsonPropertyName("startupPosition")]
public StartupPosition Position { get; set; }
@@ -111,6 +114,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
GenerateThumbnailsFromFiles = true;
UsePinyin = false;
ShowPluginsOverview = 0;
TitleFontSize = 16;
}
}
}

View File

@@ -83,6 +83,7 @@ namespace ViewModelTests
Assert.AreEqual(originalSettings.Properties.GenerateThumbnailsFromFiles, viewModel.GenerateThumbnailsFromFiles);
Assert.AreEqual(originalSettings.Properties.UsePinyin, viewModel.UsePinyin);
Assert.AreEqual(originalSettings.Properties.ShowPluginsOverview, viewModel.ShowPluginsOverviewIndex);
Assert.AreEqual(originalSettings.Properties.TitleFontSize, viewModel.TitleFontSize);
// Verify that the stub file was used
var expectedCallCount = 2; // once via the view model, and once by the test (GetSettings<T>)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -209,6 +209,33 @@
<ComboBoxItem x:Uid="ShowPluginsOverview_None" />
</ComboBox>
</controls:SettingsCard>
<controls:SettingsCard x:Uid="PowerLauncher_TitleFontSize" HeaderIcon="{ui:FontIcon Glyph=&#xE8E9;}">
<StackPanel Orientation="Horizontal" Spacing="12">
<TextBlock
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontSize="12"
FontWeight="SemiBold"
Text="A" />
<Slider
x:Uid="PowerLauncher_TextFontSizeSlider"
LargeChange="2"
Maximum="24"
Minimum="12"
SmallChange="2"
StepFrequency="2"
TickFrequency="2"
TickPlacement="Outside"
Value="{x:Bind ViewModel.TitleFontSize, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontSize="24"
FontWeight="SemiBold"
Text="A" />
</StackPanel>
</controls:SettingsCard>
</custom:SettingsGroup>
<custom:SettingsGroup x:Uid="PowerLauncher_Plugins" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}">

View File

@@ -59,10 +59,7 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root"
xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
@@ -3916,4 +3913,13 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="ShowPluginsOverview_NonGlobal.Content" xml:space="preserve">
<value>Not included in global results</value>
</data>
<data name="PowerLauncher_TitleFontSize.Description" xml:space="preserve">
<value>The size of result titles and the search query</value>
</data>
<data name="PowerLauncher_TitleFontSize.Header" xml:space="preserve">
<value>Text size (pt)</value>
</data>
<data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Text size of result titles</value>
</data>
</root>

View File

@@ -614,6 +614,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public int TitleFontSize
{
get
{
return settings.Properties.TitleFontSize;
}
set
{
if (settings.Properties.TitleFontSize != value)
{
settings.Properties.TitleFontSize = value;
UpdateSettings();
}
}
}
private ObservableCollection<PowerLauncherPluginViewModel> _plugins;
public ObservableCollection<PowerLauncherPluginViewModel> Plugins