| 70 | } |
| 71 | |
| 72 | void renderCurrent() { |
| 73 | switch (phase) { |
| 74 | case Phase::Welcome: { |
| 75 | lv_label_set_text(titleLabel, "Welcome"); |
| 76 | auto device_names = string::split(std::string(CONFIG_TT_DEVICE_NAME_SIMPLE), ","); |
| 77 | lv_label_set_text_fmt(descriptionLabel, "It's time to set up your %s!", device_names.front().c_str()); |
| 78 | lv_obj_add_flag(skipButton, LV_OBJ_FLAG_HIDDEN); |
| 79 | lv_label_set_text(lv_obj_get_child(continueButton, 0), "Continue"); |
| 80 | break; |
| 81 | } |
| 82 | case Phase::StepIntro: { |
| 83 | const auto& step = steps[stepIndex]; |
| 84 | lv_label_set_text(titleLabel, step.title.c_str()); |
| 85 | lv_label_set_text(descriptionLabel, step.description.c_str()); |
| 86 | lv_obj_remove_flag(skipButton, LV_OBJ_FLAG_HIDDEN); |
| 87 | lv_label_set_text(lv_obj_get_child(skipButton, 0), "Skip"); |
| 88 | lv_label_set_text(lv_obj_get_child(continueButton, 0), "Continue"); |
| 89 | break; |
| 90 | } |
| 91 | case Phase::Done: |
| 92 | lv_label_set_text(titleLabel, "Setup Complete"); |
| 93 | lv_label_set_text(descriptionLabel, "You're all set."); |
| 94 | lv_obj_add_flag(skipButton, LV_OBJ_FLAG_HIDDEN); |
| 95 | lv_label_set_text(lv_obj_get_child(continueButton, 0), "Finish"); |
| 96 | break; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | void advanceTo(size_t index) { |
| 101 | if (index < steps.size()) { |