nyx: deduplicate window creation functions

Also rename mbox_action and fix a double lv obj deletion in partition manager.
This commit is contained in:
CTCaer
2026-02-07 00:36:19 +02:00
parent 380bbe77a5
commit 5cca9025b0
10 changed files with 110 additions and 127 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018-2025 CTCaer
* Copyright (c) 2018-2026 CTCaer
* Copyright (c) 2018 balika011
*
* This program is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ static lv_res_t _create_window_dump_done(int error, char *dump_filenames)
lv_mbox_set_text(mbox, txt_buf);
free(txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -71,7 +71,7 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (btn_idx == 1)
{
@@ -542,14 +542,14 @@ static lv_res_t _action_win_hw_info_status_close(lv_obj_t *btn)
hw_info = NULL;
}
return nyx_win_close_action_custom(btn);
return nyx_win_close_action(btn);
}
static lv_res_t _create_window_hw_info_status(lv_obj_t *btn)
{
u32 uptime_s = get_tmr_s();
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close);
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" HW & Fuses Info", _action_win_hw_info_status_close);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump fuses", _fuse_dump_window_action);
lv_win_add_btn(win, NULL, SYMBOL_INFO" CAL0 Info", _create_mbox_cal0);
@@ -1328,7 +1328,7 @@ static void _ipatch_process(u32 offset, u32 value)
static lv_res_t _create_window_bootrom_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Bootrom Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Bootrom", _bootrom_dump_window_action);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -1360,7 +1360,7 @@ static lv_res_t _launch_lockpick_action(lv_obj_t *btns, const char * txt)
{
int btn_idx = lv_btnm_get_pressed(btns);
mbox_action(btns, txt);
nyx_mbox_action(btns, txt);
if (btn_idx == 1)
{
@@ -1582,7 +1582,7 @@ out:
free (txt_buf);
free (txt_buf2);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -1929,7 +1929,7 @@ out:
free(txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action); // Important. After set_text.
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action); // Important. After set_text.
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
return LV_RES_OK;
@@ -1951,7 +1951,7 @@ static lv_res_t _create_mbox_sd_bench(lv_obj_t * btn)
static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" Internal eMMC Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_CHIP" Benchmark", _create_mbox_emmc_bench);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -2203,7 +2203,7 @@ out_error:
emmc_errors[EMMC_ERROR_RW_RETRY]);
lv_mbox_set_text(mbox, txt_buf);
lv_mbox_add_btns(mbox, mbox_btn_map, mbox_action);
lv_mbox_add_btns(mbox, mbox_btn_map, nyx_mbox_action);
lv_obj_set_width(mbox, LV_HOR_RES / 9 * 5);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);
@@ -2217,7 +2217,7 @@ out_error:
static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SD" microSD Card Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_SD" Benchmark", _create_mbox_sd_bench);
lv_obj_t *desc = lv_cont_create(win, NULL);
@@ -2622,7 +2622,7 @@ failed:
static lv_res_t _create_window_battery_status(lv_obj_t *btn)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info");
lv_obj_t *win = nyx_create_standard_window(SYMBOL_BATTERY_FULL" Battery Info", NULL);
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump Fuel Regs", _battery_dump_window_action);
lv_obj_t *desc = lv_cont_create(win, NULL);