From 62015d28ae374ea6737bc66260812b860b039d8c Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Wed, 4 Dec 2024 21:23:25 +0200 Subject: [PATCH 1/3] feat: show version in top panel --- src/ui/components/top_panel.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/components/top_panel.rs b/src/ui/components/top_panel.rs index a159e6cc7..c121594db 100644 --- a/src/ui/components/top_panel.rs +++ b/src/ui/components/top_panel.rs @@ -1,3 +1,4 @@ +use std::env; use crate::app::{AppAction, DesiredAppAction}; use crate::backend_task::core::CoreTask; use crate::backend_task::BackendTask; @@ -43,6 +44,11 @@ fn add_location_view(ui: &mut Ui, location: Vec<(&str, AppAction)>) -> AppAction action } +fn show_app_version(ui: &mut Ui) { + let version = env::var("CARGO_PKG_VERSION").unwrap_or_else(|_| "".to_string()); + ui.label(version); +} + fn add_connection_indicator(ui: &mut Ui, app_context: &Arc) -> AppAction { let mut action = AppAction::None; @@ -145,8 +151,10 @@ pub fn add_top_panel( .exact_height(50.0) .show(ctx, |ui| { egui::menu::bar(ui, |ui| { - action |= add_connection_indicator(ui, app_context); - + ui.horizontal(|ui| { + action |= add_connection_indicator(ui, app_context); + show_app_version(ui); + }); // Left-aligned content with location view action |= add_location_view(ui, location); From 2fbf01fba703921235bad0f7612cd73687f67fe6 Mon Sep 17 00:00:00 2001 From: pauldelucia Date: Thu, 5 Dec 2024 12:19:20 +0700 Subject: [PATCH 2/3] feat: move version display to top window bar --- src/main.rs | 5 ++++- src/ui/components/top_panel.rs | 7 ------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 75e33a991..59435766f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +use std::env; + use crate::cpu_compatibility::check_cpu_compatibility; mod app; @@ -30,8 +32,9 @@ fn main() -> eframe::Result<()> { centered: true, // Center window on startup if not maximized ..Default::default() }; + let version = env::var("CARGO_PKG_VERSION").unwrap_or_else(|_| "".to_string()); eframe::run_native( - "Dash Evo Tool", + &format!("Dash Evo Tool v{}", version), native_options, Box::new(|_cc| Ok(Box::new(app::AppState::new()))), ) diff --git a/src/ui/components/top_panel.rs b/src/ui/components/top_panel.rs index c121594db..9f11c6f74 100644 --- a/src/ui/components/top_panel.rs +++ b/src/ui/components/top_panel.rs @@ -1,4 +1,3 @@ -use std::env; use crate::app::{AppAction, DesiredAppAction}; use crate::backend_task::core::CoreTask; use crate::backend_task::BackendTask; @@ -44,11 +43,6 @@ fn add_location_view(ui: &mut Ui, location: Vec<(&str, AppAction)>) -> AppAction action } -fn show_app_version(ui: &mut Ui) { - let version = env::var("CARGO_PKG_VERSION").unwrap_or_else(|_| "".to_string()); - ui.label(version); -} - fn add_connection_indicator(ui: &mut Ui, app_context: &Arc) -> AppAction { let mut action = AppAction::None; @@ -153,7 +147,6 @@ pub fn add_top_panel( egui::menu::bar(ui, |ui| { ui.horizontal(|ui| { action |= add_connection_indicator(ui, app_context); - show_app_version(ui); }); // Left-aligned content with location view action |= add_location_view(ui, location); From b2fe8a35d986d0d438175df1f53c9419065d91b4 Mon Sep 17 00:00:00 2001 From: pauldelucia Date: Thu, 5 Dec 2024 14:16:00 +0700 Subject: [PATCH 3/3] fix: remove unnecessary component --- src/ui/components/top_panel.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui/components/top_panel.rs b/src/ui/components/top_panel.rs index 9f11c6f74..a159e6cc7 100644 --- a/src/ui/components/top_panel.rs +++ b/src/ui/components/top_panel.rs @@ -145,9 +145,8 @@ pub fn add_top_panel( .exact_height(50.0) .show(ctx, |ui| { egui::menu::bar(ui, |ui| { - ui.horizontal(|ui| { - action |= add_connection_indicator(ui, app_context); - }); + action |= add_connection_indicator(ui, app_context); + // Left-aligned content with location view action |= add_location_view(ui, location);