summaryrefslogtreecommitdiff
path: root/src/ui/modal_progress.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-10-04 15:38:18 +1100
committerjacqueline <me@jacqueline.id.au>2023-10-04 15:38:18 +1100
commitee8e5234562c2b9ee1bb261785135abd4f718f83 (patch)
treececd2f215dcd7298e17e9538902da8c59b7fadb8 /src/ui/modal_progress.cpp
parent28633e857f86a21d874117fd677de5e8ad21d8d3 (diff)
downloadtangara-fw-ee8e5234562c2b9ee1bb261785135abd4f718f83.tar.gz
Add a basic database reindex screen
Diffstat (limited to 'src/ui/modal_progress.cpp')
-rw-r--r--src/ui/modal_progress.cpp29
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