#pragma once #include #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