From d58c91320cefc90a9712410eeb234ce36650cc15 Mon Sep 17 00:00:00 2001 From: Daniel McInnes Date: Wed, 31 Jul 2024 16:11:06 +1000 Subject: [PATCH] Refactor NotificationButton - don't override contentItem --- components/StatusBar.qml | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/components/StatusBar.qml b/components/StatusBar.qml index 56bd22f41..927990545 100644 --- a/components/StatusBar.qml +++ b/components/StatusBar.qml @@ -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 - } } @@ -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() } @@ -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() }