PluginSystem: relying on entryPoints, removing "provides" to keep things simple

This commit is contained in:
ItsLemmy
2025-12-01 22:04:22 -05:00
parent 49c1b835cb
commit 2662df52cd
4 changed files with 20 additions and 23 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ SmartPanel {
return false;
}
if (!plugin.manifest.provides.panel) {
if (!plugin.manifest.entryPoints || !plugin.manifest.entryPoints.panel) {
Logger.w("PluginPanelSlot", "Plugin does not provide a panel:", pluginId);
return false;
}
+12 -12
View File
@@ -58,18 +58,6 @@ ColumnLayout {
description: modelData.description
}
NToggle {
checked: PluginRegistry.isPluginEnabled(modelData.id)
baseSize: Style.baseWidgetSize * 0.7
onToggled: function (checked) {
if (checked) {
PluginService.enablePlugin(modelData.id);
} else {
PluginService.disablePlugin(modelData.id);
}
}
}
NIconButton {
icon: "settings"
tooltipText: I18n.tr("settings.plugins.settings.tooltip")
@@ -89,6 +77,18 @@ ColumnLayout {
uninstallDialog.open();
}
}
NToggle {
checked: PluginRegistry.isPluginEnabled(modelData.id)
baseSize: Style.baseWidgetSize * 0.7
onToggled: function (checked) {
if (checked) {
PluginService.enablePlugin(modelData.id);
} else {
PluginService.disablePlugin(modelData.id);
}
}
}
}
}
}
-7
View File
@@ -340,13 +340,6 @@ Singleton {
}
}
if (!manifest.provides) {
return {
valid: false,
error: "Missing 'provides' field"
};
}
if (!manifest.entryPoints) {
return {
valid: false,
+7 -3
View File
@@ -360,7 +360,7 @@ Singleton {
}
// Load bar widget component if provided (don't instantiate - BarWidgetRegistry will do that)
if (manifest.provides.barWidget && manifest.entryPoints.barWidget) {
if (manifest.entryPoints && manifest.entryPoints.barWidget) {
var widgetPath = pluginDir + "/" + manifest.entryPoints.barWidget;
var widgetComponent = Qt.createComponent("file://" + widgetPath);
@@ -390,7 +390,7 @@ Singleton {
Logger.i("PluginService", "Unloading plugin:", pluginId);
// Unregister from BarWidgetRegistry
if (plugin.manifest.provides.barWidget) {
if (plugin.manifest.entryPoints && plugin.manifest.entryPoints.barWidget) {
BarWidgetRegistry.unregisterPluginWidget(pluginId);
}
@@ -417,6 +417,7 @@ Singleton {
readonly property string pluginId: "${pluginId}"
readonly property string pluginDir: "${pluginDir}"
property var pluginSettings: ({})
property var manifest: ({})
// IPC handlers storage
property var ipcHandlers: ({})
@@ -428,6 +429,9 @@ Singleton {
}
`, root, "PluginAPI_" + pluginId);
// Set manifest
api.manifest = manifest;
// Load plugin settings
loadPluginSettings(pluginId, function (settings) {
api.pluginSettings = settings;
@@ -586,7 +590,7 @@ Singleton {
}
var plugin = root.loadedPlugins[pluginId];
if (!plugin || !plugin.manifest || !plugin.manifest.provides.panel) {
if (!plugin || !plugin.manifest || !plugin.manifest.entryPoints || !plugin.manifest.entryPoints.panel) {
Logger.w("PluginService", "Plugin does not provide a panel:", pluginId);
return false;
}