From 5d94c0a7d44a2255b81815a52a7056a94a39842d Mon Sep 17 00:00:00 2001 From: nippy Date: Sat, 18 Apr 2026 13:49:56 +0200 Subject: update Raveos themes --- .../Modules/Settings/Widgets/SettingsCard.qml | 199 +++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml') diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml new file mode 100644 index 0000000..65642a0 --- /dev/null +++ b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml @@ -0,0 +1,199 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import qs.Common +import qs.Services +import qs.Widgets + +StyledRect { + id: root + + LayoutMirroring.enabled: I18n.isRtl + LayoutMirroring.childrenInherit: true + + property string tab: "" + property var tags: [] + property string settingKey: "" + + property string title: "" + property string iconName: "" + property bool collapsible: false + property bool expanded: true + property real headerLeftPadding: 0 + + default property alias content: contentColumn.children + property alias headerActions: headerActionsRow.children + + readonly property bool isHighlighted: settingKey !== "" && SettingsSearchService.highlightSection === settingKey + + width: parent?.width ?? 0 + height: { + var hasHeader = root.title !== "" || root.iconName !== ""; + if (collapsed) + return headerRow.height + Theme.spacingL * 2; + var h = Theme.spacingL * 2 + contentColumn.height; + if (hasHeader) + h += headerRow.height + Theme.spacingM; + return h; + } + radius: Theme.cornerRadius + color: Theme.surfaceContainerHigh + + readonly property bool collapsed: collapsible && !expanded + readonly property bool hasHeader: root.title !== "" || root.iconName !== "" + property bool userToggledCollapse: false + + function findParentFlickable() { + let p = root.parent; + while (p) { + if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem")) { + return p; + } + p = p.parent; + } + return null; + } + + Component.onCompleted: { + if (settingKey) { + let flickable = findParentFlickable(); + if (flickable) { + SettingsSearchService.registerCard(settingKey, root, flickable); + } + } + } + + Component.onDestruction: { + if (settingKey) { + SettingsSearchService.unregisterCard(settingKey); + } + } + + Behavior on height { + enabled: root.userToggledCollapse + NumberAnimation { + duration: Theme.shortDuration + easing.type: Theme.standardEasing + onRunningChanged: { + if (!running) + root.userToggledCollapse = false; + } + } + } + + Rectangle { + id: highlightBorder + anchors.fill: parent + anchors.margins: -2 + radius: root.radius + 2 + color: "transparent" + border.width: 2 + border.color: Theme.primary + opacity: root.isHighlighted ? 1 : 0 + visible: opacity > 0 + z: 100 + + Behavior on opacity { + NumberAnimation { + duration: Theme.shortDuration + easing.type: Theme.standardEasing + } + } + } + + Column { + id: mainColumn + anchors.fill: parent + anchors.margins: Theme.spacingL + spacing: root.hasHeader ? Theme.spacingM : 0 + clip: true + + Item { + id: headerRow + width: parent.width + height: root.hasHeader ? Math.max(headerIcon.height, headerText.height, headerActionsRow.height) : 0 + visible: root.hasHeader + + Row { + anchors.left: parent.left + anchors.leftMargin: root.headerLeftPadding + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.spacingM + + DankIcon { + id: headerIcon + name: root.iconName + size: Theme.iconSize + color: Theme.primary + anchors.verticalCenter: parent.verticalCenter + visible: root.iconName !== "" + } + + StyledText { + id: headerText + text: root.title + font.pixelSize: Theme.fontSizeLarge + font.weight: Font.Medium + color: Theme.surfaceText + anchors.verticalCenter: parent.verticalCenter + visible: root.title !== "" + width: implicitWidth + horizontalAlignment: Text.AlignLeft + } + } + + Row { + id: headerActionsRow + anchors.right: root.collapsible ? caretIcon.left : parent.right + anchors.rightMargin: root.collapsible ? Theme.spacingS : 0 + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.spacingXS + } + + DankIcon { + id: caretIcon + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + name: root.expanded ? "expand_less" : "expand_more" + size: Theme.iconSize - 2 + color: Theme.surfaceVariantText + visible: root.collapsible + } + + MouseArea { + anchors.left: parent.left + anchors.right: headerActionsRow.left + anchors.top: parent.top + anchors.bottom: parent.bottom + enabled: root.collapsible + cursorShape: root.collapsible ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: { + root.userToggledCollapse = true; + root.expanded = !root.expanded; + } + } + + MouseArea { + visible: root.collapsible + anchors.left: caretIcon.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.leftMargin: -Theme.spacingS + enabled: root.collapsible + cursorShape: root.collapsible ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: { + root.userToggledCollapse = true; + root.expanded = !root.expanded; + } + } + } + + Column { + id: contentColumn + width: parent.width + spacing: Theme.spacingM + visible: !root.collapsed + } + } +} -- cgit v1.3