Public Access
M0 step 7: Settings, About, Storage, first-boot setup
- lib/apps_model (host-tested): SettingsMenu (rows, readable values, choices, validation messages) and SetupWizard (names, Region confirmation, timezone; saves only when finished) - AppManager: modal Apps that Home/Back can't leave (setup wizard) - SettingsApp: all settings plus Storage (usage, erase SD behind a dialog) and About (version, node id, battery, memory, uptime) pages, replacing the temporary Diagnostics App - SetupApp: first-boot wizard, opened modally until SetupDone - Node id and default names derived from the MAC like Meshtastic - Widget demo is now hidden (About, then w) - lib_ldf_mode = deep+ so libraries see each other's headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "line_editor.h"
|
||||
#include "settings.h"
|
||||
|
||||
namespace roro {
|
||||
|
||||
// The first-boot setup flow: names, Region confirmation, timezone. Nothing is saved until the
|
||||
// last step, so an interrupted setup simply starts again at the next boot.
|
||||
class SetupWizard {
|
||||
public:
|
||||
enum class Step { Welcome, LongName, ShortName, Region, Timezone, Done };
|
||||
|
||||
SetupWizard(Settings& settings, std::string defaultLongName, std::string defaultShortName);
|
||||
|
||||
Step step() const { return step_; }
|
||||
bool finished() const { return finished_; }
|
||||
|
||||
// Name steps edit text; Region and Timezone steps pick a choice.
|
||||
LineEditor& editor() { return editor_; }
|
||||
int choiceCount() const;
|
||||
std::string choiceLabel(int i) const;
|
||||
int selectedChoice() const;
|
||||
void selectChoice(int i);
|
||||
|
||||
bool next(); // validates the step; false (with error()) if it can't advance
|
||||
void back();
|
||||
const std::string& error() const { return error_; }
|
||||
|
||||
private:
|
||||
void enter(Step step);
|
||||
void save();
|
||||
|
||||
Settings& settings_;
|
||||
Step step_ = Step::Welcome;
|
||||
bool finished_ = false;
|
||||
std::string error_;
|
||||
LineEditor editor_{39};
|
||||
std::string longName_, shortName_;
|
||||
int region_ = 0;
|
||||
int timezone_ = 0;
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user