From 2d9be15713d595a11b97802e4d8a91cb61c90e33 Mon Sep 17 00:00:00 2001 From: bleackstorm Date: Thu, 5 Nov 2026 22:09:21 +0100 Subject: [PATCH] feat(ui): redesign GPUI interface with responsive tabbed cockpit, settings, telemetry, and logs --- src/gui_gpui.rs | 1492 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 1030 insertions(+), 462 deletions(-) diff --git a/src/gui_gpui.rs b/src/gui_gpui.rs index 8e3ff59..779374d 100644 --- a/src/gui_gpui.rs +++ b/src/gui_gpui.rs @@ -18,10 +18,11 @@ use std::time::Duration; // ========================================================================= // Palette Cyberpunk / Aeronautic FPV // ========================================================================= -const COLOR_BG_DARK: u32 = 0x090b10; -const COLOR_SURFACE_CARD: u32 = 0x11151f; -const COLOR_SURFACE_ELEVATED: u32 = 0x181e2b; -const COLOR_BORDER_SUBTLE: u32 = 0x1f293d; +const COLOR_BG_DARK: u32 = 0x07090e; +const COLOR_SURFACE_CARD: u32 = 0x0f131c; +const COLOR_SURFACE_ELEVATED: u32 = 0x161c28; +const COLOR_BORDER_SUBTLE: u32 = 0x1d2636; +const COLOR_BORDER_ACTIVE: u32 = 0x00e5ff; const COLOR_CYAN: u32 = 0x00e5ff; const COLOR_GREEN: u32 = 0x10b981; @@ -30,6 +31,14 @@ const COLOR_RED: u32 = 0xef4444; const COLOR_TEXT_MUTED: u32 = 0x64748b; const COLOR_TEXT_MAIN: u32 = 0xe2e8f0; +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ActiveTab { + Cockpit, + Settings, + Telemetry, + Logs, +} + pub struct SteamFrameGpuiApp { cfg: AppConfig, engine: FpvEngineController, @@ -38,6 +47,8 @@ pub struct SteamFrameGpuiApp { current_render_image: Option>, images_to_drop: Vec>, last_frame_seq: u64, + active_tab: ActiveTab, + show_hud_overlay: bool, // Snapshots pour l'affichage réactif usb_status: SubsystemStatus, xr_status: SubsystemStatus, @@ -67,6 +78,8 @@ impl SteamFrameGpuiApp { current_render_image: None, images_to_drop: Vec::new(), last_frame_seq: 0, + active_tab: ActiveTab::Cockpit, + show_hud_overlay: true, usb_status: SubsystemStatus::Starting, xr_status: SubsystemStatus::Starting, nomad_status: SubsystemStatus::Disabled, @@ -110,9 +123,7 @@ impl SteamFrameGpuiApp { self.current_render_image = Some(new_render_image); self.last_frame_seq = mon.preview_frame_seq; - // Nettoyage de l'atlas texture GPU pour empêcher l'accumulation de VRAM. - // On conserve les 2 dernières trames pour garantir que le GPU a fini - // de les projeter à l'écran avant destruction de la texture. + // Nettoyage de l'atlas texture GPU avec tampon de 2 trames while self.images_to_drop.len() > 2 { let old_img = self.images_to_drop.remove(0); let _ = window.drop_image(old_img); @@ -135,18 +146,23 @@ impl SteamFrameGpuiApp { self.last_log_revision = lb.revision; self.log_err_count = lb.error_count; self.log_warn_count = lb.warn_count; - self.log_entries = lb.entries.iter().rev().take(50).cloned().collect(); + self.log_entries = lb.entries.iter().rev().take(60).cloned().collect(); } } fn run_usb_rndis_setup(&self) { log::info!("[USB RNDIS] Exécution du script de configuration réseau..."); - let script_path = concat!(env!("CARGO_MANIFEST_DIR"), "/scripts/setup_usb_rndis.sh").to_string(); + let script_path = + concat!(env!("CARGO_MANIFEST_DIR"), "/scripts/setup_usb_rndis.sh").to_string(); std::thread::spawn(move || { match Command::new("bash").arg(&script_path).output() { Ok(out) => { let stdout = String::from_utf8_lossy(&out.stdout); - log::info!("[USB RNDIS] Résultat (exit={}) :\n{}", out.status, stdout.trim()); + log::info!( + "[USB RNDIS] Résultat (exit={}) :\n{}", + out.status, + stdout.trim() + ); } Err(e) => log::error!("[USB RNDIS] Échec d'exécution du script : {}", e), } @@ -222,29 +238,29 @@ impl Render for SteamFrameGpuiApp { .text_color(rgb(COLOR_TEXT_MAIN)) .p_3() .gap_3() - // 1. HEADER COCKPIT BAR + .overflow_hidden() + // 1. HEADER COCKPIT BAR AVEC MENU D'ONGLETS .child(self.render_header(cx)) - // 2. MAIN LAYOUT: SIDEBAR + CENTRAL COCKPIT + // 2. VUE ACTIVE (Cockpit plein format, Réglages, Télémétrie, Logs) .child( div() .flex() - .flex_row() + .flex_col() .flex_1() - .gap_3() .overflow_hidden() - // Sidebar (340px) - .child(self.render_sidebar(cx)) - // Dashboard central (Aperçu Vidéo + HUD) - .child(self.render_cockpit()), + .child(match self.active_tab { + ActiveTab::Cockpit => self.render_cockpit_view(cx).into_any_element(), + ActiveTab::Settings => self.render_settings_view(cx).into_any_element(), + ActiveTab::Telemetry => self.render_telemetry_view().into_any_element(), + ActiveTab::Logs => self.render_logs_view(cx).into_any_element(), + }), ) - // 3. LOG CONSOLE (DRAWER INFERIEUR) - .child(self.render_logs_drawer(cx)) } } impl SteamFrameGpuiApp { // ------------------------------------------------------------------------- - // 1. Barre Supérieure (Header & Cockpit Quick Actions) + // 1. Barre Supérieure (Header & Navigation par Onglets) // ------------------------------------------------------------------------- fn render_header(&self, cx: &mut Context) -> impl IntoElement { div() @@ -256,37 +272,58 @@ impl SteamFrameGpuiApp { .border_1() .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_xl() - .px_4() + .px_3() .py_2() + .gap_2() + // GAUCHE : Identité & Badges Statut .child( div() .flex() .items_center() - .gap_3() + .gap_2p5() .child( div() - .text_xl() + .text_base() .font_weight(gpui::FontWeight::BOLD) .text_color(rgb(COLOR_CYAN)) .child("🥽 SteamFrame FPV"), ) - .child( - div() - .text_xs() - .text_color(rgb(COLOR_TEXT_MUTED)) - .child("Eachine Sphere Link • RadioMaster Nomad • OpenXR 140°"), - ), + .child(self.render_status_badge("VRX", &self.usb_status)) + .child(self.render_status_badge("VR", &self.xr_status)), ) + // CENTRE : Barre d'onglets épurée + .child( + div() + .flex() + .items_center() + .gap_1() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .p_1() + .rounded_lg() + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .child(self.render_nav_tab("📹 Cockpit", ActiveTab::Cockpit, cx)) + .child(self.render_nav_tab("⚙️ Réglages", ActiveTab::Settings, cx)) + .child(self.render_nav_tab("📊 Télémétrie", ActiveTab::Telemetry, cx)) + .child(self.render_nav_tab( + &if self.log_err_count > 0 { + format!("📜 Logs ({})", self.log_err_count) + } else { + "📜 Logs".to_string() + }, + ActiveTab::Logs, + cx, + )), + ) + // DROITE : Quick Actions & Tare .child( div() .flex() .items_center() .gap_2() - .child(self.render_status_badge("VRX", &self.usb_status)) - .child(self.render_status_badge("VR Casque", &self.xr_status)) .child( div() - .id("toggle_ht") + .id("toggle_ht_quick") .cursor_pointer() .on_click(cx.listener(|this, _, _, cx| { this.cfg.head_tracking_enabled = !this.cfg.head_tracking_enabled; @@ -295,14 +332,14 @@ impl SteamFrameGpuiApp { cx.notify(); })) .child(self.render_toggle_pill( - "🎯 Suivi Tête", + "🎯 Suivi", self.cfg.head_tracking_enabled, rgb(COLOR_GREEN), )), ) .child( div() - .id("toggle_telem") + .id("toggle_telem_quick") .cursor_pointer() .on_click(cx.listener(|this, _, _, cx| { this.cfg.telemetry_enabled = !this.cfg.telemetry_enabled; @@ -311,21 +348,15 @@ impl SteamFrameGpuiApp { cx.notify(); })) .child(self.render_toggle_pill( - "📶 Télémétrie OSD", + "📶 OSD", self.cfg.telemetry_enabled, rgb(COLOR_CYAN), )), - ), - ) - .child( - div() - .flex() - .items_center() - .gap_2() + ) .child( div() - .id("btn_tare") - .px_3() + .id("btn_tare_quick") + .px_2p5() .py_1() .bg(rgb(COLOR_SURFACE_ELEVATED)) .border_1() @@ -338,13 +369,316 @@ impl SteamFrameGpuiApp { this.engine.request_recenter(); cx.notify(); })) - .child("🎯 Tare (Recentrer)"), + .child("🎯 Tare"), + ), + ) + } + + fn render_nav_tab(&self, label: &str, tab: ActiveTab, cx: &mut Context) -> impl IntoElement { + let is_active = self.active_tab == tab; + let tab_id = match tab { + ActiveTab::Cockpit => "tab_btn_cockpit", + ActiveTab::Settings => "tab_btn_settings", + ActiveTab::Telemetry => "tab_btn_telemetry", + ActiveTab::Logs => "tab_btn_logs", + }; + div() + .id(tab_id) + .px_3() + .py_1() + .rounded_md() + .text_xs() + .font_weight(if is_active { + gpui::FontWeight::BOLD + } else { + gpui::FontWeight::NORMAL + }) + .bg(if is_active { + rgb(0x1a2638) + } else { + rgba(0x00000000) + }) + .border_1() + .border_color(if is_active { + rgb(COLOR_BORDER_ACTIVE) + } else { + rgba(0x00000000) + }) + .text_color(if is_active { + rgb(COLOR_CYAN) + } else { + rgb(COLOR_TEXT_MUTED) + }) + .cursor_pointer() + .on_click(cx.listener(move |this, _, _, cx| { + this.active_tab = tab; + cx.notify(); + })) + .child(label.to_string()) + } + + // ------------------------------------------------------------------------- + // 2. Vue Cockpit : Plein Format Vidéo + Overlay HUD Discret + // ------------------------------------------------------------------------- + fn render_cockpit_view(&self, cx: &mut Context) -> impl IntoElement { + div() + .flex() + .flex_col() + .size_full() + .relative() + .bg(rgb(0x030508)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_xl() + .overflow_hidden() + .items_center() + .justify_center() + // 2.1 Flux Vidéo + .child(if let Some(ref img_src) = self.current_render_image { + div().size_full().child(img(img_src.clone()).size_full()) + } else { + div() + .flex() + .flex_col() + .items_center() + .gap_3() + .child( + div() + .text_xl() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(COLOR_CYAN)) + .child("🥽 En attente du flux Eachine Sphere Link..."), ) .child( div() - .id("btn_apply") - .px_3() + .text_xs() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child("Réception active sur UDP 0.0.0.0:5600 (H.264 Raw direct)"), + ) + .child( + div() + .flex() + .gap_2() + .pt_2() + .child( + div() + .px_3() + .py_1p5() + .bg(rgb(COLOR_SURFACE_CARD)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_lg() + .text_xs() + .child("1. Branchez le câble USB-C OTG ou Mini-HDMI"), + ) + .child( + div() + .px_3() + .py_1p5() + .bg(rgb(COLOR_SURFACE_CARD)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_lg() + .text_xs() + .child("2. Vérifiez le canal 5.8 GHz (Canal 161)"), + ), + ) + }) + // 2.2 Overlay Supérieur Gauche (FPS & Trames) + .child( + div() + .absolute() + .top_3() + .left_3() + .flex() + .gap_2() + .child( + div() + .px_2p5() .py_1() + .bg(rgba(0x0a101abb)) + .border_1() + .border_color(rgb(COLOR_GREEN)) + .rounded_md() + .text_xs() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(COLOR_GREEN)) + .child(format!("{:.1} FPS", self.video_fps)), + ) + .child( + div() + .px_2p5() + .py_1() + .bg(rgba(0x0a101abb)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(format!("{} trames", self.video_frames_total)), + ), + ) + // 2.3 Overlay Supérieur Droit (VR & Format) + .child( + div() + .absolute() + .top_3() + .right_3() + .flex() + .gap_2() + .child( + div() + .px_2p5() + .py_1() + .bg(rgba(0x0a101abb)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .text_color(rgb(COLOR_CYAN)) + .child(format!( + "{} • {}", + self.cfg.vrx_video_profile, + self.cfg.projection_mode.to_uppercase() + )), + ) + .child( + div() + .id("btn_toggle_hud") + .px_2p5() + .py_1() + .bg(rgba(0x0a101abb)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .text_color(rgb(COLOR_TEXT_MUTED)) + .cursor_pointer() + .on_click(cx.listener(|this, _, _, cx| { + this.show_hud_overlay = !this.show_hud_overlay; + cx.notify(); + })) + .child(if self.show_hud_overlay { + "👁️ HUD ON" + } else { + "👁️ HUD OFF" + }), + ), + ) + // 2.4 Bandeau Flottant Inférieur (HUD Télémetrie & Suivi Tête discret) + .child(if self.show_hud_overlay { + div() + .absolute() + .bottom_3() + .flex() + .items_center() + .gap_3() + .px_4() + .py_1p5() + .bg(rgba(0x090e18ee)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_full() + .text_xs() + .child( + div() + .text_color(rgb(COLOR_GREEN)) + .child(format!("🔋 {:.1} V", self.latest_telem.battery_voltage_v)), + ) + .child( + div() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child("•"), + ) + .child( + div() + .text_color(rgb(COLOR_CYAN)) + .child(format!("📶 LQ {}%", self.latest_telem.link_quality_pct)), + ) + .child( + div() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child("•"), + ) + .child( + div() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!( + "🚀 {:.0} km/h • ⛰️ {:.0} m", + self.latest_telem.groundspeed_ms * 3.6, + self.latest_telem.altitude_m + )), + ) + .child( + div() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child("•"), + ) + .child( + div() + .text_color(rgb(COLOR_ORANGE)) + .child(format!( + "🎯 P:{:+.0}° T:{:+.0}° R:{:+.0}°", + self.latest_pose.pan_deg, + self.latest_pose.tilt_deg, + self.latest_pose.roll_deg + )), + ) + .into_any_element() + } else { + div().into_any_element() + }) + } + + // ------------------------------------------------------------------------- + // 3. Vue Réglages (Menus Déroulants & Paramètres Configurables) + // ------------------------------------------------------------------------- + fn render_settings_view(&self, cx: &mut Context) -> impl IntoElement { + div() + .flex() + .flex_col() + .size_full() + .id("settings_view_scroll") + .overflow_y_scroll() + .bg(rgb(COLOR_SURFACE_CARD)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_xl() + .p_4() + .gap_4() + // Titre & En-tête + .child( + div() + .flex() + .justify_between() + .items_center() + .border_b_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .pb_3() + .child( + div() + .flex() + .flex_col() + .gap_0p5() + .child( + div() + .text_base() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(COLOR_CYAN)) + .child("⚙️ Paramètres et Réglages FPV"), + ) + .child( + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child("Configurez le récepteur VRX, le Wi-Fi Nomad, la projection VR et l'OSD."), + ), + ) + .child( + div() + .id("btn_apply_settings") + .px_4() + .py_1p5() .bg(rgb(COLOR_GREEN)) .text_color(rgb(0x000000)) .rounded_md() @@ -352,334 +686,527 @@ impl SteamFrameGpuiApp { .font_weight(gpui::FontWeight::BOLD) .cursor_pointer() .on_click(cx.listener(|this, _, _, cx| { + log::info!("[Réglages] Application et redémarrage du moteur FPV..."); this.engine.start(this.cfg.clone()); cx.notify(); })) - .child("🔄 Appliquer"), + .child("🔄 Appliquer & Redémarrer"), ), ) - } - - // ------------------------------------------------------------------------- - // 2. Panneau Gauche (Sidebar Matérielle & Options) - // ------------------------------------------------------------------------- - fn render_sidebar(&self, cx: &mut Context) -> impl IntoElement { - div() - .flex() - .flex_col() - .w(px(340.0)) - .bg(rgb(COLOR_SURFACE_CARD)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_xl() - .p_3() - .gap_3() - .id("sidebar_scroll") - .overflow_scroll() - // Section 1 : VRX Eachine Sphere Link - .child( - div() - .flex() - .flex_col() - .gap_2() - .child( - div() - .text_sm() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(COLOR_CYAN)) - .child("🔌 1. VRX Sphere Link (Radxa 3W)"), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Mode USB :") - .child( - div() - .text_color(rgb(COLOR_GREEN)) - .child(self.cfg.usb_video_mode.to_uppercase()), - ), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Canal 5.8 GHz :") - .child( - div() - .text_color(rgb(COLOR_ORANGE)) - .child(format!("Canal {}", self.cfg.wifi_channel)), - ), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Résolution Cible :") - .child(format!("{} @ 60 FPS", self.cfg.vrx_video_profile)), - ) - .child( - div() - .flex() - .gap_2() - .pt_1() - .child( - div() - .id("btn_rndis") - .flex_1() - .py_1() - .bg(rgb(COLOR_SURFACE_ELEVATED)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_md() - .text_xs() - .cursor_pointer() - .on_click(cx.listener(|this, _, _, _| { - this.run_usb_rndis_setup(); - })) - .child("⚡ Config RNDIS"), - ) - .child( - div() - .id("btn_ssh") - .flex_1() - .py_1() - .bg(rgb(COLOR_SURFACE_ELEVATED)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_md() - .text_xs() - .cursor_pointer() - .on_click(cx.listener(|this, _, _, _| { - this.configure_radxa_ssh(); - })) - .child("🔧 Config SSH"), - ), - ), - ) - // Section 2 : Wi-Fi RadioMaster Nomad - .child( - div() - .flex() - .flex_col() - .gap_2() - .pt_2() - .border_t_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .child( - div() - .text_sm() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(COLOR_ORANGE)) - .child("📡 2. Wi-Fi Nomad (ELRS)"), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Cible UDP :") - .child(format!("{}:{}", self.cfg.nomad_ip, self.cfg.nomad_port)), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Protocole :") - .child(self.cfg.ht_protocol.to_uppercase()), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Courses Max :") - .child(format!( - "P:{}° T:{}° R:{}°", - self.cfg.max_pan_deg, self.cfg.max_tilt_deg, self.cfg.max_roll_deg - )), - ) - .child( - div() - .id("btn_nomad_test") - .w_full() - .py_1() - .bg(rgb(COLOR_SURFACE_ELEVATED)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_md() - .text_xs() - .cursor_pointer() - .on_click(cx.listener(|this, _, _, _| { - this.test_nomad_packet(); - })) - .child("📡 Envoyer paquet test"), - ), - ) - // Section 3 : Projection OpenXR 140° - .child( - div() - .flex() - .flex_col() - .gap_2() - .pt_2() - .border_t_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .child( - div() - .text_sm() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(COLOR_CYAN)) - .child("🥽 3. Projection VR & Optique"), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Mode Projection :") - .child(self.cfg.projection_mode.to_uppercase()), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("FOV Caméra :") - .child(format!("{}°", self.cfg.camera_fov_deg)), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Distorsion Lentille :") - .child(format!("k1={:.2} k2={:.2}", self.cfg.lens_k1, self.cfg.lens_k2)), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child("Rayon Dôme :") - .child(format!("{:.1} m", self.cfg.screen_distance_m)), - ), - ) - } - - // ------------------------------------------------------------------------- - // 3. Cockpit Central (Vidéo Haute Fréquence + Jauges Télémetrie) - // ------------------------------------------------------------------------- - fn render_cockpit(&self) -> impl IntoElement { - div() - .flex() - .flex_col() - .flex_1() - .gap_3() - .overflow_hidden() - // 3.1 VIEWPORT VIDEO 16:9 - .child( - div() - .flex() - .flex_1() - .bg(rgb(0x05070a)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_xl() - .relative() - .overflow_hidden() - .items_center() - .justify_center() - .child(if let Some(ref img_src) = self.current_render_image { - div().size_full().child(img(img_src.clone()).size_full()) - } else { - div() - .flex() - .flex_col() - .items_center() - .gap_2() - .child( - div() - .text_lg() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(COLOR_CYAN)) - .child("En attente du flux vidéo 720p60..."), - ) - .child( - div() - .text_xs() - .text_color(rgb(COLOR_TEXT_MUTED)) - .child("Port UDP 0.0.0.0:5600 (H.264 Raw NAL direct)"), - ) - }) - // Overlay FPS & Compteur de trames en haut à droite - .child( - div() - .absolute() - .top_3() - .right_3() - .flex() - .gap_2() - .child( - div() - .px_2() - .py_0p5() - .bg(rgba(0x000000bb)) - .border_1() - .border_color(rgb(COLOR_GREEN)) - .rounded_md() - .text_xs() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(COLOR_GREEN)) - .child(format!("{:.1} FPS", self.video_fps)), - ) - .child( - div() - .px_2() - .py_0p5() - .bg(rgba(0x000000bb)) - .border_1() - .border_color(rgb(COLOR_BORDER_SUBTLE)) - .rounded_md() - .text_xs() - .text_color(rgb(COLOR_TEXT_MUTED)) - .child(format!("{} trames", self.video_frames_total)), - ), - ), - ) - // 3.2 DOUBLE CARTE DE MONITORING : SUIVI TÊTE & TELEMETRIE + // Grille des réglages (Cartes thématiques) .child( div() .flex() .flex_row() - .h(px(160.0)) + .flex_wrap() .gap_3() - // Carte Suivi de Tête Nomad + // 3.1 Carte VRX Eachine Sphere Link + .child(self.render_settings_card( + "🔌 1. Récepteur VRX Sphere Link (Radxa Zero 3W)", + COLOR_CYAN, + div() + .flex() + .flex_col() + .gap_3() + // Mode d'acquisition + .child(self.render_setting_row( + "Mode Acquisition Vidéo", + div() + .flex() + .gap_2() + .child(self.render_selectable_pill( + "pill_mode_rndis", + "USB OTG (RNDIS)", + self.cfg.usb_video_mode.eq_ignore_ascii_case("rndis"), + cx.listener(|this, _, _, cx| { + this.cfg.usb_video_mode = "rndis".into(); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_mode_uvc", + "Mini-HDMI (UVC)", + self.cfg.usb_video_mode.eq_ignore_ascii_case("uvc"), + cx.listener(|this, _, _, cx| { + this.cfg.usb_video_mode = "uvc".into(); + cx.notify(); + }), + )), + )) + // Canal 5.8 GHz + .child(self.render_setting_row( + "Canal 5.8 GHz (RTL8812EU)", + div() + .flex() + .gap_1p5() + .child(self.render_channel_button(149, 5745, cx)) + .child(self.render_channel_button(153, 5765, cx)) + .child(self.render_channel_button(157, 5785, cx)) + .child(self.render_channel_button(161, 5805, cx)), + )) + // Codec & Transport + .child(self.render_setting_row( + "Codec Décodage", + div() + .flex() + .gap_2() + .child(self.render_selectable_pill( + "pill_codec_h264", + "H.264 (Faible Latence)", + self.cfg.codec.eq_ignore_ascii_case("h264"), + cx.listener(|this, _, _, cx| { + this.cfg.codec = "h264".into(); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_codec_h265", + "H.265 (HEVC)", + self.cfg.codec.eq_ignore_ascii_case("h265"), + cx.listener(|this, _, _, cx| { + this.cfg.codec = "h265".into(); + cx.notify(); + }), + )), + )) + // Actions matérielles + .child( + div() + .flex() + .gap_2() + .pt_2() + .child( + div() + .id("btn_rndis_setup") + .flex_1() + .py_1p5() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .cursor_pointer() + .on_click(cx.listener(|this, _, _, _| { + this.run_usb_rndis_setup(); + })) + .child("⚡ Lancer setup_usb_rndis.sh"), + ) + .child( + div() + .id("btn_ssh_setup") + .flex_1() + .py_1p5() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .cursor_pointer() + .on_click(cx.listener(|this, _, _, _| { + this.configure_radxa_ssh(); + })) + .child("🔧 Config Canal par SSH"), + ), + ), + )) + // 3.2 Carte Wi-Fi RadioMaster Nomad (ELRS) + .child(self.render_settings_card( + "📡 2. Suivi de Tête & Radio (Nomad ELRS)", + COLOR_ORANGE, + div() + .flex() + .flex_col() + .gap_3() + // Protocole + .child(self.render_setting_row( + "Protocole Wi-Fi", + div() + .flex() + .gap_2() + .child(self.render_selectable_pill( + "pill_proto_msp", + "MSPv2 0x0383 (ELRS Backpack)", + self.cfg.ht_protocol.eq_ignore_ascii_case("msp"), + cx.listener(|this, _, _, cx| { + this.cfg.ht_protocol = "msp".into(); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_proto_crsf", + "CRSF 0x16 (RC Channels)", + self.cfg.ht_protocol.eq_ignore_ascii_case("crsf"), + cx.listener(|this, _, _, cx| { + this.cfg.ht_protocol = "crsf".into(); + cx.notify(); + }), + )), + )) + // Cible UDP + .child(self.render_setting_row( + "Cible Réseau", + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!("{}:{} (Backpack AP)", self.cfg.nomad_ip, self.cfg.nomad_port)), + )) + // Courses maximales + .child(self.render_setting_row( + "Débattements Max", + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!( + "Pan : {}° | Tilt : {}° | Roll : {}°", + self.cfg.max_pan_deg, self.cfg.max_tilt_deg, self.cfg.max_roll_deg + )), + )) + // Actions Nomad + .child( + div() + .flex() + .gap_2() + .pt_2() + .child( + div() + .id("btn_test_packet_settings") + .flex_1() + .py_1p5() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .cursor_pointer() + .on_click(cx.listener(|this, _, _, _| { + this.test_nomad_packet(); + })) + .child("📡 Envoyer paquet test"), + ) + .child( + div() + .id("btn_tare_settings") + .flex_1() + .py_1p5() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_md() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .cursor_pointer() + .on_click(cx.listener(|this, _, _, cx| { + this.engine.request_recenter(); + cx.notify(); + })) + .child("🎯 Réinitialiser Zéro (Tare)"), + ), + ), + )) + // 3.3 Carte Projection VR Steam Frame & Optique + .child(self.render_settings_card( + "🥽 3. Projection VR & Correction Optique 140°", + COLOR_CYAN, + div() + .flex() + .flex_col() + .gap_3() + // Mode de projection + .child(self.render_setting_row( + "Mode de Projection VR", + div() + .flex() + .gap_2() + .child(self.render_selectable_pill( + "pill_proj_dome", + "Dôme 140° (Equirect2)", + self.cfg.projection_mode.eq_ignore_ascii_case("dome"), + cx.listener(|this, _, _, cx| { + this.cfg.projection_mode = "dome".into(); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_proj_cyl", + "Cylindre 140°", + self.cfg.projection_mode.eq_ignore_ascii_case("cylinder"), + cx.listener(|this, _, _, cx| { + this.cfg.projection_mode = "cylinder".into(); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_proj_flat", + "Quad Plat", + self.cfg.projection_mode.eq_ignore_ascii_case("flat"), + cx.listener(|this, _, _, cx| { + this.cfg.projection_mode = "flat".into(); + cx.notify(); + }), + )), + )) + // Lentille et FOV + .child(self.render_setting_row( + "Champ de Vision & Optique", + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!( + "FOV : {}° | Lentille : k1={:.2}, k2={:.2}", + self.cfg.camera_fov_deg, self.cfg.lens_k1, self.cfg.lens_k2 + )), + )) + // Distance virtuelle + .child(self.render_setting_row( + "Distance Virtuelle Écran", + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!("{:.1} mètres", self.cfg.screen_distance_m)), + )), + )) + // 3.4 Carte Télémétrie OSD & MAVLink + .child(self.render_settings_card( + "📊 4. Télémétrie OSD & MAVLink", + COLOR_GREEN, + div() + .flex() + .flex_col() + .gap_3() + .child(self.render_setting_row( + "État Télémétrie & OSD", + div() + .flex() + .gap_2() + .child(self.render_selectable_pill( + "pill_telem_on", + "Activé (ON)", + self.cfg.telemetry_enabled, + cx.listener(|this, _, _, cx| { + this.cfg.telemetry_enabled = true; + this.engine.set_telemetry_enabled(true); + cx.notify(); + }), + )) + .child(self.render_selectable_pill( + "pill_telem_off", + "Désactivé (OFF)", + !self.cfg.telemetry_enabled, + cx.listener(|this, _, _, cx| { + this.cfg.telemetry_enabled = false; + this.engine.set_telemetry_enabled(false); + cx.notify(); + }), + )), + )) + .child(self.render_setting_row( + "Port UDP Écoute MAVLink", + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(format!("0.0.0.0:{}", self.cfg.telemetry_udp_port)), + )), + )), + ) + } + + fn render_settings_card(&self, title: &str, accent_color: u32, content: impl IntoElement) -> impl IntoElement { + div() + .flex() + .flex_col() + .w(px(570.0)) + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_xl() + .p_4() + .gap_3() + .child( + div() + .text_sm() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(accent_color)) + .child(title.to_string()), + ) + .child(content) + } + + fn render_setting_row(&self, label: &str, control: impl IntoElement) -> impl IntoElement { + div() + .flex() + .flex_col() + .gap_1p5() + .child( + div() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(label.to_string()), + ) + .child(control) + } + + fn render_selectable_pill( + &self, + id: &'static str, + label: &str, + is_selected: bool, + on_click: impl Fn(&gpui::ClickEvent, &mut Window, &mut App) + 'static, + ) -> impl IntoElement { + div() + .id(id) + .px_3() + .py_1() + .bg(if is_selected { + rgb(0x132738) + } else { + rgb(COLOR_SURFACE_CARD) + }) + .border_1() + .border_color(if is_selected { + rgb(COLOR_CYAN) + } else { + rgb(COLOR_BORDER_SUBTLE) + }) + .rounded_md() + .text_xs() + .font_weight(if is_selected { + gpui::FontWeight::BOLD + } else { + gpui::FontWeight::NORMAL + }) + .text_color(if is_selected { + rgb(COLOR_CYAN) + } else { + rgb(COLOR_TEXT_MUTED) + }) + .cursor_pointer() + .on_click(on_click) + .child(label.to_string()) + } + + fn render_channel_button(&self, ch: u16, freq_mhz: u32, cx: &mut Context) -> impl IntoElement { + let is_selected = self.cfg.wifi_channel == ch; + let btn_id = match ch { + 149 => "btn_ch_149", + 153 => "btn_ch_153", + 157 => "btn_ch_157", + _ => "btn_ch_161", + }; + div() + .id(btn_id) + .flex_1() + .px_2() + .py_1() + .bg(if is_selected { + rgb(0x28190d) + } else { + rgb(COLOR_SURFACE_CARD) + }) + .border_1() + .border_color(if is_selected { + rgb(COLOR_ORANGE) + } else { + rgb(COLOR_BORDER_SUBTLE) + }) + .rounded_md() + .text_xs() + .text_center() + .font_weight(if is_selected { + gpui::FontWeight::BOLD + } else { + gpui::FontWeight::NORMAL + }) + .text_color(if is_selected { + rgb(COLOR_ORANGE) + } else { + rgb(COLOR_TEXT_MUTED) + }) + .cursor_pointer() + .on_click(cx.listener(move |this, _, _, cx| { + this.cfg.wifi_channel = ch; + cx.notify(); + })) + .child(format!("CH {} ({}MHz)", ch, freq_mhz)) + } + + // ------------------------------------------------------------------------- + // 4. Vue Télémétrie Détaillée & Jauges Vol + // ------------------------------------------------------------------------- + fn render_telemetry_view(&self) -> impl IntoElement { + div() + .flex() + .flex_col() + .size_full() + .id("telemetry_view_scroll") + .overflow_y_scroll() + .bg(rgb(COLOR_SURFACE_CARD)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_xl() + .p_4() + .gap_4() + // Bandeau supérieur des données batterie et signal + .child( + div() + .flex() + .gap_3() + .child(self.render_stat_box( + "🔋 BATTERIE DRONE", + &format!("{:.2} V", self.latest_telem.battery_voltage_v), + &format!("{:.1} A débit", self.latest_telem.battery_current_a), + COLOR_GREEN, + )) + .child(self.render_stat_box( + "📶 QUALITÉ DU LIEN", + &format!("{} %", self.latest_telem.link_quality_pct), + &format!("{} dBm (RSSI)", self.latest_telem.rssi_dbm), + COLOR_CYAN, + )) + .child(self.render_stat_box( + "🚀 VITESSE SOL", + &format!("{:.1} km/h", self.latest_telem.groundspeed_ms * 3.6), + &format!("Gaz : {}%", self.latest_telem.throttle_pct), + COLOR_ORANGE, + )) + .child(self.render_stat_box( + "⛰️ ALTITUDE & CAP", + &format!("{:.1} m", self.latest_telem.altitude_m), + &format!("Cap : {:.0}°", self.latest_telem.drone_heading_deg), + COLOR_CYAN, + )), + ) + // Double Panneau : Suivi de Tête & Radio + .child( + div() + .flex() + .gap_4() + // Panneau Jauges Suivi de Tête .child( div() .flex() .flex_col() .flex_1() - .bg(rgb(COLOR_SURFACE_CARD)) + .bg(rgb(COLOR_SURFACE_ELEVATED)) .border_1() .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_xl() - .p_3() - .gap_2() + .p_4() + .gap_3() .child( div() .flex() .justify_between() + .items_center() .child( div() - .text_xs() + .text_sm() .font_weight(gpui::FontWeight::BOLD) .text_color(rgb(COLOR_ORANGE)) - .child("🎯 Suivi de Tête -> Nomad (CRSF 172..1811)"), + .child("🎯 Canaux CRSF Suivi de Tête (172..1811)"), ) .child( div() @@ -693,120 +1220,138 @@ impl SteamFrameGpuiApp { ), ) .child(self.render_crsf_gauge( - "PAN (Lacet)", + "PAN (Lacet / Direction)", self.latest_pose.pan_deg, self.latest_pose.pan_crsf, self.cfg.max_pan_deg, )) .child(self.render_crsf_gauge( - "TILT (Tangage)", + "TILT (Tangage / Élévation)", self.latest_pose.tilt_deg, self.latest_pose.tilt_crsf, self.cfg.max_tilt_deg, )) .child(self.render_crsf_gauge( - "ROLL (Roulis)", + "ROLL (Roulis / Inclinaison)", self.latest_pose.roll_deg, self.latest_pose.roll_crsf, self.cfg.max_roll_deg, )), ) - // Carte Télémétrie OSD + // Panneau État Liaison Nomad .child( div() .flex() .flex_col() - .flex_1() - .bg(rgb(COLOR_SURFACE_CARD)) + .w(px(340.0)) + .bg(rgb(COLOR_SURFACE_ELEVATED)) .border_1() .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_xl() - .p_3() - .gap_2() + .p_4() + .gap_3() .child( div() - .text_xs() + .text_sm() .font_weight(gpui::FontWeight::BOLD) .text_color(rgb(COLOR_CYAN)) - .child("📊 Télémétrie Drone & OSD"), + .child("📡 État RadioMaster Nomad"), ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child(format!( - "🔋 Batterie : {:.1} V ({:.1} A)", - self.latest_telem.battery_voltage_v, - self.latest_telem.battery_current_a - )) - .child(format!( - "📶 Signal : LQ {}% | {} dBm", - self.latest_telem.link_quality_pct, - self.latest_telem.rssi_dbm - )), - ) - .child( - div() - .flex() - .justify_between() - .text_xs() - .child(format!( - "🧭 Altitude : {:.1} m", - self.latest_telem.altitude_m - )) - .child(format!( - "🚀 Vitesse : {:.1} km/h (Gaz {}%)", - self.latest_telem.groundspeed_ms * 3.6, - self.latest_telem.throttle_pct - )), - ) - .child( - div() - .text_xs() - .text_color(rgb(COLOR_TEXT_MUTED)) - .child(format!( - "Attitude : R{:+.1}° | P{:+.1}° | Cap {:.0}° ({} trames OSD)", - self.latest_telem.drone_roll_rad.to_degrees(), - self.latest_telem.drone_pitch_rad.to_degrees(), - self.latest_telem.drone_heading_deg, - self.latest_telem.packets_received - )), - ), + .child(self.render_stat_row("Statut Réseau :", &format!("{:?}", self.nomad_status))) + .child(self.render_stat_row("Cible UDP :", &format!("{}:{}", self.cfg.nomad_ip, self.cfg.nomad_port))) + .child(self.render_stat_row("Protocole :", &self.cfg.ht_protocol.to_uppercase())) + .child(self.render_stat_row("Fréquence d'Émission :", "60 Hz (Sync OpenXR)")) + .child(self.render_stat_row("Dernière émission :", if self.latest_pose.last_send_ok { "Succès (OK)" } else { "En attente" })), ), ) } - // ------------------------------------------------------------------------- - // 4. Console de Logs & Diagnostic - // ------------------------------------------------------------------------- - fn render_logs_drawer(&self, cx: &mut Context) -> impl IntoElement { + fn render_stat_box(&self, title: &str, value: &str, sub: &str, color: u32) -> impl IntoElement { div() .flex() .flex_col() - .h(px(140.0)) + .flex_1() + .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .rounded_xl() + .p_3() + .gap_1() + .child( + div() + .text_xs() + .font_weight(gpui::FontWeight::SEMIBOLD) + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(title.to_string()), + ) + .child( + div() + .text_xl() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(color)) + .child(value.to_string()), + ) + .child( + div() + .text_xs() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(sub.to_string()), + ) + } + + fn render_stat_row(&self, label: &str, val: &str) -> impl IntoElement { + div() + .flex() + .justify_between() + .text_xs() + .child( + div() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(label.to_string()), + ) + .child( + div() + .font_weight(gpui::FontWeight::SEMIBOLD) + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(val.to_string()), + ) + } + + // ------------------------------------------------------------------------- + // 5. Vue Console de Logs Complète + // ------------------------------------------------------------------------- + fn render_logs_view(&self, cx: &mut Context) -> impl IntoElement { + div() + .flex() + .flex_col() + .size_full() .bg(rgb(COLOR_SURFACE_CARD)) .border_1() .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_xl() - .p_2() - .gap_1() + .p_4() + .gap_3() + .overflow_hidden() + // Barre d'outils .child( div() .flex() .justify_between() .items_center() - .px_2() + .border_b_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) + .pb_3() .child( div() .flex() - .gap_3() .items_center() + .gap_3() .child( div() - .text_xs() + .text_sm() .font_weight(gpui::FontWeight::BOLD) - .child("📋 Journal de Diagnostic"), + .text_color(rgb(COLOR_CYAN)) + .child("📜 Console de Diagnostic et Journal Système"), ) .child( div() @@ -814,7 +1359,7 @@ impl SteamFrameGpuiApp { .text_color(if self.log_err_count > 0 { rgb(COLOR_RED) } else { - rgb(COLOR_GREEN) + rgb(COLOR_TEXT_MUTED) }) .child(format!("{} Erreurs", self.log_err_count)), ) @@ -835,14 +1380,20 @@ impl SteamFrameGpuiApp { .gap_2() .child( div() - .id("filter_all") - .px_2() - .py_0p5() + .id("filter_all_tab") + .px_3() + .py_1() .bg(if self.log_filter == LogFilter::All { rgb(0x1e3a5f) } else { rgb(COLOR_SURFACE_ELEVATED) }) + .border_1() + .border_color(if self.log_filter == LogFilter::All { + rgb(COLOR_CYAN) + } else { + rgb(COLOR_BORDER_SUBTLE) + }) .rounded_md() .text_xs() .cursor_pointer() @@ -850,18 +1401,24 @@ impl SteamFrameGpuiApp { this.log_filter = LogFilter::All; cx.notify(); })) - .child("Tous"), + .child("Tous les logs"), ) .child( div() - .id("filter_warn") - .px_2() - .py_0p5() + .id("filter_warn_tab") + .px_3() + .py_1() .bg(if self.log_filter == LogFilter::WarningsAndErrors { rgb(0x1e3a5f) } else { rgb(COLOR_SURFACE_ELEVATED) }) + .border_1() + .border_color(if self.log_filter == LogFilter::WarningsAndErrors { + rgb(COLOR_ORANGE) + } else { + rgb(COLOR_BORDER_SUBTLE) + }) .rounded_md() .text_xs() .cursor_pointer() @@ -869,18 +1426,24 @@ impl SteamFrameGpuiApp { this.log_filter = LogFilter::WarningsAndErrors; cx.notify(); })) - .child("Warn/Err"), + .child("Warn / Erreurs"), ) .child( div() - .id("filter_err") - .px_2() - .py_0p5() + .id("filter_err_tab") + .px_3() + .py_1() .bg(if self.log_filter == LogFilter::ErrorsOnly { rgb(0x1e3a5f) } else { rgb(COLOR_SURFACE_ELEVATED) }) + .border_1() + .border_color(if self.log_filter == LogFilter::ErrorsOnly { + rgb(COLOR_RED) + } else { + rgb(COLOR_BORDER_SUBTLE) + }) .rounded_md() .text_xs() .cursor_pointer() @@ -888,14 +1451,16 @@ impl SteamFrameGpuiApp { this.log_filter = LogFilter::ErrorsOnly; cx.notify(); })) - .child("Err"), + .child("Erreurs seules"), ) .child( div() - .id("btn_clear_logs") - .px_2() - .py_0p5() + .id("btn_clear_logs_tab") + .px_3() + .py_1() .bg(rgb(COLOR_SURFACE_ELEVATED)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_md() .text_xs() .cursor_pointer() @@ -909,19 +1474,20 @@ impl SteamFrameGpuiApp { this.log_warn_count = 0; cx.notify(); })) - .child("Effacer"), + .child("🗑️ Effacer"), ), ), ) + // Liste scrollable des messages .child( div() .flex() .flex_col() .flex_1() - .id("logs_scroll") - .overflow_scroll() + .id("logs_scroll_tab") + .overflow_y_scroll() .px_2() - .gap_0p5() + .gap_1() .children( self.log_entries .iter() @@ -933,34 +1499,34 @@ impl SteamFrameGpuiApp { } LogFilter::ErrorsOnly => matches!(e.level, log::Level::Error), }) - .take(40) .map(|e| { - let badge_color = match e.level { - log::Level::Error => COLOR_RED, - log::Level::Warn => COLOR_ORANGE, - _ => COLOR_CYAN, - }; - div() - .flex() - .gap_2() - .text_xs() - .child( + let badge_color = match e.level { + log::Level::Error => COLOR_RED, + log::Level::Warn => COLOR_ORANGE, + _ => COLOR_CYAN, + }; div() - .text_color(rgb(COLOR_TEXT_MUTED)) - .child(e.timestamp.clone()), - ) - .child( - div() - .font_weight(gpui::FontWeight::BOLD) - .text_color(rgb(badge_color)) - .child(format!("[{}]", e.level)), - ) - .child( - div() - .text_color(rgb(COLOR_TEXT_MAIN)) - .child(e.message.clone()), - ) - })), + .flex() + .gap_2() + .text_xs() + .child( + div() + .text_color(rgb(COLOR_TEXT_MUTED)) + .child(e.timestamp.clone()), + ) + .child( + div() + .font_weight(gpui::FontWeight::BOLD) + .text_color(rgb(badge_color)) + .child(format!("[{:<5}]", e.level)), + ) + .child( + div() + .text_color(rgb(COLOR_TEXT_MAIN)) + .child(e.message.clone()), + ) + }), + ), ) } @@ -1044,7 +1610,9 @@ impl SteamFrameGpuiApp { div() .w_full() .h(px(6.0)) - .bg(rgb(COLOR_SURFACE_ELEVATED)) + .bg(rgb(COLOR_SURFACE_CARD)) + .border_1() + .border_color(rgb(COLOR_BORDER_SUBTLE)) .rounded_full() .overflow_hidden() .child( @@ -1059,7 +1627,7 @@ impl SteamFrameGpuiApp { pub fn run_gpui_app(cfg: AppConfig, log_buffer: Arc>) -> Result<()> { Application::new().run(move |cx: &mut App| { - let bounds = Bounds::centered(None, size(px(1240.0), px(840.0)), cx); + let bounds = Bounds::centered(None, size(px(1240.0), px(820.0)), cx); let window_res = cx.open_window( WindowOptions {