Skip to content

Commit

Permalink
Add new notification counter properties for gui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTrahearn-Qinetic committed Jan 15, 2025
1 parent a08a5fb commit 9e67a27
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ Rectangle {
right: rightSideRow.right
verticalCenter: parent.verticalCenter
}

// TODO: do we nean to use Global.notifications.numberOfActiveWarnings?

enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alert && !alarmButton.enabled
backgroundColor: Theme.color_warning
//% "Acknowledge alerts"
Expand All @@ -228,6 +231,9 @@ Rectangle {
right: rightSideRow.right
verticalCenter: parent.verticalCenter
}

// TODO: do we nean to use Global.notifications.numberOfActiveAlarms?

enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm
backgroundColor: Theme.color_critical_background
icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
Expand Down
40 changes: 40 additions & 0 deletions data/Notifications.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ QtObject {
sortFunction: root._notificationSortFunction
}

// TODO: no longer relevant for gui-v2
readonly property bool alarm: !!_alarm.value
readonly property bool alert: !!_alert.value

readonly property bool numberOfActiveAlarms: !!_numberOfActiveAlarms.value
readonly property bool numberOfActiveWarnings: !!_numberOfActiveWarnings.value
readonly property bool numberOfActiveInformations: !!_numberOfActiveInformations.value
readonly property bool numberOfUnsilencedAlarms: !!_numberOfUnsilencedAlarms.value
readonly property bool numberOfUnsilencedWarnings: !!_numberOfUnsilencedWarnings.value
readonly property bool numerOfUnsilencedInformations: !!_numerOfUnsilencedInformations.value

signal silenceNotification(notificationId: int)

function reset() {
Expand All @@ -52,14 +60,46 @@ QtObject {
uid: root.serviceUid + "/SilenceAll"
}

// TODO: no longer relevant for gui-v2
readonly property VeQuickItem _alarm: VeQuickItem {
uid: root.serviceUid + "/Alarm"
}

// TODO: no longer relevant for gui-v2
readonly property VeQuickItem _alert: VeQuickItem {
uid: root.serviceUid + "/Alert"
}

readonly property VeQuickItem _numberOfActiveAlarms: VeQuickItem {
// including both silenced or unsilenced alarms
uid: root.serviceUid + "/NumberOfActiveAlarms"
}

readonly property VeQuickItem _numberOfActiveWarnings: VeQuickItem {
// including both silenced or unsilenced warnings
uid: root.serviceUid + "/NumberOfActiveWarnings"
}

readonly property VeQuickItem _numberOfActiveInformations: VeQuickItem {
// including both silenced or unsilenced warnings
uid: root.serviceUid + "/NumberOfActiveInformations"
}

readonly property VeQuickItem _numberOfUnsilencedAlarms: VeQuickItem {
// including both active or inactive alarms
uid: root.serviceUid + "/NumberOfUnsilenceAlarms"
}

readonly property VeQuickItem _numberOfUnsilencedWarnings: VeQuickItem {
// including both active or inactive warnings
uid: root.serviceUid + "/NumberOfUnsilencedWarnings"
}

readonly property VeQuickItem _numerOfUnsilencedInformations: VeQuickItem {
// including both active or inactive informations
uid: root.serviceUid + "/NumberOfUnsilencedInformations"
}

Component.onCompleted: {
Global.notifications = root
}
Expand Down
5 changes: 5 additions & 0 deletions pages/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ Item {
sourceComponent: swipeViewComponent
visible: swipeView && swipeView.ready && pageStack.swipeViewVisible && !(root.controlsActive && !controlsInAnimation.running && !controlsOutAnimation.running)
onLoaded: {

// TODO: review the use of Global.notifications.alarm here as this is no longer
// relevant to gui-v2. do we mean Global.notifications.numberOfActiveAlarms or
// do we need to include Global.notifications.numberOfActiveWarnings too?

// If there is an alarm, the notifications page will be shown; otherwise, show the
// application start page, if set.
if (Global.notifications.alarm) {
Expand Down

0 comments on commit 9e67a27

Please sign in to comment.