From d69ce92e32ac3534ff1aad8fb0ad3650d50c9b3a Mon Sep 17 00:00:00 2001 From: Felipe Canin Novaes Date: Sat, 28 Feb 2026 20:40:04 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20ajusta=20r=C3=B3tulo=20do=20bot=C3=A3o?= =?UTF-8?q?=20de=20lote=20para=20remover=20=C3=ADcone=20e=20melhorar=20leg?= =?UTF-8?q?ibilidade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/app.rs | 2 +- src/ui/components/batch_panel.rs | 158 +++++++++++++++++-------------- 2 files changed, 86 insertions(+), 74 deletions(-) diff --git a/src/ui/app.rs b/src/ui/app.rs index 6e1aa15..c011ddc 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -478,7 +478,7 @@ impl eframe::App for App { egui::TopBottomPanel::top("tab_bar").show(ctx, |ui| { ui.horizontal(|ui| { ui.selectable_value(&mut self.active_tab, ActiveTab::Single, "Projeto Único"); - ui.selectable_value(&mut self.active_tab, ActiveTab::Batch, "πŸ—‚ Lote"); + ui.selectable_value(&mut self.active_tab, ActiveTab::Batch, "Lote"); }); }); diff --git a/src/ui/components/batch_panel.rs b/src/ui/components/batch_panel.rs index 65655ca..77d43f6 100644 --- a/src/ui/components/batch_panel.rs +++ b/src/ui/components/batch_panel.rs @@ -181,59 +181,67 @@ impl BatchPanel { .and_then(|n| n.to_str()) .unwrap_or("β€”"); - ui.group(|ui| { - ui.horizontal(|ui| { - let (icon, color) = match &item.state { - ExecutionState::Idle => ("⏳", egui::Color32::GRAY), - ExecutionState::Running => ("⟳", egui::Color32::YELLOW), - ExecutionState::Success => ("βœ“", egui::Color32::GREEN), - ExecutionState::Cancelled => { - ("⊘", egui::Color32::from_rgb(255, 200, 0)) - } - ExecutionState::Error(_) => ("βœ—", egui::Color32::RED), - }; - ui.colored_label(color, icon); - ui.label(format!("#{} β€” {} β†’ {}", idx + 1, source_name, output_name)); - - ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - if !is_processing && matches!(item.state, ExecutionState::Idle) { - if ui.small_button("βœ• Remover").clicked() { - events.push(BatchPanelEvent::RemoveItem(idx)); + ui.push_id(("batch_item", idx), |ui| { + ui.group(|ui| { + ui.horizontal(|ui| { + let (icon, color) = match &item.state { + ExecutionState::Idle => ("⏳", egui::Color32::GRAY), + ExecutionState::Running => ("⟳", egui::Color32::YELLOW), + ExecutionState::Success => ("βœ“", egui::Color32::GREEN), + ExecutionState::Cancelled => { + ("⊘", egui::Color32::from_rgb(255, 200, 0)) } - if ui.small_button("✏ Editar").clicked() { - open_edit_for = Some(idx); - } - } - }); - }); + ExecutionState::Error(_) => ("βœ—", egui::Color32::RED), + }; + ui.colored_label(color, icon); + ui.label(format!("#{} β€” {} >> {}", idx + 1, source_name, output_name)); - let track_count = item.project.tracks.len(); - let existing_count = item.project.existing_tracks.len(); - ui.label( - egui::RichText::new(format!( - " {} faixas existentes Β· {} faixas adicionadas", - existing_count, track_count - )) - .small() - .weak(), - ); - - if let ExecutionState::Error(msg) = &item.state { - ui.colored_label(egui::Color32::RED, format!(" Erro: {}", msg)); - } - - if !item.log_lines.is_empty() { - ui.collapsing("Log detalhado", |ui| { - egui::ScrollArea::vertical() - .max_height(120.0) - .show(ui, |ui| { - for line in &item.log_lines { - ui.label(egui::RichText::new(line).monospace().size(10.0)); + ui.with_layout( + egui::Layout::right_to_left(egui::Align::Center), + |ui| { + if !is_processing && matches!(item.state, ExecutionState::Idle) + { + if ui.small_button("πŸ—‘ Remover").clicked() { + events.push(BatchPanelEvent::RemoveItem(idx)); + } + if ui.small_button("✏ Editar").clicked() { + open_edit_for = Some(idx); + } } - }); + }, + ); }); - } - }); + + let track_count = item.project.tracks.len(); + let existing_count = item.project.existing_tracks.len(); + ui.label( + egui::RichText::new(format!( + " {} faixas existentes Β· {} faixas adicionadas", + existing_count, track_count + )) + .small() + .weak(), + ); + + if let ExecutionState::Error(msg) = &item.state { + ui.colored_label(egui::Color32::RED, format!(" Erro: {}", msg)); + } + + if !item.log_lines.is_empty() { + ui.collapsing("Log detalhado", |ui| { + egui::ScrollArea::vertical() + .max_height(120.0) + .show(ui, |ui| { + for line in &item.log_lines { + ui.label( + egui::RichText::new(line).monospace().size(10.0), + ); + } + }); + }); + } + }); + }); // push_id ui.add_space(4.0); } @@ -364,18 +372,20 @@ impl BatchPanel { .file_name() .and_then(|n| n.to_str()) .unwrap_or("β€”"); - ui.horizontal(|ui| { - ui.label( - egui::RichText::new(format!(" 🎡 {} [{}]", name, audio.language)) - .small(), - ); - if ui - .small_button("βœ•") - .on_hover_text("Remover faixa") - .clicked() - { - remove_audio = Some(i); - } + ui.push_id(("audio", i), |ui| { + ui.horizontal(|ui| { + ui.label( + egui::RichText::new(format!(" 🎡 {} [{}]", name, audio.language)) + .small(), + ); + if ui + .small_button("πŸ—‘") + .on_hover_text("Remover faixa") + .clicked() + { + remove_audio = Some(i); + } + }); }); } if let Some(i) = remove_audio { @@ -390,18 +400,20 @@ impl BatchPanel { .file_name() .and_then(|n| n.to_str()) .unwrap_or("β€”"); - ui.horizontal(|ui| { - ui.label( - egui::RichText::new(format!(" πŸ’¬ {} [{}]", name, sub.language)) - .small(), - ); - if ui - .small_button("βœ•") - .on_hover_text("Remover faixa") - .clicked() - { - remove_sub = Some(i); - } + ui.push_id(("sub", i), |ui| { + ui.horizontal(|ui| { + ui.label( + egui::RichText::new(format!(" πŸ’¬ {} [{}]", name, sub.language)) + .small(), + ); + if ui + .small_button("πŸ—‘") + .on_hover_text("Remover faixa") + .clicked() + { + remove_sub = Some(i); + } + }); }); } if let Some(i) = remove_sub {