From 5720c398efad9bd5f9a5b7a5e34e629d1ab08228 Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Sun, 13 Sep 2026 11:45:55 +0200 Subject: [PATCH] docs: describe the core/pages architecture in both READMEs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ€– Generated with Codebuff Co-Authored-By: Codebuff --- README.en.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 94 insertions(+), 8 deletions(-) diff --git a/README.en.md b/README.en.md index c1a3f15..179f00f 100644 --- a/README.en.md +++ b/README.en.md @@ -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) diff --git a/README.md b/README.md index 5c63c94..7d57e3b 100644 --- a/README.md +++ b/README.md @@ -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)