11use data:: config:: { self } ;
22use iced:: widget:: { checkbox, column, pick_list, row} ;
33use iced:: Command ;
4- use std:: path:: PathBuf ;
54
6- use crate :: screen:: config:: name_preview;
7- use crate :: utils:: folder_dialog;
85use crate :: widget:: helpers:: control;
96use crate :: widget:: Element ;
107
118#[ derive( Debug , Clone ) ]
129pub enum Message {
1310 NonGuiQuietOutput ( bool ) ,
1411 NonGuiUseCwd ( bool ) ,
15- SetLogFolder ( Option < PathBuf > ) ,
16- SetLogFolderDialog ,
1712 ShowAnimatedGIF ( bool ) ,
1813 SuppressWarnings ( bool ) ,
1914 ShowErrorsInTextEditor ( bool ) ,
20- SetGif {
21- kind : GIFKind ,
22- path : Option < PathBuf > ,
23- } ,
2415 SetTheme ( data:: theme:: Themes ) ,
25- NamePreview ( name_preview:: Message ) ,
26- ImportTheme ,
27- ExportTheme ,
2816}
2917
3018/*
@@ -58,7 +46,6 @@ pub fn view(general: &config::GeneralConfig) -> Element<Message> {
5846
5947 column ! [ control( "Application Settings" , settings) ]
6048 . push ( themes ( general) )
61- // .push(animated_gif(general))
6249 . push_maybe ( non_gui ( general) )
6350 . spacing ( 8 )
6451 . into ( )
@@ -71,7 +58,6 @@ pub fn themes(general: &config::GeneralConfig) -> Element<Message> {
7158 Some ( general. theme) ,
7259 Message :: SetTheme
7360 ) ,
74- // button("Load").on_press(Message::ImportTheme),
7561 ]
7662 . spacing ( 8 )
7763 . align_items ( iced:: Alignment :: Center ) ;
@@ -103,50 +89,15 @@ pub enum GIFKind {
10389 Complete ,
10490}
10591
106- // pub fn animated_gif(general: &config::GeneralConfig) -> Element<Message> {
107- // let settings = column![checkbox(
108- // "Hide Animated GIFs",
109- // general.hide_gif,
110- // Message::ShowAnimatedGIF
111- // ),
112- // ]
113-
114- // // .push(button(
115- // // general
116- // // .logging_path
117- // // .as_deref()
118- // // .map(filename)
119- // // .unwrap_or_default(),
120- // // ))
121- // .spacing(8);
122- // control("Animated GIFs", settings).into()
123- // }
124-
12592pub fn update ( cfg : & mut config:: GeneralConfig , message : Message ) -> Command < Message > {
12693 tracing:: info!( "{:?}" , & message) ;
12794
12895 match message {
12996 Message :: NonGuiQuietOutput ( quiet_output) => cfg. non_gui_quiet_output = quiet_output,
13097 Message :: NonGuiUseCwd ( use_cwd) => cfg. non_gui_use_cwd = use_cwd,
131- Message :: SetLogFolder ( log_path) => {
132- if let Some ( log_path) = log_path {
133- cfg. logging_path = Some ( log_path)
134- }
135- }
136- Message :: SetLogFolderDialog => {
137- return Command :: perform ( folder_dialog ( ) , Message :: SetLogFolder )
138- }
13998 Message :: ShowAnimatedGIF ( toggle) => cfg. hide_gif = toggle,
14099 Message :: SuppressWarnings ( toggle) => cfg. suppress_warnings = toggle,
141- Message :: SetGif { kind, path } => match kind {
142- GIFKind :: Idle => cfg. idle_gif = path,
143- GIFKind :: Ripping => cfg. ripping_gif = path,
144- GIFKind :: Complete => cfg. complete_gif = path,
145- } ,
146100 Message :: SetTheme ( theme) => cfg. theme = theme,
147- Message :: NamePreview ( msg) => name_preview:: update ( & mut cfg. sample_name_params , msg) ,
148- Message :: ImportTheme => ( ) ,
149- Message :: ExportTheme => ( ) ,
150101 Message :: ShowErrorsInTextEditor ( show) => cfg. show_errors_in_text_editor = show,
151102 }
152103
0 commit comments