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.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#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_;
|
||||
};
|
||||
Reference in New Issue
Block a user