Refine node info UI and peer announcements

This commit is contained in:
liu weikai
2026-04-21 22:32:52 +08:00
parent a022d4af8b
commit 110fa96be8
10 changed files with 1721 additions and 1007 deletions
@@ -5,6 +5,8 @@
#pragma once
#include <cstddef>
#include "chat/domain/contact_types.h"
#include "lvgl.h"
@@ -13,62 +15,53 @@ namespace node_info
namespace ui
{
static constexpr std::size_t kNodeInfoTileCount = 9;
static constexpr std::size_t kNodeInfoInfoLineCount = 8;
struct NodeInfoWidgets
{
lv_obj_t* root = nullptr;
lv_obj_t* header = nullptr;
lv_obj_t* content = nullptr;
lv_obj_t* top_row = nullptr;
lv_obj_t* info_card = nullptr;
lv_obj_t* info_header = nullptr;
lv_obj_t* info_footer = nullptr;
lv_obj_t* location_card = nullptr;
lv_obj_t* location_header = nullptr;
lv_obj_t* location_map = nullptr;
lv_obj_t* location_coords = nullptr;
lv_obj_t* location_updated = nullptr;
lv_obj_t* link_panel = nullptr;
lv_obj_t* link_header = nullptr;
lv_obj_t* link_row_1 = nullptr;
lv_obj_t* link_row_2 = nullptr;
lv_obj_t* back_btn = nullptr;
lv_obj_t* back_label = nullptr;
lv_obj_t* title_label = nullptr;
lv_obj_t* battery_label = nullptr;
lv_obj_t* avatar_bg = nullptr;
lv_obj_t* avatar_label = nullptr;
lv_obj_t* name_label = nullptr;
lv_obj_t* desc_label = nullptr;
lv_obj_t* map_stage = nullptr;
lv_obj_t* tile_layer = nullptr;
lv_obj_t* left_scrim = nullptr;
lv_obj_t* right_scrim = nullptr;
lv_obj_t* id_label = nullptr;
lv_obj_t* role_label = nullptr;
lv_obj_t* lon_label = nullptr;
lv_obj_t* lat_label = nullptr;
lv_obj_t* no_position_label = nullptr;
lv_obj_t* location_title_label = nullptr;
lv_obj_t* map_image = nullptr;
lv_obj_t* map_label = nullptr;
lv_obj_t* coords_latlon_label = nullptr;
lv_obj_t* coords_acc_label = nullptr;
lv_obj_t* coords_alt_label = nullptr;
lv_obj_t* updated_label = nullptr;
lv_obj_t* connection_line = nullptr;
lv_obj_t* marker_node_ring = nullptr;
lv_obj_t* marker_node_dot = nullptr;
lv_obj_t* marker_self_ring = nullptr;
lv_obj_t* marker_self_dot = nullptr;
lv_obj_t* distance_label = nullptr;
lv_obj_t* link_title_label = nullptr;
lv_obj_t* link_rssi_label = nullptr;
lv_obj_t* link_snr_label = nullptr;
lv_obj_t* link_ch_label = nullptr;
lv_obj_t* link_sf_label = nullptr;
lv_obj_t* link_bw_label = nullptr;
lv_obj_t* link_hop_label = nullptr;
lv_obj_t* link_last_heard_label = nullptr;
lv_obj_t* zoom_in_btn = nullptr;
lv_obj_t* zoom_out_btn = nullptr;
lv_obj_t* zoom_in_label = nullptr;
lv_obj_t* zoom_out_label = nullptr;
lv_obj_t* tile_images[kNodeInfoTileCount]{};
lv_obj_t* info_labels[kNodeInfoInfoLineCount]{};
};
/**
* @brief Create an empty Node Info screen structure.
* @brief Create the Node Info page widgets.
*/
NodeInfoWidgets create(lv_obj_t* parent);
/**
* @brief Destroy the Node Info screen (if created).
* @brief Destroy the Node Info page (if created).
*/
void destroy();
@@ -78,7 +71,7 @@ void destroy();
const NodeInfoWidgets& widgets();
/**
* @brief Update UI labels with NodeInfo data.
* @brief Update UI widgets with NodeInfo data.
*/
void set_node_info(const chat::contacts::NodeInfo& node);
@@ -1,6 +1,6 @@
/**
* @file node_info_page_layout.h
* @brief Node info page layout (structure only)
* @brief Node info page layout helpers
*/
#pragma once
@@ -17,18 +17,6 @@ namespace layout
lv_obj_t* create_root(lv_obj_t* parent);
lv_obj_t* create_header(lv_obj_t* root);
lv_obj_t* create_content(lv_obj_t* root);
lv_obj_t* create_top_row(lv_obj_t* content);
lv_obj_t* create_info_card(lv_obj_t* top_row);
lv_obj_t* create_info_header(lv_obj_t* info_card);
lv_obj_t* create_info_footer(lv_obj_t* info_card);
lv_obj_t* create_location_card(lv_obj_t* top_row);
lv_obj_t* create_location_header(lv_obj_t* location_card);
lv_obj_t* create_location_map(lv_obj_t* location_card);
lv_obj_t* create_location_coords(lv_obj_t* location_card);
lv_obj_t* create_location_updated(lv_obj_t* location_card);
lv_obj_t* create_link_panel(lv_obj_t* content);
lv_obj_t* create_link_header(lv_obj_t* link_panel);
lv_obj_t* create_link_row(lv_obj_t* link_panel);
} // namespace layout
} // namespace ui