Files
radiantwave/src/system_name_page.h
T
NeilClack 1bfe64580c Kiosk: System Name entry in System Settings
Adds a System Name text-entry page (hint 'e.g. Living Room', 1-40 char
validation) and a data-driven System Settings row for it. Saving persists
locally and nudges the background sync; conflict/invalid results surface
the message and restore the previous name. Extends the settings-menu
tests.
2026-09-29 09:58:08 -05:00

45 lines
1.2 KiB
C++

#pragma once
#include "page.h"
#include "text_cache.h"
#include <SDL3_ttf/SDL_ttf.h>
#include <string>
// Text-entry page for the Kiosk's System Name (a human-readable label for this
// License Key). Saves locally first, then syncs in the background so the UI is
// never blocked on the network.
class SystemNamePage : public Page {
public:
void onPush(AppState& state) override;
void onResume(AppState& state) override;
void onPause(AppState& state) override;
void onPop(AppState& state) override;
void handleEvent(const SDL_Event& event) override;
void update(float dt) override;
void render(SDL_Renderer* renderer) override;
private:
void createFonts();
void destroyFonts();
void destroyTextures();
void submit();
void pollSyncResult();
AppState* state_ = nullptr;
std::string storedValue_;
std::string input_;
std::string statusMessage_;
bool statusIsError_ = false;
TTF_Font* fontTitle_ = nullptr;
TTF_Font* fontHeader_ = nullptr;
TTF_Font* fontBody_ = nullptr;
TTF_Font* fontSmall_ = nullptr;
CachedText titleText_;
CachedText storedText_;
CachedText valueText_;
CachedText statusText_;
CachedText hintText_;
};