6
6
using System . IO ;
7
7
using System . Linq ;
8
8
using System . Windows . Media ;
9
- using CommunityToolkit . Mvvm . DependencyInjection ;
10
9
using CommunityToolkit . Mvvm . Input ;
11
10
using Flow . Launcher . Core . Resource ;
12
11
using Flow . Launcher . Helper ;
@@ -22,10 +21,12 @@ namespace Flow.Launcher.SettingPages.ViewModels;
22
21
23
22
public partial class SettingsPaneThemeViewModel : BaseModel
24
23
{
24
+ public Settings Settings { get ; }
25
+
26
+ private readonly Theme _theme ;
27
+
25
28
private readonly string DefaultFont = Win32Helper . GetSystemDefaultFont ( ) ;
26
29
public string BackdropSubText => ! Win32Helper . IsBackdropSupported ( ) ? App . API . GetTranslation ( "BackdropTypeDisabledToolTip" ) : "" ;
27
- public Settings Settings { get ; }
28
- private readonly Theme _theme = Ioc . Default . GetRequiredService < Theme > ( ) ;
29
30
30
31
public static string LinkHowToCreateTheme => @"https://www.flowlauncher.com/theme-builder/" ;
31
32
public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438" ;
@@ -289,59 +290,14 @@ public bool UseDate
289
290
set => Settings . UseDate = value ;
290
291
}
291
292
293
+ public FontFamily ClockPanelFont { get ; }
294
+
292
295
public Brush PreviewBackground
293
296
{
294
297
get => WallpaperPathRetrieval . GetWallpaperBrush ( ) ;
295
298
}
296
299
297
- public ResultsViewModel PreviewResults
298
- {
299
- get
300
- {
301
- var results = new List < Result >
302
- {
303
- new ( )
304
- {
305
- Title = App . API . GetTranslation ( "SampleTitleExplorer" ) ,
306
- SubTitle = App . API . GetTranslation ( "SampleSubTitleExplorer" ) ,
307
- IcoPath = Path . Combine (
308
- Constant . ProgramDirectory ,
309
- @"Plugins\Flow.Launcher.Plugin.Explorer\Images\explorer.png"
310
- )
311
- } ,
312
- new ( )
313
- {
314
- Title = App . API . GetTranslation ( "SampleTitleWebSearch" ) ,
315
- SubTitle = App . API . GetTranslation ( "SampleSubTitleWebSearch" ) ,
316
- IcoPath = Path . Combine (
317
- Constant . ProgramDirectory ,
318
- @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png"
319
- )
320
- } ,
321
- new ( )
322
- {
323
- Title = App . API . GetTranslation ( "SampleTitleProgram" ) ,
324
- SubTitle = App . API . GetTranslation ( "SampleSubTitleProgram" ) ,
325
- IcoPath = Path . Combine (
326
- Constant . ProgramDirectory ,
327
- @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png"
328
- )
329
- } ,
330
- new ( )
331
- {
332
- Title = App . API . GetTranslation ( "SampleTitleProcessKiller" ) ,
333
- SubTitle = App . API . GetTranslation ( "SampleSubTitleProcessKiller" ) ,
334
- IcoPath = Path . Combine (
335
- Constant . ProgramDirectory ,
336
- @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png"
337
- )
338
- }
339
- } ;
340
- var vm = new ResultsViewModel ( Settings ) ;
341
- vm . AddResults ( results , "PREVIEW" ) ;
342
- return vm ;
343
- }
344
- }
300
+ public ResultsViewModel PreviewResults { get ; }
345
301
346
302
public FontFamily SelectedQueryBoxFont
347
303
{
@@ -479,9 +435,53 @@ public FamilyTypeface SelectedResultSubFontFaces
479
435
480
436
public string ThemeImage => Constant . QueryTextBoxIconImagePath ;
481
437
482
- public SettingsPaneThemeViewModel ( Settings settings )
438
+ public SettingsPaneThemeViewModel ( Settings settings , Theme theme )
483
439
{
484
440
Settings = settings ;
441
+ _theme = theme ;
442
+ ClockPanelFont = new FontFamily ( DefaultFont ) ;
443
+ var results = new List < Result >
444
+ {
445
+ new ( )
446
+ {
447
+ Title = App . API . GetTranslation ( "SampleTitleExplorer" ) ,
448
+ SubTitle = App . API . GetTranslation ( "SampleSubTitleExplorer" ) ,
449
+ IcoPath = Path . Combine (
450
+ Constant . ProgramDirectory ,
451
+ @"Plugins\Flow.Launcher.Plugin.Explorer\Images\explorer.png"
452
+ )
453
+ } ,
454
+ new ( )
455
+ {
456
+ Title = App . API . GetTranslation ( "SampleTitleWebSearch" ) ,
457
+ SubTitle = App . API . GetTranslation ( "SampleSubTitleWebSearch" ) ,
458
+ IcoPath = Path . Combine (
459
+ Constant . ProgramDirectory ,
460
+ @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png"
461
+ )
462
+ } ,
463
+ new ( )
464
+ {
465
+ Title = App . API . GetTranslation ( "SampleTitleProgram" ) ,
466
+ SubTitle = App . API . GetTranslation ( "SampleSubTitleProgram" ) ,
467
+ IcoPath = Path . Combine (
468
+ Constant . ProgramDirectory ,
469
+ @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png"
470
+ )
471
+ } ,
472
+ new ( )
473
+ {
474
+ Title = App . API . GetTranslation ( "SampleTitleProcessKiller" ) ,
475
+ SubTitle = App . API . GetTranslation ( "SampleSubTitleProcessKiller" ) ,
476
+ IcoPath = Path . Combine (
477
+ Constant . ProgramDirectory ,
478
+ @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png"
479
+ )
480
+ }
481
+ } ;
482
+ var vm = new ResultsViewModel ( Settings ) ;
483
+ vm . AddResults ( results , "PREVIEW" ) ;
484
+ PreviewResults = vm ;
485
485
}
486
486
487
487
[ RelayCommand ]
0 commit comments