# lukarty/qkd_techpo architecture

> Architecture diagram of the GitHub repository lukarty/qkd_techpo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lukarty/qkd_techpo
- Repository: https://github.com/lukarty/qkd_techpo

## Overview

QKDStand is a Qt desktop application for operating and monitoring a quantum-key-distribution hardware stand. The user workflow runs from the main window through hardware controls or a background protocol worker, which configures the stand, reads signal levels, and applies protocol-specific bit decisions; the UI also exposes monitoring and analysis views. The source index and excerpts support these principal interactions, but not the wiring of every dialog or the lower-level serial/bootloader calls, so those links are omitted.

Main entry points: [`sources/mainwindow.cpp`](https://github.com/lukarty/qkd_techpo/blob/main/sources/mainwindow.cpp) (Main Window), [`streamwork.cpp`](https://github.com/lukarty/qkd_techpo/blob/main/streamwork.cpp) (Protocol Worker), [`sources/conserial.cpp`](https://github.com/lukarty/qkd_techpo/blob/main/sources/conserial.cpp) (Hardware API), [`headers/qcustomplot.h`](https://github.com/lukarty/qkd_techpo/blob/main/headers/qcustomplot.h) (Plotting Widget)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop UI"]
  node_app["Qt Application<br/>[main.cpp]"]
  node_main["Main Window<br/>[mainwindow.cpp]"]
  node_portpicker["COM Port Selector<br/>[com_combobox.cpp]"]
  node_admin["Admin Login<br/>[adminlogin.cpp]"]
  node_help["Help Window<br/>[helpwindow.cpp]"]
end

subgraph group_protocol["QKD Protocols"]
  node_worker["Protocol Worker<br/>[streamwork.cpp]"]
  node_qkd["Protocol Decisions<br/>[streamwork.cpp]"]
end

subgraph group_hardware["Stand Hardware"]
  node_hardwareapi["Hardware API<br/>[conserial.cpp]"]
  node_serial["Serial Transport<br/>[ceSerial.cpp]"]
  node_firmware["Firmware Update<br/>[bootloader.cpp]"]
end

subgraph group_visualization["Analysis Views"]
  node_plot["Plotting Widget<br/>[qcustomplot.h]"]
  node_histogram["Signal Histogram<br/>[histogram.cpp]"]
  node_evalhist["Evaluation Histogram<br/>[histogrameva.cpp]"]
end

node_user(("Operator"))

node_user -->|"operates"| node_main
node_app -->|"creates"| node_main
node_main -->|"sets stand"| node_portpicker
node_portpicker -->|"sets port"| node_hardwareapi
node_main -->|"controls stand"| node_hardwareapi
node_main -->|"starts worker"| node_worker
node_worker -->|"requests readings"| node_hardwareapi
node_worker -->|"applies decisions"| node_qkd
node_main -->|"updates graph"| node_plot
node_histogram -->|"uses plotting"| node_plot
node_evalhist -->|"uses plotting"| node_plot

click node_app "https://github.com/lukarty/qkd_techpo/blob/main/sources/main.cpp"
click node_main "https://github.com/lukarty/qkd_techpo/blob/main/sources/mainwindow.cpp"
click node_portpicker "https://github.com/lukarty/qkd_techpo/blob/main/sources/com_combobox.cpp"
click node_admin "https://github.com/lukarty/qkd_techpo/blob/main/sources/adminlogin.cpp"
click node_help "https://github.com/lukarty/qkd_techpo/blob/main/sources/helpwindow.cpp"
click node_worker "https://github.com/lukarty/qkd_techpo/blob/main/streamwork.cpp"
click node_qkd "https://github.com/lukarty/qkd_techpo/blob/main/streamwork.cpp"
click node_hardwareapi "https://github.com/lukarty/qkd_techpo/blob/main/sources/conserial.cpp"
click node_serial "https://github.com/lukarty/qkd_techpo/blob/main/sources/ceSerial.cpp"
click node_firmware "https://github.com/lukarty/qkd_techpo/blob/main/sources/bootloader.cpp"
click node_plot "https://github.com/lukarty/qkd_techpo/blob/main/headers/qcustomplot.h"
click node_histogram "https://github.com/lukarty/qkd_techpo/blob/main/sources/histogram.cpp"
click node_evalhist "https://github.com/lukarty/qkd_techpo/blob/main/sources/histogrameva.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_main,node_portpicker,node_admin,node_help toneBlue
class node_worker,node_qkd toneAmber
class node_hardwareapi,node_serial,node_firmware toneMint
class node_plot,node_histogram,node_evalhist toneRose
class node_user toneIndigo
```

## Components

### Desktop UI

- [Qt Application](https://github.com/lukarty/qkd_techpo/blob/main/sources/main.cpp): `sources/main.cpp`
- [Main Window](https://github.com/lukarty/qkd_techpo/blob/main/sources/mainwindow.cpp): `sources/mainwindow.cpp`
- [COM Port Selector](https://github.com/lukarty/qkd_techpo/blob/main/sources/com_combobox.cpp): `sources/com_combobox.cpp`
- [Admin Login](https://github.com/lukarty/qkd_techpo/blob/main/sources/adminlogin.cpp): `sources/adminlogin.cpp`
- [Help Window](https://github.com/lukarty/qkd_techpo/blob/main/sources/helpwindow.cpp): `sources/helpwindow.cpp`

### QKD Protocols

- [Protocol Worker](https://github.com/lukarty/qkd_techpo/blob/main/streamwork.cpp): `streamwork.cpp`
- [Protocol Decisions](https://github.com/lukarty/qkd_techpo/blob/main/streamwork.cpp): `streamwork.cpp`

### Stand Hardware

- [Hardware API](https://github.com/lukarty/qkd_techpo/blob/main/sources/conserial.cpp): `sources/conserial.cpp`
- [Serial Transport](https://github.com/lukarty/qkd_techpo/blob/main/sources/ceSerial.cpp): `sources/ceSerial.cpp`
- [Firmware Update](https://github.com/lukarty/qkd_techpo/blob/main/sources/bootloader.cpp): `sources/bootloader.cpp`

### Analysis Views

- [Plotting Widget](https://github.com/lukarty/qkd_techpo/blob/main/headers/qcustomplot.h): `headers/qcustomplot.h`
- [Signal Histogram](https://github.com/lukarty/qkd_techpo/blob/main/sources/histogram.cpp): `sources/histogram.cpp`
- [Evaluation Histogram](https://github.com/lukarty/qkd_techpo/blob/main/sources/histogrameva.cpp): `sources/histogrameva.cpp`

### Other components

- **Operator**

## Connections

- Operator → Main Window: operates
- Qt Application → Main Window: creates (evidence: `sources/main.cpp`)
- Main Window → COM Port Selector: sets stand (evidence: `sources/mainwindow.cpp`)
- COM Port Selector → Hardware API: sets port (evidence: `sources/com_combobox.cpp`)
- Main Window → Hardware API: controls stand (evidence: `sources/mainwindow.cpp`)
- Main Window → Protocol Worker: starts worker (evidence: `sources/mainwindow.cpp`)
- Protocol Worker → Hardware API: requests readings (evidence: `streamwork.cpp`)
- Protocol Worker → Protocol Decisions: applies decisions (evidence: `streamwork.cpp`)
- Main Window → Plotting Widget: updates graph (evidence: `sources/mainwindow.cpp`)
- Signal Histogram → Plotting Widget: uses plotting
- Evaluation Histogram → Plotting Widget: uses plotting
