1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-31 17:02:51 -05:00

plugins: represent featured plugins in built-in browsers

This commit is contained in:
bbedward
2026-01-30 13:31:12 -05:00
parent f2d9066f90
commit 02edce2999
8 changed files with 101 additions and 15 deletions

View File

@@ -9,6 +9,8 @@ Singleton {
readonly property int longTextThreshold: 200
readonly property int modalWidth: 650
readonly property int modalHeight: 550
readonly property int popoutWidth: 550
readonly property int popoutHeight: 500
readonly property int itemHeight: 72
readonly property int thumbnailSize: 48
readonly property int retryInterval: 50

View File

@@ -111,8 +111,8 @@ DankPopout {
return ClipboardService.getEntryType(entry);
}
popupWidth: ClipboardConstants.modalWidth
popupHeight: ClipboardConstants.modalHeight
popupWidth: ClipboardConstants.popoutWidth
popupHeight: ClipboardConstants.popoutHeight
triggerWidth: 55
positioning: ""
screen: triggerScreen

View File

@@ -19,24 +19,29 @@ FloatingWindow {
function updateFilteredWidgets() {
const allWidgets = DesktopWidgetRegistry.registeredWidgetsList || [];
if (!searchQuery || searchQuery.length === 0) {
filteredWidgets = allWidgets.slice();
return;
}
var filtered = [];
var query = searchQuery.toLowerCase();
for (var i = 0; i < allWidgets.length; i++) {
var widget = allWidgets[i];
var name = widget.name ? widget.name.toLowerCase() : "";
var description = widget.description ? widget.description.toLowerCase() : "";
var id = widget.id ? widget.id.toLowerCase() : "";
if (!searchQuery || searchQuery.length === 0) {
filtered = allWidgets.slice();
} else {
var query = searchQuery.toLowerCase();
for (var i = 0; i < allWidgets.length; i++) {
var widget = allWidgets[i];
var name = widget.name ? widget.name.toLowerCase() : "";
var description = widget.description ? widget.description.toLowerCase() : "";
var id = widget.id ? widget.id.toLowerCase() : "";
if (name.indexOf(query) !== -1 || description.indexOf(query) !== -1 || id.indexOf(query) !== -1)
filtered.push(widget);
if (name.indexOf(query) !== -1 || description.indexOf(query) !== -1 || id.indexOf(query) !== -1)
filtered.push(widget);
}
}
filtered.sort((a, b) => {
if (a.featured !== b.featured)
return a.featured ? -1 : 1;
return 0;
});
filteredWidgets = filtered;
selectedIndex = -1;
keyboardNavigationActive = false;
@@ -356,6 +361,38 @@ FloatingWindow {
color: Theme.surfaceText
}
Rectangle {
visible: delegateRoot.modelData.featured || false
width: featuredWidgetRow.implicitWidth + Theme.spacingXS * 2
height: 18
radius: 9
color: Theme.withAlpha(Theme.secondary, 0.15)
border.color: Theme.withAlpha(Theme.secondary, 0.4)
border.width: 1
anchors.verticalCenter: parent.verticalCenter
Row {
id: featuredWidgetRow
anchors.centerIn: parent
spacing: 2
DankIcon {
name: "star"
size: 10
color: Theme.secondary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: I18n.tr("featured")
font.pixelSize: Theme.fontSizeSmall - 2
color: Theme.secondary
font.weight: Font.Medium
}
}
}
Rectangle {
visible: delegateRoot.modelData.type === "plugin"
width: pluginLabel.implicitWidth + Theme.spacingXS * 2

View File

@@ -48,6 +48,14 @@ FloatingWindow {
filtered.push(plugin);
}
filtered.sort((a, b) => {
if (a.featured !== b.featured)
return a.featured ? -1 : 1;
if (a.firstParty !== b.firstParty)
return a.firstParty ? -1 : 1;
return 0;
});
filteredPlugins = filtered;
selectedIndex = -1;
keyboardNavigationActive = false;
@@ -411,6 +419,7 @@ FloatingWindow {
property bool isSelected: root.keyboardNavigationActive && index === root.selectedIndex
property bool isInstalled: modelData.installed || false
property bool isFirstParty: modelData.firstParty || false
property bool isFeatured: modelData.featured || false
property bool isCompatible: PluginService.checkPluginCompatibility(modelData.requires_dms)
color: isSelected ? Theme.primarySelected : Theme.withAlpha(Theme.surfaceVariant, 0.3)
border.color: isSelected ? Theme.primary : Theme.withAlpha(Theme.outline, 0.2)
@@ -449,6 +458,38 @@ FloatingWindow {
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
height: 16
width: featuredRow.implicitWidth + Theme.spacingXS * 2
radius: 8
color: Theme.withAlpha(Theme.secondary, 0.15)
border.color: Theme.withAlpha(Theme.secondary, 0.4)
border.width: 1
visible: isFeatured
anchors.verticalCenter: parent.verticalCenter
Row {
id: featuredRow
anchors.centerIn: parent
spacing: 2
DankIcon {
name: "star"
size: 10
color: Theme.secondary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: I18n.tr("featured")
font.pixelSize: Theme.fontSizeSmall - 2
color: Theme.secondary
font.weight: Font.Medium
anchors.verticalCenter: parent.verticalCenter
}
}
}
Rectangle {
height: 16
width: firstPartyText.implicitWidth + Theme.spacingXS * 2