refactor app code (#93)
This commit is contained in:
committed by
GitHub
parent
a312bd5527
commit
d7b151ab88
@@ -2,18 +2,18 @@
|
||||
|
||||
namespace tt::app::screenshot {
|
||||
|
||||
static void on_show(App app, lv_obj_t* parent) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(tt_app_get_data(app));
|
||||
static void on_show(App& app, lv_obj_t* parent) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(app.getData());
|
||||
create_ui(app, ui, parent);
|
||||
}
|
||||
|
||||
static void on_start(App app) {
|
||||
static void on_start(App& app) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(malloc(sizeof(ScreenshotUi)));
|
||||
tt_app_set_data(app, ui);
|
||||
app.setData(ui);
|
||||
}
|
||||
|
||||
static void on_stop(App app) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(tt_app_get_data(app));
|
||||
static void on_stop(App& app) {
|
||||
auto* ui = static_cast<ScreenshotUi*>(app.getData());
|
||||
free(ui);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ extern const Manifest manifest = {
|
||||
.name = "_Screenshot", // So it gets put at the bottom of the desktop and becomes less visible on small screen devices
|
||||
.icon = LV_SYMBOL_IMAGE,
|
||||
.type = TypeSystem,
|
||||
.on_start = &on_start,
|
||||
.on_stop = &on_stop,
|
||||
.on_show = &on_show,
|
||||
.onStart = &on_start,
|
||||
.onStop = &on_stop,
|
||||
.onShow = &on_show,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -153,7 +153,7 @@ static void create_timer_settings_ui(ScreenshotUi* ui, lv_obj_t* parent) {
|
||||
lv_label_set_text(delay_unit_label, "seconds");
|
||||
}
|
||||
|
||||
void create_ui(App app, ScreenshotUi* ui, lv_obj_t* parent) {
|
||||
void create_ui(const App& app, ScreenshotUi* ui, lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, app);
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
@@ -13,6 +13,6 @@ typedef struct {
|
||||
lv_obj_t* delay_textarea;
|
||||
} ScreenshotUi;
|
||||
|
||||
void create_ui(App app, ScreenshotUi* ui, lv_obj_t* parent);
|
||||
void create_ui(const App& app, ScreenshotUi* ui, lv_obj_t* parent);
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user