# ckckh2023/trashgo_airecognition architecture

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

- Interactive diagram: https://gitdiagram.com/ckckh2023/trashgo_airecognition
- Repository: https://github.com/ckckh2023/trashgo_airecognition

## Overview

TrashGo is a Qt/QML desktop assistant centered on image-based garbage sorting. The primary workflow is selecting an image, classifying it with a configured local model or Baidu API, presenting the category and disposal advice, and recording the result for later history and bookmarks. The graph also includes settings and release/tip capabilities documented by the README. QML page wiring and unsampled implementation details are represented conservatively; the README documents SQLite history and dark mode.

Main entry points: [`Main.qml`](https://github.com/ckckh2023/trashgo_airecognition/blob/main/Main.qml) (Application shell), [`src/GarbageClassifier.cpp`](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GarbageClassifier.cpp) (Garbage classifier), [`main.cpp`](https://github.com/ckckh2023/trashgo_airecognition/blob/main/main.cpp) (Application startup), [`src/HistoryRecord.cpp`](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/HistoryRecord.cpp) (History records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["QML interface"]
  node_app["Application startup<br/>[main.cpp]"]
  node_qml["Application shell<br/>[Main.qml]"]
  node_home["Home page<br/>[HomePage.qml]"]
  node_garbage_ui["Classification page<br/>[GarbagePage.qml]"]
  node_history_ui["History page<br/>[HistoryPage.qml]"]
  node_star_ui["Bookmarks page<br/>[StarPage.qml]"]
  node_settings_ui["Settings page<br/>[SettingPage.qml]"]
  node_about_ui["About dialog<br/>[AboutDialog.qml]"]
end

subgraph group_recognition["Recognition"]
  node_classifier["Garbage classifier"]
  node_class_data["Category guidance<br/>[GarbageData.cpp]"]
  node_local_models["Local ONNX models"]
  node_result_image["Result image provider<br/>[ReturnImage.cpp]"]
end

subgraph group_records["History and settings"]
  node_history["History records<br/>[HistoryRecord.cpp]"]
  node_history_db[("SQLite history")]
  node_settings["Configuration handler<br/>[IniFileHandler.cpp]"]
end

subgraph group_online["Online features"]
  node_online["Release and daily tips<br/>[GitHubOnline.cpp]"]
end

node_user(("User"))
node_baidu["Baidu AI API"]
node_github["GitHub releases"]

node_user -->|"uses"| node_qml
node_app -->|"loads"| node_qml
node_app -->|"exposes"| node_classifier
node_app -->|"exposes"| node_history
node_app -->|"exposes"| node_settings
node_app -->|"exposes"| node_online
node_app -->|"registers"| node_result_image
node_qml -->|"shows"| node_home
node_qml -->|"shows"| node_garbage_ui
node_qml -->|"shows"| node_history_ui
node_qml -->|"shows"| node_star_ui
node_qml -->|"shows"| node_settings_ui
node_qml -->|"shows"| node_about_ui
node_garbage_ui -->|"requests classification"| node_classifier
node_classifier -->|"reads provider"| node_settings
node_classifier -->|"loads model"| node_local_models
node_classifier -.->|"sends image"| node_baidu
node_classifier -->|"looks up guidance"| node_class_data
node_classifier -->|"saves result"| node_history
node_garbage_ui -->|"requests image"| node_result_image
node_history_ui -->|"queries records"| node_history
node_star_ui -->|"queries bookmarks"| node_history
node_history -->|"reads and writes"| node_history_db
node_settings_ui -->|"updates preferences"| node_settings
node_about_ui -->|"requests release info"| node_online
node_home -->|"requests daily tip"| node_online
node_online -->|"checks releases"| node_github

click node_app "https://github.com/ckckh2023/trashgo_airecognition/blob/main/main.cpp"
click node_qml "https://github.com/ckckh2023/trashgo_airecognition/blob/main/Main.qml"
click node_home "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/HomePage.qml"
click node_garbage_ui "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/GarbagePage.qml"
click node_history_ui "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/HistoryPage.qml"
click node_star_ui "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/StarPage.qml"
click node_settings_ui "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/SettingPage.qml"
click node_about_ui "https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/AboutDialog.qml"
click node_classifier "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GarbageClassifier.cpp"
click node_class_data "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GarbageData.cpp"
click node_local_models "https://github.com/ckckh2023/trashgo_airecognition/tree/main/model"
click node_result_image "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/ReturnImage.cpp"
click node_history "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/HistoryRecord.cpp"
click node_settings "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/IniFileHandler.cpp"
click node_online "https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GitHubOnline.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_qml,node_home,node_garbage_ui,node_history_ui,node_star_ui,node_settings_ui,node_about_ui,node_user toneBlue
class node_classifier,node_class_data,node_local_models,node_result_image toneAmber
class node_history,node_history_db,node_settings,node_baidu toneMint
class node_online toneRose
class node_github toneIndigo
```

## Components

### QML interface

- [Application startup](https://github.com/ckckh2023/trashgo_airecognition/blob/main/main.cpp): `main.cpp`
- [Application shell](https://github.com/ckckh2023/trashgo_airecognition/blob/main/Main.qml): `Main.qml`
- [Home page](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/HomePage.qml): `components/pages/HomePage.qml`
- [Classification page](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/GarbagePage.qml): `components/pages/GarbagePage.qml`
- [History page](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/HistoryPage.qml): `components/pages/HistoryPage.qml`
- [Bookmarks page](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/StarPage.qml): `components/pages/StarPage.qml`
- [Settings page](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/SettingPage.qml): `components/pages/SettingPage.qml`
- [About dialog](https://github.com/ckckh2023/trashgo_airecognition/blob/main/components/pages/AboutDialog.qml): `components/pages/AboutDialog.qml`

### Recognition

- [Garbage classifier](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GarbageClassifier.cpp): `src/GarbageClassifier.cpp`
- [Category guidance](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GarbageData.cpp): `src/GarbageData.cpp`
- [Local ONNX models](https://github.com/ckckh2023/trashgo_airecognition/tree/main/model): `model`
- [Result image provider](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/ReturnImage.cpp): `src/ReturnImage.cpp`

### History and settings

- [History records](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/HistoryRecord.cpp): `src/HistoryRecord.cpp`
- **SQLite history**
- [Configuration handler](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/IniFileHandler.cpp): `src/IniFileHandler.cpp`

### Online features

- [Release and daily tips](https://github.com/ckckh2023/trashgo_airecognition/blob/main/src/GitHubOnline.cpp): `src/GitHubOnline.cpp`

### Other components

- **User**
- **Baidu AI API**
- **GitHub releases**

## Connections

- User → Application shell: uses
- Application startup → Application shell: loads
- Application startup → Garbage classifier: exposes
- Application startup → History records: exposes
- Application startup → Configuration handler: exposes
- Application startup → Release and daily tips: exposes
- Application startup → Result image provider: registers
- Application shell → Home page: shows
- Application shell → Classification page: shows
- Application shell → History page: shows
- Application shell → Bookmarks page: shows
- Application shell → Settings page: shows
- Application shell → About dialog: shows
- Classification page → Garbage classifier: requests classification
- Garbage classifier → Configuration handler: reads provider
- Garbage classifier → Local ONNX models: loads model
- Garbage classifier → Baidu AI API: sends image
- Garbage classifier → Category guidance: looks up guidance
- Garbage classifier → History records: saves result
- Classification page → Result image provider: requests image
- History page → History records: queries records
- Bookmarks page → History records: queries bookmarks
- History records → SQLite history: reads and writes
- Settings page → Configuration handler: updates preferences
- About dialog → Release and daily tips: requests release info
- Home page → Release and daily tips: requests daily tip
- Release and daily tips → GitHub releases: checks releases
