docs: describe the core/pages architecture in both READMEs

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTVandCodebuff committed 2026-09-13 11:45:55 +02:00
1 parent 897c174925
commit 5720c398ef
2 files changed
+94 -8

No files matched your search

+46 -4
View File
@@ -14,26 +14,68 @@ Package manager for **Arch Linux** based on **pacman**, with a Qt6 graphical int
## Architecture
The code is split in two layers, and the split is structural: **every rule lives
in `AppCore`**, every screen lives in `pages/` — the Qt window (`MainWindow`) is
only the frame around them.
- `include/app-core.h` + `src/app-core.cpp` — **the logic**: providers (pacman,
Flatpak, AUR…), worker threads, history, plugin registry, privileged commands
(`sudo`), pacman's database lock, self-update. No widget at all: the layer
depends on Qt Core only and runs headless (`build/app-core-test` does not even
link QtWidgets).
- `include/main-window.h` + `src/main-window.cpp` — **the frame**: sidebar,
header, status bar, menus, tray, dialogs (sudo password, pacman lock, export)
and the stack holding the screens. No business rule.
- `pages/` — **the screens, one file per screen**: `dashboard-page`,
`browse-page` (search / installed / updates), `cleanup-page`,
`history-page`, `logs-page`, `plugins-page`. `page.h` holds the shared
contract (`navTitle()`, `refresh()`, asking the frame for an operation) and
`ui-kit.*` the shared widgets (tables, cards, badges). Reworking a UI means
editing its file under `pages/`; adding a screen means one `Page` subclass
plus a sidebar entry — nothing else.
The conversation always goes the same way: the view calls a core method
(`install()`, `loadUpdates()`, `cleanCaches()`…), which answers "started", "I
need the sudo password" or "pacman's database is locked"; the view then asks the
user for whatever is missing and replays the request. Results come back as
signals (`listFinished`, `actionProgress`, `actionFinished`, `statusMessage`…).
Every operation that spawns a process is asynchronous.
```
package-manager/
├── CMakeLists.txt # Build root
├── include/
│ ├── app-core.h # LOGIC: everything the app does (no widget)
│ ├── workers.h # Shared threads (search / listings / actions)
│ ├── package-manager.h # Package manager interface (IPackageManager)
│ ├── plugin.h # Generic plugin contract (PluginInfo, IPlugin)
│ ├── provider-plugin.h # C ABI contract for plugins (providers + addons)
│ ├── pacman-manager.h # pacman manager (Arch Linux, built-in)
│ ├── plugin-manager.h # Plugin registry + shared-library loading
│ ├── main-window.h # Main GUI
│ ├── main-window.h # INTERFACE: the window frame
│ ├── history-manager.h # Action history
│ └── package-model.h # Qt model for the list
│ ├── package-model.h # Qt model for the list
│ └── update-manager.h # Self-update (releases)
├── src/
│ ├── main.cpp
│ ├── app-core.cpp
│ ├── workers.cpp
│ ├── main-window.cpp
│ ├── pacman-manager.cpp
│ ├── flatpak-manager.cpp
│ ├── plugin-manager.cpp
│ ├── history-manager.cpp
│ └── package-model.cpp
│ ├── package-model.cpp
│ ├── update-manager.cpp
│ └── app-logging.cpp
├── pages/ # INTERFACE: one file per screen
│ ├── page.h/.cpp # Screen contract (Page) + helpers
│ ├── ui-kit.h/.cpp # Shared widgets (tables, cards, badges)
│ ├── dashboard-page.h/.cpp # Dashboard
│ ├── browse-page.h/.cpp # Search / installed / updates
│ ├── cleanup-page.h/.cpp # Cleanup
│ ├── history-page.h/.cpp # History
│ ├── logs-page.h/.cpp # pacman logs
│ └── plugins-page.h/.cpp # Plugins
├── plugins/
│ ├── example-provider/ # Example external provider plugin (template)
│ ├── example-addon/ # Example external addon plugin (extension, template)
+48 -4
View File
@@ -14,26 +14,70 @@ Gestionnaire de paquets pour **Arch Linux** basé sur **pacman**, avec interface
## Architecture
Le code est coupé en deux couches, et la coupure est structurante : **toute la
logique vit dans `AppCore`**, l'interface vit dans `pages/` — la fenêtre Qt
(`MainWindow`) n'est plus qu'un cadre autour des écrans.
- `include/app-core.h` + `src/app-core.cpp` — **la logique** : providers
(pacman, Flatpak, AUR…), threads de travail, historique, registre de plugins,
commandes privilégiées (`sudo`), verrou de la base pacman, auto-mise à jour.
Aucun widget : la couche ne dépend que de Qt Core et tourne sans écran
(`build/app-core-test` ne lie même pas QtWidgets).
- `include/main-window.h` + `src/main-window.cpp` — **le cadre** : barre
latérale, en-tête, barre de statut, menus, tray, dialogues (mot de passe
sudo, verrou pacman, export) et la pile qui contient les écrans. Aucune règle
métier.
- `pages/` — **les écrans, un fichier par écran** : `dashboard-page`,
`browse-page` (recherche / installés / mises à jour), `cleanup-page`,
`history-page`, `logs-page`, `plugins-page`. `page.h` donne le contrat commun
(`navTitle()`, `refresh()`, demander une opération au cadre) et `ui-kit.*` les
widgets partagés (tableaux, cartes, badges). Retravailler une interface =
éditer son fichier dans `pages/` ; ajouter un écran = une classe `Page` et une
entrée dans la barre latérale, rien d'autre.
Le dialogue va toujours dans le même sens : la vue appelle une méthode du core
(`install()`, `loadUpdates()`, `cleanCaches()`…) qui répond « lancé », « il me
faut le mot de passe sudo » ou « la base pacman est verrouillée » ; la vue
demande alors à l'utilisateur ce qu'il faut, puis rejoue la requête. Les
résultats reviennent par signaux (`listFinished`, `actionProgress`,
`actionFinished`, `statusMessage`…). Toute opération qui lance un processus est
asynchrone.
```
package-manager/
├── CMakeLists.txt # Build root
├── include/
│ ├── app-core.h # LOGIQUE : tout ce que l'app fait (sans widget)
│ ├── workers.h # Threads partagés (recherche / listes / actions)
│ ├── package-manager.h # Interface du gestionnaire de paquets (IPackageManager)
│ ├── plugin.h # Contrat générique des plugins (PluginInfo, IPlugin)
│ ├── provider-plugin.h # Contrat C ABI des plugins (fournisseurs + addons)
│ ├── pacman-manager.h # Gestionnaire pacman (Arch Linux, intégré)
│ ├── plugin-manager.h # Registre des plugins + chargement des bibliothèques
│ ├── main-window.h # GUI principal
│ ├── main-window.h # INTERFACE : le cadre de la fenêtre
│ ├── history-manager.h # Historique des actions
│ └── package-model.h # Modèle Qt pour la liste
│ ├── package-model.h # Modèle Qt pour la liste
│ └── update-manager.h # Auto-mise à jour (releases)
├── src/
│ ├── main.cpp
│ ├── app-core.cpp
│ ├── workers.cpp
│ ├── main-window.cpp
│ ├── pacman-manager.cpp
│ ├── flatpak-manager.cpp
│ ├── plugin-manager.cpp
│ ├── history-manager.cpp
│ └── package-model.cpp
│ ├── package-model.cpp
│ ├── update-manager.cpp
│ └── app-logging.cpp
├── pages/ # INTERFACE : un fichier par écran
│ ├── page.h/.cpp # Contrat d'un écran (Page) + helpers
│ ├── ui-kit.h/.cpp # Widgets partagés (tableaux, cartes, badges)
│ ├── dashboard-page.h/.cpp # Tableau de bord
│ ├── browse-page.h/.cpp # Recherche / installés / mises à jour
│ ├── cleanup-page.h/.cpp # Nettoyage
│ ├── history-page.h/.cpp # Historique
│ ├── logs-page.h/.cpp # Logs pacman
│ └── plugins-page.h/.cpp # Plugins
├── plugins/
│ ├── example-provider/ # Plugin fournisseur externe d'exemple (modèle à copier)
│ ├── example-addon/ # Plugin addon externe d'exemple (extension, modèle à copier)