config moved to c++ plugin, removed old qml + fileview implementation
This commit is contained in:
@@ -7,8 +7,9 @@ import Quickshell.Services.Notifications
|
||||
import ZShell.Components
|
||||
import qs.Daemons
|
||||
import qs.Helpers
|
||||
import qs.Config
|
||||
import ZShell.Config
|
||||
import qs.Components
|
||||
import qs.Services
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
@@ -17,16 +18,16 @@ CustomRect {
|
||||
readonly property bool hasAppIcon: modelData.appIcon.length > 0
|
||||
readonly property bool hasImage: modelData.image.length > 0
|
||||
required property NotifServer.Notif modelData
|
||||
readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? Appearance.spacing.extraSmall * 2 + appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
|
||||
readonly property int nonAnimHeight: summary.implicitHeight + (root.expanded ? Tokens.spacing.extraSmall * 2 + appName.height + body.height + actions.height + actions.anchors.topMargin : bodyPreview.height) + inner.anchors.margins * 2
|
||||
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondaryContainer : DynamicColors.tPalette.m3surfaceContainer
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3secondaryContainer : Colors.tPalette.m3surfaceContainer
|
||||
implicitHeight: inner.implicitHeight
|
||||
radius: Appearance.rounding.small
|
||||
radius: Tokens.rounding.small
|
||||
x: implicitWidth
|
||||
|
||||
Behavior on x {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
easing.bezierCurve: Tokens.anim.curves.emphasizedDecel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ CustomRect {
|
||||
id: inner
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Appearance.padding.normal
|
||||
anchors.margins: Tokens.padding.normal
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
implicitHeight: root.nonAnimHeight
|
||||
@@ -109,10 +110,10 @@ CustomRect {
|
||||
width: Config.notifs.sizes.image
|
||||
|
||||
sourceComponent: CustomClippingRect {
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2) : DynamicColors.palette.m3secondaryContainer
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 2) : Colors.palette.m3secondaryContainer
|
||||
implicitHeight: Config.notifs.sizes.image
|
||||
implicitWidth: Config.notifs.sizes.image
|
||||
radius: Appearance.rounding.full
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
@@ -139,10 +140,10 @@ CustomRect {
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: CustomRect {
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2) : DynamicColors.palette.m3secondaryContainer
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colors.layer(Colors.palette.m3surfaceContainerHighest, 2) : Colors.palette.m3secondaryContainer
|
||||
implicitHeight: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
|
||||
implicitWidth: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
|
||||
radius: Appearance.rounding.full
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
Loader {
|
||||
id: icon
|
||||
@@ -155,7 +156,7 @@ CustomRect {
|
||||
|
||||
sourceComponent: ColoredIcon {
|
||||
anchors.fill: parent
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onSecondaryContainer
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer
|
||||
layer.enabled: root.modelData.appIcon.endsWith("symbolic")
|
||||
source: Quickshell.iconPath(root.modelData.appIcon)
|
||||
}
|
||||
@@ -168,7 +169,7 @@ CustomRect {
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? DynamicColors.palette.m3onSurface : DynamicColors.palette.m3onSecondaryContainer
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onError : root.modelData.urgency === NotificationUrgency.Low ? Colors.palette.m3onSurface : Colors.palette.m3onSecondaryContainer
|
||||
text: Icons.getNotifIcon(root.modelData.summary, root.modelData.urgency)
|
||||
}
|
||||
}
|
||||
@@ -188,7 +189,7 @@ CustomRect {
|
||||
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
strokeColor: DynamicColors.palette.m3primary
|
||||
strokeColor: Colors.palette.m3primary
|
||||
strokeWidth: 2
|
||||
|
||||
PathAngleArc {
|
||||
@@ -196,14 +197,14 @@ CustomRect {
|
||||
|
||||
centerX: progressIndicator.width / 2
|
||||
centerY: progressIndicator.height / 2
|
||||
radiusX: progressIndicator.width / 2 - Appearance.padding.extraSmall / 2
|
||||
radiusY: progressIndicator.height / 2 - Appearance.padding.extraSmall / 2
|
||||
radiusX: progressIndicator.width / 2 - Tokens.padding.extraSmall / 2
|
||||
radiusY: progressIndicator.height / 2 - Tokens.padding.extraSmall / 2
|
||||
startAngle: -90
|
||||
sweepAngle: ((root.modelData.hints.value ?? 0) / 100) * 360
|
||||
|
||||
Behavior on sweepAngle {
|
||||
Anim {
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
easing.bezierCurve: Tokens.anim.curves.emphasizedDecel
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,10 +215,10 @@ CustomRect {
|
||||
id: appName
|
||||
|
||||
anchors.left: image.right
|
||||
anchors.leftMargin: Appearance.spacing.small
|
||||
anchors.leftMargin: Tokens.spacing.small
|
||||
anchors.top: parent.top
|
||||
animate: true
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
maximumLineCount: 1
|
||||
opacity: root.expanded ? 1 : 0
|
||||
text: appNameMetrics.elidedText
|
||||
@@ -233,7 +234,7 @@ CustomRect {
|
||||
id: appNameMetrics
|
||||
|
||||
elide: Text.ElideRight
|
||||
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Appearance.spacing.small * 3
|
||||
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Tokens.spacing.small * 3
|
||||
font: appName.font
|
||||
text: root.modelData.appName
|
||||
}
|
||||
@@ -242,10 +243,10 @@ CustomRect {
|
||||
id: summary
|
||||
|
||||
anchors.left: image.right
|
||||
anchors.leftMargin: Appearance.spacing.small
|
||||
anchors.leftMargin: Tokens.spacing.small
|
||||
anchors.top: parent.top
|
||||
animate: true
|
||||
font.pointSize: Appearance.font.size.small
|
||||
font.pointSize: Tokens.font.size.small
|
||||
height: implicitHeight
|
||||
maximumLineCount: 1
|
||||
text: summaryMetrics.elidedText
|
||||
@@ -259,9 +260,9 @@ CustomRect {
|
||||
when: root.expanded
|
||||
|
||||
PropertyChanges {
|
||||
body.anchors.topMargin: Appearance.spacing.extraSmall
|
||||
bodyPreview.anchors.topMargin: Appearance.spacing.extraSmall
|
||||
summary.anchors.topMargin: Appearance.spacing.extraSmall
|
||||
body.anchors.topMargin: Tokens.spacing.extraSmall
|
||||
bodyPreview.anchors.topMargin: Tokens.spacing.extraSmall
|
||||
summary.anchors.topMargin: Tokens.spacing.extraSmall
|
||||
summary.maximumLineCount: undefined
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ CustomRect {
|
||||
id: summaryMetrics
|
||||
|
||||
elide: Text.ElideRight
|
||||
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Appearance.spacing.small * 3
|
||||
elideWidth: expandBtn.x - time.width - timeSep.width - summary.x - Tokens.spacing.small * 3
|
||||
font: summary.font
|
||||
text: root.modelData.summary
|
||||
}
|
||||
@@ -298,9 +299,9 @@ CustomRect {
|
||||
id: timeSep
|
||||
|
||||
anchors.left: summary.right
|
||||
anchors.leftMargin: Appearance.spacing.small
|
||||
anchors.leftMargin: Tokens.spacing.small
|
||||
anchors.top: parent.top
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
text: "•"
|
||||
|
||||
states: State {
|
||||
@@ -322,11 +323,11 @@ CustomRect {
|
||||
id: time
|
||||
|
||||
anchors.left: timeSep.right
|
||||
anchors.leftMargin: Appearance.spacing.small
|
||||
anchors.leftMargin: Tokens.spacing.small
|
||||
anchors.top: parent.top
|
||||
animate: true
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.small
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Tokens.font.size.small
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
text: root.modelData.timeStr
|
||||
}
|
||||
@@ -336,13 +337,13 @@ CustomRect {
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: -Appearance.padding.extraSmall
|
||||
anchors.topMargin: -Tokens.padding.extraSmall
|
||||
implicitHeight: expandIcon.implicitHeight
|
||||
implicitWidth: expandIcon.implicitHeight
|
||||
|
||||
StateLayer {
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondaryContainer : DynamicColors.palette.m3onSurface
|
||||
radius: Appearance.rounding.full
|
||||
color: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onSecondaryContainer : Colors.palette.m3onSurface
|
||||
radius: Tokens.rounding.full
|
||||
|
||||
onClicked: root.expanded = !root.expanded
|
||||
}
|
||||
@@ -371,11 +372,11 @@ CustomRect {
|
||||
|
||||
anchors.left: summary.left
|
||||
anchors.right: expandBtn.left
|
||||
anchors.rightMargin: Appearance.spacing.small
|
||||
anchors.rightMargin: Tokens.spacing.small
|
||||
anchors.top: summary.bottom
|
||||
animate: true
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Appearance.font.size.small
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
font.pointSize: Tokens.font.size.small
|
||||
opacity: root.expanded ? 0 : 1
|
||||
text: bodyPreviewMetrics.elidedText
|
||||
textFormat: Text.MarkdownText
|
||||
@@ -401,10 +402,10 @@ CustomRect {
|
||||
|
||||
anchors.left: summary.left
|
||||
anchors.right: expandBtn.left
|
||||
anchors.rightMargin: Appearance.spacing.small
|
||||
anchors.rightMargin: Tokens.spacing.small
|
||||
anchors.top: summary.bottom
|
||||
animate: true
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
color: Colors.palette.m3onSurfaceVariant
|
||||
height: text ? implicitHeight : 0
|
||||
opacity: root.expanded ? 1 : 0
|
||||
text: root.modelData.body
|
||||
@@ -432,9 +433,9 @@ CustomRect {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: body.bottom
|
||||
anchors.topMargin: Appearance.spacing.small
|
||||
anchors.topMargin: Tokens.spacing.small
|
||||
opacity: root.expanded ? 1 : 0
|
||||
spacing: Appearance.spacing.extraSmall
|
||||
spacing: Tokens.spacing.extraSmall
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
@@ -446,10 +447,10 @@ CustomRect {
|
||||
enabled: root.expanded
|
||||
fillWidth: root.modelData.actions.length === 0
|
||||
icon: "close"
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3onSurfaceVariant
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3secondary : Colors.layer(Colors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onSecondary : Colors.palette.m3onSurfaceVariant
|
||||
isRound: true
|
||||
padding: Appearance.padding.extraSmall
|
||||
padding: Tokens.padding.extraSmall
|
||||
shapeMorph: true
|
||||
|
||||
onClicked: root.modelData.close()
|
||||
@@ -465,16 +466,16 @@ CustomRect {
|
||||
fillWidth: true
|
||||
font: {
|
||||
const f = Qt.font(font);
|
||||
f.pointSize = Appearance.font.size.small;
|
||||
f.pointSize = Tokens.font.size.small;
|
||||
return f;
|
||||
}
|
||||
implicitWidth: label.implicitWidth
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3onSurfaceVariant
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3secondary : Colors.layer(Colors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onSecondary : Colors.palette.m3onSurfaceVariant
|
||||
isRound: true
|
||||
label.anchors.centerIn: undefined
|
||||
label.anchors.left: left
|
||||
label.anchors.margins: Appearance.padding.normal
|
||||
label.anchors.margins: Tokens.padding.normal
|
||||
label.anchors.right: right
|
||||
label.anchors.verticalCenter: verticalCenter
|
||||
label.elide: Text.ElideRight
|
||||
@@ -490,11 +491,11 @@ CustomRect {
|
||||
enabled: root.expanded
|
||||
fillWidth: root.modelData.actions.length === 0
|
||||
icon: copyTimer.running ? "inventory" : "content_copy"
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3secondary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? DynamicColors.palette.m3onSecondary : DynamicColors.palette.m3onSurfaceVariant
|
||||
inactiveColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3secondary : Colors.layer(Colors.palette.m3surfaceContainerHighest, 2)
|
||||
inactiveOnColor: root.modelData.urgency === NotificationUrgency.Critical ? Colors.palette.m3onSecondary : Colors.palette.m3onSurfaceVariant
|
||||
isRound: true
|
||||
label.animate: true
|
||||
padding: Appearance.padding.extraSmall
|
||||
padding: Tokens.padding.extraSmall
|
||||
shapeMorph: true
|
||||
|
||||
onClicked: {
|
||||
|
||||
Reference in New Issue
Block a user