66using System . IO ;
77using System . Linq ;
88using System . Windows . Media ;
9- using CommunityToolkit . Mvvm . DependencyInjection ;
109using CommunityToolkit . Mvvm . Input ;
1110using Flow . Launcher . Core . Resource ;
1211using Flow . Launcher . Helper ;
@@ -22,10 +21,12 @@ namespace Flow.Launcher.SettingPages.ViewModels;
2221
2322public partial class SettingsPaneThemeViewModel : BaseModel
2423{
24+ public Settings Settings { get ; }
25+
26+ private readonly Theme _theme ;
27+
2528 private readonly string DefaultFont = Win32Helper . GetSystemDefaultFont ( ) ;
2629 public string BackdropSubText => ! Win32Helper . IsBackdropSupported ( ) ? App . API . GetTranslation ( "BackdropTypeDisabledToolTip" ) : "" ;
27- public Settings Settings { get ; }
28- private readonly Theme _theme = Ioc . Default . GetRequiredService < Theme > ( ) ;
2930
3031 public static string LinkHowToCreateTheme => @"https://www.flowlauncher.com/theme-builder/" ;
3132 public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438" ;
@@ -289,59 +290,14 @@ public bool UseDate
289290 set => Settings . UseDate = value ;
290291 }
291292
293+ public FontFamily ClockPanelFont { get ; }
294+
292295 public Brush PreviewBackground
293296 {
294297 get => WallpaperPathRetrieval . GetWallpaperBrush ( ) ;
295298 }
296299
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 ; }
345301
346302 public FontFamily SelectedQueryBoxFont
347303 {
@@ -479,9 +435,53 @@ public FamilyTypeface SelectedResultSubFontFaces
479435
480436 public string ThemeImage => Constant . QueryTextBoxIconImagePath ;
481437
482- public SettingsPaneThemeViewModel ( Settings settings )
438+ public SettingsPaneThemeViewModel ( Settings settings , Theme theme )
483439 {
484440 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 ;
485485 }
486486
487487 [ RelayCommand ]
0 commit comments