|
@@ -19,9 +19,12 @@
|
|
|
|
|
|
|
|
#define MAX_DEVS 8
|
|
#define MAX_DEVS 8
|
|
|
#define MAX_BSS 32
|
|
#define MAX_BSS 32
|
|
|
-#define DEV_ROW_H 32
|
|
|
|
|
-#define WIFI_ROW_H 38
|
|
|
|
|
-#define SAVED_ROW_H 34
|
|
|
|
|
|
|
+#define DEV_ROW_H 42
|
|
|
|
|
+#define WIFI_ROW_H 42
|
|
|
|
|
+#define SAVED_ROW_H 30
|
|
|
|
|
+#define SAVED_LIST_ROW_H 42
|
|
|
|
|
+#define SECTION_H 28
|
|
|
|
|
+#define MENU_GAP 10
|
|
|
#define LOG_MAX 2048
|
|
#define LOG_MAX 2048
|
|
|
|
|
|
|
|
#define ID_REFRESH 1
|
|
#define ID_REFRESH 1
|
|
@@ -755,7 +758,7 @@ static void draw_status_card(struct ngui_rect r)
|
|
|
p = sput(p, "Wired network");
|
|
p = sput(p, "Wired network");
|
|
|
*p = '\0';
|
|
*p = '\0';
|
|
|
ngui_text_px(&ui, r.x + 34, r.y + 10, line, slen(line),
|
|
ngui_text_px(&ui, r.x + 34, r.y + 10, line, slen(line),
|
|
|
- ui.theme.text, 16, 1, 0, 0);
|
|
|
|
|
|
|
+ ui.theme.text, 14, 1, 0, 0);
|
|
|
|
|
|
|
|
p = line;
|
|
p = line;
|
|
|
if (net_present) {
|
|
if (net_present) {
|
|
@@ -788,16 +791,14 @@ static void draw_wifi_list(struct ngui_rect area, int *y)
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
|
|
if (!wifi_present) {
|
|
if (!wifi_present) {
|
|
|
- ngui_text_px(&ui, area.x + 12, *y + 10,
|
|
|
|
|
- "No Wi-Fi card detected", 22,
|
|
|
|
|
- ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
|
|
+ ngui_text(&ui, area.x + 12, *y + 12,
|
|
|
|
|
+ "No Wi-Fi card detected", ui.theme.text_dim);
|
|
|
*y += WIFI_ROW_H;
|
|
*y += WIFI_ROW_H;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (scanning) {
|
|
if (scanning) {
|
|
|
- ngui_text_px(&ui, area.x + 12, *y + 10,
|
|
|
|
|
- "Scanning for networks...", 24,
|
|
|
|
|
- ui.theme.accent, 11, 0, 0, 0);
|
|
|
|
|
|
|
+ ngui_text(&ui, area.x + 12, *y + 12,
|
|
|
|
|
+ "Scanning for networks...", ui.theme.accent);
|
|
|
*y += WIFI_ROW_H;
|
|
*y += WIFI_ROW_H;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -806,8 +807,8 @@ static void draw_wifi_list(struct ngui_rect area, int *y)
|
|
|
"Connected - disconnect to scan for other networks" :
|
|
"Connected - disconnect to scan for other networks" :
|
|
|
"Press Scan to list Wi-Fi networks";
|
|
"Press Scan to list Wi-Fi networks";
|
|
|
|
|
|
|
|
- ngui_text_px(&ui, area.x + 12, *y + 10, msg, slen(msg),
|
|
|
|
|
- ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
|
|
+ ngui_text(&ui, area.x + 12, *y + 12, msg,
|
|
|
|
|
+ ui.theme.text_dim);
|
|
|
*y += WIFI_ROW_H;
|
|
*y += WIFI_ROW_H;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -850,8 +851,8 @@ static void draw_main(void)
|
|
|
|
|
|
|
|
card = ngui_cut_top(&body, 64);
|
|
card = ngui_cut_top(&body, 64);
|
|
|
draw_status_card(card);
|
|
draw_status_card(card);
|
|
|
- body.y += 8;
|
|
|
|
|
- body.h -= 8;
|
|
|
|
|
|
|
+ body.y += MENU_GAP;
|
|
|
|
|
+ body.h -= MENU_GAP;
|
|
|
|
|
|
|
|
shown = 0;
|
|
shown = 0;
|
|
|
for (i = 0; i < ndev; i++)
|
|
for (i = 0; i < ndev; i++)
|
|
@@ -861,16 +862,16 @@ static void draw_main(void)
|
|
|
if (shown > 4)
|
|
if (shown > 4)
|
|
|
shown = 4;
|
|
shown = 4;
|
|
|
|
|
|
|
|
- content_h = 26 + (shown ? shown * DEV_ROW_H : DEV_ROW_H) +
|
|
|
|
|
- (more ? 18 : 0) + 10 + 26;
|
|
|
|
|
|
|
+ content_h = SECTION_H + (shown ? shown * DEV_ROW_H : DEV_ROW_H) +
|
|
|
|
|
+ (more ? 20 : 0) + MENU_GAP + SECTION_H;
|
|
|
if (!wifi_present || scanning || nbss == 0)
|
|
if (!wifi_present || scanning || nbss == 0)
|
|
|
content_h += WIFI_ROW_H;
|
|
content_h += WIFI_ROW_H;
|
|
|
else
|
|
else
|
|
|
content_h += nbss * WIFI_ROW_H;
|
|
content_h += nbss * WIFI_ROW_H;
|
|
|
if (net_present)
|
|
if (net_present)
|
|
|
- content_h += 10 + 26 + 4 * 26;
|
|
|
|
|
|
|
+ content_h += MENU_GAP + SECTION_H + 4 * 30;
|
|
|
if (nsaved)
|
|
if (nsaved)
|
|
|
- content_h += SAVED_ROW_H + 8;
|
|
|
|
|
|
|
+ content_h += SAVED_ROW_H + MENU_GAP;
|
|
|
|
|
|
|
|
main_scroll.content_h = content_h;
|
|
main_scroll.content_h = content_h;
|
|
|
area = body;
|
|
area = body;
|
|
@@ -879,10 +880,10 @@ static void draw_main(void)
|
|
|
ngui_scroll_keys(&ui, &main_scroll);
|
|
ngui_scroll_keys(&ui, &main_scroll);
|
|
|
|
|
|
|
|
y = area.y - main_scroll.offset;
|
|
y = area.y - main_scroll.offset;
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w - 18, 26 };
|
|
|
|
|
|
|
+ r = (struct ngui_rect){ area.x, y, area.w - 18, SECTION_H };
|
|
|
if (ngui_section(&ui, r, "Devices", ID_REFRESH, "Refresh"))
|
|
if (ngui_section(&ui, r, "Devices", ID_REFRESH, "Refresh"))
|
|
|
actions |= ACT_REFRESH;
|
|
actions |= ACT_REFRESH;
|
|
|
- y += 26;
|
|
|
|
|
|
|
+ y += SECTION_H;
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
int n = 0;
|
|
int n = 0;
|
|
@@ -912,8 +913,8 @@ static void draw_main(void)
|
|
|
"No wired or USB device" :
|
|
"No wired or USB device" :
|
|
|
"No device found - plug one in and Refresh";
|
|
"No device found - plug one in and Refresh";
|
|
|
|
|
|
|
|
- ngui_text_px(&ui, area.x + 12, y + 8, msg, slen(msg),
|
|
|
|
|
- ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
|
|
+ ngui_text(&ui, area.x + 12, y + 12, msg,
|
|
|
|
|
+ ui.theme.text_dim);
|
|
|
y += DEV_ROW_H;
|
|
y += DEV_ROW_H;
|
|
|
} else if (more) {
|
|
} else if (more) {
|
|
|
p = line;
|
|
p = line;
|
|
@@ -921,13 +922,13 @@ static void draw_main(void)
|
|
|
p = put_dec(p, (unsigned int)more);
|
|
p = put_dec(p, (unsigned int)more);
|
|
|
p = sput(p, " more devices");
|
|
p = sput(p, " more devices");
|
|
|
*p = '\0';
|
|
*p = '\0';
|
|
|
- ngui_text_px(&ui, area.x + 12, y + 2, line, slen(line),
|
|
|
|
|
- ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
- y += 18;
|
|
|
|
|
|
|
+ ngui_text(&ui, area.x + 12, y + 2, line,
|
|
|
|
|
+ ui.theme.text_dim);
|
|
|
|
|
+ y += 20;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- y += 10;
|
|
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w - 18, 26 };
|
|
|
|
|
|
|
+ y += MENU_GAP;
|
|
|
|
|
+ r = (struct ngui_rect){ area.x, y, area.w - 18, SECTION_H };
|
|
|
if (wifi_present && wst.state >= SYS_WIFI_ST_ASSOC) {
|
|
if (wifi_present && wst.state >= SYS_WIFI_ST_ASSOC) {
|
|
|
if (ngui_section(&ui, r, "Wi-Fi", ID_DISCONNECT,
|
|
if (ngui_section(&ui, r, "Wi-Fi", ID_DISCONNECT,
|
|
|
"Disconnect"))
|
|
"Disconnect"))
|
|
@@ -938,7 +939,7 @@ static void draw_main(void)
|
|
|
} else {
|
|
} else {
|
|
|
ngui_section(&ui, r, "Wi-Fi", 0, 0);
|
|
ngui_section(&ui, r, "Wi-Fi", 0, 0);
|
|
|
}
|
|
}
|
|
|
- y += 26;
|
|
|
|
|
|
|
+ y += SECTION_H;
|
|
|
|
|
|
|
|
draw_wifi_list(area, &y);
|
|
draw_wifi_list(area, &y);
|
|
|
|
|
|
|
@@ -949,10 +950,10 @@ static void draw_main(void)
|
|
|
char value[40];
|
|
char value[40];
|
|
|
int di;
|
|
int di;
|
|
|
|
|
|
|
|
- y += 10;
|
|
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w - 18, 26 };
|
|
|
|
|
|
|
+ y += MENU_GAP;
|
|
|
|
|
+ r = (struct ngui_rect){ area.x, y, area.w - 18, SECTION_H };
|
|
|
ngui_section(&ui, r, "Connection", 0, 0);
|
|
ngui_section(&ui, r, "Connection", 0, 0);
|
|
|
- y += 26;
|
|
|
|
|
|
|
+ y += SECTION_H;
|
|
|
for (di = 0; di < 4; di++) {
|
|
for (di = 0; di < 4; di++) {
|
|
|
char *vp = value;
|
|
char *vp = value;
|
|
|
|
|
|
|
@@ -969,7 +970,7 @@ static void draw_main(void)
|
|
|
vp = put_mac(vp, net.mac);
|
|
vp = put_mac(vp, net.mac);
|
|
|
*vp = '\0';
|
|
*vp = '\0';
|
|
|
|
|
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w - 18, 26 };
|
|
|
|
|
|
|
+ r = (struct ngui_rect){ area.x, y, area.w - 18, 30 };
|
|
|
if (r.y + r.h > area.y && r.y < area.y + area.h) {
|
|
if (r.y + r.h > area.y && r.y < area.y + area.h) {
|
|
|
row.title = labels[di];
|
|
row.title = labels[di];
|
|
|
row.subtitle = 0;
|
|
row.subtitle = 0;
|
|
@@ -978,20 +979,20 @@ static void draw_main(void)
|
|
|
row.selected = 0;
|
|
row.selected = 0;
|
|
|
ngui_list_row(&ui, ID_INFO_BASE + di, r, &row);
|
|
ngui_list_row(&ui, ID_INFO_BASE + di, r, &row);
|
|
|
}
|
|
}
|
|
|
- y += 26;
|
|
|
|
|
|
|
+ y += 30;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (nsaved) {
|
|
if (nsaved) {
|
|
|
char nbuf[12], *np = nbuf;
|
|
char nbuf[12], *np = nbuf;
|
|
|
|
|
|
|
|
- y += 8;
|
|
|
|
|
|
|
+ y += MENU_GAP;
|
|
|
r = (struct ngui_rect){ area.x, y, area.w - 18, SAVED_ROW_H };
|
|
r = (struct ngui_rect){ area.x, y, area.w - 18, SAVED_ROW_H };
|
|
|
if (r.y + r.h > area.y && r.y < area.y + area.h) {
|
|
if (r.y + r.h > area.y && r.y < area.y + area.h) {
|
|
|
np = put_dec(np, (unsigned int)nsaved);
|
|
np = put_dec(np, (unsigned int)nsaved);
|
|
|
*np = '\0';
|
|
*np = '\0';
|
|
|
row.title = "Saved networks";
|
|
row.title = "Saved networks";
|
|
|
- row.subtitle = "Join again without the passphrase";
|
|
|
|
|
|
|
+ row.subtitle = 0;
|
|
|
row.trailing = nbuf;
|
|
row.trailing = nbuf;
|
|
|
row.bars = -1;
|
|
row.bars = -1;
|
|
|
row.selected = 0;
|
|
row.selected = 0;
|
|
@@ -1018,7 +1019,7 @@ static void draw_pass(void)
|
|
|
|
|
|
|
|
r = ngui_cut_top(&body, 22);
|
|
r = ngui_cut_top(&body, 22);
|
|
|
ngui_text_px(&ui, r.x, r.y, "WPA2-PSK passphrase", 19,
|
|
ngui_text_px(&ui, r.x, r.y, "WPA2-PSK passphrase", 19,
|
|
|
- ui.theme.text_dim, 11, 1, 0, 0);
|
|
|
|
|
|
|
+ ui.theme.text_dim, 14, 1, 0, 0);
|
|
|
|
|
|
|
|
r = ngui_cut_top(&body, 34);
|
|
r = ngui_cut_top(&body, 34);
|
|
|
ev = ngui_text_input(&ui, ID_PASS, r, &pass_in);
|
|
ev = ngui_text_input(&ui, ID_PASS, r, &pass_in);
|
|
@@ -1026,17 +1027,17 @@ static void draw_pass(void)
|
|
|
actions |= ACT_CONNECT;
|
|
actions |= ACT_CONNECT;
|
|
|
if (ev & NGUI_INPUT_CANCEL)
|
|
if (ev & NGUI_INPUT_CANCEL)
|
|
|
actions |= ACT_BACK;
|
|
actions |= ACT_BACK;
|
|
|
- body.y += 8;
|
|
|
|
|
- body.h -= 8;
|
|
|
|
|
|
|
+ body.y += MENU_GAP;
|
|
|
|
|
+ body.h -= MENU_GAP;
|
|
|
|
|
|
|
|
- r = ngui_cut_top(&body, 20);
|
|
|
|
|
- ngui_text_px(&ui, r.x, r.y,
|
|
|
|
|
- "8-63 characters, or 64 hex digits for a raw PSK.",
|
|
|
|
|
- 48, ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
- body.y += 12;
|
|
|
|
|
- body.h -= 12;
|
|
|
|
|
|
|
+ r = ngui_cut_top(&body, 22);
|
|
|
|
|
+ ngui_text(&ui, r.x, r.y,
|
|
|
|
|
+ "8-63 characters, or 64 hex digits for a raw PSK.",
|
|
|
|
|
+ ui.theme.text_dim);
|
|
|
|
|
+ body.y += MENU_GAP;
|
|
|
|
|
+ body.h -= MENU_GAP;
|
|
|
|
|
|
|
|
- r = ngui_cut_top(&body, 30);
|
|
|
|
|
|
|
+ r = ngui_cut_top(&body, 28);
|
|
|
b1 = r;
|
|
b1 = r;
|
|
|
b1.w = 110;
|
|
b1.w = 110;
|
|
|
b2 = r;
|
|
b2 = r;
|
|
@@ -1079,7 +1080,7 @@ static void draw_connect(void)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
y = log.y + 10;
|
|
y = log.y + 10;
|
|
|
- for (i = start; i < conn_log_len && y + 14 <= log.y + log.h - 8; i++) {
|
|
|
|
|
|
|
+ for (i = start; i < conn_log_len && y + 17 <= log.y + log.h - 8; i++) {
|
|
|
char c = conn_log[i];
|
|
char c = conn_log[i];
|
|
|
|
|
|
|
|
if (c == '\r')
|
|
if (c == '\r')
|
|
@@ -1089,8 +1090,8 @@ static void draw_connect(void)
|
|
|
if (line_y)
|
|
if (line_y)
|
|
|
ngui_text_px(&ui, log.x + 10, y, line,
|
|
ngui_text_px(&ui, log.x + 10, y, line,
|
|
|
(unsigned int)line_y,
|
|
(unsigned int)line_y,
|
|
|
- ui.theme.text_dim, 11, 0, 0, 1);
|
|
|
|
|
- y += 14;
|
|
|
|
|
|
|
+ ui.theme.text_dim, 14, 0, 0, 1);
|
|
|
|
|
+ y += 17;
|
|
|
line_y = 0;
|
|
line_y = 0;
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
@@ -1100,14 +1101,14 @@ static void draw_connect(void)
|
|
|
if (line_y) {
|
|
if (line_y) {
|
|
|
line[line_y] = '\0';
|
|
line[line_y] = '\0';
|
|
|
ngui_text_px(&ui, log.x + 10, y, line, (unsigned int)line_y,
|
|
ngui_text_px(&ui, log.x + 10, y, line, (unsigned int)line_y,
|
|
|
- ui.theme.text_dim, 11, 0, 0, 1);
|
|
|
|
|
|
|
+ ui.theme.text_dim, 14, 0, 0, 1);
|
|
|
}
|
|
}
|
|
|
ngui_pop_clip(&ui);
|
|
ngui_pop_clip(&ui);
|
|
|
|
|
|
|
|
b.x = body.x;
|
|
b.x = body.x;
|
|
|
b.y = body.y + body.h - 28;
|
|
b.y = body.y + body.h - 28;
|
|
|
b.w = 110;
|
|
b.w = 110;
|
|
|
- b.h = 26;
|
|
|
|
|
|
|
+ b.h = 28;
|
|
|
if (ngui_button(&ui, ID_CONN_CANCEL, b,
|
|
if (ngui_button(&ui, ID_CONN_CANCEL, b,
|
|
|
connect_pid > 0 ? "Cancel" : "Back"))
|
|
connect_pid > 0 ? "Cancel" : "Back"))
|
|
|
actions |= ACT_BACK;
|
|
actions |= ACT_BACK;
|
|
@@ -1123,24 +1124,24 @@ static void draw_saved(void)
|
|
|
|
|
|
|
|
r = ngui_cut_top(&body, 22);
|
|
r = ngui_cut_top(&body, 22);
|
|
|
ngui_text_px(&ui, r.x, r.y, "Saved Wi-Fi networks", 20,
|
|
ngui_text_px(&ui, r.x, r.y, "Saved Wi-Fi networks", 20,
|
|
|
- ui.theme.text, 16, 1, 0, 0);
|
|
|
|
|
|
|
+ ui.theme.text, 14, 1, 0, 0);
|
|
|
|
|
|
|
|
if (!nsaved) {
|
|
if (!nsaved) {
|
|
|
- ngui_text_px(&ui, body.x + 2, body.y + 4,
|
|
|
|
|
- "No saved networks", 17,
|
|
|
|
|
- ui.theme.text_dim, 11, 0, 0, 0);
|
|
|
|
|
|
|
+ ngui_text(&ui, body.x + 2, body.y + 4,
|
|
|
|
|
+ "No saved networks", ui.theme.text_dim);
|
|
|
} else {
|
|
} else {
|
|
|
list = body;
|
|
list = body;
|
|
|
list.h -= 38;
|
|
list.h -= 38;
|
|
|
- saved_scroll.content_h = nsaved * 40;
|
|
|
|
|
|
|
+ saved_scroll.content_h = nsaved * SAVED_LIST_ROW_H;
|
|
|
ngui_scroll_begin(&ui, list, &saved_scroll);
|
|
ngui_scroll_begin(&ui, list, &saved_scroll);
|
|
|
ngui_scroll_wheel(&ui, list, &saved_scroll);
|
|
ngui_scroll_wheel(&ui, list, &saved_scroll);
|
|
|
ngui_scroll_keys(&ui, &saved_scroll);
|
|
ngui_scroll_keys(&ui, &saved_scroll);
|
|
|
for (i = 0; i < nsaved; i++) {
|
|
for (i = 0; i < nsaved; i++) {
|
|
|
row.x = list.x;
|
|
row.x = list.x;
|
|
|
- row.y = list.y - saved_scroll.offset + i * 40;
|
|
|
|
|
|
|
+ row.y = list.y - saved_scroll.offset +
|
|
|
|
|
+ i * SAVED_LIST_ROW_H;
|
|
|
row.w = list.w - 16;
|
|
row.w = list.w - 16;
|
|
|
- row.h = 38;
|
|
|
|
|
|
|
+ row.h = SAVED_LIST_ROW_H;
|
|
|
if (row.y + row.h <= list.y ||
|
|
if (row.y + row.h <= list.y ||
|
|
|
row.y >= list.y + list.h)
|
|
row.y >= list.y + list.h)
|
|
|
continue;
|
|
continue;
|
|
@@ -1149,7 +1150,7 @@ static void draw_saved(void)
|
|
|
bt.x = row.x + row.w - 64;
|
|
bt.x = row.x + row.w - 64;
|
|
|
bt.w = 60;
|
|
bt.w = 60;
|
|
|
bt.h = 28;
|
|
bt.h = 28;
|
|
|
- bt.y = row.y + 5;
|
|
|
|
|
|
|
+ bt.y = row.y + 7;
|
|
|
row.w -= 76;
|
|
row.w -= 76;
|
|
|
|
|
|
|
|
desc.title = ssid;
|
|
desc.title = ssid;
|
|
@@ -1172,7 +1173,7 @@ static void draw_saved(void)
|
|
|
back.x = body.x;
|
|
back.x = body.x;
|
|
|
back.y = body.y + body.h - 28;
|
|
back.y = body.y + body.h - 28;
|
|
|
back.w = 100;
|
|
back.w = 100;
|
|
|
- back.h = 26;
|
|
|
|
|
|
|
+ back.h = 28;
|
|
|
if (ngui_button(&ui, ID_SAVED_BACK, back, "Back"))
|
|
if (ngui_button(&ui, ID_SAVED_BACK, back, "Back"))
|
|
|
actions |= ACT_BACK;
|
|
actions |= ACT_BACK;
|
|
|
}
|
|
}
|