diff --git a/docs/windows-quickstart.txt b/docs/windows-quickstart.txt index edc6469..efe312b 100644 --- a/docs/windows-quickstart.txt +++ b/docs/windows-quickstart.txt @@ -3,7 +3,11 @@ PPTX Reporter Extract the whole archive before launching pptx-reporter-gui.exe. Keep ffprobe.exe beside it. Python, Typst and PowerPoint are not required. -Drop a .pptx into the window, select report formats, and choose Generate. +Drop a .pptx into the window, choose what to create, and use the purple action +button. The selected filename and save location are shown before you start. +Use Reading & printing to select web, PDF and compact PDF reports, Defaults +for Markdown and Ontime, or All for every format. You can also select formats +individually. Reports are saved under _videos/reports. Extracted videos go under _videos/videos. Reports only uses temporary video files and does not keep newly extracted media. diff --git a/src/gui.rs b/src/gui.rs index d5ee80a..a5ddc23 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -46,6 +46,20 @@ pub fn accept_drop(paths: impl IntoIterator) -> Result &str { + match format { + "md" => "Markdown", + "txt" => "Plain text", + "json" => "JSON", + "html" => "Web page", + "typst" => "Typst source", + "pdf" => "PDF", + "pdf-dense" => "Compact PDF", + "ontime" => "Ontime", + other => other, + } +} + enum Update { Progress(Event), Finished(Result), @@ -244,13 +258,18 @@ impl App { ui.add_space(12.0); ui.label(RichText::new("PRESENTATION MEDIA").color(Color32::from_rgb(117,100,230)).strong()); ui.heading(RichText::new("PPTX Reporter").size(32.0)); - ui.label("Video timings, beautifully documented."); + ui.label("Turn embedded videos into clear timing reports."); ui.add_space(18.0); ui.add_enabled_ui(self.rx.is_none(), |ui| { egui::Frame::group(ui.style()).inner_margin(20.0).show(ui, |ui| { ui.set_min_width(ui.available_width()); - ui.label(RichText::new("Drop a PPTX here").size(22.0).strong()); - ui.label("Or choose a presentation to get started."); + ui.label(RichText::new("1 Presentation").small().strong()); + let selected = !self.source.is_empty(); + let title = if selected { + std::path::Path::new(&self.source).file_name().unwrap_or_default().to_string_lossy().into_owned() + } else { "Drop a PPTX here".into() }; + ui.label(RichText::new(title).size(22.0).strong()); + ui.weak(if selected { "Drop another presentation to change your selection." } else { "Drag a file into this window, or choose one below." }); if ui.button("Choose presentation…").clicked() && let Some(file) = rfd::FileDialog::new().add_filter("PowerPoint",&["pptx"]).pick_file() { self.source = file.display().to_string(); @@ -265,6 +284,7 @@ impl App { } }); ui.add_space(12.0); + ui.label(RichText::new("2 Save location").strong()); ui.horizontal(|ui| { ui.label("Output folder"); if ui.button("Choose…").clicked() @@ -274,6 +294,16 @@ impl App { if ui.button("Use default").clicked() { self.output.clear(); } }); ui.add(egui::TextEdit::singleline(&mut self.output).desired_width(f32::INFINITY).hint_text("Default: _videos")); + if !self.source.is_empty() { + let preview = Options { + source: PathBuf::from(&self.source), + output: (!self.output.trim().is_empty()).then(|| PathBuf::from(&self.output)), + ..Default::default() + }.output_dir(); + ui.weak(format!("Save to: {}", preview.display())); + } + ui.add_space(8.0); + ui.label(RichText::new("3 What to create").strong()); let options = &mut self.preferences.options; let mut mode = if options.extract_only { 2 } else if options.timings_only { 1 } else { 0 }; ui.horizontal_wrapped(|ui| { @@ -282,17 +312,34 @@ impl App { ui.selectable_value(&mut mode,2,"Extract only"); }); options.extract_only = mode == 2; options.timings_only = mode == 1; + ui.weak(match mode { + 1 => "Create reports without keeping extracted videos.", + 2 => "Save embedded videos without generating reports.", + _ => "Save embedded videos and generate timing reports.", + }); ui.add_enabled_ui(!options.extract_only,|ui| { + ui.horizontal_wrapped(|ui| { + ui.label("Report formats"); + if ui.small_button("Reading & printing").on_hover_text("Web page, PDF and compact PDF").clicked() { + options.formats = ["html", "pdf", "pdf-dense"].map(String::from).to_vec(); + } + if ui.small_button("Defaults").on_hover_text("Markdown and Ontime").clicked() { + options.formats = Options::default().formats; + } + if ui.small_button("All").clicked() { options.formats = FORMATS.iter().map(|s| (*s).into()).collect(); } + }); ui.horizontal_wrapped(|ui| { for format in FORMATS { let mut selected = options.formats.iter().any(|f| f == format); - if ui.checkbox(&mut selected,*format).changed() { + if ui.checkbox(&mut selected,format_label(format)).changed() { options.formats.retain(|f| f != format); if selected { options.formats.push((*format).into()); } } } - if ui.small_button("All").clicked() { options.formats = FORMATS.iter().map(|s| (*s).into()).collect(); } }); + if options.formats.is_empty() { + ui.colored_label(Color32::from_rgb(236,185,86), "Select at least one report format."); + } }); ui.collapsing("Advanced",|ui| { ui.checkbox(&mut options.overwrite,"Replace existing extracted videos"); @@ -308,13 +355,22 @@ impl App { ui.label("PDF generation is built in. FFprobe comes from FFmpeg; no PowerPoint installation is needed."); }); ui.add_space(10.0); - if ui.add_sized([180.0,38.0],egui::Button::new("Generate")).clicked() { self.start(); } + let ready = !self.source.is_empty() && (options.extract_only || !options.formats.is_empty()); + let action = match mode { + 1 => "Generate reports", + 2 => "Extract videos", + _ => "Extract & generate reports", + }; + ui.add_enabled_ui(ready, |ui| { + if ui.add_sized([240.0,40.0],egui::Button::new(RichText::new(action).color(Color32::WHITE)).fill(Color32::from_rgb(87,68,181))).clicked() { self.start(); } + }); }); ui.add_space(14.0); if self.rx.is_some() { ui.horizontal(|ui| { ui.spinner(); ui.label(&self.status.message); - if ui.button("Cancel").clicked() { self.cancel.store(true,Ordering::Relaxed); } + let cancelling = self.cancel.load(Ordering::Relaxed); + if ui.add_enabled(!cancelling, egui::Button::new(if cancelling { "Cancelling…" } else { "Cancel" })).clicked() { self.cancel.store(true,Ordering::Relaxed); } }); let e = &self.status; if e.total > 0 { ui.add(egui::ProgressBar::new(e.done as f32/e.total as f32).show_percentage()); } @@ -326,6 +382,7 @@ impl App { if let Some(error) = &self.error { ui.colored_label(Color32::from_rgb(255,150,120),error); } if let Some(dir) = self.completed_output.clone() { ui.add_space(12.0); + ui.label(RichText::new("Your files are ready").size(20.0).color(Color32::from_rgb(133,214,170)).strong()); if ui.button("Open output folder").clicked() { self.open(&dir); } } for path in self.paths.clone() { @@ -335,7 +392,7 @@ impl App { if ui.button("Copy path").clicked() { ctx.copy_text(path.display().to_string()); } }); } - ui.collapsing("Activity",|ui| { + ui.collapsing("Activity & diagnostics",|ui| { egui::ScrollArea::vertical().max_height(180.0).stick_to_bottom(true).show(ui,|ui| { for (line, warning) in &self.log { ui.colored_label(if *warning {Color32::from_rgb(236,185,86)} else {Color32::from_rgb(160,175,195)},line); } }); @@ -364,7 +421,7 @@ pub fn launch() -> anyhow::Result<()> { let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default() .with_icon(icon) - .with_inner_size([860.0, 760.0]) + .with_inner_size([860.0, 820.0]) .with_min_inner_size([620.0, 500.0]) .with_drag_and_drop(true), ..Default::default() @@ -376,6 +433,12 @@ pub fn launch() -> anyhow::Result<()> { cc.egui_ctx.set_visuals(egui::Visuals::dark()); let mut style = (*cc.egui_ctx.style()).clone(); style.spacing.item_spacing = egui::vec2(10.0, 10.0); + style.visuals.override_text_color = Some(Color32::from_rgb(218, 224, 235)); + for role in [egui::TextStyle::Body, egui::TextStyle::Button] { + style + .text_styles + .insert(role, egui::FontId::proportional(14.0)); + } style.visuals.selection.bg_fill = Color32::from_rgb(87, 68, 181); cc.egui_ctx.set_style(style); Ok(Box::new(App::new()))