From 60e7f74273402a56d5a9cb65f4ecc76707ce08b4 Mon Sep 17 00:00:00 2001 From: MrEnder0 <72358826+MrEnder0@users.noreply.github.com> Date: Mon, 22 Jan 2024 03:08:42 -0600 Subject: [PATCH] Refactor UI code for version footer --- .todo | 2 ++ src/main.rs | 7 +------ src/ui.rs | 12 ++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .todo diff --git a/.todo b/.todo new file mode 100644 index 0000000..03cedb6 --- /dev/null +++ b/.todo @@ -0,0 +1,2 @@ +[ ] Create a version checker +[ ] Create a config system that saves settings \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index bb0eb96..cf01d81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -185,12 +185,7 @@ impl eframe::App for MyApp { ui.add_enabled(allow_preview, egui::Checkbox::new(&mut self.display_rgb_preview, "Display RGB Preview")).on_hover_text("Displays a preview of the lighting, this can be disabled to improve performance"); egui::TopBottomPanel::bottom("footer").show(ctx, |ui| { - ui.horizontal(|ui| { - ui.hyperlink_to(format!( - "Wootili-View {} by Mr.Ender", - env!("CARGO_PKG_VERSION") - ), format!("https://github.com/MrEnder0/wootili-view/releases/tag/{}", env!("CARGO_PKG_VERSION"))); - }); + version_footer(ui); }); egui::SidePanel::right("lighting_preview_panel").show(ctx, |ui| { diff --git a/src/ui.rs b/src/ui.rs index c712300..7f77d98 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -78,3 +78,15 @@ pub fn display_lighting_dimensions(ui: &mut egui::Ui, frame_rgb_size: (u32, u32) lighting_dimensions ))); } + +pub fn version_footer(ui: &mut egui::Ui) { + ui.horizontal(|ui| { + ui.hyperlink_to( + format!("Wootili-View {} by Mr.Ender", env!("CARGO_PKG_VERSION")), + format!( + "https://github.com/MrEnder0/wootili-view/releases/tag/{}", + env!("CARGO_PKG_VERSION") + ), + ); + }); +}