summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml199
1 files changed, 199 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/Widgets/SettingsCard.qml
new file mode 100644
index 0000000..65642a0
--- /dev/null
+++ b/raveos-hyprland-theme/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
+ }
+ }
+}