setup.rs

crates/veilvoice-gui/src/setup.rs

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

The setup tab: install this copy, undo that, and the optional companions.

This is the graphical front end to veilvoice_setup, and it is a front end in the strict sense: it holds no installation logic of its own. Every change to the machine goes through the same functions veilvoice install calls, so the careful part (editing PATH, which is the one operation here that can damage a machine) has one implementation and one set of tests.

Portable is the default, and this tab says so first

The screen opens by telling the user what they already have: a portable copy that needs nothing, or an installed one. Installing is offered as a convenience with an exact list of what it will change, not as a step somebody has to complete before the program is usable. A privacy tool that implies it must be installed has trained its user badly.

Nothing is ticked, because there is nothing to tick

The companions are not a checklist with defaults. Each is a row that states what the software is, who wrote it and under what licence, whether it was found on this machine, and a single button that does one thing to one named program. There is no "install recommended extras", because that is the control through which unwanted software historically arrived.

Where the answer is a proprietary driver the button opens the vendor's page and nothing else; where it needs root the command is shown and not run. Both of those refusals live in veilvoice_setup::companions, not here, so that a second front end cannot be more permissive than this one.

Nothing slow runs on the UI thread

Copying binaries, editing the registry and running a package manager all take real time, because a package manager can take minutes. Each runs on a worker and reports back through an std::sync::mpsc channel, exactly as the file job in crate::VeilVoiceApp does, so the window keeps painting and the progress strip keeps moving.

The strip honours the reduced-motion decision like everything else: with motion off it is a static bar and a word, not a frozen animation.

In plain words

The tab that installs this copy, removes it again, and points at the optional extra software.

It is only a front end: every decision about where files go and what gets changed lives in one place shared with the command line, so the two cannot disagree about what "installed" means.

Nothing here installs anything belonging to somebody else without being asked. What each thing is, who makes it and what it is for are shown first, and the exact command is shown before the question.

WHAT THIS FILE CONTAINS

1144 lines defining 18 functions (5 public), 3 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • struct Done line 62 · What a worker finished doing: lines to show, and whether it went well.
  • struct Row line 68 · One companion as this tab needs it: the facts, plus what was found.
  • struct Setup line 75 · The setup tab's 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.

  • Setup::running_installed line 138 · Whether this copy is the installed one.
  • Setup::is_busy line 143 · True while a worker is running, so the app can keep repainting.
  • Setup::tab line 226 · Draw the tab.
    reaches companion_rows, install_controls, poll, where_this_copy_lives, start, start_probe, can_install, carry_question, install_changes, progress, field, visibility_note

WHAT CALLS WHAT

Setup::default line 112 Setup::new line 119 Setup::running_installed line 138 Setup::is_busy line 143 Setup::start_probe line 156 Setup::poll line 173 Setup::tab line 226 Setup::visibility_note line 254 Setup::where_this_copy_lives line 273 Setup::install_controls line 342 Setup::carry_question line 477 Setup::start line 523 Setup::progress line 553 Setup::companion_rows line 569 detect_all line 745 can_install line 769 install_changes line 779 field line 792 entry: a way in: public, and nothing in this file calls it api: public, and also used inside this file 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_default["Setup::default<br/>line 112"]
    n_new["Setup::new<br/>line 119"]
    n_running_installed(["Setup::running_installed<br/>line 138"])
    n_is_busy(["Setup::is_busy<br/>line 143"])
    n_start_probe["Setup::start_probe<br/>line 156"]
    n_poll["Setup::poll<br/>line 173"]
    n_tab(["Setup::tab<br/>line 226"])
    n_visibility_note["Setup::visibility_note<br/>line 254"]
    n_where_this_copy_lives["Setup::where_this_copy_lives<br/>line 273"]
    n_install_controls["Setup::install_controls<br/>line 342"]
    n_carry_question["Setup::carry_question<br/>line 477"]
    n_start["Setup::start<br/>line 523"]
    n_progress["Setup::progress<br/>line 553"]
    n_companion_rows["Setup::companion_rows<br/>line 569"]
    n_detect_all["detect_all<br/>line 745"]
    n_can_install["can_install<br/>line 769"]
    n_install_changes["install_changes<br/>line 779"]
    n_field["field<br/>line 792"]
    n_companion_rows --> n_start
    n_companion_rows --> n_start_probe
    n_default --> n_new
    n_install_controls --> n_can_install
    n_install_controls --> n_carry_question
    n_install_controls --> n_install_changes
    n_install_controls --> n_progress
    n_install_controls --> n_start
    n_new --> n_detect_all
    n_poll --> n_start_probe
    n_start_probe --> n_detect_all
    n_tab --> n_companion_rows
    n_tab --> n_install_controls
    n_tab --> n_poll
    n_tab --> n_where_this_copy_lives
    n_where_this_copy_lives --> n_field
    n_where_this_copy_lives --> n_visibility_note
    click n_default href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L112" "open the source"
    click n_new href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L119" "open the source"
    click n_running_installed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L138" "open the source"
    click n_is_busy href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L143" "open the source"
    click n_start_probe href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L156" "open the source"
    click n_poll href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L173" "open the source"
    click n_tab href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L226" "open the source"
    click n_visibility_note href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L254" "open the source"
    click n_where_this_copy_lives href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L273" "open the source"
    click n_install_controls href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L342" "open the source"
    click n_carry_question href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L477" "open the source"
    click n_start href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L523" "open the source"
    click n_progress href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L553" "open the source"
    click n_companion_rows href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L569" "open the source"
    click n_detect_all href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L745" "open the source"
    click n_can_install href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L769" "open the source"
    click n_install_changes href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L779" "open the source"
    click n_field href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L792" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_running_installed,n_is_busy,n_tab entry
    classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
    class n_new,n_poll api
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_default,n_start_probe,n_visibility_note,n_where_this_copy_lives,n_install_controls,n_carry_question,n_start,n_progress,n_companion_rows,n_detect_all,n_can_install,n_install_changes,n_field helper
    subgraph chart_key ["Key"]
        direction LR
        key_entry["entry: a way in: public, and nothing in this file calls it"]
        key_api["api: public, and also used inside this file"]
        key_helper["helper: private to this file"]
    end
    class key_entry entry
    class key_api api
    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
Done struct62What a worker finished doing: lines to show, and whether it went well.
Row struct68One companion as this tab needs it: the facts, plus what was found.
Setup pub struct75The setup tab's state.
Setup::default fn112
Setup::new pub fn119Read the machine's current state.
Setup::running_installed pub fn138Whether this copy is the installed one.
Setup::is_busy pub fn143True while a worker is running, so the app can keep repainting.
Setup::start_probe fn156Read this machine again, on a worker thread.
Setup::poll pub fn173Drain the worker channel.
Setup::tab pub fn226Draw the tab.
Setup::visibility_note fn254Why this tab is here, and how to make it not be.
Setup::where_this_copy_lives fn273Say whether this copy is portable or installed, and where its files are.
Setup::install_controls fn342The install and uninstall buttons, and what each will do before it is pressed.
Setup::carry_question fn477Ask whether an install should take the settings with it.
Setup::start fn523Start a worker, and remember what it is doing so the strip can say.
Setup::progress fn553The progress strip, from crate::progress.
Setup::companion_rows fn569One row per companion: whether it is here, and how to get it if not.
detect_all fn745Probe for every companion that applies to this platform.
can_install fn769Exactly what an install changes, in the order it changes it.
install_changes fn779Everything installing alters, listed so the button is never a surprise.
field fn792One labelled read-only value, in the shape this tab uses throughout.
companion_tests mod969
typeface_tests mod1102