diff --git a/Cargo.lock b/Cargo.lock index 2310d43ebe6107f344a47ae2a650f2455ce59749..bec2d8ad5015b084511c92c7bb8c177780963879 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,6 +183,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -639,6 +645,20 @@ dependencies = [ "libc", ] +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets 0.52.6", +] + [[package]] name = "clipboard-win" version = "5.4.0" @@ -1305,6 +1325,21 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +[[package]] +name = "git2" +version = "0.13.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" +dependencies = [ + "bitflags 1.3.2", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + [[package]] name = "gl_generator" version = "0.14.0" @@ -1522,6 +1557,29 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core 0.52.0", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "1.5.0" @@ -1785,6 +1843,20 @@ version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +[[package]] +name = "libgit2-sys" +version = "0.12.26+1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" +dependencies = [ + "cc", + "libc", + "libssh2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", +] + [[package]] name = "libloading" version = "0.8.5" @@ -1806,6 +1878,32 @@ dependencies = [ "redox_syscall 0.5.7", ] +[[package]] +name = "libssh2-sys" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2304,6 +2402,24 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "orbclient" version = "0.3.48" @@ -2706,12 +2822,14 @@ name = "segs" version = "0.1.0" dependencies = [ "anyhow", + "chrono", "crossbeam-channel", "eframe", "egui", "egui_plot", "egui_tiles", "enum_dispatch", + "git2", "mavlink-bindgen", "parking_lot", "serde", @@ -2860,6 +2978,7 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "skyward_mavlink" version = "0.1.0" +source = "git+https://git.skywarder.eu/avn/swd/mavlink/mavlink-skyward-lib.git?branch=rust-strum#a766c38ea2dada7450cd2531b8610cbabcb6a449" dependencies = [ "bitflags 2.6.0", "mavlink-bindgen", @@ -3285,6 +3404,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index 86847c816c571072d4445219f8deb2d9ab1d6318..54237fe6b1a0e5f7f39d807e2d88594f521f8574 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,3 +42,5 @@ crossbeam-channel = "0.5" # for dynamic dispatch enum_dispatch = "0.3" anyhow = "1.0" +chrono = "0.4" +git2 = "0.13" \ No newline at end of file diff --git a/src/ui/composable_view.rs b/src/ui/composable_view.rs index 5ba5b3e60f109eaa767fa4388ed4414365eaab78..57799b1063a1b1eaedeb2e86ef19a78ad4655b2b 100644 --- a/src/ui/composable_view.rs +++ b/src/ui/composable_view.rs @@ -7,6 +7,11 @@ use super::{ use egui::{Key, Modifiers}; use egui_tiles::{Behavior, Container, Linear, LinearDir, Tile, TileId, Tiles, Tree}; +//the following to display a small top bar +use chrono::Local; +use std::path::Path; +use git2::Repository; + pub struct ComposableView { panes_tree: Tree<Pane>, @@ -33,6 +38,30 @@ impl Default for ComposableView { impl eframe::App for ComposableView { // The update function is called each time the UI needs repainting! fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + // Add a top panel to display the time and latest commit + egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { + let now = Local::now(); + let time_str = format!("{}", now.format("%H:%M:%S")); + + let mut branch_name = String::from("Unknown branch"); + let mut commit_info = String::from("No commit information"); + + // Get the latest commit information + if let Ok(repo) = Repository::open(Path::new(".")) { + if let Ok(head) = repo.head() { + if let Some(name) = head.shorthand() { + branch_name = name.to_string(); + } + if let Some(commit) = head.peel_to_commit().ok() { + let commit_id = commit.id(); + let short_commit_id = format!("{:.7}", commit_id); + commit_info = format!("{}", short_commit_id); + } + } + } + + ui.label(format!("SkywardEnhancedGroundStation SEGS v. {} - {} | {} ", commit_info, branch_name, time_str )); + }); // get the id of the hovered pane, in order to apply actions to it let hovered_pane = self .panes_tree