lib.rs

crates/veilvoice-gui/src/lib.rs

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

The VeilVoice desktop application: an egui/eframe front-end, monospace throughout: anonymise a file, scramble a microphone live, watch what is listening, manage the app lock, choose how the app looks, and an about panel that states the honest scope.

The binary lives in main.rs; this library exists so the UI logic can be unit tested without opening a window.

That split is worth stating plainly, because it is the reason this crate has tests at all: a binary crate cannot be unit tested, so everything with logic in it -- the app lock's state machine, preference loading, palette resolution, the reduced-motion decision -- lives here where a test can reach it without a display server. main.rs holds only what genuinely needs a window.

The modules

| Module | What it owns | |---|---| | security | The unlock screen, the lock tab, and the at-rest controls | | prefs | Preferences, and recovering from a corrupt preferences file | | policy | Settings somebody has fixed, and the reason beside each one | | settings | The settings tab | | setup | Installing this copy, and the optional companions | | theme | The palette, shared with the command-line front end | | soundbar | The animated level meter | | reduced_motion | Whether to animate at all | | watchfeed | The device monitor, on a thread that is not this one |

Two rules this crate keeps

The user interface never softens a scope note. Where a control has a bound -- the app lock is a verifier and not disk encryption, tamper detection detects rather than prevents -- the interface says so next to the control, and tests fail the build if that text changes. Documentation nobody opens does not protect anybody.

Animation is a preference that is honoured, not a decoration. reduced_motion resolves the platform's own setting alongside the user's explicit choice, and the whole interface reads that answer rather than each widget deciding for itself.

In plain words

This is the window.

Tabs down the top for the things the program does: disguise a file, scramble a microphone as you talk, handle a recording with several people, watch for anything using your microphone, put the app behind a password, check a download, and change how it looks.

Nine colour schemes, and your own if you write one. It does the slow work on another thread, so the window keeps answering while it is busy.

WHAT THIS FILE CONTAINS

1824 lines defining 12 functions (4 public), 0 types and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.

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.

  • tabs line 68 · The name of every tab the window shows, in the order it shows them.
  • settings_pages line 84 · The name of every page of the Settings tab, in the order the menu shows them.
  • tour_stops line 94 · The name of every stop on the walkthrough, the setup stops and the tabs.
  • jetbrains_mono_path line 150 · Where JetBrains Mono is on this machine, if it is anywhere.

WHAT CALLS WHAT

tabs line 68 settings_pages line 84 tour_stops line 94 command line 120 hide_console line 132 hide_console line 142 jetbrains_mono_path line 150 headless_frame line 207 no_motion line 223 sources line 241 shipped line 370 declared_modules line 401 entry: a way in: public, and nothing in this file calls it helper: private to this file dashed: a call that goes back up, or across a wrapped rank 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.

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.

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_tabs(["tabs<br/>line 68"])
    n_settings_pages(["settings_pages<br/>line 84"])
    n_tour_stops(["tour_stops<br/>line 94"])
    n_command["command<br/>line 120"]
    n_hide_console["hide_console<br/>line 132"]
    n_hide_console["hide_console<br/>line 142"]
    n_jetbrains_mono_path(["jetbrains_mono_path<br/>line 150"])
    n_headless_frame["headless_frame<br/>line 207"]
    n_no_motion["no_motion<br/>line 223"]
    n_sources["sources<br/>line 241"]
    n_shipped["shipped<br/>line 370"]
    n_declared_modules["declared_modules<br/>line 401"]
    n_command --> n_hide_console
    click n_tabs href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L68" "open the source"
    click n_settings_pages href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L84" "open the source"
    click n_tour_stops href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L94" "open the source"
    click n_command href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L120" "open the source"
    click n_hide_console href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L132" "open the source"
    click n_hide_console href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L142" "open the source"
    click n_jetbrains_mono_path href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L150" "open the source"
    click n_headless_frame href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L207" "open the source"
    click n_no_motion href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L223" "open the source"
    click n_sources href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L241" "open the source"
    click n_shipped href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L370" "open the source"
    click n_declared_modules href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L401" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_tabs,n_settings_pages,n_tour_stops,n_jetbrains_mono_path entry
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_command,n_hide_console,n_hide_console,n_headless_frame,n_no_motion,n_sources,n_shipped,n_declared_modules helper
    subgraph chart_key ["Key"]
        direction LR
        key_entry["entry: a way in: public, and nothing in this file calls it"]
        key_helper["helper: private to this file"]
    end
    class key_entry entry
    class key_helper helper

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
tabs pub fn68The name of every tab the window shows, in the order it shows them.
settings_pages pub fn84The name of every page of the Settings tab, in the order the menu shows them.
tour_stops pub fn94The name of every stop on the walkthrough, the setup stops and the tabs.
command pub(crate) fn120Spawn a subprocess without a console window.
hide_console fn132The Windows half of command.
hide_console fn142The everywhere-else half of command: no console is created by spawning a process in the first place, so there is nothing to suppress.
jetbrains_mono_path pub fn150Where JetBrains Mono is on this machine, if it is anywhere.
VERSION pub const194Crate version string, surfaced in the About panel.
headless_frame pub(crate) fn207Draw one frame with no window, and discard what a real backend would have uploaded.
no_motion pub(crate) fn223Motion resolved to "nothing moves", for tests that drive a panel.
sources pub(crate) fn241Every module's source, for the guards that read the crate rather than run it.
shipped pub(crate) fn370The half of a module that ships, for a guard that reads source.
declared_modules pub(crate) fn401The modules lib.rs declares, as filenames.
spawn_tests mod416
draw_path_tests mod495
row_tests mod1352