mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1793 from spiros132/main
Added button for plugin debug mode toggle
This commit is contained in:
@@ -1337,6 +1337,8 @@
|
||||
"collision-already-installed": "This plugin is already installed",
|
||||
"collision-custom-version-exists": "A custom version from \"{source}\" is already installed",
|
||||
"collision-official-version-exists": "The official version of this plugin is already installed",
|
||||
"debug-disable": "Disable debug mode for this plugin",
|
||||
"debug-enable": "Enable debug mode for this plugin",
|
||||
"filter-downloaded": "Downloaded",
|
||||
"filter-not-downloaded": "Not Downloaded",
|
||||
"filter-tags-description": "Filter plugins by category or download status.",
|
||||
|
||||
@@ -206,6 +206,14 @@ ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: PluginService.isPluginHotReloadEnabled(modelData.id) ? "bug-filled" : "bug-off"
|
||||
tooltipText: PluginService.isPluginHotReloadEnabled(modelData.id) ? I18n.tr("panels.plugins.debug-disable") : I18n.tr("panels.plugins.debug-enable")
|
||||
baseSize: Style.baseWidgetSize * 0.7
|
||||
enabled: modelData.enabled && !Settings.isDebug
|
||||
onClicked: PluginService.togglePluginHotReload(modelData.id)
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "settings"
|
||||
tooltipText: I18n.tr("panels.plugins.settings-tooltip")
|
||||
|
||||
@@ -49,6 +49,7 @@ Singleton {
|
||||
// Hot reload: file watchers for plugin directories
|
||||
property var pluginFileWatchers: ({}) // { pluginId: FileView }
|
||||
property bool hotReloadEnabled: Settings.isDebug
|
||||
property list<string> pluginHotReloadEnabled: [] // List of pluginIds that have hot reload enabled
|
||||
|
||||
onHotReloadEnabledChanged: {
|
||||
if (root.initialized) {
|
||||
@@ -1696,7 +1697,7 @@ Singleton {
|
||||
|
||||
// Set up file watcher for a plugin directory
|
||||
function setupPluginFileWatcher(pluginId) {
|
||||
if (!root.hotReloadEnabled) {
|
||||
if (!root.hotReloadEnabled && !isPluginHotReloadEnabled(pluginId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1978,6 +1979,28 @@ Singleton {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if a certain plugin has hot reload enabled
|
||||
function isPluginHotReloadEnabled(pluginId) {
|
||||
return root.pluginHotReloadEnabled.indexOf(pluginId) !== -1;
|
||||
}
|
||||
|
||||
// Toggle the hot reload state of a certain plugin
|
||||
function togglePluginHotReload(pluginId) {
|
||||
// If we have hot reload completely enabled just return
|
||||
if (root.hotReloadEnabled) return;
|
||||
|
||||
const index = root.pluginHotReloadEnabled.indexOf(pluginId);
|
||||
if (index === -1) {
|
||||
root.pluginHotReloadEnabled.push(pluginId);
|
||||
setupPluginFileWatcher(pluginId);
|
||||
Logger.i("PluginService", "Hot reload enabled for plugin:", pluginId);
|
||||
} else {
|
||||
root.pluginHotReloadEnabled.splice(index, 1);
|
||||
removePluginFileWatcher(pluginId);
|
||||
Logger.i("PluginService", "Hot reload disabled for plugin:", pluginId);
|
||||
}
|
||||
}
|
||||
|
||||
// Enable/disable hot reload for all loaded plugins
|
||||
function setHotReloadEnabled(enabled) {
|
||||
root.hotReloadEnabled = enabled;
|
||||
|
||||
Reference in New Issue
Block a user