From 5e97b32e211101d76802aa28a88912ef2dfdd53b Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 28 Nov 2018 14:32:20 +0900 Subject: [PATCH] package-manager: visual improvements --- apps/package-manager.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/package-manager.c b/apps/package-manager.c index af757ae6..da2e3b23 100644 --- a/apps/package-manager.c +++ b/apps/package-manager.c @@ -42,6 +42,7 @@ static int modifiers = 0; /* For ctrl-click */ struct Package { char name[256]; + char friendly_name[256]; char description[1024]; char version[256]; /* Really doesn't need to be that long */ int selected; @@ -128,10 +129,12 @@ static void draw_package(struct Package * package, int index) { uint32_t text_color = package->selected ? rgb(255,255,255) : rgb(0,0,0); - char tmp[520]; - sprintf(tmp, "%s - %s", package->name, package->version); + char tmp[2048]; + sprintf(tmp, "%s - %s", package->friendly_name, package->version); draw_sdf_string(contents, 64, offset_y + 4, tmp, 20, text_color, SDF_FONT_BOLD); - draw_sdf_string(contents, 64, offset_y + 24, package->description, 16, text_color, SDF_FONT_THIN); + sprintf(tmp, "%s - %s", package->name, package->description); + int x = draw_sdf_string(contents, 65, offset_y + 24, package->name, 16, rgb(150,150,150), SDF_FONT_THIN); + draw_sdf_string(contents, 64 + x + 4, offset_y + 24, package->description, 16, text_color, SDF_FONT_THIN); } @@ -186,9 +189,11 @@ static void load_manifest(void) { if (!strlen(name)) continue; /* skip empty section */ char * desc = confreader_get(conf, name, "description"); char * version = confreader_get(conf, name, "version"); + char * friendly_name = confreader_get(conf, name, "friendly-name"); struct Package * p = malloc(sizeof(struct Package)); sprintf(p->name, name); + sprintf(p->friendly_name, friendly_name); sprintf(p->description, desc); sprintf(p->version, version); p->selected = 0;