## 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)
64 lines
1.6 KiB
C++
64 lines
1.6 KiB
C++
#include "Check.h"
|
|
#include "Log.h"
|
|
#include "service/gui/Gui_i.h"
|
|
#include "lvgl/LvglSync.h"
|
|
#include "lvgl/Statusbar.h"
|
|
#include "lvgl/Style.h"
|
|
|
|
namespace tt::service::gui {
|
|
|
|
#define TAG "gui"
|
|
|
|
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(parent);
|
|
lv_obj_add_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
|
|
} else {
|
|
gui->keyboard = nullptr;
|
|
}
|
|
|
|
return child_container;
|
|
}
|
|
|
|
void redraw(Gui* gui) {
|
|
tt_assert(gui);
|
|
|
|
// Lock GUI and LVGL
|
|
lock();
|
|
|
|
if (lvgl::lock(1000)) {
|
|
lv_obj_clean(gui->appRootWidget);
|
|
|
|
ViewPort* view_port = gui->appViewPort;
|
|
if (view_port != nullptr) {
|
|
app::AppContext& app = view_port->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");
|
|
}
|
|
|
|
// Unlock GUI and LVGL
|
|
lvgl::unlock();
|
|
} else {
|
|
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
|
}
|
|
|
|
unlock();
|
|
}
|
|
|
|
} // namespace
|