Files
MontaukOS/programs/src/desktop/apps/settings/about.cpp
T
2026-05-30 10:22:40 +02:00

51 lines
1.5 KiB
C++

/*
* about.cpp
* About tab for the embedded desktop settings app
* Copyright (c) 2026 Daniel Hammer
*/
#include "settings_internal.hpp"
namespace settings_app {
void settings_draw_about(Canvas& c, SettingsState* st) {
st->uptime_ms = montauk::get_milliseconds();
mtk::Theme theme = settings_theme(st);
int x = 16;
int y = 20;
char line[128];
int sfh = system_font_height();
int line_h = sfh + 6;
c.text_2x(x, y, st->sys_info.osName, theme.accent);
int large_h = (fonts::system_font && fonts::system_font->valid)
? fonts::system_font->get_line_height(fonts::LARGE_SIZE) : (FONT_HEIGHT * 2);
y += large_h + 8;
snprintf(line, sizeof(line), "Version %s (Build %u)",
st->sys_info.osVersion, (unsigned)st->sys_info.buildNumber);
c.text(x, y, line, theme.text);
y += line_h + 8;
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
y += 12;
snprintf(line, sizeof(line), "Build number: %u", (unsigned)st->sys_info.buildNumber);
c.kv_line(x, &y, line, theme.text, line_h);
int up_sec = (int)(st->uptime_ms / 1000);
int up_min = up_sec / 60;
int up_hr = up_min / 60;
snprintf(line, sizeof(line), "Uptime: %d:%02d:%02d", up_hr, up_min % 60, up_sec % 60);
c.kv_line(x, &y, line, theme.text, line_h);
y += 8;
mtk::draw_separator(c, x, y, c.w - 2 * x, theme);
y += 12;
c.text(x, y, "Copyright \xa9 2026 Montauk Operating System", theme.text_muted);
}
} // namespace settings_app