Add network

This commit is contained in:
2026-01-09 21:58:48 +00:00
parent f8e1948059
commit 5b5be7c3c8
24 changed files with 482 additions and 114 deletions
+3 -27
View File
@@ -8,39 +8,14 @@
#include "display/ui/text/Renderer.h"
#include "display/ui/bar/Bar.h"
#include "metrics/Host.h"
#include "config/server/StyleConfig.h"
namespace display::ui::hostblock
{
// ===== Layout =====
constexpr int BLOCK_WIDTH = 118; // 118
constexpr int BLOCK_HEIGHT = 146; // 146
constexpr int PADDING = 5; // 5
constexpr int HEADER_HEIGHT = 7; // 12
constexpr std::string_view HEADER_FONT_NAME = "PixelFive-Regular";
constexpr int HEADER_FONT_SIZE = 5; // 10
constexpr int SECTION_GAP = 4; // 4
// ===== CPU bars =====
constexpr int CPU_BAR_WIDTH = 8; // 10
constexpr int CPU_BAR_TEMP_WIDTH = 3;
constexpr int CPU_BAR_GAP = 4; // 4
constexpr int CPU_BAR_HEIGHT = 16; // 16
constexpr int CPU_MAX_PER_ROW = 8; // 8
constexpr int CPU_ROWS = 2; // 2
constexpr int CPU_BAR_TEMP_MIN = 20;
// ===== Memory bar =====
constexpr int MEM_BAR_HEIGHT = 11; // 8
constexpr int MEM_BAR_TEXT_PADDING_X = PADDING + 3;
class HostBlock
{
public:
HostBlock();
static constexpr int width() { return BLOCK_WIDTH; }
static constexpr int height() { return BLOCK_HEIGHT; }
HostBlock(config::server::StyleConfig &config);
void draw(
display::graphics::Framebuffer &fb,
@@ -50,6 +25,7 @@ namespace display::ui::hostblock
const metrics::Host &metrics);
private:
config::server::StyleConfig &config;
display::ui::bar::Bar cpuBar;
display::ui::bar::Bar cpuTempBar;
display::ui::bar::Bar memBar;