diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 8b9f069ce..b9e821913 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -22,6 +22,7 @@ namespace Flow.Launcher.SettingPages.ViewModels; public partial class SettingsPaneThemeViewModel : BaseModel { + private const string DefaultFont = "Segoe UI"; public Settings Settings { get; } public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme"; @@ -82,6 +83,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel get => Settings.QueryBoxFontSize; set => Settings.QueryBoxFontSize = value; } + public double ResultItemFontSize { get => Settings.ResultItemFontSize; @@ -97,30 +99,9 @@ public partial class SettingsPaneThemeViewModel : BaseModel private List _themes; public List Themes => _themes ??= ThemeManager.Instance.LoadAvailableThemes(); + public class ColorSchemeData : DropdownDataGeneric { } - public class ColorScheme - { - public string Display { get; set; } - public ColorSchemes Value { get; set; } - } - - public List ColorSchemes - { - get - { - List modes = new List(); - var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes)); - foreach (var e in enums) - { - var key = $"ColorScheme{e}"; - var display = InternationalizationManager.Instance.GetTranslation(key); - var m = new ColorScheme { Display = display, Value = e, }; - modes.Add(m); - } - - return modes; - } - } + public List ColorSchemes { get; } = DropdownDataGeneric.GetValues("ColorScheme"); public List TimeFormatList { get; } = new() { @@ -167,11 +148,13 @@ public partial class SettingsPaneThemeViewModel : BaseModel } public IEnumerable MaxResultsRange => Enumerable.Range(2, 16); + public bool KeepMaxResults { get => Settings.KeepMaxResults; set => Settings.KeepMaxResults = value; } + public string ClockText => DateTime.Now.ToString(TimeFormat, CultureInfo.CurrentCulture); public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture); @@ -188,29 +171,9 @@ public partial class SettingsPaneThemeViewModel : BaseModel set => Settings.UseAnimation = value; } - public class AnimationSpeed - { - public string Display { get; set; } - public AnimationSpeeds Value { get; set; } - } + public class AnimationSpeedData : DropdownDataGeneric { } + public List AnimationSpeeds { get; } = DropdownDataGeneric.GetValues("AnimationSpeed"); - public List AnimationSpeeds - { - get - { - List speeds = new List(); - var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds)); - foreach (var e in enums) - { - var key = $"AnimationSpeed{e}"; - var display = InternationalizationManager.Instance.GetTranslation(key); - var m = new AnimationSpeed { Display = display, Value = e, }; - speeds.Add(m); - } - - return speeds; - } - } public bool UseSound { get => Settings.UseSound; @@ -329,7 +292,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel return fontExists switch { true => new FontFamily(Settings.QueryBoxFont), - _ => new FontFamily("Segoe UI") + _ => new FontFamily(DefaultFont) }; } set @@ -373,7 +336,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel return fontExists switch { true => new FontFamily(Settings.ResultFont), - _ => new FontFamily("Segoe UI") + _ => new FontFamily(DefaultFont) }; } set @@ -418,7 +381,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel } else { - var font = new FontFamily("Segoe UI"); + var font = new FontFamily(DefaultFont); return font; } } @@ -449,6 +412,7 @@ public partial class SettingsPaneThemeViewModel : BaseModel ThemeManager.Instance.ChangeTheme(Settings.Theme); } } + public string ThemeImage => Constant.QueryTextBoxIconImagePath; [RelayCommand] @@ -473,4 +437,22 @@ public partial class SettingsPaneThemeViewModel : BaseModel Settings = settings; } + [RelayCommand] + public void Reset() + { + SelectedQueryBoxFont = new FontFamily(DefaultFont); + SelectedQueryBoxFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal }; + QueryBoxFontSize = 20; + + SelectedResultFont = new FontFamily(DefaultFont); + SelectedResultFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal }; + ResultItemFontSize = 16; + + SelectedResultSubFont = new FontFamily(DefaultFont); + SelectedResultSubFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal }; + ResultSubItemFontSize = 13; + + WindowHeightSize = 42; + ItemHeightSize = 58; + } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 60f9f6b38..c154268de 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -255,9 +255,8 @@