feat: adicionar confirmação de saída no comparador DMED
This commit is contained in:
Vendored
BIN
Binary file not shown.
+31
-2
@@ -29,6 +29,7 @@ struct ComparadorApp {
|
||||
cpfs_so_xls: Vec<CpfExclusivo>,
|
||||
erros_validacao: Vec<ErroValidacao>,
|
||||
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));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user