iPXE
|
Option configuration console. More...
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <curses.h>
#include <ipxe/console.h>
#include <ipxe/settings.h>
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/ansicol.h>
#include <ipxe/jumpscroll.h>
#include <ipxe/settings_ui.h>
#include <config/branding.h>
Go to the source code of this file.
Data Structures | |
struct | settings_ui_row |
A settings user interface row. More... | |
struct | settings_ui |
A settings user interface. More... | |
Macros | |
#define | TITLE_ROW 1U |
#define | SETTINGS_LIST_ROW 3U |
#define | SETTINGS_LIST_COL 1U |
#define | SETTINGS_LIST_ROWS ( LINES - 6U - SETTINGS_LIST_ROW ) |
#define | INFO_ROW ( LINES - 5U ) |
#define | ALERT_ROW ( LINES - 2U ) |
#define | INSTRUCTION_ROW ( LINES - 2U ) |
#define | INSTRUCTION_PAD " " |
#define | SETTING_ROW_TEXT(cols) |
Layout of text within a setting row. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static unsigned int | select_setting_row (struct settings_ui *ui, unsigned int index) |
Select a setting. More... | |
static size_t | string_copy (char *dest, const char *src, size_t len) |
Copy string without NUL termination. More... | |
static void | draw_setting_row (struct settings_ui *ui) |
Draw setting row. More... | |
static int | edit_setting (struct settings_ui *ui, int key) |
Edit setting ui. More... | |
static int | save_setting (struct settings_ui *ui) |
Save setting ui value back to configuration settings. More... | |
static void | vmsg (unsigned int row, const char *fmt, va_list args) |
Print message centred on specified row. More... | |
static void | msg (unsigned int row, const char *fmt,...) |
Print message centred on specified row. More... | |
static void | clearmsg (unsigned int row) |
Clear message on specified row. More... | |
static void | valert (const char *fmt, va_list args) |
Print alert message. More... | |
static void | alert (const char *fmt,...) |
Print alert message. More... | |
static void | draw_title_row (struct settings_ui *ui) |
Draw title row. More... | |
static void | draw_info_row (struct settings_ui *ui) |
Draw information row. More... | |
static void | draw_instruction_row (struct settings_ui *ui) |
Draw instruction row. More... | |
static void | draw_setting_rows (struct settings_ui *ui) |
Draw the current block of setting rows. More... | |
static void | select_settings (struct settings_ui *ui, struct settings *settings) |
Select settings block. More... | |
static int | main_loop (struct settings *settings) |
int | settings_ui (struct settings *settings) |
Option configuration console.
Definition in file settings_ui.c.
#define TITLE_ROW 1U |
Definition at line 47 of file settings_ui.c.
#define SETTINGS_LIST_ROW 3U |
Definition at line 48 of file settings_ui.c.
#define SETTINGS_LIST_COL 1U |
Definition at line 49 of file settings_ui.c.
#define SETTINGS_LIST_ROWS ( LINES - 6U - SETTINGS_LIST_ROW ) |
Definition at line 50 of file settings_ui.c.
#define INFO_ROW ( LINES - 5U ) |
Definition at line 51 of file settings_ui.c.
#define ALERT_ROW ( LINES - 2U ) |
Definition at line 52 of file settings_ui.c.
#define INSTRUCTION_ROW ( LINES - 2U ) |
Definition at line 53 of file settings_ui.c.
#define INSTRUCTION_PAD " " |
Definition at line 54 of file settings_ui.c.
#define SETTING_ROW_TEXT | ( | cols | ) |
Layout of text within a setting row.
Definition at line 57 of file settings_ui.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Select a setting.
ui | Settings user interface |
index | Index of setting row |
count | Number of setting rows |
Definition at line 116 of file settings_ui.c.
References settings::children, COLS, count, settings_ui_row::editbox, fetchf_setting(), jump_scroller::first, for_each_table_entry, index, init_editbox(), list_for_each_entry, memset(), settings::name, NULL, offsetof, settings_ui_row::origin, settings::parent, settings_ui_row::row, settings_ui::row, settings_ui::scroll, settings_ui_row::setting, setting_applies(), setting_cmp(), SETTING_ROW_TEXT, SETTINGS, settings_ui_row::settings, settings_ui::settings, SETTINGS_LIST_COL, SETTINGS_LIST_ROW, snprintf(), typeof(), u, and settings_ui_row::value.
Referenced by draw_setting_rows(), main_loop(), and select_settings().
Copy string without NUL termination.
dest | Destination |
src | Source |
len | Maximum length of destination |
len | Length of (unterminated) string |
Definition at line 182 of file settings_ui.c.
References dest, len, memcpy(), src, and strlen().
Referenced by draw_setting_row().
|
static |
Draw setting row.
ui | Settings UI |
Definition at line 197 of file settings_ui.c.
References A_BOLD, attroff(), attron(), COLS, memset(), move(), mvprintw, setting::name, NULL, offsetof, settings_ui_row::origin, settings_ui_row::row, settings_ui::row, settings_ui_row::setting, SETTING_ROW_TEXT, settings_ui_row::settings, settings_ui::settings, SETTINGS_LIST_COL, string_copy(), typeof(), u, value, and settings_ui_row::value.
Referenced by draw_setting_rows(), and main_loop().
|
static |
Edit setting ui.
ui | Settings UI |
key | Key pressed by user |
key | Key returned to application, or zero |
Definition at line 247 of file settings_ui.c.
References assert(), edit_editbox(), settings_ui_row::editbox, settings_ui_row::editing, key, setting::name, NULL, settings_ui::row, and settings_ui_row::setting.
Referenced by main_loop().
|
static |
Save setting ui value back to configuration settings.
ui | Settings UI |
Definition at line 258 of file settings_ui.c.
References assert(), setting::name, NULL, settings_ui::row, settings_ui_row::setting, settings_ui::settings, storef_setting(), and settings_ui_row::value.
Referenced by main_loop().
|
static |
Print message centred on specified row.
Definition at line 270 of file settings_ui.c.
References COLS, fmt, len, mvprintw, and vsnprintf().
|
static |
Print message centred on specified row.
Definition at line 285 of file settings_ui.c.
References fmt, va_end, va_start, and vmsg().
Referenced by ccmp_kie_decrypt(), ccmp_kie_mic(), draw_info_row(), draw_instruction_row(), draw_title_row(), hv_post_message(), hv_wait_for_message(), igbvf_read_mbx_vf(), igbvf_read_posted_mbx(), igbvf_write_mbx_vf(), igbvf_write_posted_mbx(), intelvf_mbox_msg(), intelvf_mbox_poll(), intelvf_mbox_read(), intelvf_mbox_reset(), intelvf_mbox_set_mac(), intelvf_mbox_set_mtu(), intelvf_mbox_write(), intelxvf_mbox_queues(), intelxvf_mbox_version(), ipair_key(), ipair_rx(), ipair_rx_pair(), ipair_rx_pubkey(), ipair_rx_session(), ipair_tag(), ipair_tx(), netvsc_establish_buffer(), netvsc_initialise(), netvsc_ndis_version(), netvsc_recv_data(), netvsc_revoke_buffer(), netvsc_transmit(), ntlm_data_okx(), peerblk_parse_block(), peerblk_parse_header(), peerblk_parse_iv(), peerblk_parse_useless(), peerblk_retrieval_open(), reg_delay(), rndis_rx_data(), rndis_rx_status(), rndis_tx_data(), rndis_tx_defer(), rndis_tx_halt(), rndis_tx_initialise(), rndis_tx_oid(), sis190_phy_task(), tkip_kie_decrypt(), tkip_kie_mic(), usbio_config(), usbio_control_poll(), xcm_deliver(), xenstore_request(), xenstore_response(), xsmp_chassis_name(), xsmp_rx_session(), xsmp_rx_session_confirm(), xsmp_rx_session_reject(), xsmp_rx_session_shutdown(), xsmp_rx_xve(), xsmp_rx_xve_delete(), xsmp_rx_xve_install(), xsmp_rx_xve_modify(), xsmp_rx_xve_oper_req(), xsmp_rx_xve_ready(), xsmp_rx_xve_update(), xsmp_session_name(), xsmp_tx_session(), xsmp_tx_xve(), xsmp_tx_xve_nack(), xsmp_tx_xve_notify(), and xsmp_tx_xve_params().
|
static |
Clear message on specified row.
row | Row |
Definition at line 298 of file settings_ui.c.
References clrtoeol(), and move().
Referenced by draw_info_row(), draw_instruction_row(), draw_setting_rows(), draw_title_row(), and valert().
|
static |
Print alert message.
Definition at line 309 of file settings_ui.c.
References ALERT_ROW, clearmsg(), color_set, CPAIR_ALERT, CPAIR_NORMAL, fmt, NULL, sleep(), and vmsg().
Referenced by alert().
|
static |
Print alert message.
Definition at line 324 of file settings_ui.c.
References fmt, va_end, va_start, and valert().
Referenced by main_loop(), and tls_new_alert().
|
static |
Draw title row.
ui | Settings UI |
Definition at line 337 of file settings_ui.c.
References A_BOLD, attroff(), attron(), clearmsg(), msg(), name, PRODUCT_SHORT_NAME, settings_ui::settings, settings_name(), and TITLE_ROW.
Referenced by select_settings().
|
static |
Draw information row.
ui | Settings UI |
Definition at line 353 of file settings_ui.c.
References A_BOLD, attroff(), attron(), clearmsg(), color_set, CPAIR_NORMAL, CPAIR_URL, setting::description, INFO_ROW, msg(), setting::name, NULL, settings_ui_row::origin, PRODUCT_SETTING_URI, settings_ui::row, settings_ui_row::setting, setting_name(), and settings_ui::settings.
Referenced by main_loop().
|
static |
Draw instruction row.
ui | Settings UI |
Definition at line 381 of file settings_ui.c.
References clearmsg(), settings_ui_row::editing, INSTRUCTION_PAD, INSTRUCTION_ROW, msg(), settings_ui_row::origin, settings_ui::row, and settings_ui::settings.
Referenced by main_loop().
|
static |
Draw the current block of setting rows.
ui | Settings UI |
Definition at line 401 of file settings_ui.c.
References clearmsg(), color_set, jump_scroller::count, CPAIR_NORMAL, CPAIR_SEPARATOR, draw_setting_row(), jump_scroller::first, jump_scroll_is_first(), jump_scroll_is_last(), mvaddstr(), NULL, settings_ui::scroll, select_setting_row(), SETTINGS_LIST_COL, SETTINGS_LIST_ROW, and SETTINGS_LIST_ROWS.
Referenced by main_loop(), and select_settings().
|
static |
Select settings block.
ui | Settings UI |
settings | Settings block |
Definition at line 430 of file settings_ui.c.
References jump_scroller::count, jump_scroller::current, draw_setting_rows(), draw_title_row(), jump_scroller::first, jump_scroller::rows, settings_ui::scroll, select_setting_row(), settings_ui::settings, SETTINGS_LIST_ROWS, and settings_target().
Referenced by main_loop().
|
static |
Definition at line 443 of file settings_ui.c.
References alert(), assert(), color_set, CPAIR_EDIT, CPAIR_NORMAL, CPAIR_SELECT, CR, CTRL_C, CTRL_D, CTRL_X, jump_scroller::current, curs_set(), delete_setting(), draw_editbox(), draw_info_row(), draw_instruction_row(), draw_setting_row(), draw_setting_rows(), edit_setting(), settings_ui_row::editbox, settings_ui_row::editing, getkey(), jump_scroll(), jump_scroll_key(), jump_scroll_move(), key, LF, memset(), move(), setting::name, NULL, rc, settings_ui::row, save_setting(), settings_ui::scroll, select_setting_row(), select_settings(), settings_ui_row::setting, settings_ui_row::settings, settings_ui::settings, and strerror().
Referenced by settings_ui().
int settings_ui | ( | struct settings * | settings | ) |
Definition at line 548 of file settings_ui.c.
References color_set, CPAIR_NORMAL, curs_set(), endwin(), erase(), initscr(), main_loop(), NULL, rc, and start_color.