summaryrefslogtreecommitdiff
path: root/src/ui.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-08-08 13:57:45 +0800
committerMole Shang <[email protected]>2023-08-08 14:37:43 +0800
commitbd141e0ac144c1ec2494d5dceeb6ca013f0da58f (patch)
treed8c50614d04b6f311d50533b2fb20e9c7d933cc3 /src/ui.c
parentccb42e42baca4fc1bd1323dbc17e6193a0adb9f6 (diff)
downloadhinata-bd141e0ac144c1ec2494d5dceeb6ca013f0da58f.tar.gz
hinata-bd141e0ac144c1ec2494d5dceeb6ca013f0da58f.tar.bz2
hinata-bd141e0ac144c1ec2494d5dceeb6ca013f0da58f.zip
ui: add about menu
Diffstat (limited to 'src/ui.c')
-rw-r--r--src/ui.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/ui.c b/src/ui.c
index d140207..2c1ab15 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -13,12 +13,13 @@
#include "utils/size_info.h"
static nk_size pct;
+static bool show_app_about;
static char *outPath;
void load_ui(struct ui_struct *ui) {
static char text[USHRT_MAX], box_buffer[UINT16_MAX], status_string[UCHAR_MAX];
float logGroup_height =
- nk_window_get_height(ui->ctx) - 80 - 45 - 50 - 35 - 80;
+ nk_window_get_height(ui->ctx) - 30 - 85 - 45 - 50 - 35 - 80;
ui->logger->extend_box =
(logGroup_height - 15) <
((ui->logger->box_lines + 1) * (ui->logger->font_height + 2));
@@ -36,6 +37,37 @@ void load_ui(struct ui_struct *ui) {
(ui->stat->total) = 0; // To prevent nuklear further updating status_string
}
+ nk_menubar_begin(ui->ctx);
+ nk_layout_row_begin(ui->ctx, NK_STATIC, 30, 1);
+ nk_layout_row_push(ui->ctx, 100);
+ if (nk_menu_begin_label(ui->ctx, "MENU", NK_TEXT_CENTERED,
+ nk_vec2(100, 200))) {
+ nk_layout_row_dynamic(ui->ctx, 30, 1);
+ if (nk_menu_item_label(ui->ctx, "About", NK_TEXT_CENTERED))
+ show_app_about = nk_true;
+ nk_menu_end(ui->ctx);
+ }
+ nk_layout_row_end(ui->ctx);
+ nk_menubar_end(ui->ctx);
+
+ if (show_app_about) {
+ /* about popup */
+ static struct nk_rect s = {100, 100, 600, 300};
+ if (nk_popup_begin(ui->ctx, NK_POPUP_STATIC, "About", NK_WINDOW_CLOSABLE,
+ s)) {
+ nk_layout_row_dynamic(ui->ctx, 30, 1);
+ nk_label(ui->ctx, "A cross-platform multi-thread downloader", NK_TEXT_LEFT);
+ nk_label(ui->ctx, "By Mole Shang", NK_TEXT_LEFT);
+ SPACER;
+ nk_label(ui->ctx, "hinata is licensed under LGPL-3.0.", NK_TEXT_LEFT);
+ nk_label(ui->ctx, "For further information, checkout", NK_TEXT_LEFT);
+ nk_label(ui->ctx, "<https://git.135e2.dev/135e2/hinata.git/>.",
+ NK_TEXT_LEFT);
+ nk_popup_end(ui->ctx);
+ } else
+ show_app_about = nk_false;
+ }
+
nk_layout_row_dynamic(ui->ctx, 80, 1);
nk_label(ui->ctx, "Hinata", NK_TEXT_CENTERED);