Merge branch 'dev' into 250423-FixNumberboxColor

This commit is contained in:
DB P 2025-04-23 18:54:53 +09:00 committed by GitHub
commit 8ed0c47dac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 183 additions and 104 deletions

View file

@ -31,7 +31,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
{ {
_storage.Save(); _storage.Save();
} }
private string _theme = Constant.DefaultTheme; private string _theme = Constant.DefaultTheme;
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
@ -103,6 +103,20 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool ShowBadges { get; set; } = false; public bool ShowBadges { get; set; } = false;
public bool ShowBadgesGlobalOnly { get; set; } = false; public bool ShowBadgesGlobalOnly { get; set; } = false;
private string _settingWindowFont { get; set; } = Win32Helper.GetSystemDefaultFont(false);
public string SettingWindowFont
{
get => _settingWindowFont;
set
{
if (_settingWindowFont != value)
{
_settingWindowFont = value;
OnPropertyChanged();
}
}
}
public bool UseClock { get; set; } = true; public bool UseClock { get; set; } = true;
public bool UseDate { get; set; } = false; public bool UseDate { get; set; } = false;
public string TimeFormat { get; set; } = "hh:mm tt"; public string TimeFormat { get; set; } = "hh:mm tt";

View file

@ -628,21 +628,33 @@ namespace Flow.Launcher.Infrastructure
{ "pt", "Noto Sans" } { "pt", "Noto Sans" }
}; };
public static string GetSystemDefaultFont() /// <summary>
/// Gets the system default font.
/// </summary>
/// <param name="useNoto">
/// If true, it will try to find the Noto font for the current culture.
/// </param>
/// <returns>
/// The name of the system default font.
/// </returns>
public static string GetSystemDefaultFont(bool useNoto = true)
{ {
try try
{ {
var culture = CultureInfo.CurrentCulture; if (useNoto)
var language = culture.Name; // e.g., "zh-TW"
var langPrefix = language.Split('-')[0]; // e.g., "zh"
// First, try to find by full name, and if not found, fallback to prefix
if (TryGetNotoFont(language, out var notoFont) || TryGetNotoFont(langPrefix, out notoFont))
{ {
// If the font is installed, return it var culture = CultureInfo.CurrentCulture;
if (Fonts.SystemFontFamilies.Any(f => f.Source.Equals(notoFont))) var language = culture.Name; // e.g., "zh-TW"
var langPrefix = language.Split('-')[0]; // e.g., "zh"
// First, try to find by full name, and if not found, fallback to prefix
if (TryGetNotoFont(language, out var notoFont) || TryGetNotoFont(langPrefix, out notoFont))
{ {
return notoFont; // If the font is installed, return it
if (Fonts.SystemFontFamilies.Any(f => f.Source.Equals(notoFont)))
{
return notoFont;
}
} }
} }

View file

@ -8,6 +8,7 @@
Width="530" Width="530"
Background="{DynamicResource PopuBGColor}" Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}" DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}" Foreground="{DynamicResource PopupTextColor}"
Icon="Images\app.png" Icon="Images\app.png"
MouseDown="window_MouseDown" MouseDown="window_MouseDown"

View file

@ -1,22 +1,23 @@
using Flow.Launcher.Helper; using System.Collections.ObjectModel;
using Flow.Launcher.Infrastructure.UserSettings;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Controls; using System.Windows.Controls;
using Flow.Launcher.Helper;
using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher namespace Flow.Launcher
{ {
public partial class CustomQueryHotkeySetting : Window public partial class CustomQueryHotkeySetting : Window
{ {
private readonly Settings _settings; public Settings Settings { get; }
private bool update; private bool update;
private CustomPluginHotkey updateCustomHotkey; private CustomPluginHotkey updateCustomHotkey;
public CustomQueryHotkeySetting(Settings settings) public CustomQueryHotkeySetting(Settings settings)
{ {
_settings = settings; Settings = settings;
InitializeComponent(); InitializeComponent();
} }
@ -29,13 +30,13 @@ namespace Flow.Launcher
{ {
if (!update) if (!update)
{ {
_settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>(); Settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>();
var pluginHotkey = new CustomPluginHotkey var pluginHotkey = new CustomPluginHotkey
{ {
Hotkey = HotkeyControl.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text Hotkey = HotkeyControl.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text
}; };
_settings.CustomPluginHotkeys.Add(pluginHotkey); Settings.CustomPluginHotkeys.Add(pluginHotkey);
HotKeyMapper.SetCustomQueryHotkey(pluginHotkey); HotKeyMapper.SetCustomQueryHotkey(pluginHotkey);
} }
@ -54,7 +55,7 @@ namespace Flow.Launcher
public void UpdateItem(CustomPluginHotkey item) public void UpdateItem(CustomPluginHotkey item)
{ {
updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o => updateCustomHotkey = Settings.CustomPluginHotkeys.FirstOrDefault(o =>
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey); o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
if (updateCustomHotkey == null) if (updateCustomHotkey == null)
{ {

View file

@ -7,6 +7,7 @@
Width="530" Width="530"
Background="{DynamicResource PopuBGColor}" Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}" DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}" Foreground="{DynamicResource PopupTextColor}"
Icon="Images\app.png" Icon="Images\app.png"
ResizeMode="NoResize" ResizeMode="NoResize"
@ -56,11 +57,11 @@
</Button> </Button>
</Grid> </Grid>
</StackPanel> </StackPanel>
<StackPanel Margin="26,0,26,0"> <StackPanel Margin="26 0 26 0">
<StackPanel Grid.Row="0" Margin="0,0,0,12"> <StackPanel Grid.Row="0" Margin="0 0 0 12">
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Margin="0,0,0,0" Margin="0 0 0 0"
FontSize="20" FontSize="20"
FontWeight="SemiBold" FontWeight="SemiBold"
Text="{DynamicResource customQueryShortcut}" Text="{DynamicResource customQueryShortcut}"
@ -73,18 +74,18 @@
TextAlignment="Left" TextAlignment="Left"
TextWrapping="WrapWithOverflow" /> TextWrapping="WrapWithOverflow" />
<TextBlock <TextBlock
Margin="0,20,0,0" Margin="0 20 0 0"
FontSize="14" FontSize="14"
Text="{DynamicResource customeQueryShortcutGuide}" Text="{DynamicResource customeQueryShortcutGuide}"
TextAlignment="Left" TextAlignment="Left"
TextWrapping="WrapWithOverflow" /> TextWrapping="WrapWithOverflow" />
<Image <Image
Width="478" Width="478"
Margin="0,20,0,0" Margin="0 20 0 0"
Source="/Images/illustration_02.png" /> Source="/Images/illustration_02.png" />
</StackPanel> </StackPanel>
<StackPanel Margin="0,10,0,10" Orientation="Horizontal"> <StackPanel Margin="0 10 0 10" Orientation="Horizontal">
<Grid Width="478"> <Grid Width="478">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
@ -124,14 +125,14 @@
LastChildFill="True"> LastChildFill="True">
<Button <Button
x:Name="btnTestShortcut" x:Name="btnTestShortcut"
Margin="0,0,10,0" Margin="0 0 10 0"
Padding="10,5,10,5" Padding="10 5 10 5"
Click="BtnTestShortcut_OnClick" Click="BtnTestShortcut_OnClick"
Content="{DynamicResource preview}" Content="{DynamicResource preview}"
DockPanel.Dock="Right" /> DockPanel.Dock="Right" />
<TextBox <TextBox
x:Name="tbExpand" x:Name="tbExpand"
Margin="10,0,10,0" Margin="10 0 10 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
Text="{Binding Value}" /> Text="{Binding Value}" />
@ -142,21 +143,21 @@
</StackPanel> </StackPanel>
<Border <Border
Grid.Row="1" Grid.Row="1"
Margin="0,10,0,0" Margin="0 10 0 0"
Background="{DynamicResource PopupButtonAreaBGColor}" Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0"> BorderThickness="0 1 0 0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button <Button
x:Name="btnCancel" x:Name="btnCancel"
MinWidth="140" MinWidth="140"
Margin="10,0,5,0" Margin="10 0 5 0"
Click="BtnCancel_OnClick" Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" /> Content="{DynamicResource cancel}" />
<Button <Button
x:Name="btnAdd" x:Name="btnAdd"
MinWidth="140" MinWidth="140"
Margin="5,0,10,0" Margin="5 0 10 0"
Click="BtnAdd_OnClick" Click="BtnAdd_OnClick"
Style="{StaticResource AccentButtonStyle}"> Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" /> <TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />

View file

@ -1,15 +1,18 @@
using System; using System.Windows;
using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.SettingPages.ViewModels; using Flow.Launcher.SettingPages.ViewModels;
namespace Flow.Launcher namespace Flow.Launcher
{ {
public partial class CustomShortcutSetting : Window public partial class CustomShortcutSetting : Window
{ {
public Settings Settings { get; } = Ioc.Default.GetRequiredService<Settings>();
private readonly SettingsPaneHotkeyViewModel _hotkeyVm; private readonly SettingsPaneHotkeyViewModel _hotkeyVm;
public string Key { get; set; } = String.Empty; public string Key { get; set; } = string.Empty;
public string Value { get; set; } = String.Empty; public string Value { get; set; } = string.Empty;
private string originalKey { get; } = null; private string originalKey { get; } = null;
private string originalValue { get; } = null; private string originalValue { get; } = null;
private bool update { get; } = false; private bool update { get; } = false;

View file

@ -355,6 +355,7 @@
<system:String x:Key="logLevel">Log Level</system:String> <system:String x:Key="logLevel">Log Level</system:String>
<system:String x:Key="LogLevelDEBUG">Debug</system:String> <system:String x:Key="LogLevelDEBUG">Debug</system:String>
<system:String x:Key="LogLevelINFO">Info</system:String> <system:String x:Key="LogLevelINFO">Info</system:String>
<system:String x:Key="settingWindowFont">Setting Window Font</system:String>
<!-- FileManager Setting Dialog --> <!-- FileManager Setting Dialog -->
<system:String x:Key="fileManagerWindow">Select File Manager</system:String> <system:String x:Key="fileManagerWindow">Select File Manager</system:String>

View file

@ -10,6 +10,7 @@
Width="550" Width="550"
Background="{DynamicResource PopuBGColor}" Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}" DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}" Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize" ResizeMode="NoResize"
SizeToContent="Height" SizeToContent="Height"
@ -54,11 +55,11 @@
</Button> </Button>
</Grid> </Grid>
</StackPanel> </StackPanel>
<StackPanel Margin="26,12,26,0"> <StackPanel Margin="26 12 26 0">
<StackPanel Margin="0,0,0,12"> <StackPanel Margin="0 0 0 12">
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Margin="0,0,0,0" Margin="0 0 0 0"
FontSize="20" FontSize="20"
FontWeight="SemiBold" FontWeight="SemiBold"
Text="{DynamicResource defaultBrowserTitle}" Text="{DynamicResource defaultBrowserTitle}"
@ -73,7 +74,7 @@
</StackPanel> </StackPanel>
<StackPanel Margin="14,28,0,0" Orientation="Horizontal"> <StackPanel Margin="14 28 0 0" Orientation="Horizontal">
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
@ -84,7 +85,7 @@
Name="comboBox" Name="comboBox"
Height="35" Height="35"
MinWidth="200" MinWidth="200"
Margin="14,0,0,0" Margin="14 0 0 0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
ItemsSource="{Binding CustomBrowsers}" ItemsSource="{Binding CustomBrowsers}"
@ -96,11 +97,11 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<Button <Button
Margin="10,0,0,0" Margin="10 0 0 0"
Click="btnAdd_Click" Click="btnAdd_Click"
Content="{DynamicResource add}" /> Content="{DynamicResource add}" />
<Button <Button
Margin="10,0,0,0" Margin="10 0 0 0"
Click="btnDelete_Click" Click="btnDelete_Click"
Content="{DynamicResource delete}" Content="{DynamicResource delete}"
IsEnabled="{Binding CustomBrowser.Editable}" /> IsEnabled="{Binding CustomBrowser.Editable}" />
@ -108,10 +109,10 @@
</StackPanel> </StackPanel>
<Rectangle <Rectangle
Height="1" Height="1"
Margin="0,20,0,12" Margin="0 20 0 12"
Fill="{DynamicResource SeparatorForeground}" /> Fill="{DynamicResource SeparatorForeground}" />
<StackPanel <StackPanel
Margin="0,0,0,0" Margin="0 0 0 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
DataContext="{Binding CustomBrowser}" DataContext="{Binding CustomBrowser}"
Orientation="Horizontal"> Orientation="Horizontal">
@ -129,7 +130,7 @@
<TextBlock <TextBlock
Grid.Row="0" Grid.Row="0"
Grid.Column="0" Grid.Column="0"
Margin="14,5,10,0" Margin="14 5 10 0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="14" FontSize="14"
@ -139,7 +140,7 @@
Grid.Row="0" Grid.Row="0"
Grid.Column="1" Grid.Column="1"
Width="Auto" Width="Auto"
Margin="10,5,0,0" Margin="10 5 0 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
IsEnabled="{Binding Editable}" IsEnabled="{Binding Editable}"
@ -147,7 +148,7 @@
<TextBlock <TextBlock
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
Margin="14,10,0,0" Margin="14 10 0 0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="14" FontSize="14"
@ -159,7 +160,7 @@
LastChildFill="True"> LastChildFill="True">
<Button <Button
Name="btnBrowseFile" Name="btnBrowseFile"
Margin="0,10,0,0" Margin="0 10 0 0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" VerticalAlignment="Center"
Click="btnBrowseFile_Click" Click="btnBrowseFile_Click"
@ -177,7 +178,7 @@
</Button> </Button>
<TextBox <TextBox
x:Name="PathTextBox" x:Name="PathTextBox"
Margin="10,10,5,0" Margin="10 10 5 0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
IsEnabled="{Binding Editable}" IsEnabled="{Binding Editable}"
@ -187,19 +188,17 @@
<StackPanel <StackPanel
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Margin="14,10,14,0" Margin="14 10 14 0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
Orientation="Horizontal"> Orientation="Horizontal">
<RadioButton IsChecked="{Binding OpenInTab}" <RadioButton Content="{DynamicResource defaultBrowser_newTab}" IsChecked="{Binding OpenInTab}" />
Content="{DynamicResource defaultBrowser_newTab}"></RadioButton> <RadioButton Content="{DynamicResource defaultBrowser_newWindow}" IsChecked="{Binding OpenInNewWindow, Mode=OneTime}" />
<RadioButton IsChecked="{Binding OpenInNewWindow, Mode=OneTime}"
Content="{DynamicResource defaultBrowser_newWindow}"></RadioButton>
</StackPanel> </StackPanel>
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
Margin="14,10,0,20" Margin="14 10 0 20"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="14" FontSize="14"
@ -207,17 +206,17 @@
<StackPanel <StackPanel
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Margin="0,10,0,15" Margin="0 10 0 15"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Center" VerticalAlignment="Center"
Orientation="Horizontal"> Orientation="Horizontal">
<TextBox <TextBox
x:Name="fileArgTextBox" x:Name="fileArgTextBox"
Width="180" Width="180"
Margin="10,0,0,0" Margin="10 0 0 0"
Text="{Binding PrivateArg}" /> Text="{Binding PrivateArg}" />
<CheckBox <CheckBox
Margin="12,0,0,0" Margin="12 0 0 0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsChecked="{Binding EnablePrivate}"> IsChecked="{Binding EnablePrivate}">
<CheckBox.Style> <CheckBox.Style>
@ -239,18 +238,18 @@
Grid.Row="1" Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}" Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}" BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0"> BorderThickness="0 1 0 0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button <Button
x:Name="btnCancel" x:Name="btnCancel"
Width="145" Width="145"
Margin="0,0,5,0" Margin="0 0 5 0"
Click="btnCancel_Click" Click="btnCancel_Click"
Content="{DynamicResource cancel}" /> Content="{DynamicResource cancel}" />
<Button <Button
x:Name="btnDone" x:Name="btnDone"
Width="145" Width="145"
Margin="5,0,0,0" Margin="5 0 0 0"
Click="btnDone_Click" Click="btnDone_Click"
Content="{DynamicResource done}" Content="{DynamicResource done}"
ForceCursor="True" ForceCursor="True"

View file

@ -1,27 +1,25 @@
using Flow.Launcher.Infrastructure.UserSettings; using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher namespace Flow.Launcher
{ {
public partial class SelectBrowserWindow : Window, INotifyPropertyChanged [INotifyPropertyChanged]
public partial class SelectBrowserWindow : Window
{ {
private int selectedCustomBrowserIndex;
public event PropertyChangedEventHandler PropertyChanged;
public Settings Settings { get; } public Settings Settings { get; }
private int selectedCustomBrowserIndex;
public int SelectedCustomBrowserIndex public int SelectedCustomBrowserIndex
{ {
get => selectedCustomBrowserIndex; set get => selectedCustomBrowserIndex; set
{ {
selectedCustomBrowserIndex = value; selectedCustomBrowserIndex = value;
PropertyChanged?.Invoke(this, new(nameof(CustomBrowser))); OnPropertyChanged(nameof(CustomBrowser));
} }
} }
public ObservableCollection<CustomBrowserViewModel> CustomBrowsers { get; set; } public ObservableCollection<CustomBrowserViewModel> CustomBrowsers { get; set; }
@ -64,8 +62,7 @@ namespace Flow.Launcher
private void btnBrowseFile_Click(object sender, RoutedEventArgs e) private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
{ {
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
Nullable<bool> result = dlg.ShowDialog(); var result = dlg.ShowDialog();
if (result == true) if (result == true)
{ {
TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox"); TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");

View file

@ -10,6 +10,7 @@
Width="600" Width="600"
Background="{DynamicResource PopuBGColor}" Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}" DataContext="{Binding RelativeSource={RelativeSource Self}}"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Foreground="{DynamicResource PopupTextColor}" Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize" ResizeMode="NoResize"
SizeToContent="Height" SizeToContent="Height"

View file

@ -1,28 +1,27 @@
using Flow.Launcher.Infrastructure.UserSettings; using System.Collections.ObjectModel;
using Flow.Launcher.ViewModel;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.ViewModel;
namespace Flow.Launcher namespace Flow.Launcher
{ {
public partial class SelectFileManagerWindow : Window, INotifyPropertyChanged [INotifyPropertyChanged]
public partial class SelectFileManagerWindow : Window
{ {
private int selectedCustomExplorerIndex;
public event PropertyChangedEventHandler PropertyChanged;
public Settings Settings { get; } public Settings Settings { get; }
private int selectedCustomExplorerIndex;
public int SelectedCustomExplorerIndex public int SelectedCustomExplorerIndex
{ {
get => selectedCustomExplorerIndex; set get => selectedCustomExplorerIndex; set
{ {
selectedCustomExplorerIndex = value; selectedCustomExplorerIndex = value;
PropertyChanged?.Invoke(this, new(nameof(CustomExplorer))); OnPropertyChanged(nameof(CustomExplorer));
} }
} }
public ObservableCollection<CustomExplorerViewModel> CustomExplorers { get; set; } public ObservableCollection<CustomExplorerViewModel> CustomExplorers { get; set; }
@ -65,8 +64,7 @@ namespace Flow.Launcher
private void btnBrowseFile_Click(object sender, RoutedEventArgs e) private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
{ {
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
Nullable<bool> result = dlg.ShowDialog(); var result = dlg.ShowDialog();
if (result == true) if (result == true)
{ {
TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox"); TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");

View file

@ -268,4 +268,23 @@ public partial class SettingsPaneAboutViewModel : BaseModel
return "0 B"; return "0 B";
} }
public string SettingWindowFont
{
get => _settings.SettingWindowFont;
set
{
if (_settings.SettingWindowFont != value)
{
_settings.SettingWindowFont = value;
OnPropertyChanged();
}
}
}
[RelayCommand]
private void ResetSettingWindowFont()
{
SettingWindowFont = Win32Helper.GetSystemDefaultFont(false);
}
} }

View file

@ -12,6 +12,11 @@
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<ui:Page.Resources>
<ResourceDictionary>
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}" />
</ResourceDictionary>
</ui:Page.Resources>
<ScrollViewer <ScrollViewer
Margin="0" Margin="0"
CanContentScroll="True" CanContentScroll="True"
@ -127,13 +132,39 @@
</StackPanel> </StackPanel>
</cc:Card> </cc:Card>
<cc:Card Title="{DynamicResource logLevel}" Icon="&#xE749;"> <cc:ExCard
<ComboBox Title="Advanced"
DisplayMemberPath="Display" Margin="0 14 0 0"
ItemsSource="{Binding LogLevels}" Icon="&#xE8B7;">
SelectedValue="{Binding LogLevel}" <StackPanel>
SelectedValuePath="Value" /> <cc:Card
</cc:Card> Title="{DynamicResource logLevel}"
Icon="&#xE749;"
Type="Inside">
<ComboBox
DisplayMemberPath="Display"
ItemsSource="{Binding LogLevels}"
SelectedValue="{Binding LogLevel}"
SelectedValuePath="Value" />
</cc:Card>
<cc:Card
Title="{DynamicResource settingWindowFont}"
Icon="&#xf259;"
Type="Inside">
<StackPanel Orientation="Horizontal">
<Button Command="{Binding ResetSettingWindowFontCommand}" Content="Reset" />
<ComboBox
Margin="12 8 0 8"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
DisplayMemberPath="Source"
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedValue="{Binding SettingWindowFont, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Source" />
</StackPanel>
</cc:Card>
</StackPanel>
</cc:ExCard>
<TextBlock <TextBlock
Margin="14 20 0 0" Margin="14 20 0 0"

View file

@ -13,6 +13,7 @@
MinHeight="600" MinHeight="600"
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}" d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"
Closed="OnClosed" Closed="OnClosed"
FontFamily="{Binding Settings.SettingWindowFont, Mode=TwoWay}"
Icon="Images\app.ico" Icon="Images\app.ico"
Left="{Binding SettingWindowLeft, Mode=TwoWay}" Left="{Binding SettingWindowLeft, Mode=TwoWay}"
Loaded="OnLoaded" Loaded="OnLoaded"

View file

@ -5,11 +5,11 @@ namespace Flow.Launcher.ViewModel;
public partial class SettingWindowViewModel : BaseModel public partial class SettingWindowViewModel : BaseModel
{ {
private readonly Settings _settings; public Settings Settings { get; }
public SettingWindowViewModel(Settings settings) public SettingWindowViewModel(Settings settings)
{ {
_settings = settings; Settings = settings;
} }
/// <summary> /// <summary>
@ -17,30 +17,30 @@ public partial class SettingWindowViewModel : BaseModel
/// </summary> /// </summary>
public void Save() public void Save()
{ {
_settings.Save(); Settings.Save();
} }
public double SettingWindowWidth public double SettingWindowWidth
{ {
get => _settings.SettingWindowWidth; get => Settings.SettingWindowWidth;
set => _settings.SettingWindowWidth = value; set => Settings.SettingWindowWidth = value;
} }
public double SettingWindowHeight public double SettingWindowHeight
{ {
get => _settings.SettingWindowHeight; get => Settings.SettingWindowHeight;
set => _settings.SettingWindowHeight = value; set => Settings.SettingWindowHeight = value;
} }
public double? SettingWindowTop public double? SettingWindowTop
{ {
get => _settings.SettingWindowTop; get => Settings.SettingWindowTop;
set => _settings.SettingWindowTop = value; set => Settings.SettingWindowTop = value;
} }
public double? SettingWindowLeft public double? SettingWindowLeft
{ {
get => _settings.SettingWindowLeft; get => Settings.SettingWindowLeft;
set => _settings.SettingWindowLeft = value; set => Settings.SettingWindowLeft = value;
} }
} }