@@ -22,6 +22,7 @@ namespace Flow.Launcher.SettingPages.ViewModels;
2222
2323public partial class SettingsPaneThemeViewModel : BaseModel
2424{
25+ private const string DefaultFont = "Segoe UI" ;
2526 public Settings Settings { get ; }
2627
2728 public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme" ;
@@ -82,6 +83,7 @@ public double QueryBoxFontSize
8283 get => Settings . QueryBoxFontSize ;
8384 set => Settings . QueryBoxFontSize = value ;
8485 }
86+
8587 public double ResultItemFontSize
8688 {
8789 get => Settings . ResultItemFontSize ;
@@ -97,30 +99,9 @@ public double ResultSubItemFontSize
9799 private List < Theme . ThemeData > _themes ;
98100 public List < Theme . ThemeData > Themes => _themes ??= ThemeManager . Instance . LoadAvailableThemes ( ) ;
99101
102+ public class ColorSchemeData : DropdownDataGeneric < ColorSchemes > { }
100103
101- public class ColorScheme
102- {
103- public string Display { get ; set ; }
104- public ColorSchemes Value { get ; set ; }
105- }
106-
107- public List < ColorScheme > ColorSchemes
108- {
109- get
110- {
111- List < ColorScheme > modes = new List < ColorScheme > ( ) ;
112- var enums = ( ColorSchemes [ ] ) Enum . GetValues ( typeof ( ColorSchemes ) ) ;
113- foreach ( var e in enums )
114- {
115- var key = $ "ColorScheme{ e } ";
116- var display = InternationalizationManager . Instance . GetTranslation ( key ) ;
117- var m = new ColorScheme { Display = display , Value = e , } ;
118- modes . Add ( m ) ;
119- }
120-
121- return modes ;
122- }
123- }
104+ public List < ColorSchemeData > ColorSchemes { get ; } = DropdownDataGeneric < ColorSchemes > . GetValues < ColorSchemeData > ( "ColorScheme" ) ;
124105
125106 public List < string > TimeFormatList { get ; } = new ( )
126107 {
@@ -167,11 +148,13 @@ public string DateFormat
167148 }
168149
169150 public IEnumerable < int > MaxResultsRange => Enumerable . Range ( 2 , 16 ) ;
151+
170152 public bool KeepMaxResults
171153 {
172154 get => Settings . KeepMaxResults ;
173155 set => Settings . KeepMaxResults = value ;
174156 }
157+
175158 public string ClockText => DateTime . Now . ToString ( TimeFormat , CultureInfo . CurrentCulture ) ;
176159
177160 public string DateText => DateTime . Now . ToString ( DateFormat , CultureInfo . CurrentCulture ) ;
@@ -188,29 +171,9 @@ public bool UseAnimation
188171 set => Settings . UseAnimation = value ;
189172 }
190173
191- public class AnimationSpeed
192- {
193- public string Display { get ; set ; }
194- public AnimationSpeeds Value { get ; set ; }
195- }
174+ public class AnimationSpeedData : DropdownDataGeneric < AnimationSpeeds > { }
175+ public List < AnimationSpeedData > AnimationSpeeds { get ; } = DropdownDataGeneric < AnimationSpeeds > . GetValues < AnimationSpeedData > ( "AnimationSpeed" ) ;
196176
197- public List < AnimationSpeed > AnimationSpeeds
198- {
199- get
200- {
201- List < AnimationSpeed > speeds = new List < AnimationSpeed > ( ) ;
202- var enums = ( AnimationSpeeds [ ] ) Enum . GetValues ( typeof ( AnimationSpeeds ) ) ;
203- foreach ( var e in enums )
204- {
205- var key = $ "AnimationSpeed{ e } ";
206- var display = InternationalizationManager . Instance . GetTranslation ( key ) ;
207- var m = new AnimationSpeed { Display = display , Value = e , } ;
208- speeds . Add ( m ) ;
209- }
210-
211- return speeds ;
212- }
213- }
214177 public bool UseSound
215178 {
216179 get => Settings . UseSound ;
@@ -329,7 +292,7 @@ public FontFamily SelectedQueryBoxFont
329292 return fontExists switch
330293 {
331294 true => new FontFamily ( Settings . QueryBoxFont ) ,
332- _ => new FontFamily ( "Segoe UI" )
295+ _ => new FontFamily ( DefaultFont )
333296 } ;
334297 }
335298 set
@@ -373,7 +336,7 @@ public FontFamily SelectedResultFont
373336 return fontExists switch
374337 {
375338 true => new FontFamily ( Settings . ResultFont ) ,
376- _ => new FontFamily ( "Segoe UI" )
339+ _ => new FontFamily ( DefaultFont )
377340 } ;
378341 }
379342 set
@@ -418,7 +381,7 @@ public FontFamily SelectedResultSubFont
418381 }
419382 else
420383 {
421- var font = new FontFamily ( "Segoe UI" ) ;
384+ var font = new FontFamily ( DefaultFont ) ;
422385 return font ;
423386 }
424387 }
@@ -449,6 +412,7 @@ public FamilyTypeface SelectedResultSubFontFaces
449412 ThemeManager . Instance . ChangeTheme ( Settings . Theme ) ;
450413 }
451414 }
415+
452416 public string ThemeImage => Constant . QueryTextBoxIconImagePath ;
453417
454418 [ RelayCommand ]
@@ -473,4 +437,22 @@ public SettingsPaneThemeViewModel(Settings settings)
473437 Settings = settings ;
474438 }
475439
440+ [ RelayCommand ]
441+ public void Reset ( )
442+ {
443+ SelectedQueryBoxFont = new FontFamily ( DefaultFont ) ;
444+ SelectedQueryBoxFontFaces = new FamilyTypeface { Stretch = FontStretches . Normal , Weight = FontWeights . Normal , Style = FontStyles . Normal } ;
445+ QueryBoxFontSize = 20 ;
446+
447+ SelectedResultFont = new FontFamily ( DefaultFont ) ;
448+ SelectedResultFontFaces = new FamilyTypeface { Stretch = FontStretches . Normal , Weight = FontWeights . Normal , Style = FontStyles . Normal } ;
449+ ResultItemFontSize = 16 ;
450+
451+ SelectedResultSubFont = new FontFamily ( DefaultFont ) ;
452+ SelectedResultSubFontFaces = new FamilyTypeface { Stretch = FontStretches . Normal , Weight = FontWeights . Normal , Style = FontStyles . Normal } ;
453+ ResultSubItemFontSize = 13 ;
454+
455+ WindowHeightSize = 42 ;
456+ ItemHeightSize = 58 ;
457+ }
476458}
0 commit comments