Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: Don't display 'acknowledge all' after clicking 'silenc… #1349

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ApplicationContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Item {

ScreenBlanker {
id: screenBlanker
enabled: !Global.splashScreenVisible && !(!!Global.notifications && Global.notifications.alert)
enabled: !Global.splashScreenVisible && !(!!Global.pageManager && Global.pageManager.statusBar.notificationButtonVisible)
displayOffTime: displayOffItem.isValid ? 1000*displayOffItem.value : 0.0
property VeQuickItem displayOffItem: VeQuickItem {
uid: !!Global.systemSettings ? Global.systemSettings.serviceUid + "/Settings/Gui/DisplayOff" : ""
Expand Down
53 changes: 52 additions & 1 deletion components/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Rectangle {

property int leftButton: VenusOS.StatusBar_LeftButton_None
property int rightButton: VenusOS.StatusBar_RightButton_None
property alias rightSideRow: rightSideRow
readonly property bool notificationButtonsEnabled: Global.mainView.currentPage && Global.mainView.currentPage.url.endsWith("NotificationsPage.qml")
readonly property bool notificationButtonVisible: alertButton.enabled || alertButton.animating || alarmButton.enabled || alarmButton.animating

property bool animationEnabled

Expand Down Expand Up @@ -55,6 +56,26 @@ Rectangle {
}
}

component NotificationButton : Button {
readonly property bool animating: animator.running

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 {
id: animator

duration: Theme.animation_toastNotification_fade_duration
}
}
}


StatusBarButton {
id: leftButton

Expand Down Expand Up @@ -90,6 +111,36 @@ Rectangle {
rightMargin: Theme.geometry_statusBar_rightSideRow_horizontalMargin
verticalCenter: parent.verticalCenter
}
width: Math.max(20, implicitWidth)
}

NotificationButton {
id: alertButton

anchors {
right: rightSideRow.right
verticalCenter: parent.verticalCenter
}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alert && !alarmButton.enabled
backgroundColor: Theme.color_warning
//% "Acknowledge alerts"
text: qsTrId("notifications_acknowledge_alerts")
onClicked: Global.notifications.acknowledgeAll()
}

NotificationButton {
id: alarmButton

anchors {
right: rightSideRow.right
verticalCenter: parent.verticalCenter
}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm
backgroundColor: Theme.color_critical_background
icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
//% "Silence alarm"
text: qsTrId("notifications_silence_alarm")
onClicked: Global.notifications.acknowledgeAll()
}

Row {
Expand Down
37 changes: 0 additions & 37 deletions pages/NotificationsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -160,41 +160,4 @@ SwipeViewPage {
spacing: Theme.geometry_gradientList_spacing
delegate: NotificationDelegate {}
}

Button {
parent: !!Global.pageManager ? Global.pageManager.statusBar.rightSideRow : root
leftPadding: Theme.geometry_silenceAlarmButton_horizontalPadding
rightPadding: Theme.geometry_silenceAlarmButton_horizontalPadding
height: Theme.geometry_notificationsPage_snoozeButton_height
radius: Theme.geometry_button_radius

enabled: !!Global.notifications && (Global.notifications.alarm || Global.notifications.alert) && root.isCurrentPage
opacity: enabled ? 1 : 0
Behavior on opacity { OpacityAnimator { duration: Theme.animation_toastNotification_fade_duration} }
backgroundColor: Global.notifications.alarm ? Theme.color_critical_background : Theme.color_warning

contentItem: Row {
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.geometry_notificationsPage_snoozeButton_spacing

CP.ColorImage {
anchors.verticalCenter: parent.verticalCenter
visible: Global.notifications.alarm
source: "qrc:/images/icon_alarm_snooze_24.svg"
color: Theme.color_font_primary
}

Label {
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Theme.font_size_caption
text: Global.notifications.alarm
//% "Silence alarm"
? qsTrId("notifications_silence_alarm")
//% "Acknowledge alerts"
: qsTrId("notifications_acknowledge_alerts")
}
}

onClicked: Global.notifications.acknowledgeAll()
}
}