Add Subtext Highlight Setting

This commit is contained in:
DB p 2021-12-10 23:28:47 +09:00
parent 1f64dc8e94
commit 1a49178ebe
5 changed files with 43 additions and 1 deletions

View file

@ -40,6 +40,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string ResultFontStretch { get; set; }
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool SubtitleHighlight { get; set; } = false;
public bool UseSound { get; set; } = true;
public bool FirstLaunch { get; set; } = true;

View file

@ -8,11 +8,15 @@ using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Documents;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Core.Resource;
namespace Flow.Launcher.Converters
{
public class HighlightTextConverter : IMultiValueConverter
{
public Settings Settings { get;}
Settings settings = new Settings();
public object Convert(object[] value, Type targetType, object parameter, CultureInfo cultureInfo)
{
var text = value[0] as string;
@ -31,8 +35,14 @@ namespace Flow.Launcher.Converters
var currentCharacter = text.Substring(i, 1);
if (this.ShouldHighlight(highlightData, i))
{
System.Diagnostics.Debug.WriteLine(settings.SubtitleHighlight);
if (settings.SubtitleHighlight == true)
{
textBlock.Inlines.Add(new Run(currentCharacter) { Style = (Style)Application.Current.FindResource("HighlightStyle") });
}
else
{
}
}
else
@ -52,5 +62,6 @@ namespace Flow.Launcher.Converters
{
return highlightData.Contains(index);
}
}
}

View file

@ -90,6 +90,7 @@
<system:String x:Key="ThemeFolder">Theme Folder</system:String>
<system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String>
<system:String x:Key="ColorScheme">Color Scheme</system:String>
<system:String x:Key="SubtitleHihglight">Subtitle Highlight</system:String>
<system:String x:Key="ColorSchemeSystem">System Default</system:String>
<system:String x:Key="ColorSchemeLight">Light</system:String>
<system:String x:Key="ColorSchemeDark">Dark</system:String>

View file

@ -1937,6 +1937,29 @@
</TextBlock>
</ItemsControl>
</Border>
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Border
Margin="0,0,0,0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource SubtitleHihglight}" />
</StackPanel>
<ui:ToggleSwitch
Grid.Row="0"
Grid.Column="2"
Width="100"
Margin="0,0,2,0"
IsOn="{Binding SubtitleHighlight, Mode=TwoWay}" />
<TextBlock Style="{StaticResource Glyph}">
&#xea80;
</TextBlock>
</ItemsControl>
</Border>
</StackPanel>
</Border>

View file

@ -356,12 +356,18 @@ namespace Flow.Launcher.ViewModel
set => Settings.UseAnimation = value;
}
public bool UseSound
{
get => Settings.UseSound;
set => Settings.UseSound = value;
}
public bool SubtitleHighlight
{
get => Settings.SubtitleHighlight;
set => Settings.SubtitleHighlight = value;
}
public Brush PreviewBackground
{
get