@@ -23,6 +23,7 @@ mod shell_cmd_dialog;
2323mod snippet_dialog;
2424mod tempfile_alias_dialog;
2525mod tempfile_dialog;
26+ mod theme_settings_dialog;
2627mod timer_dialog;
2728mod toast_log_dialog;
2829mod todo_dialog;
@@ -61,6 +62,7 @@ pub use shell_cmd_dialog::ShellCmdDialog;
6162pub use snippet_dialog:: SnippetDialog ;
6263pub use tempfile_alias_dialog:: TempfileAliasDialog ;
6364pub use tempfile_dialog:: TempfileDialog ;
65+ pub use theme_settings_dialog:: ThemeSettingsDialogState ;
6466pub use timer_dialog:: { TimerCompletionDialog , TimerDialog } ;
6567pub use toast_log_dialog:: ToastLogDialog ;
6668pub use todo_dialog:: TodoDialog ;
@@ -307,6 +309,7 @@ pub enum Panel {
307309 MacroDialog ,
308310 MouseGesturesDialog ,
309311 MouseGestureSettingsDialog ,
312+ ThemeSettingsDialog ,
310313 FavDialog ,
311314 NotesDialog ,
312315 UnusedAssetsDialog ,
@@ -345,6 +348,7 @@ struct PanelStates {
345348 macro_dialog : bool ,
346349 mouse_gestures_dialog : bool ,
347350 mouse_gesture_settings_dialog : bool ,
351+ theme_settings_dialog : bool ,
348352 fav_dialog : bool ,
349353 notes_dialog : bool ,
350354 unused_assets_dialog : bool ,
@@ -449,6 +453,8 @@ pub struct LauncherApp {
449453 macro_dialog : MacroDialog ,
450454 mouse_gestures_dialog : MgGesturesDialog ,
451455 mouse_gesture_settings_dialog : MouseGestureSettingsDialog ,
456+ theme_settings_dialog_open : bool ,
457+ theme_settings_dialog : ThemeSettingsDialogState ,
452458 fav_dialog : FavDialog ,
453459 notes_dialog : NotesDialog ,
454460 unused_assets_dialog : UnusedAssetsDialog ,
@@ -717,10 +723,7 @@ impl LauncherApp {
717723 }
718724
719725 fn is_note_search_query ( query : & str ) -> bool {
720- query
721- . trim_start ( )
722- . to_lowercase ( )
723- . starts_with ( "note search" )
726+ query. trim_start ( ) . to_lowercase ( ) . starts_with ( "note search" )
724727 }
725728
726729 fn note_search_debounce_ready (
@@ -800,6 +803,20 @@ impl LauncherApp {
800803 pub fn open_mouse_gesture_settings_dialog ( & mut self ) {
801804 self . mouse_gesture_settings_dialog . open ( ) ;
802805 }
806+
807+ pub fn open_theme_settings_dialog ( & mut self ) {
808+ self . theme_settings_dialog_open = true ;
809+ self . theme_settings_dialog . request_reload ( ) ;
810+ }
811+
812+ pub fn is_theme_settings_dialog_open ( & self ) -> bool {
813+ self . theme_settings_dialog_open
814+ }
815+
816+ pub fn close_theme_settings_dialog ( & mut self ) {
817+ self . theme_settings_dialog_open = false ;
818+ self . update_panel_stack ( ) ;
819+ }
803820 pub fn update_paths (
804821 & mut self ,
805822 plugin_dirs : Option < Vec < String > > ,
@@ -1281,6 +1298,8 @@ impl LauncherApp {
12811298 macro_dialog : MacroDialog :: default ( ) ,
12821299 mouse_gestures_dialog : MgGesturesDialog :: default ( ) ,
12831300 mouse_gesture_settings_dialog : MouseGestureSettingsDialog :: default ( ) ,
1301+ theme_settings_dialog_open : false ,
1302+ theme_settings_dialog : ThemeSettingsDialogState :: default ( ) ,
12841303 fav_dialog : FavDialog :: default ( ) ,
12851304 notes_dialog : NotesDialog :: default ( ) ,
12861305 unused_assets_dialog : UnusedAssetsDialog :: default ( ) ,
@@ -2561,6 +2580,8 @@ impl LauncherApp {
25612580 let registry = self . dashboard . registry ( ) . clone ( ) ;
25622581 self . dashboard_editor . open ( & self . dashboard_path , & registry) ;
25632582 self . show_dashboard_editor = true ;
2583+ } else if a. action == "theme:dialog" {
2584+ self . open_theme_settings_dialog ( ) ;
25642585 } else if a. action == "volume:dialog" {
25652586 self . volume_dialog . open ( ) ;
25662587 } else if a. action == "brightness:dialog" {
@@ -2930,6 +2951,7 @@ impl LauncherApp {
29302951 || self . macro_dialog . open
29312952 || self . mouse_gestures_dialog . open
29322953 || self . mouse_gesture_settings_dialog . open
2954+ || self . theme_settings_dialog_open
29332955 || self . fav_dialog . open
29342956 || self . notes_dialog . open
29352957 || self . unused_assets_dialog . open
@@ -3054,6 +3076,10 @@ impl LauncherApp {
30543076 self . mouse_gesture_settings_dialog . open = false ;
30553077 self . panel_states . mouse_gesture_settings_dialog = false ;
30563078 }
3079+ Panel :: ThemeSettingsDialog => {
3080+ self . theme_settings_dialog_open = false ;
3081+ self . panel_states . theme_settings_dialog = false ;
3082+ }
30573083 Panel :: FavDialog => {
30583084 self . fav_dialog . open = false ;
30593085 self . panel_states . fav_dialog = false ;
@@ -3200,6 +3226,10 @@ impl LauncherApp {
32003226 self . mouse_gesture_settings_dialog . open = false ;
32013227 self . panel_states . mouse_gesture_settings_dialog = false ;
32023228 }
3229+ Panel :: ThemeSettingsDialog => {
3230+ self . theme_settings_dialog_open = false ;
3231+ self . panel_states . theme_settings_dialog = false ;
3232+ }
32033233 Panel :: FavDialog => {
32043234 self . fav_dialog . open = false ;
32053235 self . panel_states . fav_dialog = false ;
@@ -3304,6 +3334,7 @@ impl LauncherApp {
33043334 Panel :: MacroDialog => self . macro_dialog . open = true ,
33053335 Panel :: MouseGesturesDialog => self . mouse_gestures_dialog . open = true ,
33063336 Panel :: MouseGestureSettingsDialog => self . mouse_gesture_settings_dialog . open ( ) ,
3337+ Panel :: ThemeSettingsDialog => self . open_theme_settings_dialog ( ) ,
33073338 Panel :: FavDialog => self . fav_dialog . open = true ,
33083339 Panel :: NotesDialog => self . notes_dialog . open = true ,
33093340 Panel :: UnusedAssetsDialog => self . unused_assets_dialog . open = true ,
@@ -3431,6 +3462,11 @@ impl LauncherApp {
34313462 mouse_gesture_settings_dialog,
34323463 Panel :: MouseGestureSettingsDialog
34333464 ) ;
3465+ check ! (
3466+ self . theme_settings_dialog_open,
3467+ theme_settings_dialog,
3468+ Panel :: ThemeSettingsDialog
3469+ ) ;
34343470 check ! ( self . fav_dialog. open, fav_dialog, Panel :: FavDialog ) ;
34353471 check ! ( self . notes_dialog. open, notes_dialog, Panel :: NotesDialog ) ;
34363472 check ! (
@@ -4451,6 +4487,11 @@ impl eframe::App for LauncherApp {
44514487 let mut mg_settings_dlg = std:: mem:: take ( & mut self . mouse_gesture_settings_dialog ) ;
44524488 mg_settings_dlg. ui ( ctx, self ) ;
44534489 self . mouse_gesture_settings_dialog = mg_settings_dlg;
4490+ let mut theme_state = std:: mem:: take ( & mut self . theme_settings_dialog ) ;
4491+ let mut theme_open = self . theme_settings_dialog_open ;
4492+ crate :: gui:: theme_settings_dialog:: ui ( ctx, self , & mut theme_open, & mut theme_state) ;
4493+ self . theme_settings_dialog_open = theme_open;
4494+ self . theme_settings_dialog = theme_state;
44544495 let mut fav_dlg = std:: mem:: take ( & mut self . fav_dialog ) ;
44554496 fav_dlg. ui ( ctx, self ) ;
44564497 self . fav_dialog = fav_dlg;
@@ -4895,8 +4936,8 @@ mod tests {
48954936 atomic:: { AtomicBool , Ordering } ,
48964937 Arc , Mutex ,
48974938 } ;
4898- use tempfile:: tempdir;
48994939 use std:: time:: { Duration , Instant } ;
4940+ use tempfile:: tempdir;
49004941
49014942 static TEST_MUTEX : Lazy < Mutex < ( ) > > = Lazy :: new ( || Mutex :: new ( ( ) ) ) ;
49024943
0 commit comments