Installing a plugin meant compiling a shared library and dropping it in a directory by hand. The shop reads a catalogue (plugins/catalog.json, one entry per plugin with its description and download URL), lists what can be installed next to what already is, and installs an entry into ~/.local/share/PacManager/plugins — the directory the registry already scans — so a plugin becomes usable without root rights and without a restart. Installing runs third-party code in this process, so the shop only fetches what the user picked, checks the announced sha256 before writing anything, and a removal deletes only the files the shop wrote itself. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
|
|
#include <string>
|
|
|
|
#include "page.h"
|
|
|
|
class QLabel;
|
|
class QPushButton;
|
|
class QTableWidget;
|
|
|
|
// Plugins: what is installed, and the shop it can be installed from.
|
|
//
|
|
// 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 shop: the catalogue the
|
|
// core fetches (see PluginShop), with the entries that are not installed here
|
|
// yet one click away from being downloaded into the per-user plugin directory.
|
|
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);
|
|
// Shop half: the catalogue table, the source line above it and the
|
|
// Installer/Désinstaller state of the selected entry.
|
|
void refreshShopTable();
|
|
void onShopSelected(int row);
|
|
void updateShopHint();
|
|
|
|
QTableWidget* m_table = nullptr;
|
|
QLabel* m_description = nullptr;
|
|
QPushButton* m_toggleButton = nullptr;
|
|
QPushButton* m_installButton = nullptr;
|
|
std::string m_selectedId;
|
|
|
|
QLabel* m_shopHint = nullptr;
|
|
QTableWidget* m_shopTable = nullptr;
|
|
QPushButton* m_shopInstallButton = nullptr;
|
|
QPushButton* m_shopRemoveButton = nullptr;
|
|
QString m_shopSelectedId;
|
|
};
|