Skip to content

Commit

Permalink
optimize: slint run into app run
Browse files Browse the repository at this point in the history
  • Loading branch information
Horbin-Magician committed Sep 28, 2024
1 parent 4fd8b6a commit 9cddbc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/core/application/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ impl Application {
}
}
});

while self.is_running() {
slint::run_event_loop()
.unwrap_or_else(|e| log_util::log_error(format!("slint run_event_loop error: {:?}", e)));
self.clean();
}
}

pub fn clean(&mut self) {
Expand Down
18 changes: 6 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ fn main() {
true
}
) {return;}


// del tmp and .fd files
file_util::del_useless_files()
.unwrap_or_else(|e| log_util::log_error(format!("del_useless_files error: {:?}", e))); // del tmp and .fd files
.unwrap_or_else(|e| log_util::log_error(format!("del_useless_files error: {:?}", e)));

// start event loop
if let Ok(mut app) = Application::new() {
app.run();
while app.is_running() {
slint::run_event_loop()
.unwrap_or_else(|e| log_util::log_error(format!("slint run_event_loop error: {:?}", e)));
app.clean();
}
} else {
log_util::log_error("Application::new error".to_string());
}
Application::new()
.map(|mut app| app.run())
.unwrap_or_else(|_| log_util::log_error("Application::new error".to_string()));
}

0 comments on commit 9cddbc5

Please sign in to comment.