Time & date, system events and much more (#152)

## Time & Date
- Added time to statusbar widget
- Added Time & Date Settings app
- Added TimeZone app for selecting TimeZone
- Added `tt::time` namespace with timezone code

## Other changes

- Added `SystemEvent` to publish/subscribe to system wide (e.g. for init code, but also for time settings changes)
- Changed the way the statusbar widget works: now there's only 1 that gets shown/hidden, instead of 1 instance per app instance.
- Moved `lowercase()` function to new namespace: `tt::string`
- Increased T-Deck flash & PSRAM SPI frequencies to 120 MHz (from 80 MHz)
- Temporary work-around (+ TODO item) for LVGL stack size (issue with WiFi app)
- Suppress T-Deck keystroke debugging to debug level (privacy issue)
- Improved SDL dependency wiring in various `CMakeLists.txt`
- `Loader` service had some variables renamed to the newer C++ style (from previous C style)
This commit is contained in:
Ken Van Hoeylandt
2025-01-10 23:44:32 +01:00
committed by GitHub
parent 4f360741a1
commit bf91e7530d
50 changed files with 1498 additions and 153 deletions
+15 -20
View File
@@ -9,27 +9,14 @@ namespace tt::service::gui {
#define TAG "gui"
static lv_obj_t* create_app_views(Gui* gui, lv_obj_t* parent, app::AppContext& app) {
lvgl::obj_set_style_bg_blacken(parent);
lv_obj_t* vertical_container = lv_obj_create(parent);
lv_obj_set_size(vertical_container, LV_PCT(100), LV_PCT(100));
lv_obj_set_flex_flow(vertical_container, LV_FLEX_FLOW_COLUMN);
lvgl::obj_set_style_no_padding(vertical_container);
lvgl::obj_set_style_bg_blacken(vertical_container);
// TODO: Move statusbar into separate ViewPort
app::Flags flags = app.getFlags();
if (flags.showStatusbar) {
lvgl::statusbar_create(vertical_container);
}
lv_obj_t* child_container = lv_obj_create(vertical_container);
static lv_obj_t* createAppViews(Gui* gui, lv_obj_t* parent, app::AppContext& app) {
lv_obj_send_event(gui->statusbarWidget, LV_EVENT_DRAW_MAIN, nullptr);
lv_obj_t* child_container = lv_obj_create(parent);
lv_obj_set_width(child_container, LV_PCT(100));
lv_obj_set_flex_grow(child_container, 1);
if (keyboardIsEnabled()) {
gui->keyboard = lv_keyboard_create(vertical_container);
gui->keyboard = lv_keyboard_create(parent);
lv_obj_add_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
} else {
gui->keyboard = nullptr;
@@ -45,12 +32,20 @@ void redraw(Gui* gui) {
lock();
if (lvgl::lock(1000)) {
lv_obj_clean(gui->lvgl_parent);
lv_obj_clean(gui->appRootWidget);
ViewPort* view_port = gui->app_view_port;
ViewPort* view_port = gui->appViewPort;
if (view_port != nullptr) {
app::AppContext& app = view_port->app;
lv_obj_t* container = create_app_views(gui, gui->lvgl_parent, app);
app::Flags flags = app.getFlags();
if (flags.showStatusbar) {
lv_obj_remove_flag(gui->statusbarWidget, LV_OBJ_FLAG_HIDDEN);
} else {
lv_obj_add_flag(gui->statusbarWidget, LV_OBJ_FLAG_HIDDEN);
}
lv_obj_t* container = createAppViews(gui, gui->appRootWidget, app);
view_port_show(view_port, container);
} else {
TT_LOG_W(TAG, "nothing to draw");