setup.rs

crates/veilvoice-gui/src/setup.rs

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

1038 lines defining 17 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 129 · Whether this copy is the installed one.
  • Setup::is_busy line 134 · True while a worker is running, so the app can keep repainting.
  • Setup::tab line 191 · Draw the tab.
    reaches companion_rows, install_controls, poll, where_this_copy_lives, detect_all, start, can_install, carry_question, install_changes, progress, field, visibility_note

WHAT CALLS WHAT

Setup::default line 103 Setup::new line 110 Setup::running_installed line 129 Setup::is_busy line 134 Setup::poll line 142 Setup::tab line 191 Setup::visibility_note line 219 Setup::where_this_copy_lives line 238 Setup::install_controls line 307 Setup::carry_question line 441 Setup::start line 487 Setup::progress line 511 Setup::companion_rows line 557 detect_all line 732 can_install line 756 install_changes line 766 field line 779 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 103"]
    n_new["Setup::new<br/>line 110"]
    n_running_installed(["Setup::running_installed<br/>line 129"])
    n_is_busy(["Setup::is_busy<br/>line 134"])
    n_poll["Setup::poll<br/>line 142"]
    n_tab(["Setup::tab<br/>line 191"])
    n_visibility_note["Setup::visibility_note<br/>line 219"]
    n_where_this_copy_lives["Setup::where_this_copy_lives<br/>line 238"]
    n_install_controls["Setup::install_controls<br/>line 307"]
    n_carry_question["Setup::carry_question<br/>line 441"]
    n_start["Setup::start<br/>line 487"]
    n_progress["Setup::progress<br/>line 511"]
    n_companion_rows["Setup::companion_rows<br/>line 557"]
    n_detect_all["detect_all<br/>line 732"]
    n_can_install["can_install<br/>line 756"]
    n_install_changes["install_changes<br/>line 766"]
    n_field["field<br/>line 779"]
    n_companion_rows --> n_detect_all
    n_companion_rows --> n_start
    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_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#L103" "open the source"
    click n_new href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L110" "open the source"
    click n_running_installed href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L129" "open the source"
    click n_is_busy href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L134" "open the source"
    click n_poll href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L142" "open the source"
    click n_tab href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L191" "open the source"
    click n_visibility_note href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L219" "open the source"
    click n_where_this_copy_lives href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L238" "open the source"
    click n_install_controls href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L307" "open the source"
    click n_carry_question href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L441" "open the source"
    click n_start href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L487" "open the source"
    click n_progress href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L511" "open the source"
    click n_companion_rows href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L557" "open the source"
    click n_detect_all href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L732" "open the source"
    click n_can_install href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L756" "open the source"
    click n_install_changes href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L766" "open the source"
    click n_field href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/setup.rs#L779" "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_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

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 fn103
Setup::new pub fn110Read the machine's current state.
Setup::running_installed pub fn129Whether this copy is the installed one.
Setup::is_busy pub fn134True while a worker is running, so the app can keep repainting.
Setup::poll pub fn142Drain the worker channel.
Setup::tab pub fn191Draw the tab.
Setup::visibility_note fn219Why this tab is here, and how to make it not be.
Setup::where_this_copy_lives fn238Say whether this copy is portable or installed, and where its files are.
Setup::install_controls fn307The install and uninstall buttons, and what each will do before it is pressed.
Setup::carry_question fn441Ask whether an install should take the settings with it.
Setup::start fn487Start a worker, and remember what it is doing so the strip can say.
Setup::progress fn511The progress strip: a travelling highlight, or a plain bar when motion is off.
Setup::companion_rows fn557One row per companion: whether it is here, and how to get it if not.
detect_all fn732Probe for every companion that applies to this platform.
can_install fn756Exactly what an install changes, in the order it changes it.
install_changes fn766Everything installing alters, listed so the button is never a surprise.
field fn779One labelled read-only value, in the shape this tab uses throughout.
companion_tests mod938
typeface_tests mod996