diff options
Diffstat (limited to 'src/ui/modal_progress.cpp')
| -rw-r--r-- | src/ui/modal_progress.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/ui/modal_progress.cpp b/src/ui/modal_progress.cpp index 1213de7e..d3d3e9b9 100644 --- a/src/ui/modal_progress.cpp +++ b/src/ui/modal_progress.cpp @@ -28,18 +28,39 @@ namespace ui { namespace modals { -Progress::Progress(Screen* host, std::pmr::string title_text) : Modal(host) { +Progress::Progress(Screen* host, + std::pmr::string title_text, + std::pmr::string subtitle_text) + : Modal(host) { lv_obj_set_layout(root_, LV_LAYOUT_FLEX); lv_obj_set_flex_flow(root_, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(root_, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_t* title = lv_label_create(root_); - lv_label_set_text(title, title_text.c_str()); - lv_obj_set_size(title, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + title_ = lv_label_create(root_); + lv_obj_set_size(title_, LV_SIZE_CONTENT, LV_SIZE_CONTENT); + + subtitle_ = lv_label_create(root_); + lv_obj_set_size(subtitle_, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_obj_t* spinner = lv_spinner_create(root_, 3000, 45); lv_obj_set_size(spinner, 16, 16); + + title(title_text); + subtitle(subtitle_text); +} + +void Progress::title(const std::pmr::string& s) { + lv_label_set_text(title_, s.c_str()); +} + +void Progress::subtitle(const std::pmr::string& s) { + if (s.empty()) { + lv_obj_add_flag(subtitle_, LV_OBJ_FLAG_HIDDEN); + } else { + lv_obj_clear_flag(subtitle_, LV_OBJ_FLAG_HIDDEN); + lv_label_set_text(subtitle_, s.c_str()); + } } } // namespace modals |
