diff --git a/.vscode/settings.json b/.vscode/settings.json index f208ee319..1349ac589 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -209,7 +209,9 @@ "untar.h": "c", "ft2build.h": "c", "wait.h": "c", - "ctype.h": "c" + "ctype.h": "c", + "format": "c", + "stacktrace": "c" }, "files.exclude": { "bundled": true, diff --git a/bootstrap/sys-apps.yml b/bootstrap/sys-apps.yml index 09eb390ce..a186ab0d2 100644 --- a/bootstrap/sys-apps.yml +++ b/bootstrap/sys-apps.yml @@ -209,6 +209,32 @@ packages: - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@/bin/.' - '@SOURCE_ROOT@/target/boot_disk_kot_mount/.' + - name: store-ui + source: + subdir: 'sources/core/apps' + tools_required: + - host-gcc + pkgs_required: + - mlibc + - curl + - cjson + build: + - args: + - 'make' + - '-C' + - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@' + - 'build' + environ: + CC: "@OPTION:cc@" + CXX: "@OPTION:cxx@" + LD: "@OPTION:ld@" + ASMC: "@OPTION:asmc@" + - args: + - 'cp' + - '-r' + - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@/bin/.' + - '@SOURCE_ROOT@/target/boot_disk_kot_mount/.' + - name: welcome source: subdir: 'sources/core/apps' diff --git a/sources/core/apps/desktop/icons/icons.json b/sources/core/apps/desktop/icons/icons.json index 0eb68d8eb..34ddea74c 100644 --- a/sources/core/apps/desktop/icons/icons.json +++ b/sources/core/apps/desktop/icons/icons.json @@ -23,6 +23,12 @@ "executablePath": "/usr/bin/lock", "appName": "Lock" }, + { + "cwdPath": "/usr/bin/", + "iconPath": "/usr/bin/icons/store-ui.tga", + "executablePath": "/usr/bin/store-ui", + "appName": "Store UI" + }, { "cwdPath": "/usr/bin/", "iconPath": "/usr/bin/icons/weather-ui.tga", diff --git a/sources/core/apps/desktop/icons/store-ui.tga b/sources/core/apps/desktop/icons/store-ui.tga new file mode 100644 index 000000000..e4a1b592c Binary files /dev/null and b/sources/core/apps/desktop/icons/store-ui.tga differ diff --git a/sources/core/apps/desktop/source/core/core.c b/sources/core/apps/desktop/source/core/core.c index 4ead55941..767aaa0a1 100644 --- a/sources/core/apps/desktop/source/core/core.c +++ b/sources/core/apps/desktop/source/core/core.c @@ -44,6 +44,7 @@ kfont_t font; int fb_fd = -1; kframebuffer_t fb; +kframebuffer_t loading_fb; struct fb_fix_screeninfo fix_screeninfo; struct fb_var_screeninfo var_screeninfo; @@ -100,6 +101,10 @@ void draw_frame(){ write(fb_fd, fb.buffer, fb.size); } +void draw_loading_frame(){ + write(fb_fd, loading_fb.buffer, loading_fb.size); +} + int get_key(int* pressed, uint64_t* key){ int64_t buffer; if(read(fb_fd, &buffer, 1) > 0){ @@ -123,8 +128,6 @@ void get_current_date_time(char *time_str) { int load_fb(){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading desktop...\n"); - assert(fb_fd >= 0); @@ -146,6 +149,8 @@ int load_fb(){ fb.height = var_screeninfo.yres_virtual; fb.buffer = malloc(fb.size); memset(fb.buffer, 0, fb.size); + memcpy(&loading_fb, &fb, sizeof(kframebuffer_t)); + loading_fb.buffer = malloc(loading_fb.size); }else{ perror("'/dev/fb0' : format not supported\n"); return EXIT_FAILURE; @@ -397,6 +402,12 @@ int reload_icons(){ return 0; } +void show_loading_screen(raw_image_t* icon_image){ + memset(loading_fb.buffer, 0, fb.size); + draw_image_with_binary_transparency(&loading_fb, icon_image, (loading_fb.width - ICON_IMAGE_WIDTH) / 2, (loading_fb.height - ICON_IMAGE_HEIGHT) / 2, ICON_IMAGE_WIDTH, ICON_IMAGE_HEIGHT); + draw_loading_frame(); +} + void get_input(){ static bool arrow_pressed = false; static bool wait_release = false; @@ -469,6 +480,12 @@ void get_input(){ int c = focus_icon_column + focus_icon_row * icon_column_count; { + if(icons_image[c] != NULL){ + show_loading_screen(icons_image[c]); + }else{ + show_loading_screen(default_icon_image); + } + pid_t p = fork(); if(p < 0){ perror("desktop: fork failed"); diff --git a/sources/core/apps/explorer/source/core/core.c b/sources/core/apps/explorer/source/core/core.c index 277c3a9d4..35b71e059 100644 --- a/sources/core/apps/explorer/source/core/core.c +++ b/sources/core/apps/explorer/source/core/core.c @@ -167,8 +167,6 @@ char* get_file_ext(char* name) { int load_fb(){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading explorer...\n"); - assert(fb_fd >= 0); diff --git a/sources/core/apps/image-reader/source/core/core.c b/sources/core/apps/image-reader/source/core/core.c index 6208c24a6..5ee4e07fd 100644 --- a/sources/core/apps/image-reader/source/core/core.c +++ b/sources/core/apps/image-reader/source/core/core.c @@ -88,8 +88,6 @@ int wait_escape(){ int load_fb(){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading image-reader...\n"); - assert(fb_fd >= 0); diff --git a/sources/core/apps/lock/source/core/core.c b/sources/core/apps/lock/source/core/core.c index 1fed467ab..45e168a73 100644 --- a/sources/core/apps/lock/source/core/core.c +++ b/sources/core/apps/lock/source/core/core.c @@ -82,7 +82,7 @@ void get_current_time(char *time_str) { void get_current_date(char *date_str) { time_t now = time(NULL); struct tm *t = localtime(&now); - strftime(date_str, 20, "%A, %B %d", t); + strftime(date_str, 30, "%A, %B %d", t); } int wait_escape(){ @@ -181,8 +181,6 @@ int check_pin(char* pin, char* pin_expected){ int main(int argc, char* argv[]){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading lock screen...\n"); - assert(fb_fd >= 0); @@ -330,7 +328,7 @@ int main(int argc, char* argv[]){ while(true){ while(true){ char time_str[6]; - char date_str[20]; + char date_str[30]; draw_image(&fb, wallpaper_resized, 0, 0, fb.width, fb.height); diff --git a/sources/core/apps/text-reader/source/core/core.c b/sources/core/apps/text-reader/source/core/core.c index 88eed073b..8e3e95f43 100644 --- a/sources/core/apps/text-reader/source/core/core.c +++ b/sources/core/apps/text-reader/source/core/core.c @@ -213,8 +213,6 @@ char* get_file_ext(char* name) { int load_fb(){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading text-reader...\n"); - assert(fb_fd >= 0); diff --git a/sources/core/apps/weather-ui/source/core/core.c b/sources/core/apps/weather-ui/source/core/core.c index bc079d1a3..adefd88cb 100644 --- a/sources/core/apps/weather-ui/source/core/core.c +++ b/sources/core/apps/weather-ui/source/core/core.c @@ -147,8 +147,6 @@ void convert_name_to_path(char* name){ int load_fb(){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading weather-ui...\n"); - assert(fb_fd >= 0); diff --git a/sources/core/apps/welcome/source/core/core.c b/sources/core/apps/welcome/source/core/core.c index 0c721fe9e..9e9f822b5 100644 --- a/sources/core/apps/welcome/source/core/core.c +++ b/sources/core/apps/welcome/source/core/core.c @@ -133,8 +133,6 @@ int wait_for_the_next_slide(){ int main(int argc, char* argv[]){ fb_fd = open("/dev/fb0", O_RDWR); - printf("Loading welcome app...\n"); - assert(fb_fd >= 0); diff --git a/target/boot-disk.sh b/target/boot-disk.sh index 491ba81df..92c3199bb 100644 --- a/target/boot-disk.sh +++ b/target/boot-disk.sh @@ -14,7 +14,7 @@ function mount_boot_disk { mkdir -p $(dirname ${BOOT_DISK}) if ! [[ -b $BOOT_DISK ]]; then - sudo dd if=/dev/zero bs=5M count=0 seek=128 of=${BOOT_DISK} + sudo dd if=/dev/zero bs=10M count=0 seek=128 of=${BOOT_DISK} fi # Configure GPT partition table