Files
FWS-PacManage/plugins/example-provider/example-provider.cpp
T
BlackAngelTV cd5bed0f4d feat(ui): stream search results and show real download progress
Search now publishes provider results in small batches as they arrive, so
the first matches appear in the table while slower providers keep running.

The bottom status-bar bar is now a determinate indicator: pacman output is
streamed live and its (n/Total) package counter is parsed into a percentage
that fills the bar during install/update, instead of an indeterminate spinner.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-08-29 20:17:45 +02:00

47 lines
2.1 KiB
C++

// Example external provider plugin — a template for adding new package
// providers without touching the application code.
//
// Build it as a shared library and drop it in a plugin directory
// (next to the PacManager binary in ./plugins/ or in
// ~/.local/share/PacManager/plugins/); the app discovers it at launch and on
// the Providers page via "Recharger".
//
// A plugin only needs to:
// 1. implement IPackageManager (see include/package-manager.h)
// 2. export the C ABI symbols via the FWS_PROVIDER_PLUGIN macro
//
// To build with CMake from the project root:
// cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON && cmake --build build
#include "provider-plugin.h"
// A trivial provider that reports itself as always available but manages
// nothing — replace the stubs with real commands (apt, dnf, zypper, ...).
class SampleProvider : public IPackageManager {
public:
std::string getName() const override { return "sample"; }
std::string getVersion() const override { return "0.1.0"; }
std::string getDescription() const override {
return "Exemple de plugin fournisseur (modèle à copier)";
}
bool canSearch() const override { return false; }
bool canInstall() const override { return false; }
bool canRemove() const override { return false; }
bool canUpdate() const override { return false; }
bool canListInstalled() const override { return false; }
bool isAvailable() const override { return true; }
std::vector<PackageInfo> search(const std::string&) override { return {}; }
bool install(const std::string&, ProgressCallback) override { return false; }
bool remove(const std::string&, ProgressCallback) override { return false; }
bool update(const std::string&, ProgressCallback) override { return false; }
std::vector<PackageInfo> listInstalled() override { return {}; }
std::vector<PackageInfo> listUpdates() override { return {}; }
bool refresh(ProgressCallback) override { return false; }
};
FWS_PROVIDER_PLUGIN(SampleProvider, "sample", "Sample Provider", "0.1.0",
"Exemple de plugin fournisseur (modèle à copier)", "FWS");