diff --git a/Cargo.toml b/Cargo.toml index 3773528..7c9f199 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,4 @@ egui = "0.28.1" eframe = "0.28.1" tracing-subscriber = "0.3.16" strum = { version = "0.26.3", features = ["derive"] } +tokio = "1.39.2" diff --git a/src/app/metar/mod.rs b/src/app/metar/mod.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/app/metar/mod.rs @@ -0,0 +1 @@ + diff --git a/src/app/mod.rs b/src/app/mod.rs index cd5bbcb..9b4066f 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,3 +1,5 @@ +mod metar; +mod req; mod ui; /// Stuct to store the state of the running application diff --git a/src/app/req/mod.rs b/src/app/req/mod.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/app/req/mod.rs @@ -0,0 +1 @@ + diff --git a/src/app/ui/mod.rs b/src/app/ui/mod.rs index a7cee21..4ea2c3d 100644 --- a/src/app/ui/mod.rs +++ b/src/app/ui/mod.rs @@ -6,7 +6,6 @@ pub mod tabs; impl<'a> eframe::App for App<'a> { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { let frame = egui::Frame::default().fill(ONE_DARK.bg); - // Display the top bar of tabs tabs::display_tabs(&mut self.tab_state, ctx, &frame); diff --git a/src/app/ui/tabs/metar_tab.rs b/src/app/ui/tabs/metar_tab.rs index 79d79f0..e42c24b 100644 --- a/src/app/ui/tabs/metar_tab.rs +++ b/src/app/ui/tabs/metar_tab.rs @@ -1,19 +1,33 @@ +use egui::Key; + use super::Tab; -#[derive(Debug, Default, PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub struct MetarTab { pub icaos: Vec, pub metars: Vec, } +impl Default for MetarTab { + fn default() -> Self { + Self { + icaos: vec!["".to_string()], + metars: vec![], + } + } +} + impl Tab for MetarTab { fn display_tab(&mut self, ctx: &egui::Context, frame: &egui::Frame) { egui::CentralPanel::default().frame(*frame).show(ctx, |ui| { + // Given Key pressed, place focus on next item + let new_icao_focus: bool = ui.input(|i| i.key_pressed(Key::Space)); + for icao in self.icaos.iter_mut() { ui.text_edit_singleline(icao); } - if ui.button("Add More").clicked() || ui.input(|i| i.key_pressed(egui::Key::Tab)) { + if ui.button("Add More").clicked() || new_icao_focus { self.icaos.push("".to_string()); } }); diff --git a/src/app/ui/tabs/mod.rs b/src/app/ui/tabs/mod.rs index 701f0b5..64f9c5b 100644 --- a/src/app/ui/tabs/mod.rs +++ b/src/app/ui/tabs/mod.rs @@ -1,4 +1,4 @@ -pub mod metar_tab; +mod metar_tab; use std::collections::HashMap;