From 3bfc8438cb65026ba4360e352358e035ba202404 Mon Sep 17 00:00:00 2001 From: konect-V <66421869+konect-V@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:37:08 +0200 Subject: [PATCH] Desktop : Page support --- sources/core/apps/desktop/icons/default.tga | Bin 0 -> 640018 bytes sources/core/apps/desktop/icons/icons.json | 576 +++++++++++++++++++ sources/core/apps/desktop/res/desktop.json | 1 + sources/core/apps/desktop/source/core/core.c | 206 +++++-- sources/core/apps/lock/source/core/core.c | 68 ++- 5 files changed, 766 insertions(+), 85 deletions(-) create mode 100644 sources/core/apps/desktop/icons/default.tga diff --git a/sources/core/apps/desktop/icons/default.tga b/sources/core/apps/desktop/icons/default.tga new file mode 100644 index 0000000000000000000000000000000000000000..702b9ef69b37ada3eefa4fafb84149c5f4284c2a GIT binary patch literal 640018 zcmeI52Y4LS)rRASjcK8TKp@7(#<+KEY-2iv-a7$eu<6aT011H*T7VD|2npe*h8jAU z-g^gw=`HkXNmjGE?*E;&*4RR_R?_awow=``=RE2&_rCW#=bPEtne&sMbp1*8O|gz* z6-AFijFD|Z00IzzK>P$$cWUtbGXx+20SH7+ zK(%{C#qNqb6mt~0dO*JZu1Nd5OR=Y7rN{xWLkK_s0uX2y0o7`Ijp{dwrxewSeEC5~ zw_{^?S}|3zLc1ozA432F5P(3z38*&P`=ho|JglfubhO?V>i=v^c1?aeMX!PbVFwU^ z00bb=CIQvsfr?8NrHVq;|9ow?Ok=!Ev38pi;}0MJ0SG{#AOuu{mr&R>4toz&zUq5a z+p#h4p;)3IaM&mWAOHafv`9d8cO}I+iX@zKwB|{6F7juaON*1_hY)}O1R#)C0;;zI z6t^iF6s^_fr2O3GaJyoyyh37Q5P$##Ag~Al)!8u$yN@F&{*dc9pVgekE;3oZfdB*` z0D-&^P<7{n%ktjz+xj1fB*y_kRcF&cVs=po~bf{WrqL+AOL~R6Hq-J zrg&MAt+8qUY;zsnd2(z40uX>exCB&3S64g~kauLg(dN8*xGT@hApijgbew?d=hBMH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core/apps/desktop/icons/icons.json index 8e8a3fb11..77ea6a975 100644 --- a/sources/core/apps/desktop/icons/icons.json +++ b/sources/core/apps/desktop/icons/icons.json @@ -17,6 +17,582 @@ "executablePath": "/usr/bin/nyancat", "appName": "Nyancat" }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, + { + "cwdPath": "/usr/bin/", + "iconPath": "", + "executablePath": "/usr/bin/nyancat", + "appName": "Test" + }, { "cwdPath": "/usr/bin/doom", "iconPath": "/usr/bin/icons/doom.tga", diff --git a/sources/core/apps/desktop/res/desktop.json b/sources/core/apps/desktop/res/desktop.json index 8ce3a4732..156fca94b 100644 --- a/sources/core/apps/desktop/res/desktop.json +++ b/sources/core/apps/desktop/res/desktop.json @@ -1,4 +1,5 @@ { + "default_icon_path": "/usr/bin/icons/default.tga", "font_path": "/usr/bin/res/desktop/default_font.ttf", "wallpaper_path": "/usr/bin/res/desktop/default_wallpaper.jpg", "pin_expected": "" diff --git a/sources/core/apps/desktop/source/core/core.c b/sources/core/apps/desktop/source/core/core.c index dd231c6ad..17a3e72f4 100644 --- a/sources/core/apps/desktop/source/core/core.c +++ b/sources/core/apps/desktop/source/core/core.c @@ -48,16 +48,23 @@ struct fb_fix_screeninfo fix_screeninfo; struct fb_var_screeninfo var_screeninfo; raw_image_t* wallpaper_resized = NULL; +raw_image_t* default_icon_image = NULL; char* wallpaper_path = NULL; +char* default_icon_path = NULL; char* font_path = NULL; +size_t icon_json_length = 0; +void* icon_json_data = NULL; +cJSON* icon_json_root = NULL; + size_t json_size = 0; void* json_buffer = NULL; FILE* json_file = NULL; cJSON* json_root = NULL; cJSON* wallpaper_path_json = NULL; cJSON* font_path_json = NULL; +cJSON* default_icon_path_json = NULL; int icon_row_count = 0; int icon_column_count = 0; @@ -71,7 +78,6 @@ int current_page = 0; int page_count = 0; int icons_count = 0; -int icon_start_count = 0; int focus_icon_row = 0; int focus_icon_column = 0; int icons_max_count = 0; @@ -171,8 +177,17 @@ int load_json(){ if(json_root != NULL){ wallpaper_path_json = cJSON_GetObjectItem(json_root, "wallpaper_path"); if(cJSON_IsString(wallpaper_path_json) && (wallpaper_path_json->valuestring != NULL)){ - wallpaper_path = malloc(strlen(wallpaper_path_json->valuestring) + 1); - strcpy(wallpaper_path, wallpaper_path_json->valuestring); + wallpaper_path = strdup(wallpaper_path_json->valuestring); + }else{ + fclose(json_file); + + printf("Error: Unable to parse the file : /usr/bin/res/desktop/desktop.json\n"); + return EXIT_FAILURE; + } + + default_icon_path_json = cJSON_GetObjectItem(json_root, "default_icon_path"); + if(cJSON_IsString(default_icon_path_json) && (default_icon_path_json->valuestring != NULL)){ + default_icon_path = strdup(default_icon_path_json->valuestring); }else{ fclose(json_file); @@ -182,8 +197,7 @@ int load_json(){ font_path_json = cJSON_GetObjectItem(json_root, "font_path"); if(cJSON_IsString(font_path_json) && (font_path_json->valuestring != NULL)){ - font_path = malloc(strlen(font_path_json->valuestring) + 1); - strcpy(font_path, font_path_json->valuestring); + font_path = strdup(font_path_json->valuestring); }else{ fclose(json_file); @@ -217,6 +231,23 @@ int load_wallpaper(char* wallpaper_path){ return EXIT_SUCCESS; } +int load_default_icon(char* default_icon_path){ + raw_image_t* default_icon_image_not_resized = load_tga_image_file(default_icon_path); + if(default_icon_image_not_resized == NULL){ + perror("error loading wallpaper\n"); + return EXIT_FAILURE; + } + if(default_icon_image_not_resized->width < default_icon_image_not_resized->height){ + default_icon_image = resize_image(default_icon_image_not_resized, 0, ICON_IMAGE_HEIGHT, true); + }else{ + default_icon_image = resize_image(default_icon_image_not_resized, ICON_IMAGE_WIDTH, 0, true); + } + + free_raw_image(default_icon_image_not_resized); + + return EXIT_SUCCESS; +} + int load_font_data(char* font_path){ FILE* font_file = fopen(font_path, "rb"); @@ -239,94 +270,105 @@ int load_font_data(char* font_path){ return EXIT_SUCCESS; } -int process_icons(const char* json_file_path){ - FILE* file = fopen(json_file_path, "r"); - if (!file) { +int load_icon_json(const char* icon_json_file_path){ + FILE* icon_json_file = fopen(icon_json_file_path, "r"); + if (!icon_json_file) { perror("Failed to open file"); return EXIT_FAILURE; } - fseek(file, 0, SEEK_END); - long length = ftell(file); - fseek(file, 0, SEEK_SET); - char* data = malloc(length + 1); - fread(data, 1, length, file); - fclose(file); - data[length] = '\0'; + fseek(icon_json_file, 0, SEEK_END); + icon_json_length = ftell(icon_json_file); + fseek(icon_json_file, 0, SEEK_SET); + icon_json_data = malloc(icon_json_length + 1); + fread(icon_json_data, 1, icon_json_length, icon_json_file); + fclose(icon_json_file); + ((char*)icon_json_data)[icon_json_length] = '\0'; - cJSON* json = cJSON_Parse(data); - free(data); + icon_json_root = cJSON_Parse(icon_json_data); - if(!json){ + if(!icon_json_root){ fprintf(stderr, "Error parsing JSON\n"); return EXIT_FAILURE; } + return EXIT_SUCCESS; +} + +int process_icons(){ int c = 0; int total_count = 0; + int icon_start_count = current_page * icons_max_count; icons_text = malloc(sizeof(char*) * icons_max_count); icons_executable_path = malloc(sizeof(char*) * icons_max_count); icons_cwd_path = malloc(sizeof(char*) * icons_max_count); icons_image = malloc(sizeof(raw_image_t*) * icons_max_count); cJSON* item = NULL; - cJSON_ArrayForEach(item, json) { - if (total_count < icon_start_count) { + cJSON_ArrayForEach(item, icon_json_root) { + if(total_count < icon_start_count){ total_count++; - } else if (total_count < icons_max_count + icon_start_count) { + }else if (total_count < icons_max_count + icon_start_count){ cJSON* iconPath = cJSON_GetObjectItem(item, "iconPath"); cJSON* executablePath = cJSON_GetObjectItem(item, "executablePath"); cJSON* cwdPath = cJSON_GetObjectItem(item, "cwdPath"); cJSON* appName = cJSON_GetObjectItem(item, "appName"); if(iconPath && executablePath && cwdPath && appName) { - raw_image_t* icon = load_tga_image_file(iconPath->valuestring); - - if (icon != NULL) { - raw_image_t* icon_resized = NULL; - if (icon->width < icon->height) { - icon_resized = resize_image(icon, 0, ICON_IMAGE_HEIGHT, true); - } else { - icon_resized = resize_image(icon, ICON_IMAGE_WIDTH, 0, true); - } + if(iconPath->valuestring[0] != '\0'){ + raw_image_t* icon = load_tga_image_file(iconPath->valuestring); + + if(icon != NULL){ + raw_image_t* icon_resized = NULL; + if (icon->width < icon->height) { + icon_resized = resize_image(icon, 0, ICON_IMAGE_HEIGHT, true); + } else { + icon_resized = resize_image(icon, ICON_IMAGE_WIDTH, 0, true); + } - free_raw_image(icon); + free_raw_image(icon); - if(icon_resized != NULL){ - size_t name_length = strlen(appName->valuestring) + 1; - char* name = malloc(name_length); - strncpy(name, appName->valuestring, name_length); + if(icon_resized != NULL){ + icons_image[c] = icon_resized; + }else{ + icons_image[c] = NULL; + } + }else{ + icons_image[c] = NULL; + } + }else{ + icons_image[c] = NULL; + } - icons_image[c] = icon_resized; - icons_text[c] = name; - icons_executable_path[c] = strdup(executablePath->valuestring); - icons_cwd_path[c] = strdup(cwdPath->valuestring); + size_t name_length = strlen(appName->valuestring) + 1; + char* name = malloc(name_length); + strncpy(name, appName->valuestring, name_length); - if (name_length > max_text_icon_length) { - char* correct_name = malloc(name_length); - strncpy(correct_name, name, name_length); - icons_executable_path[c] = correct_name; + icons_text[c] = name; + icons_executable_path[c] = strdup(executablePath->valuestring); + icons_cwd_path[c] = strdup(cwdPath->valuestring); - name[max_text_icon_length - 3] = '.'; - name[max_text_icon_length - 2] = '.'; - name[max_text_icon_length - 1] = '.'; - name[max_text_icon_length] = '\0'; - } + if (name_length > max_text_icon_length) { + char* correct_name = malloc(name_length); + strncpy(correct_name, name, name_length); + icons_executable_path[c] = correct_name; - c++; - total_count++; - } + name[max_text_icon_length - 3] = '.'; + name[max_text_icon_length - 2] = '.'; + name[max_text_icon_length - 1] = '.'; + name[max_text_icon_length] = '\0'; } + + c++; + total_count++; } - } else { + }else{ total_count++; } } - cJSON_Delete(json); - icons_count = c; - page_count = DIV_ROUND_UP(c, icons_max_count); + page_count = DIV_ROUND_UP(total_count, icons_max_count); return EXIT_SUCCESS; } @@ -420,6 +462,24 @@ void get_input(){ assert(ioctl(fb_fd, FBIOPUT_VSCREENINFO, &var_screeninfo) == 0); } } + }else if(key == 60 && pressed){ + // next page + if(current_page < page_count - 1){ + current_page++; + focus_icon_row = 0; + focus_icon_column = 0; + process_icons(); + update_icon_page = true; + } + }else if(key == 59 && pressed){ + // last page + if(current_page > 0){ + current_page--; + focus_icon_row = 0; + focus_icon_column = 0; + process_icons(); + update_icon_page = true; + } } } } @@ -440,9 +500,9 @@ void draw_desktop(){ write_paragraph(font, 0, 0, fb.width, PARAGRAPH_CENTER, date_time_str); - char page_string[20]; - snprintf(page_string, 20, "Page : %d / %d", current_page + 1, page_count); - write_paragraph(font, 0, 0, fb.width - 25, PARAGRAPH_RIGHT, page_string); + char page_string[50]; + snprintf(page_string, 50, "Page : %d / %d | Next: | Last: ", current_page + 1, page_count); + write_paragraph(font, 0, 0, fb.width - 35, PARAGRAPH_RIGHT, page_string); if(update_icon_page){ update_icon_page = false; @@ -457,7 +517,11 @@ void draw_desktop(){ uint32_t x = start_x + i * (ICON_MARGIN + ICON_WIDTH); uint32_t y = start_y + j * (ICON_MARGIN + ICON_HEIGHT); - draw_image_with_binary_transparency(&fb, icons_image[c], x, y, ICON_IMAGE_WIDTH, ICON_IMAGE_HEIGHT); + if(icons_image[c] != NULL){ + draw_image_with_binary_transparency(&fb, icons_image[c], x, y, ICON_IMAGE_WIDTH, ICON_IMAGE_HEIGHT); + }else{ + draw_image_with_binary_transparency(&fb, default_icon_image, x, y, ICON_IMAGE_WIDTH, ICON_IMAGE_HEIGHT); + } if(i == focus_icon_column && j == focus_icon_row){ draw_rectangle_border(&fb, x - ICON_BORDER_MARGIN, y - ICON_BORDER_MARGIN, ICON_WIDTH + 2 * ICON_BORDER_MARGIN, ICON_HEIGHT + 2 * ICON_BORDER_MARGIN, ICON_BORDER_FOCUS_COLOR); @@ -503,6 +567,14 @@ int main(int argc, char* argv[]){ return EXIT_FAILURE; } + if(load_default_icon(default_icon_path) != EXIT_SUCCESS){ + free_raw_image(wallpaper_resized); + + fclose(json_file); + + return EXIT_FAILURE; + } + if(load_font_data(font_path) != EXIT_SUCCESS){ free_raw_image(wallpaper_resized); @@ -511,6 +583,14 @@ int main(int argc, char* argv[]){ return EXIT_FAILURE; } + if(load_icon_json("/usr/bin/icons/icons.json") != EXIT_SUCCESS){ + free_raw_image(wallpaper_resized); + + fclose(json_file); + + return EXIT_FAILURE; + } + icon_column_count = fb.width / (ICON_WIDTH + ICON_MARGIN); icon_row_count = (fb.height - DATE_TIME_HEIGHT) / (ICON_HEIGHT + ICON_MARGIN); start_x += (fb.width - (start_x + icon_column_count * (ICON_WIDTH + ICON_MARGIN))) / 2; @@ -523,14 +603,16 @@ int main(int argc, char* argv[]){ get_textbox_info(font, " ", &char_width, NULL, NULL, NULL); max_text_icon_length = ICON_IMAGE_WIDTH / char_width; - icon_start_count = current_page * icons_max_count; - - process_icons("/usr/bin/icons/icons.json"); + process_icons(); while(true){ draw_desktop(); } + cJSON_Delete(icon_json_root); + + free(icon_json_data); + free_raw_image(wallpaper_resized); fclose(json_file); diff --git a/sources/core/apps/lock/source/core/core.c b/sources/core/apps/lock/source/core/core.c index a472143de..1fed467ab 100644 --- a/sources/core/apps/lock/source/core/core.c +++ b/sources/core/apps/lock/source/core/core.c @@ -30,6 +30,11 @@ kfont_t font; +bool redraw_image = true; + +kfont_pos_t pin_x = 0; +kfont_pos_t pin_y = 0; + int fb_fd = -1; kframebuffer_t fb; struct fb_fix_screeninfo fix_screeninfo; @@ -111,9 +116,7 @@ int wait_for_pin(char* display_pin, char* pin, char* pin_expected, bool is_pin_s if(get_key(&pressed, &key)){ if(pressed && key == 1){ return 2; - } - - if(pressed && key >= 1 && key <= 11){ + }else if(pressed && key >= 1 && key <= 11){ int number = key - 1; if(number == 10){ number = 0; @@ -143,6 +146,23 @@ int wait_for_pin(char* display_pin, char* pin, char* pin_expected, bool is_pin_s return 4; } } + }else if(pressed && key == 14){ + int number = key - 1; + if(number == 10){ + number = 0; + } + char* str_pin = pin; + int c = 0; + while(*str_pin){ + str_pin++; + c++; + } + str_pin--; + c--; + + str_pin[0] = (char)('\0'); + display_pin[c * 2] = '_'; + redraw_image = true; } } @@ -300,6 +320,7 @@ int main(int argc, char* argv[]){ fclose(font_file); char* display_pin = "_ _ _ _"; + char* textbox_display_pin = strdup(display_pin); char pin[5]; char ask_pin[48]; strcpy(ask_pin, "Please enter your PIN :"); @@ -336,17 +357,6 @@ int main(int argc, char* argv[]){ char time_str[6]; char date_str[20]; - draw_image(&fb, wallpaper_resized, 0, 0, fb.width, fb.height); - - get_current_time(time_str); - get_current_date(date_str); - - load_pen(font, &fb, 0, 0, HOUR_SIZE, 0, TEXT_COLOR); - write_paragraph(font, -1, -1, fb.width, PARAGRAPH_CENTER, time_str); - - set_pen_size(font, DATE_SIZE); - write_paragraph(font, -1, -1, fb.width, PARAGRAPH_CENTER, date_str); - int r = wait_for_pin(display_pin, pin, pin_expected, is_pin_set); if(r == 1){ if(check_pin(pin, pin_expected)){ @@ -357,9 +367,10 @@ int main(int argc, char* argv[]){ return EXIT_SUCCESS; } pin[0] = '\0'; - strcpy(display_pin, "_ _ _ _"); + strcpy(display_pin, textbox_display_pin); strcpy(ask_pin, "Wrong PIN, please enter your PIN :"); pin_color = WRONG_COLOR; + redraw_image = true; }else if(r == 2){ break; }else if(r == 3){ @@ -372,16 +383,27 @@ int main(int argc, char* argv[]){ return EXIT_SUCCESS; } - set_pen_size(font, PIN_INFO_SIZE); - set_pen_color(font, pin_color); - write_paragraph(font, -1, (fb.height - PIN_SIZE) / 2, fb.width, PARAGRAPH_CENTER, ask_pin); + if(redraw_image){ + redraw_image = false; - set_pen_color(font, TEXT_COLOR); - set_pen_size(font, PIN_SIZE); - write_paragraph(font, -1, -1, fb.width, PARAGRAPH_CENTER, display_pin); + draw_image(&fb, wallpaper_resized, 0, 0, fb.width, fb.height); - set_pen_size(font, INFO_SIZE); - write_paragraph(font, -1, fb.height - INFO_SIZE - 50, fb.width, PARAGRAPH_CENTER, "Back : \n"); + set_pen_size(font, PIN_INFO_SIZE); + set_pen_color(font, pin_color); + write_paragraph(font, -1, (fb.height - PIN_SIZE) / 2, fb.width, PARAGRAPH_CENTER, ask_pin); + + set_pen_color(font, TEXT_COLOR); + set_pen_size(font, PIN_SIZE); + pin_x = get_pen_pos_x(font); + pin_y = get_pen_pos_y(font); + write_paragraph(font, pin_x, pin_y, fb.width, PARAGRAPH_CENTER, textbox_display_pin); + + set_pen_size(font, INFO_SIZE); + write_paragraph(font, -1, fb.height - INFO_SIZE - 50, fb.width, PARAGRAPH_CENTER, "Back : \n"); + } + + set_pen_size(font, PIN_SIZE); + write_paragraph(font, pin_x, pin_y, fb.width, PARAGRAPH_CENTER, display_pin); draw_frame(); }