NotificationHistory: fully converted to Layout
This commit is contained in:
parent
4768485974
commit
a4c98f1382
1 changed files with 40 additions and 36 deletions
|
|
@ -25,6 +25,7 @@ NPanel {
|
||||||
anchors.margins: Style.marginL * scaling
|
anchors.margins: Style.marginL * scaling
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
|
// Header section
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
@ -78,13 +79,11 @@ NPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty state when no notifications
|
// Empty state when no notifications
|
||||||
Item {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
visible: NotificationService.historyModel.count === 0
|
visible: NotificationService.historyModel.count === 0
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
|
|
@ -108,8 +107,8 @@ NPanel {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Notification list
|
||||||
ListView {
|
ListView {
|
||||||
id: notificationList
|
id: notificationList
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -121,21 +120,21 @@ NPanel {
|
||||||
visible: NotificationService.historyModel.count > 0
|
visible: NotificationService.historyModel.count > 0
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
width: notificationList ? notificationList.width : 380 * scaling
|
width: notificationList.width
|
||||||
height: Math.max(80, notificationContent.height + 30)
|
height: notificationLayout.implicitHeight + (Style.marginM * scaling * 2)
|
||||||
radius: Style.radiusM * scaling
|
radius: Style.radiusM * scaling
|
||||||
color: notificationMouseArea.containsMouse ? Color.mSecondary : Color.mSurfaceVariant
|
color: notificationMouseArea.containsMouse ? Color.mSecondary : Color.mSurfaceVariant
|
||||||
|
border.color: Qt.alpha(Color.mOutline, Style.opacityMedium)
|
||||||
|
border.width: Math.max(1, Style.borderS * scaling)
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors {
|
id: notificationLayout
|
||||||
fill: parent
|
anchors.fill: parent
|
||||||
margins: Style.marginM * scaling
|
anchors.margins: Style.marginM * scaling
|
||||||
}
|
|
||||||
spacing: Style.marginM * scaling
|
spacing: Style.marginM * scaling
|
||||||
|
|
||||||
// Notification content
|
// Notification content column
|
||||||
Column {
|
ColumnLayout {
|
||||||
id: notificationContent
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
spacing: Style.marginXXS * scaling
|
spacing: Style.marginXXS * scaling
|
||||||
|
|
@ -146,7 +145,8 @@ NPanel {
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mPrimary
|
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mPrimary
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
width: parent.width - 60
|
Layout.fillWidth: true
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
maximumLineCount: 2
|
maximumLineCount: 2
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
@ -156,23 +156,27 @@ NPanel {
|
||||||
font.pointSize: Style.fontSizeXS * scaling
|
font.pointSize: Style.fontSizeXS * scaling
|
||||||
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mOnSurface
|
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mOnSurface
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
width: parent.width - 60
|
Layout.fillWidth: true
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
maximumLineCount: 3
|
maximumLineCount: 3
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
visible: text.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: NotificationService.formatTimestamp(timestamp)
|
text: NotificationService.formatTimestamp(timestamp)
|
||||||
font.pointSize: Style.fontSizeXS * scaling
|
font.pointSize: Style.fontSizeXS * scaling
|
||||||
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mOnSurface
|
color: notificationMouseArea.containsMouse ? Color.mSurface : Color.mOnSurface
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trash icon button
|
// Delete button
|
||||||
NIconButton {
|
NIconButton {
|
||||||
icon: "delete"
|
icon: "delete"
|
||||||
tooltipText: "Delete notification"
|
tooltipText: "Delete notification"
|
||||||
sizeRatio: 0.7
|
sizeRatio: 0.7
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Logger.log("NotificationHistory", "Removing notification:", summary)
|
Logger.log("NotificationHistory", "Removing notification:", summary)
|
||||||
|
|
@ -185,7 +189,7 @@ NPanel {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: notificationMouseArea
|
id: notificationMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.rightMargin: Style.marginL * 3 * scaling
|
anchors.rightMargin: Style.marginXL * scaling
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue