plugins: multi-select type chips in browser, dash browse button

port 2.0
This commit is contained in:
bbedward committed 2026-10-30 12:48:34 -04:00
1 parent 87312075dd
commit 7060c8eeb7
4 files changed
+75 -7

No files matched your search

+26
View File
@@ -18,6 +18,23 @@ FocusScope {
readonly property var tabs: DashRegistry.tabEntries
readonly property var optionEntryIds: DashRegistry.entries.filter(e => (e.options?.length ?? 0) > 0).map(e => e.id)
function showDashPluginBrowser() {
dashPluginBrowserLoader.active = true;
if (dashPluginBrowserLoader.item)
dashPluginBrowserLoader.item.show();
}
LazyLoader {
id: dashPluginBrowserLoader
active: false
PluginBrowser {
parentModal: root.parentModal
typeFilters: ["dash-tab", "dash-card"]
}
}
SettingsPage {
SettingsCard {
title: I18n.tr("Weather")
@@ -203,5 +220,14 @@ FocusScope {
}
}
}
SettingsFabBar {
DFab {
text: I18n.tr("Browse plugins")
iconName: "store"
colorRole: "secondaryContainer"
onClicked: root.showDashPluginBrowser()
}
}
}
}
@@ -90,7 +90,7 @@ Item {
PluginBrowser {
parentModal: root.parentModal
typeFilter: "desktop-widget"
typeFilters: ["desktop-widget"]
}
}
@@ -297,7 +297,7 @@ Item {
PluginBrowser {
parentModal: root.parentModal
typeFilter: "desktop-widget"
typeFilters: ["desktop-widget"]
}
}
+47 -5
View File
@@ -16,7 +16,7 @@ RegistryBrowserWindow {
readonly property var log: Log.scoped("PluginBrowser")
property var allPlugins: []
property var filteredPlugins: []
property string typeFilter: ""
property var typeFilters: []
property string categoryFilter: "all"
property var categoryFilterOptions: []
property var availableLetters: []
@@ -38,7 +38,7 @@ RegistryBrowserWindow {
readonly property var detailPlugin: resolveDetailPlugin(detailPluginId, allPlugins)
readonly property bool discoverVisible: {
if (isLoading || loadError !== "" || searchQuery !== "" || typeFilter !== "" || authorFilter !== "")
if (isLoading || loadError !== "" || searchQuery !== "" || typeFilters.length > 0 || authorFilter !== "")
return false;
if (discoverPicks.length === 0 && discoverShelves.length === 0)
return false;
@@ -71,6 +71,37 @@ RegistryBrowserWindow {
]
showLoadingSpinner: false
readonly property var typeFilterOptions: [
{
label: I18n.tr("Bar", "plugin browser type filter chip, bar widget plugins"),
value: "dankbar-widget"
},
{
label: I18n.tr("Control Center", "plugin browser type filter chip"),
value: "control-center"
},
{
label: I18n.tr("Launcher", "plugin browser type filter chip"),
value: "launcher"
},
{
label: I18n.tr("Daemon", "plugin browser type filter chip, background plugins"),
value: "daemon"
},
{
label: I18n.tr("Desktop", "plugin browser type filter chip, desktop widget plugins"),
value: "desktop-widget"
},
{
label: I18n.tr("Dash tab", "plugin browser type filter chip"),
value: "dash-tab"
},
{
label: I18n.tr("Dash card", "plugin browser type filter chip"),
value: "dash-card"
}
]
readonly property var sortChipOptions: [
{
id: "hideInstalled",
@@ -389,8 +420,8 @@ RegistryBrowserWindow {
if (!SessionData.showThirdPartyPlugins && !isFirstParty)
continue;
if (typeFilter !== "") {
var hasCapability = plugin.capabilities && plugin.capabilities.includes(typeFilter);
if (typeFilters.length > 0) {
var hasCapability = typeFilters.some(type => (plugin.capabilities || []).includes(type));
if (!hasCapability)
continue;
}
@@ -763,7 +794,7 @@ RegistryBrowserWindow {
return;
pendingRevealPluginId = pluginId;
searchQuery = "";
typeFilter = "";
typeFilters = [];
categoryFilter = "all";
detailPluginId = "";
SessionData.setPluginBrowserHideInstalled(false);
@@ -961,6 +992,17 @@ RegistryBrowserWindow {
root.updateFilteredPlugins();
}
}
DFilterChips {
width: parent.width
model: root.typeFilterOptions
multiSelect: true
selectedValues: root.typeFilters
onSelectionToggled: (index, selected) => {
var value = model[index].value;
root.typeFilters = selected ? root.typeFilters.concat([value]) : root.typeFilters.filter(type => type !== value);
root.updateFilteredPlugins();
}
}
DButton {
visible: root.authorFilter !== ""
text: I18n.tr("Plugins by %1", "plugin browser author filter, %1 is the author").arg(root.authorFilter)