diff --git a/dist/DMED-Comparador.exe b/dist/DMED-Comparador.exe index 368bfa7..bf6b3bf 100644 Binary files a/dist/DMED-Comparador.exe and b/dist/DMED-Comparador.exe differ diff --git a/src/bin/gui.rs b/src/bin/gui.rs index dda7311..593c872 100644 --- a/src/bin/gui.rs +++ b/src/bin/gui.rs @@ -29,6 +29,7 @@ struct ComparadorApp { cpfs_so_xls: Vec, erros_validacao: Vec, processando: bool, + mostrar_confirmacao_saida: bool, } #[derive(Clone)] @@ -58,6 +59,34 @@ struct Divergencia { impl eframe::App for ComparadorApp { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + // Interceptar e prevenir fechamento automático + if ctx.input(|i| i.viewport().close_requested()) { + if !self.mostrar_confirmacao_saida { + self.mostrar_confirmacao_saida = true; + ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose); + } + } + + // Diálogo de confirmação de saída + if self.mostrar_confirmacao_saida { + egui::Window::new("⚠️Confirmar Saída") + .collapsible(false) + .resizable(false) + .anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0]) + .show(ctx, |ui| { + ui.label("Deseja realmente sair do programa?"); + ui.add_space(10.0); + ui.horizontal(|ui| { + if ui.button("✅ Sim").clicked() { + ctx.send_viewport_cmd(egui::ViewportCommand::Close); + } + if ui.button("❌ Não").clicked() { + self.mostrar_confirmacao_saida = false; + } + }); + }); + } + egui::CentralPanel::default().show(ctx, |ui| { ui.heading("📊 Comparador DMED (TXT) vs Prosoft (XLS)"); ui.add_space(10.0); @@ -79,7 +108,7 @@ impl eframe::App for ComparadorApp { } } if let Some(ref path) = self.arquivo_txt { - ui.label(format!("✓ {}", path)); + ui.label(format!("✅ {}", path)); } }); @@ -98,7 +127,7 @@ impl eframe::App for ComparadorApp { } } if let Some(ref path) = self.arquivo_xls { - ui.label(format!("✓ {}", path)); + ui.label(format!("✅ {}", path)); } });