Skip to main content

lutgen_studio/ui/
about.rs

1use crate::App;
2
3impl App {
4    fn show_about(&mut self, ui: &mut egui::Ui) {
5        ui.horizontal_centered(|ui| {
6            ui.vertical_centered(|ui| {
7                ui.add_space(20.);
8                ui.add(egui::Image::from_texture(&self.icon).max_width(100.));
9                ui.add_space(20.);
10
11                ui.heading(format!("Lutgen Studio v{}", env!("CARGO_PKG_VERSION")));
12                ui.add_space(10.);
13                #[cfg(not(target_arch = "wasm32"))]
14                self.show_update(ui);
15                ui.label(format!(
16                    "License {}, Copyright 2025",
17                    env!("CARGO_PKG_LICENSE")
18                ));
19                ui.label(env!("CARGO_PKG_AUTHORS"));
20                if ui.link("Source Code (Github)").clicked() {
21                    ui.ctx()
22                        .open_url(egui::OpenUrl::new_tab(env!("CARGO_PKG_REPOSITORY")));
23                }
24
25                ui.add_space(15.);
26                ui.add(egui::Separator::default().shrink(50.));
27                ui.add_space(15.);
28
29                #[cfg(target_arch = "wasm32")]
30                {
31                    ui.heading("Web Version Note");
32                    ui.add_space(10.);
33                    ui.label("It is recommended to use the native applications.");
34                    ui.label(
35                        "The web version is much slower than the cli or native gui, and much \
36                        less responsive when tweaking settings or using high level luts",
37                    );
38                    ui.add_space(15.);
39                    ui.add(egui::Separator::default().shrink(50.));
40                    ui.add_space(15.);
41                }
42
43                ui.heading("Basic Help");
44                ui.add_space(10.);
45                ui.label("Images can be opened and saved in the top bar");
46                ui.label("Left-click the preview to toggle between original and edited");
47                ui.label("Left-click the palette colors to edit, right-click to delete");
48                ui.add_space(20.);
49            });
50        });
51    }
52
53    pub fn show_about_dialog(&mut self, ctx: &egui::Context) {
54        let title = "About Lutgen Studio";
55        if ctx.embed_viewports() {
56            // Embedded UI
57            let mut show = self.state.show_about;
58            egui::Window::new(title)
59                .open(&mut show)
60                .collapsible(false)
61                .resizable([false, false])
62                .show(ctx, |ui| self.show_about(ui));
63            self.state.show_about = show;
64        } else if self.state.show_about {
65            // Native UI
66            let id = egui::ViewportId(egui::Id::new("about"));
67            let vp = egui::ViewportBuilder::default()
68                .with_title(title)
69                .with_active(true)
70                .with_resizable(false)
71                .with_inner_size((400.0, 420.0));
72
73            ctx.show_viewport_immediate(id, vp, |ctx, _| {
74                egui::CentralPanel::default().show(ctx, |ui| {
75                    self.show_about(ui);
76                });
77                ctx.input(|state| {
78                    if state.viewport().close_requested() {
79                        self.state.show_about = false;
80                    }
81                });
82            });
83        }
84    }
85}