Skip to content

Commit

Permalink
Refactor NotificationButton - don't override contentItem
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcInnes committed Aug 6, 2024
1 parent e576fdf commit d58c913
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions components/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,14 @@ Rectangle {
}

component NotificationButton : Button {
property alias contentItemChildren: row.children

leftPadding: Theme.geometry_silenceAlarmButton_horizontalPadding
rightPadding: Theme.geometry_silenceAlarmButton_horizontalPadding
height: Theme.geometry_notificationsPage_snoozeButton_height
radius: Theme.geometry_button_radius
opacity: enabled ? 1 : 0
font.family: Global.fontFamily
font.pixelSize: Theme.font_size_caption
Behavior on opacity { OpacityAnimator { duration: Theme.animation_toastNotification_fade_duration } }

contentItem: Row {
id: row

anchors.verticalCenter: parent.verticalCenter
spacing: Theme.geometry_notificationsPage_snoozeButton_spacing
}
}


Expand Down Expand Up @@ -119,14 +112,8 @@ Rectangle {
}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alert && !alarmButton.enabled
backgroundColor: Theme.color_warning

contentItemChildren: Label {
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Theme.font_size_caption
//% "Acknowledge alerts"
text: qsTrId("notifications_acknowledge_alerts")
}

//% "Acknowledge alerts"
text: qsTrId("notifications_acknowledge_alerts")
onClicked: Global.notifications.acknowledgeAll()
}

Expand All @@ -139,20 +126,10 @@ Rectangle {
}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm
backgroundColor: Theme.color_critical_background

contentItemChildren: [
CP.ColorImage {
anchors.verticalCenter: parent.verticalCenter
source: "qrc:/images/icon_alarm_snooze_24.svg"
color: Theme.color_font_primary
},
Label {
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Theme.font_size_caption
//% "Silence alarm"
text: qsTrId("notifications_silence_alarm")
}
]
display: C.AbstractButton.TextBesideIcon
icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
//% "Silence alarm"
text: qsTrId("notifications_silence_alarm")
onClicked: Global.notifications.acknowledgeAll()
}

Expand Down

0 comments on commit d58c913

Please sign in to comment.