lib.rs

crates/veilvoice-gui/src/lib.rs

veilvoice-gui · 136 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

136 lines defining 3 functions (2 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.
  • jetbrains_mono_path line 76 · Where JetBrains Mono is on this machine, if it is anywhere.

WHAT CALLS WHAT

tabs line 68 jetbrains_mono_path line 76 headless_frame line 128 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_jetbrains_mono_path(["jetbrains_mono_path<br/>line 76"])
    n_headless_frame["headless_frame<br/>line 128"]
    click n_tabs href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L68" "open the source"
    click n_jetbrains_mono_path href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L76" "open the source"
    click n_headless_frame href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/lib.rs#L128" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_tabs,n_jetbrains_mono_path entry
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_headless_frame 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.
jetbrains_mono_path pub fn76Where JetBrains Mono is on this machine, if it is anywhere.
VERSION pub const115Crate version string, surfaced in the About panel.
headless_frame pub(crate) fn128Draw one frame with no window, and discard what a real backend would have uploaded.