Namespace

ui

On this page

Namespaces 1

Classes 3

  • ui::CheckLineA line of checklist_body().
  • ui::ChoiceA list of things to do, as a sheet (ui/action_sheet.cpp): each line's label, and what it runs once the sheet has closed; its icon (a Cadran icon, nullptr: none), what is set…
  • ui::PrefsWhat the user chose for Cadran's look.

Functions 70

void pick_language(std::function< void()> after = nullptr)

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:277
void pick_theme(std::function< void()> after = nullptr)

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:278
void pick_palette(std::function< void()> after = nullptr)

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:279
std::string palette_name()

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:280
void pick_text_size(std::function< void()> after = nullptr)

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:281
std::string text_size_name(bool tile = false)

The language and theme pickers, shared by Preferences and the main screen's header: save the choice (ui::prefs, through hooks::get().save_prefs) and apply it at once (a language makes every screen again, live_prefs; a theme or the text size runs after, a refresh). language_name / theme_name: the choice saved, as text; text_size_name, language_name and theme_name their shorter words on a tile (Preferences). The theme picker ends with the palette's row, which opens pick_palette: the boards' colours, Aurore's presets (aurore::Theme:: builtinThemes) or the user's theme files (ui::hooks' themes_dir); palette_name, the one saved (ui::Prefs::theme_file), by its name.

ui.hpp:282
void pick_rail(std::function< void()> after = nullptr)

The main screen's sidebar (ui::Prefs::rail): open, on its icons, or folding by itself; applied at once (cadran::apply_rail). rail_name: the choice saved, as text.

ui.hpp:288
std::string rail_name()

The main screen's sidebar (ui::Prefs::rail): open, on its icons, or folding by itself; applied at once (cadran::apply_rail). rail_name: the choice saved, as text.

ui.hpp:289
void pick_density(std::function< void()> after = nullptr)

How close the screens' pieces stand (ui::Prefs::density): automatic, comfortable, compact or dense; the screens built again at once (live_prefs::density_changed). density_name: the choice saved, as text.

ui.hpp:295
std::string density_name()

How close the screens' pieces stand (ui::Prefs::density): automatic, comfortable, compact or dense; the screens built again at once (live_prefs::density_changed). density_name: the choice saved, as text.

ui.hpp:296
std::string language_name(bool tile = false)

The language and the theme saved, as text (shorter on a tile).

ui.hpp:300
std::string theme_name(bool tile = false)

The language and the theme saved, as text (shorter on a tile).

ui.hpp:301
void close_sheet(std::function< void()> then)

Pops the sheet (a fade), then runs then (if any) on the next frame.

action_sheet.hpp:14
aurore::Box * sheet_outside(float width, bool grow)

Room around the panel, width wide or taking what is left (grow): a touch there closes the sheet.

action_sheet.hpp:18
std::string fmt_minutes(uint32_t minutes)

"0 min", "45 min", "2 h", "2 h 30"

format_text.hpp:14
std::string fmt_duration_ns(uint64_t ns)

rounded to minutes, as fmt_minutes

format_text.hpp:15
std::string fmt_duration(uint64_t seconds)

"0 min", "< 1 min", "45 min", "52 h 30", "278 h" (no 24 h cap)

format_text.hpp:16
std::string day_name(int day)

0 = Sunday, as a title ("Monday")

format_text.hpp:17
std::string day_name_in_text(int day)

inside a sentence (fr: "lundi")

format_text.hpp:18
std::string bool_text(bool ok,bool value,const std::string &yes,const std::string &no)
std::string yes_no(bool value)

"Yes" / "No"

format_text.hpp:20
std::string opens(const std::string &value = "")

The value of a line that opens a screen of its own (or another tab), with a chevron after it: "12 changes ›", or "›" alone. A line that asks first, in a dialog, ends its title with "…" instead; one that acts at once, neither.

format_text.hpp:24
Alive make_alive()
template <typename F>auto guarded(Weak alive, F fn)

fn(args…), or nothing once alive is gone or false. Converts to the std::function a flow takes, whatever its arguments.

guarded.hpp:29
template <typename F>auto guarded(const Alive &alive, F fn)
Prefs & prefs()

The ones in use: the app's (use_prefs), else defaults of their own.

prefs.hpp:46
void use_prefs(Prefs &p)

From now on, prefs() is p, which must outlive every screen.

prefs.hpp:48
bool env_flag(const char *name)

A flag of the environment, through ui::hooks::get().env_flag (its comment says which).

prefs.hpp:52
void use_font_for(const std::string &locale)

On the console: the default font of the labels made from now on, for the strings' language locale: the system's Latin / Japanese font, the Chinese one only as a fallback; for Chinese, the Chinese one. Right after createWindow(), before the first label exists, then again when the language changes while the app runs (live_prefs, which builds the screens again).

ui.hpp:34
void notify(const std::string &text, Toast kind = Toast::Info)

A toast of kind. Deferred to the next frame (toasts fired right after a system applet returns were dropped on fw 22.1.0).

ui.hpp:46
void refuse(const std::string &text)

Something asked that was not done, and why, as a Refused toast (its warning icon): a refusal is said and gone, a failure is a dialog (error).

ui.hpp:49
void error(const std::string &text)

A failure the user asked for something and did not get: a dialog, not a toast (a toast is gone before "error 0x…" is read). Next frame, so it can be called from a dialog button. Logged as "error: " for the smoke test.

ui.hpp:53
void error(const std::string &what, const std::string &why)

what failed because of why (a path, a message from the network…).

ui.hpp:55
void show_failure(const cadran_text::Failure &f)

The dialog the three open, now: the title, the reason, the code small, and Send a report (OK focused) when f.report.

ui.hpp:58
void replace_screen(aurore::Activity *next)

next in place of the current screen. Aurore never pops the first activity (the loading screen, under every start screen): a screen that cannot be popped gets next pushed over it instead.

ui.hpp:62
void confirm(const std::string &body,const std::string &confirm_label,std::function< void()> on_yes,std::function< void()> on_no = nullptr,bool danger = false)

Two-button dialog. Cancel (left) has the focus when it opens; confirm_label (right) runs on_yes, Cancel or B runs on_no. danger: the confirm button is drawn in the "bad" colour (see below).

ui.hpp:66
void confirm_danger(const std::string &body,const std::string &confirm_label,std::function< void()> on_yes)

Same, for actions that delete something: the confirm button is drawn in the "bad" colour so it never looks like an ordinary OK.

ui.hpp:70
void info(const std::string &body)
void qr_dialog(const std::string &body, const std::string &url)

A web page to open on a phone: body, the QR code of url, then url itself, shortened (text::short_url), and OK.

ui.hpp:74
aurore::Box * check_row(const CheckLine &line, float size = 17)

One of them: the mark, then the text (size px).

ui.hpp:94
aurore::Box * checklist_body(const std::string &title,const std::vector< CheckLine > &lines,const std::string &note = "",const std::string &subtitle = "")

Under title (and subtitle), the lines in rounded panels, one per Header line (its name small above it); note with an info icon last.

ui.hpp:97
void notice(const char *icon,Check tone,const std::string &title,const std::string &text)

A dialog that only says something: a badge (icon in tone's colour), title, text, OK.

ui.hpp:101
void hold_confirm(aurore::Box *body,const std::string &hold_label,std::function< void()> on_yes,std::function< void()> on_no = nullptr)

body with Cancel and hold_label: A (or a finger) held on it for 2 s, the button filling meanwhile, runs on_yes; let go sooner, it empties and nothing happens. For what is hard to undo from the console. The dialog says how itself (hold_hint, the A key for a controller): body need not.

ui.hpp:106
aurore::Dialog * dialog(const std::string &text)

A dialog showing text, laid out by cadran::dialog_body (its question as the title, its tables, its notes), the caller adding its buttons; a text taller than the dialog's room scrolls.

ui.hpp:112
aurore::Dialog * dialog(const std::string &text, aurore::View *below)

The same with below under the text, the card's width unless it aligns itself: a QR code, a code to read out, the cards to support the app.

ui.hpp:115
aurore::Dialog * box_dialog(aurore::Box *body)

The same for a body already laid out (a checklist, a sheet): as it is, or in a scrolling frame when taller than the dialog's room.

ui.hpp:118
void on_cancel(aurore::Dialog *dialog,std::function< void()> on_cancel)

B closes dialog and runs on_cancel (Aurore's own B only closes it).

ui.hpp:121
void add_cancel(aurore::Dialog *dialog, std::function< void()> cancel)

A Cancel button and B, both closing dialog and running cancel: a dialog that waits for something (a check, an answer from the network).

ui.hpp:124
void pick(const std::string &title,const std::vector< std::string > &values,int selected,std::function< void(int)> on_pick,bool checked = true,const std::vector< std::string > &details = {},const std::vector< std::string > &icons = {},const std::vector< Swatch > &swatches = {})

A list of values, as a sheet (ui/action_sheet.cpp); on_pick(index) runs after it has closed. The row selected has the focus and is checked as the current value, unless checked is false (a list of things to do, not of values). details, when given, says more about each row, after its label and quieter; icons, what goes before each row's label: a Cadran icon's name ("moon"), or a picture (a resource, "img/…png", drawn as it is); empty: none. swatches, when given, a sample of colours in the icon's place instead, for the rows it has (a palette's, as pick_palette() shows them): its background in a rounded square, its ring inside, its motif (a Cadran icon's name) in its ink, a hairline of the theme's cadran/line around it (CadranSwatch).

ui.hpp:140
void pick_grid(const std::string &title,const std::vector< std::string > &values,const std::vector< std::string > &icons,int selected,std::function< void(int)> on_pick,int columns = 4)

The same as tiles, columns to a row, each its Cadran icon (icons, a name) large above its label: a few values that read better side by side (the tabs of Start on).

ui.hpp:146
void pick_marked(const std::string &title,const std::vector< std::string > &values,const std::vector< bool > &marks,int focus,std::function< void(int)> on_pick,const std::vector< std::string > &details = {})

The same with several rows checked: those marks sets (true). Choosing a row closes the list as pick() does: to toggle one, the caller opens it again with the row's mark changed and the focus on it (focus).

ui.hpp:151
void pick_actions(const std::string &title,const std::vector< Choice > &choices,const std::string &subtitle = "",int image = 0)

The sheet of choices (see Choice) under title.

ui.hpp:195
bool is_sheet(aurore::View *view)

The sheet those open: its view, on top of the activities' stack.

ui.hpp:198
void prompt_text(const std::string &header,const std::string &initial,int max_len,std::function< void(std::string)> on_value)

The system keyboard for a text. The callback only on confirm.

ui.hpp:201
void show_writable(aurore::DetailCell *cell,bool writable,const char *title_key = "cadran/text",const char *detail_key = "cadran/text2")

An action that writes stays visible when the app cannot write (a read-only mode), greyed (title and value), so the user sees what exists. title_key / detail_key: the theme colours when writable. A BooleanCell gets its own colours back from its state.

ui.hpp:208
void set_visible(aurore::View *view, bool visible)

Hides a view when visible is false (Visibility::GONE frees its space). When the hidden view had the focus, the focus moves to the nearest visible focusable sibling (the next one on a tie), so it never lands on the list container or jumps far away.

ui.hpp:215
void set_visible_all(std::initializer_list< std::pair< aurore::View *, bool > > changes)

Applies several visibility changes, showing views before hiding others, so a cell that replaces the focused one (Unlock -> Lock now) is there to take the focus.

ui.hpp:220
void set_text(aurore::Label *label, const std::string &text)

A label's text, or a cell's detail, set only when it changes: Aurore lays the whole screen out again on every setText, and the tabs that refresh themselves every few seconds mostly write the same values back.

ui.hpp:225
void set_detail(aurore::DetailCell *cell, const std::string &text)
void batch_layout(aurore::Box *box, const std::function< void()> &fill)

Runs fill, which adds many views to box (or changes them), with the box out of the screen's layout, then lays the screen out once. Aurore lays the whole screen out again on each addView and setText: a list of n rows built in place cost n layouts of the whole screen, n of them on screen.

ui.hpp:232
void keep_focus(aurore::Activity *activity,aurore::View *fallback = nullptr)

For an activity's onResume(): Aurore then gives the focus back to the view that opened the dialog (or screen) just closed, and gives none when that view was hidden meanwhile; the focus would stay on the closed dialog's button, deleted after its animation, and no button answer any more. In that case only, fallback (else the activity's first focusable view) gets it first.

ui.hpp:240
bool has_focus(aurore::Activity *activity)

Whether activity has the focus: nothing (a dialog, another screen) is open over it. Unlike the top of Aurore's stack, true again as soon as a dialog over it starts closing.

ui.hpp:245
bool on_top(aurore::Activity *activity)

Whether activity is the top of Aurore's stack: no screen or dialog pushed over it, one closing included.

ui.hpp:248
aurore::Activity * main_screen()

The main screen, wherever it is in the stack; nullptr before it opens.

ui.hpp:250
void open_tab(int position, const std::string &row = "")

Shows its tab position (ui::tab) and focuses its content: the view with id row when given and shown, else its first one. Nothing before it opens.

ui.hpp:253
void refresh_shown_tab()

Re-reads the tab on screen, if any (after the read-only or developer mode changed, the language or the text size).

ui.hpp:256
void go_to_tab(aurore::View *from, int position)

Opens another tab of the main screen and focuses its first item. from is any view inside the current tab; the switch happens on the next frame because the current tab is deleted by it.

ui.hpp:261
void open_screen(aurore::View *content, const std::string &title)

content (a tab's view, such as the network clock) on a screen of its own, over the current one, titled title; B closes it.

ui.hpp:264
void quick_settings(std::function< void()> after = nullptr)

− on the main screen: a list of the two, each opening its picker.

ui.hpp:304
bool save_prefs()

Saves ui::prefs() through hooks::get().save_prefs: false when it cannot be saved at all.

ui.hpp:308

Enums 2

enum class Toast

What a toast says: news (plain), something done (a check), or something not done because of how things are (a warning); the icon in the Cadran look.

Value
Info
Done
Refused

ui.hpp:38

enum class Check

A list of checks in a dialog: each line with its mark (a teal check for what is ready, an amber or coral triangle for what is not, a grey dot for what is only said), under title, note small at the end (may be empty).

ValueDescription
Ok
Warn
Bad
Info
Header

not a check: the name of the panel of lines after it

ui.hpp:79

Types 3

using Alive = std::shared_ptr< bool >

The token a screen's late callbacks check: it goes with the screen (or is set to false, for a screen that closes before it is freed).

guarded.hpp:20
using Weak = std::weak_ptr< bool >

What a background task holds of it: the task never keeps the screen's token, it wraps with it the callback it hands to aurore::sync.

guarded.hpp:23
using Swatch = CadranSwatch::Colors

A row's colours in pick()'s swatches (CadranSwatch).

ui.hpp:127

Variables 6

constexpr constexpr const char * LANGUAGES[] = { "system", "en-US", "fr", "fr-CA", "de", "es", "es-419", "it", "nl", "pt", "pt-BR", "ru", "ja", "ko", "zh-Hans", "zh-Hant" }
constexpr constexpr const char * THEMES[] = { "system", "light", "dark" }
constexpr constexpr const char * TEXT_SIZES[] = { "auto", "normal", "large", "largest" }
constexpr constexpr const char * EFFECTS[] = { "auto", "full", "reduced" }
constexpr constexpr const char * RAILS[] = { "auto", "open", "icons" }
constexpr constexpr const char * DENSITIES[] = { "auto", "comfortable", "compact", "dense" }

Read from Aurore's headers by Doxygen at each build · library/include