Added a way to switch off tools you never need (#1115)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-10-27 08:48:52 +01:00
1 parent dcba62b45c
commit 04546c25ac
31 files changed
+638 -37

No files matched your search

@@ -48,7 +48,9 @@ public partial class ToolDefaultsConfiguration : MSGComponentBase
await base.OnInitializedAsync();
}
private HashSet<string> GetSelectedValues() => this.ToolRegistry.GetDefaultToolIds(this.Component);
// The list holds no tool the user switched off, so it must not count one as selected either:
private HashSet<string> GetSelectedValues() => this.ToolRegistry.LeaveOutSwitchedOffByUser(this.ToolRegistry.GetDefaultToolIds(this.Component));
private void UpdateSelection(HashSet<string> values) => this.SettingsManager.ConfigurationData.Tools.DefaultToolIdsByComponent[this.Component.ToString()] = [..this.ToolRegistry.NormalizeSelection(values)];
// Tools the user switched off stay preselected, so switching them on again brings them back:
private void UpdateSelection(HashSet<string> values) => this.SettingsManager.ConfigurationData.Tools.DefaultToolIdsByComponent[this.Component.ToString()] = this.ToolRegistry.KeepSwitchedOffByUser(this.ToolRegistry.GetDefaultToolIds(this.Component), values);
}