Move version display from Clock screen to the modal window (accessible from tile menu)

This commit is contained in:
JF 2020-03-02 20:12:46 +01:00
parent dccef16180
commit 824b8a7ebd
3 changed files with 7 additions and 15 deletions

View File

@ -48,11 +48,7 @@ Clock::Clock(DisplayApp* app,
label_date = lv_label_create(lv_scr_act(), NULL);
lv_label_set_style(label_date, LV_LABEL_STYLE_MAIN, labelStyle);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);
label_version = lv_label_create(lv_scr_act(), NULL);
lv_label_set_style(label_version, LV_LABEL_STYLE_MAIN, labelStyle);
lv_obj_align(label_version, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 100);
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
backgroundLabel = lv_label_create(lv_scr_act(), NULL);
backgroundLabel->user_data = this;
@ -140,13 +136,6 @@ bool Clock::Refresh() {
}
}
if(version.IsUpdated()) {
auto dummy = version.Get();
char versionStr[20];
sprintf(versionStr, "VERSION: %d.%d.%d", Version::Major(), Version::Minor(), Version::Patch());
lv_label_set_text(label_version, versionStr);
}
return running;
}

View File

@ -36,12 +36,15 @@ void Modal::Show() {
lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES);
lv_obj_set_opa_scale_enable(obj, true); /* Enable opacity scaling for the animation */
static const char * btns2[] = {"Ok", "Cancel", ""};
static const char * btns2[] = {"Ok", ""};
/* Create the message box as a child of the modal background */
mbox = lv_mbox_create(obj, NULL);
lv_mbox_add_btns(mbox, btns2);
lv_mbox_set_text(mbox, "Hello world!");
char versionStr[20];
sprintf(versionStr, "VERSION: %d.%d.%d", Version::Major(), Version::Minor(), Version::Patch());
lv_mbox_set_text(mbox, versionStr);
// lv_mbox_set_text(mbox, "Hello world!");
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(mbox, Modal::mbox_event_cb);

View File

@ -16,7 +16,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
screen->OnObjectEvent(obj, event, eventData);
}
static const char * btnm_map1[] = {"Meter", "Gauge", "Clock", "\n", "MsgBox", "App2", "App3", ""};
static const char * btnm_map1[] = {"Meter", "Gauge", "Clock", "\n", "Soft\nversion", "App2", "App3", ""};
Tile::Tile(DisplayApp* app) : Screen(app) {
modal.reset(new Modal(app));