diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2013-12-13 15:20:22 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-31 08:46:34 +0800 |
commit | c6dad307d1c305015066e179d392fae695b8cf08 (patch) | |
tree | 917fb665960d3c4c1813926a4692abcc0a931b2a /ui | |
parent | a68cae0b9d1b165eef07011011a163b906e0587c (diff) | |
download | petitboot-c6dad307d1c305015066e179d392fae695b8cf08.zip petitboot-c6dad307d1c305015066e179d392fae695b8cf08.tar.gz |
ui/ncurses: Add help to system configuration screen
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ncurses/Makefile.am | 1 | ||||
-rw-r--r-- | ui/ncurses/nc-config-help.c | 25 | ||||
-rw-r--r-- | ui/ncurses/nc-config.c | 29 |
3 files changed, 51 insertions, 4 deletions
diff --git a/ui/ncurses/Makefile.am b/ui/ncurses/Makefile.am index 3251489..2834f12 100644 --- a/ui/ncurses/Makefile.am +++ b/ui/ncurses/Makefile.am @@ -31,6 +31,7 @@ noinst_LTLIBRARIES = libpbnc.la libpbnc_la_SOURCES = \ nc-config.c \ nc-config.h \ + nc-config-help.c \ nc-cui.c \ nc-cui.h \ nc-boot-editor.c \ diff --git a/ui/ncurses/nc-config-help.c b/ui/ncurses/nc-config-help.c new file mode 100644 index 0000000..90565b2 --- /dev/null +++ b/ui/ncurses/nc-config-help.c @@ -0,0 +1,25 @@ +const char *config_help_text = "\ +Autoboot: If you select this option, Petitboot will automatically choose the \ +default option shown in the main menu. Use this option if you want to quickly \ +boot your system without changing any boot option settings.\n" +"\n" +"Timeout: Specify the length of time, in seconds, that the main menu will be \ +displayed before the first option on the main menu is started by default. \ +Timeout is applied only if the Autoboot option is selected.\n" +"\n" +"Network options:\n" +"\n" +"DHCP on all active interfaces: Automatically assigns IP addresses to each \ +network interface. Use this option if you have a DHCP server on your \ +network.\n" +"\n" +"DHCP on a specific interface: Automatically assigns IP addresses to the \ +selected network interface. The other interfaces are not configured. Select \ +this option if you have multiple DHCP servers on different interfaces, but \ +only want to configure a single interface during boot.\n" +"\n" +"Static IP configuration: Allows you to specify an IPv4 address and network \ +mask, gateway, and a DNS server or servers for a network interface. Select \ +this option if you do not have a DHCP server, or want explicit control of \ +network settings." +; diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index 9cc6a29..8d68e74 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -32,7 +32,9 @@ #include "nc-config.h" #include "nc-widgets.h" -#define N_FIELDS 23 +#define N_FIELDS 24 + +extern const char *config_help_text; enum net_conf_type { NET_CONF_TYPE_DHCP_ALL, @@ -47,6 +49,7 @@ struct config_screen { WINDOW *pad; bool exit; + bool show_help; void (*on_exit)(struct cui *); int scroll_y; @@ -83,6 +86,7 @@ struct config_screen { struct nc_widget_label *dns_help_l; struct nc_widget_button *ok_b; + struct nc_widget_button *help_b; struct nc_widget_button *cancel_b; } widgets; }; @@ -114,10 +118,17 @@ static void config_screen_process_key(struct nc_scr *scr, int key) bool handled; handled = widgetset_process_key(screen->widgetset, key); - if (screen->exit) + if (screen->exit) { screen->on_exit(screen->cui); - else if (handled) + + } else if (screen->show_help || (!handled && key == 'h')) { + screen->show_help = false; + cui_show_help(screen->cui, "System Configuration", + config_help_text); + + } else if (handled) { pad_refresh(screen); + } } static void config_screen_resize(struct nc_scr *scr) @@ -269,6 +280,12 @@ static void ok_click(void *arg) screen->exit = true; } +static void help_click(void *arg) +{ + struct config_screen *screen = arg; + screen->show_help = true; +} + static void cancel_click(void *arg) { struct config_screen *screen = arg; @@ -388,8 +405,10 @@ static void config_screen_layout_widgets(struct config_screen *screen, widget_move(widget_button_base(screen->widgets.ok_b), y, screen->field_x); - widget_move(widget_button_base(screen->widgets.cancel_b), + widget_move(widget_button_base(screen->widgets.help_b), y, screen->field_x + 10); + widget_move(widget_button_base(screen->widgets.cancel_b), + y, screen->field_x + 20); } static void config_screen_network_change(void *arg, int value) @@ -558,6 +577,8 @@ static void config_screen_setup_widgets(struct config_screen *screen, screen->widgets.ok_b = widget_new_button(set, 0, 0, 6, "OK", ok_click, screen); + screen->widgets.help_b = widget_new_button(set, 0, 0, 6, "Help", + help_click, screen); screen->widgets.cancel_b = widget_new_button(set, 0, 0, 6, "Cancel", cancel_click, screen); } |