settings.rs

crates/veilvoice-gui/src/settings.rs

veilvoice-gui · 1434 lines · read the source here · or on GitHub

The settings panel: a menu of pages, each a titled group of choices.

Why a menu rather than one long list

There are three kinds of setting here and they answer different questions: what the app looks like, how it moves, and what it does with the files it writes. Stacked in one column they read as an undifferentiated wall of tick boxes, and the one that matters most -- at-rest encryption -- ends up looking exactly as important as the colour scheme. A menu with a page per group keeps each question next to its own explanation.

Every change applies immediately, and is saved immediately

There is no "apply" button and no "unsaved changes" state. Both are ways to lose a choice silently. If saving fails the choice still applies for this session and the panel says, in the panel, that it could not be remembered and why -- rather than failing quietly and letting the setting reappear wrong on the next launch.

What is deliberately not in here

The app lock and the at-rest passphrase have their own tab and stay there. A password field sitting between "animations" and "colour scheme" invites being treated with the same weight, and it is not the same weight.

In plain words

The settings, arranged as a short menu rather than one long list.

There are enough of them now that a single column meant scrolling past things you were not looking for, and finding a setting is most of what anybody does in a settings screen.

Each page is a titled group with a sentence saying what it covers, and every choice applies as you make it and is remembered.

WHAT THIS FILE CONTAINS

1434 lines defining 43 functions (33 public), 2 types and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • enum Page line 46 · Which page of the settings menu is showing.
  • struct Settings line 71 · The settings tab's own state.

What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.

  • Settings::load line 121 · Load preferences from this platform's config directory and apply the chosen theme to ctx.
  • Settings::needs_first_run line 154 · Whether the first-run choice has still to be made.
  • Settings::save_error line 180 · Whether the app should open in group mode, and a way to change it.
  • Settings::show_install_tab line 191 · Whether the install tab should be offered at all.
  • Settings::hide_install_tab line 196 · Whether the install tab is hidden by preference.
  • Settings::acceleration line 214 · Whether the window asks the platform for a hardware-drawn context.
  • Settings::show_frame_rate line 243 · Whether the header carries a live frame-rate readout.
  • Settings::always_group line 248 · Whether the app should open in group mode.
  • Settings::seal_with_app_lock line 277 · Whether every recording is sealed with the app-lock passphrase.
  • Settings::destination line 282 · The remembered encrypted destination, rebuilt from the settings file.
  • Settings::set_destination line 291 · Remember a destination, including the answer to the hidden question.
    reaches persist
  • Settings::set_always_group line 350 · Record whether the app should open in group mode.
    reaches persist
  • Settings::set_seal_with_app_lock line 364 · Remember, or stop remembering, that recordings are sealed with the app-lock passphrase.
    reaches persist
  • Settings::toured_tabs line 579 · The tabs the tour has already covered.
  • Settings::mark_toured line 590 · Record that the tour has covered these tabs, and save.
    reaches persist
  • Settings::first_run_appearance line 604 · The first-run panel: offered once, with animation already on.
    reaches persist
  • Settings::first_run_autolock line 631 · The autolock switch and delay, for the first-run setup to place.
    reaches persist
  • Settings::finish_first_run line 659 · Mark the first run answered.
    reaches persist
  • Settings::tab line 666 · The settings tab.
    reaches appearance_page, interface_page, motion_page, security_page, storage_page, custom_palette_help, persist, section, swatches, failsafe, live_monitor, notify_style
  • Settings::theme_picker line 800 · The colour scheme, as a compact control for the window header.
    reaches persist

WHAT CALLS WHAT

The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one. 22 of 43 functions are drawn; the diagram is bounded at 22 so it stays readable.

The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
    n_motion["Settings::motion<br/>line 149"]
    n_set_hide_install_tab["Settings::set_hide_install_tab<br/>line 201"]
    n_set_acceleration["Settings::set_acceleration<br/>line 219"]
    n_frame_target["Settings::frame_target<br/>line 228"]
    n_set_frame_target["Settings::set_frame_target<br/>line 233"]
    n_autolock["Settings::autolock<br/>line 253"]
    n_set_autolock["Settings::set_autolock<br/>line 264"]
    n_set_destination(["Settings::set_destination<br/>line 291"])
    n_failsafe["Settings::failsafe<br/>line 308"]
    n_set_failsafe["Settings::set_failsafe<br/>line 313"]
    n_notify_style["Settings::notify_style<br/>line 322"]
    n_set_notify_style["Settings::set_notify_style<br/>line 327"]
    n_live_monitor["Settings::live_monitor<br/>line 336"]
    n_set_live_monitor["Settings::set_live_monitor<br/>line 341"]
    n_set_always_group(["Settings::set_always_group<br/>line 350"])
    n_set_seal_with_app_lock(["Settings::<br/>set_seal_with_app_lock<br/>line 364"])
    n_mark_toured(["Settings::mark_toured<br/>line 590"])
    n_first_run_appearance(["Settings::first_run_appearance<br/>line 604"])
    n_first_run_autolock(["Settings::first_run_autolock<br/>line 631"])
    n_finish_first_run(["Settings::finish_first_run<br/>line 659"])
    n_tab(["Settings::tab<br/>line 666"])
    n_theme_picker(["Settings::theme_picker<br/>line 800"])
    n_set_autolock --> n_autolock
    n_set_failsafe --> n_failsafe
    n_set_live_monitor --> n_live_monitor
    n_set_notify_style --> n_notify_style
    click n_motion href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L149" "open the source"
    click n_set_hide_install_tab href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L201" "open the source"
    click n_set_acceleration href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L219" "open the source"
    click n_frame_target href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L228" "open the source"
    click n_set_frame_target href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L233" "open the source"
    click n_autolock href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L253" "open the source"
    click n_set_autolock href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L264" "open the source"
    click n_set_destination href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L291" "open the source"
    click n_failsafe href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L308" "open the source"
    click n_set_failsafe href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L313" "open the source"
    click n_notify_style href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L322" "open the source"
    click n_set_notify_style href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L327" "open the source"
    click n_live_monitor href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L336" "open the source"
    click n_set_live_monitor href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L341" "open the source"
    click n_set_always_group href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L350" "open the source"
    click n_set_seal_with_app_lock href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L364" "open the source"
    click n_mark_toured href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L590" "open the source"
    click n_first_run_appearance href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L604" "open the source"
    click n_first_run_autolock href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L631" "open the source"
    click n_finish_first_run href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L659" "open the source"
    click n_tab href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L666" "open the source"
    click n_theme_picker href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/settings.rs#L800" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_set_destination,n_set_always_group,n_set_seal_with_app_lock,n_mark_toured,n_first_run_appearance,n_first_run_autolock,n_finish_first_run,n_tab,n_theme_picker entry
    classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
    class n_motion,n_set_hide_install_tab,n_set_acceleration,n_frame_target,n_set_frame_target,n_autolock,n_set_autolock,n_failsafe,n_set_failsafe,n_notify_style,n_set_notify_style,n_live_monitor,n_set_live_monitor api

This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.

ITEMS

ItemLineDocumentation
Page pub enum46Which page of the settings menu is showing.
Page::ALL pub const61Every page, in menu order, with its label and one-line summary.
Settings pub struct71The settings tab's own state.
Settings::default fn100
Settings::load pub fn121Load preferences from this platform's config directory and apply the chosen theme to ctx.
Settings::motion pub fn149How much movement is allowed this frame.
Settings::needs_first_run pub fn154Whether the first-run choice has still to be made.
Settings::persist fn159Write the settings out, encrypted and obfuscated as they are at rest.
Settings::save_error pub fn180Whether the app should open in group mode, and a way to change it.
Settings::show_install_tab pub fn191Whether the install tab should be offered at all.
Settings::hide_install_tab pub fn196Whether the install tab is hidden by preference.
Settings::set_hide_install_tab pub fn201Record whether to hide the install tab on a portable copy.
Settings::acceleration pub fn214Whether the window asks the platform for a hardware-drawn context.
Settings::set_acceleration pub fn219Record whether to ask for acceleration.
Settings::frame_target pub fn228How often the window draws while something in it is moving.
Settings::set_frame_target pub fn233Record a new frame-rate target.
Settings::show_frame_rate pub fn243Whether the header carries a live frame-rate readout.
Settings::always_group pub fn248Whether the app should open in group mode.
Settings::autolock pub fn253How the autolock is configured, brought into range.
Settings::set_autolock pub fn264Remember an autolock setting.
Settings::seal_with_app_lock pub fn277Whether every recording is sealed with the app-lock passphrase.
Settings::destination pub fn282The remembered encrypted destination, rebuilt from the settings file.
Settings::set_destination pub fn291Remember a destination, including the answer to the hidden question.
Settings::failsafe pub fn308The Failsafe posture in force.
Settings::set_failsafe pub fn313Record the Failsafe posture.
Settings::notify_style pub fn322How notifications should be shown.
Settings::set_notify_style pub fn327Record how notifications should be shown.
Settings::live_monitor pub fn336Where the live monitor sits, or whether it is shown.
Settings::set_live_monitor pub fn341Record where the live monitor sits.
Settings::set_always_group pub fn350Record whether the app should open in group mode.
Settings::set_seal_with_app_lock pub fn364Remember, or stop remembering, that recordings are sealed with the app-lock passphrase.
Settings::interface_page fn373Which tabs the window offers.
Settings::toured_tabs pub fn579The tabs the tour has already covered.
Settings::mark_toured pub fn590Record that the tour has covered these tabs, and save.
Settings::first_run_appearance pub fn604The first-run panel: offered once, with animation already on.
Settings::first_run_autolock pub fn631The autolock switch and delay, for the first-run setup to place.
Settings::finish_first_run pub fn659Mark the first run answered.
Settings::tab pub fn666The settings tab.
Settings::custom_palette_help fn721Explain where custom palettes go, and say what was refused and why.
Settings::theme_picker pub fn800The colour scheme, as a compact control for the window header.
Settings::appearance_page fn826The appearance page: palette, and what each one changes.
Settings::motion_page fn865The motion page, including honouring the system's reduced-motion setting.
Settings::security_page fn1002Roadmap item 92.
Settings::storage_page fn1102The storage page: where files go, and the portable or installed choice.
section fn1163A titled group with a one-line explanation under it.
swatches fn1171The active palette, as a row of swatches, so the choice can be seen rather than only read.