feat: ajusta rótulo do botão de lote para remover ícone e melhorar legibilidade

This commit is contained in:
2026-02-28 20:40:04 -03:00
parent 121e919bbf
commit d69ce92e32
2 changed files with 86 additions and 74 deletions
+1 -1
View File
@@ -478,7 +478,7 @@ impl eframe::App for App {
egui::TopBottomPanel::top("tab_bar").show(ctx, |ui| { egui::TopBottomPanel::top("tab_bar").show(ctx, |ui| {
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.selectable_value(&mut self.active_tab, ActiveTab::Single, "Projeto Único"); 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");
}); });
}); });
+85 -73
View File
@@ -181,59 +181,67 @@ impl BatchPanel {
.and_then(|n| n.to_str()) .and_then(|n| n.to_str())
.unwrap_or(""); .unwrap_or("");
ui.group(|ui| { ui.push_id(("batch_item", idx), |ui| {
ui.horizontal(|ui| { ui.group(|ui| {
let (icon, color) = match &item.state { ui.horizontal(|ui| {
ExecutionState::Idle => ("", egui::Color32::GRAY), let (icon, color) = match &item.state {
ExecutionState::Running => ("", egui::Color32::YELLOW), ExecutionState::Idle => ("", egui::Color32::GRAY),
ExecutionState::Success => ("", egui::Color32::GREEN), ExecutionState::Running => ("", egui::Color32::YELLOW),
ExecutionState::Cancelled => { ExecutionState::Success => ("", egui::Color32::GREEN),
("", egui::Color32::from_rgb(255, 200, 0)) 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));
} }
if ui.small_button("✏ Editar").clicked() { ExecutionState::Error(_) => ("", egui::Color32::RED),
open_edit_for = Some(idx); };
} ui.colored_label(color, icon);
} ui.label(format!("#{}{} >> {}", idx + 1, source_name, output_name));
});
});
let track_count = item.project.tracks.len(); ui.with_layout(
let existing_count = item.project.existing_tracks.len(); egui::Layout::right_to_left(egui::Align::Center),
ui.label( |ui| {
egui::RichText::new(format!( if !is_processing && matches!(item.state, ExecutionState::Idle)
" {} faixas existentes · {} faixas adicionadas", {
existing_count, track_count if ui.small_button("🗑 Remover").clicked() {
)) events.push(BatchPanelEvent::RemoveItem(idx));
.small() }
.weak(), if ui.small_button("✏ Editar").clicked() {
); open_edit_for = Some(idx);
}
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));
} }
}); },
);
}); });
}
}); 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); ui.add_space(4.0);
} }
@@ -364,18 +372,20 @@ impl BatchPanel {
.file_name() .file_name()
.and_then(|n| n.to_str()) .and_then(|n| n.to_str())
.unwrap_or(""); .unwrap_or("");
ui.horizontal(|ui| { ui.push_id(("audio", i), |ui| {
ui.label( ui.horizontal(|ui| {
egui::RichText::new(format!(" 🎵 {} [{}]", name, audio.language)) ui.label(
.small(), egui::RichText::new(format!(" 🎵 {} [{}]", name, audio.language))
); .small(),
if ui );
.small_button("") if ui
.on_hover_text("Remover faixa") .small_button("🗑")
.clicked() .on_hover_text("Remover faixa")
{ .clicked()
remove_audio = Some(i); {
} remove_audio = Some(i);
}
});
}); });
} }
if let Some(i) = remove_audio { if let Some(i) = remove_audio {
@@ -390,18 +400,20 @@ impl BatchPanel {
.file_name() .file_name()
.and_then(|n| n.to_str()) .and_then(|n| n.to_str())
.unwrap_or(""); .unwrap_or("");
ui.horizontal(|ui| { ui.push_id(("sub", i), |ui| {
ui.label( ui.horizontal(|ui| {
egui::RichText::new(format!(" 💬 {} [{}]", name, sub.language)) ui.label(
.small(), egui::RichText::new(format!(" 💬 {} [{}]", name, sub.language))
); .small(),
if ui );
.small_button("") if ui
.on_hover_text("Remover faixa") .small_button("🗑")
.clicked() .on_hover_text("Remover faixa")
{ .clicked()
remove_sub = Some(i); {
} remove_sub = Some(i);
}
});
}); });
} }
if let Some(i) = remove_sub { if let Some(i) = remove_sub {