Files
FWS-PacManage/pages/plugins-page.h
BlackAngelTV f6c8cedf93 feat(plugins): replace the shop with drag-and-drop .fwspacm packages
The shop was a catalogue served over HTTP that the application fetched and
listed, which put a network round trip between a user and a plugin that was
almost always one file they already had. It also had to keep its catalogue
URLs in step with every release, since an entry that pointed at a missing
asset was indistinguishable from one that never worked.

A plugin is now distributed as a .fwspacm package: a ZIP archive holding a
plugin.json manifest and the shared library, which the user drops anywhere
on the window. The file is the distribution, so there is no catalogue to
publish, no network, and no catalogue URL setting to explain. The manifest
tells the user what they are about to run, and its checksum is verified
before anything is written, so a package whose library is not the one it
declares never reaches the plugin directory.

Qt exposes no public ZIP API, so the archive is read directly (central
directory plus zlib for the deflated entries) rather than through a private
header that could move between toolchains. The reader stays in the logic
layer: app-core-test still links no QtWidgets, and a unit test builds its
own archives to check both compression methods and every refusal path.
2026-09-28 21:52:50 +02:00

59 lines
1.9 KiB
C++

#pragma once
#include <QString>
#include <string>
#include "page.h"
class QLabel;
class QPushButton;
class QTableWidget;
// Plugins: what is installed, and how to add more.
//
// The upper half lists every plugin known to the application (package-manager
// providers and generic addons, built-in and external) and lets the user
// enable/disable one, install the tool behind an unavailable provider and
// rescan the plugin directories. The lower half is the drop zone: a .fwspacm
// package dropped anywhere on the window is installed there (the window owns
// the drop, see MainWindow::dropEvent), and what was installed from a package
// can be removed again.
class PluginsPage : public Page {
Q_OBJECT
public:
explicit PluginsPage(AppCore* core, QWidget* parent = nullptr);
QString navTitle() const override { return QStringLiteral("Plugins"); }
QString navSubtitle() const override {
return QStringLiteral("Gestionnaires de paquets et extensions");
}
void refresh() override;
private:
void refreshTable();
void onSelected(int row);
// Package half: the drop zone, and the list of what was installed from a
// .fwspacm package with the button removing the selected one.
void refreshPackageList();
void onPackageSelected(int row);
void updateDropHint();
// Opens a file dialog on the package format and installs what was picked,
// for users who would rather click than drag the file onto the window.
void browsePackage();
QTableWidget* m_table = nullptr;
QLabel* m_description = nullptr;
QPushButton* m_toggleButton = nullptr;
QPushButton* m_installButton = nullptr;
std::string m_selectedId;
QTableWidget* m_packageTable = nullptr;
QLabel* m_packageHint = nullptr;
QPushButton* m_browseButton = nullptr;
QPushButton* m_removeButton = nullptr;
QString m_selectedPackageId;
};