diff --git a/apps/progman/progman.c b/apps/progman/progman.c index 2de5067..be6b866 100644 --- a/apps/progman/progman.c +++ b/apps/progman/progman.c @@ -56,6 +56,9 @@ #define CMD_ABOUT 300 #define CMD_TASK_MGR 301 +// Task Manager column count +#define TM_COL_COUNT 4 + // ============================================================ // Module state // ============================================================ @@ -231,7 +234,7 @@ static void buildTaskManager(void) { int32_t screenW = sAc->display.width; int32_t screenH = sAc->display.height; - int32_t winW = 300; + int32_t winW = 420; int32_t winH = 280; int32_t winX = (screenW - winW) / 2; int32_t winY = (screenH - winH) / 3; @@ -246,23 +249,25 @@ static void buildTaskManager(void) { WidgetT *root = wgtInitWindow(sAc, sTmWindow); - // ListView widget shows running apps with Name/Type/Status columns. - // wgtPercent() returns a size encoding recognized by the layout engine. - ListViewColT tmCols[3]; + // ListView with Name (descriptor), File (basename), Type, Status columns. + ListViewColT tmCols[TM_COL_COUNT]; tmCols[0].title = "Name"; - tmCols[0].width = wgtPercent(50); + tmCols[0].width = wgtPercent(35); tmCols[0].align = ListViewAlignLeftE; - tmCols[1].title = "Type"; - tmCols[1].width = wgtPercent(25); + tmCols[1].title = "File"; + tmCols[1].width = wgtPercent(30); tmCols[1].align = ListViewAlignLeftE; - tmCols[2].title = "Status"; - tmCols[2].width = wgtPercent(25); + tmCols[2].title = "Type"; + tmCols[2].width = wgtPercent(17); tmCols[2].align = ListViewAlignLeftE; + tmCols[3].title = "Status"; + tmCols[3].width = wgtPercent(18); + tmCols[3].align = ListViewAlignLeftE; sTmListView = wgtListView(root); sTmListView->weight = 100; sTmListView->prefH = wgtPixels(160); - wgtListViewSetColumns(sTmListView, tmCols, 3); + wgtListViewSetColumns(sTmListView, tmCols, TM_COL_COUNT); // Button row right-aligned (AlignEndE) to follow Windows UI convention WidgetT *btnRow = wgtHBox(root); @@ -490,9 +495,10 @@ static void refreshTaskList(void) { return; } - // Flat array of cell strings: [row0_col0, row0_col1, row0_col2, row1_col0, ...] - static const char *cells[SHELL_MAX_APPS * 3]; + // Flat array of cell strings: [row0_col0..col3, row1_col0..col3, ...] + static const char *cells[SHELL_MAX_APPS * TM_COL_COUNT]; static char typeStrs[SHELL_MAX_APPS][12]; + static char fileStrs[SHELL_MAX_APPS][64]; int32_t rowCount = 0; for (int32_t i = 1; i < SHELL_MAX_APPS; i++) { @@ -503,11 +509,29 @@ static void refreshTaskList(void) { ShellAppT *app = shellGetApp(i); if (app && app->state == AppStateRunningE) { - int32_t base = rowCount * 3; - cells[base] = app->name; + int32_t base = rowCount * TM_COL_COUNT; + + // Column 0: Name (from appDescriptor) + cells[base] = app->name; + + // Column 1: Filename (basename of .app path) + const char *slash = strrchr(app->path, '/'); + const char *back = strrchr(app->path, '\\'); + + if (back > slash) { + slash = back; + } + + const char *fname = slash ? slash + 1 : app->path; + snprintf(fileStrs[rowCount], sizeof(fileStrs[rowCount]), "%.63s", fname); + cells[base + 1] = fileStrs[rowCount]; + + // Column 2: Type (main-loop task vs callback-only) snprintf(typeStrs[rowCount], sizeof(typeStrs[rowCount]), "%s", app->hasMainLoop ? "Task" : "Callback"); - cells[base + 1] = typeStrs[rowCount]; - cells[base + 2] = "Running"; + cells[base + 2] = typeStrs[rowCount]; + + // Column 3: Status + cells[base + 3] = "Running"; rowCount++; } }