Files
simple-multimidia-track-aud…/src/ui/components/video_selector.rs
T
Felipe ce236eca5d feat: implement project management and media track handling
- Added domain entities for audio, subtitle, and video tracks.
- Created a Project entity to manage media editing sessions.
- Implemented value objects for file paths, sync offsets, track IDs, and languages.
- Developed infrastructure for asynchronous FFmpeg process execution.
- Built a user interface for selecting video files, adding audio and subtitle tracks, and managing output settings.
- Integrated error handling and logging for media processing tasks.
2026-02-28 13:42:23 -03:00

43 lines
1.3 KiB
Rust

use eframe::egui;
use crate::adapters::filesystem::FilePickerAdapter;
use crate::domain::value_objects::FilePath;
/// Componente para seleção do arquivo de vídeo base.
/// Ao confirmar, dispara LoadMediaInfo via callback.
pub struct VideoSelector {
pub selected_path: Option<FilePath>,
}
impl VideoSelector {
pub fn new() -> Self {
VideoSelector { selected_path: None }
}
/// Renderiza o seletor. Retorna `Some(FilePath)` se um novo arquivo foi selecionado.
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<FilePath> {
let mut selected = None;
ui.group(|ui| {
ui.heading("Arquivo de vídeo");
ui.horizontal(|ui| {
let label = self
.selected_path
.as_ref()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_else(|| "Nenhum arquivo selecionado".to_string());
ui.label(&label);
if ui.button("Selecionar…").clicked() {
if let Some(path) = FilePickerAdapter::pick_video() {
self.selected_path = Some(path.clone());
selected = Some(path);
}
}
});
});
selected
}
}