docs: document providers, flatpak and the plugin system
Explain multi-provider search with the Provider column, the Providers page (enable/disable, rescan, install-tool) and how to write a plugin using the example provider as a template. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2 files changed
+74
-10
No files matched your search
+37
-5
@@ -9,6 +9,7 @@ Package manager for **Arch Linux** based on **pacman**, with a Qt6 graphical int
|
||||
- 🗑️ **Package removal**
|
||||
- 🔄 **Individual or global updates**
|
||||
- 📋 **History of all actions**
|
||||
- 🧩 **Multi-provider**: pacman and Flatpak built in, plus **plugins** to add other managers (apt, dnf, …)
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -16,8 +17,11 @@ Package manager for **Arch Linux** based on **pacman**, with a Qt6 graphical int
|
||||
package-manager/
|
||||
├── CMakeLists.txt # Build root
|
||||
├── include/
|
||||
│ ├── package-manager.h # Package manager interface
|
||||
│ ├── package-manager.h # Package manager interface (IPackageManager)
|
||||
│ ├── provider-plugin.h # C ABI contract for provider plugins
|
||||
│ ├── pacman-manager.h # pacman manager (Arch Linux)
|
||||
│ ├── flatpak-manager.h # Flatpak manager
|
||||
│ ├── plugin-manager.h # Provider registry + plugin loading
|
||||
│ ├── main-window.h # Main GUI
|
||||
│ ├── history-manager.h # Action history
|
||||
│ └── package-model.h # Qt model for the list
|
||||
@@ -25,8 +29,14 @@ package-manager/
|
||||
│ ├── main.cpp
|
||||
│ ├── main-window.cpp
|
||||
│ ├── pacman-manager.cpp
|
||||
│ ├── flatpak-manager.cpp
|
||||
│ ├── plugin-manager.cpp
|
||||
│ ├── history-manager.cpp
|
||||
│ └── package-model.cpp
|
||||
├── plugins/
|
||||
│ └── example-provider/ # Example external plugin (template)
|
||||
├── tests/ # Unit tests (assert, no Qt)
|
||||
└── resources/
|
||||
```
|
||||
|
||||
## Compilation (Arch Linux)
|
||||
@@ -74,6 +84,7 @@ The interface uses **Qt6** with a dark theme, a **navigation sidebar** and stack
|
||||
- ⬆️ **Updates**: outdated packages detected by `pacman -Qu`, "Update all" button
|
||||
- 📋 **History**: filterable table (installs / removals / updates)
|
||||
- 📜 **Logs**: built-in `/var/log/pacman.log` viewer
|
||||
- 🧩 **Providers**: lists all managers (built-in and plugins), enable / disable and plugin rescan
|
||||
|
||||
### Interface overview
|
||||
```text
|
||||
@@ -97,9 +108,9 @@ The interface uses **Qt6** with a dark theme, a **navigation sidebar** and stack
|
||||
└──────────────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Package manager
|
||||
## Package managers (providers)
|
||||
|
||||
The `IPackageManager` interface (implemented by `PacmanManager`) defines:
|
||||
The `IPackageManager` interface (implemented by `PacmanManager` and `FlatpakManager`) defines:
|
||||
|
||||
| Method | Description |
|
||||
|--------|-------------|
|
||||
@@ -111,14 +122,35 @@ The `IPackageManager` interface (implemented by `PacmanManager`) defines:
|
||||
| `canRemove()` | Supports removal |
|
||||
| `canUpdate()` | Supports updates |
|
||||
| `canListInstalled()` | Supports listing installed packages |
|
||||
| `isAvailable()` | Checks whether pacman is installed |
|
||||
| `isAvailable()` | Checks whether the tool is installed |
|
||||
| `requiresPassword()` | True when operations go through sudo (pacman) |
|
||||
| `search(query)` | Search for packages |
|
||||
| `install(name, callback)` | Installation |
|
||||
| `remove(name, callback)` | Removal |
|
||||
| `update(name, callback)` | Update |
|
||||
| `listInstalled()` | List installed packages |
|
||||
| `listUpdates()` | List outdated packages |
|
||||
| `refresh(callback)` | Refresh the databases |
|
||||
| `refresh(callback)` | Refresh the sources |
|
||||
|
||||
Search queries **all active providers at once**: every result shows its origin in the **Provider** column (Pacman, Flatpak, …), and the Installed / Updates pages are aggregated. Install, remove and update are routed automatically to the right manager. The sidebar **Providers** page lets you enable / disable each provider, rescan plugins and **install a missing tool** (e.g. "Install tool" for Flatpak runs `sudo pacman -S flatpak`, then the provider becomes available).
|
||||
|
||||
### Adding a provider (plugins)
|
||||
|
||||
Pacman and Flatpak are **built-in**. To add another manager (apt, dnf, zypper, or another distro's repos) without touching the application:
|
||||
|
||||
1. Implement `IPackageManager` in a `.cpp` file (copy `plugins/example-provider/example-provider.cpp` as a template).
|
||||
2. Export the C ABI contract with the `FWS_PROVIDER_PLUGIN(MyManager, "id", "Name", "1.0.0", "Description", "Author")` macro.
|
||||
3. Compile it as a shared library and drop it into `~/.local/share/PacManager/plugins/` or `plugins/` next to the executable.
|
||||
4. Click **Rescan** on the Providers page.
|
||||
|
||||
Building the example plugin:
|
||||
|
||||
```bash
|
||||
cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON && cmake --build build
|
||||
# build/plugins/libsample-provider.so is copied next to the executable
|
||||
```
|
||||
|
||||
The plugin must be compiled with the same compiler and headers as the application (like a regular Qt plugin).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in new issue
Block a user