From 4d1254934569c210a806bcd651993647e30f751c Mon Sep 17 00:00:00 2001 From: Mike Trahearn Date: Mon, 10 Feb 2025 11:04:39 +1000 Subject: [PATCH] StatusBar bell is now a warning triangle; NotificationBar removed --- CMakeLists.txt | 1 - components/StatusBar.qml | 28 ++++++++++++---- components/StatusBarNotificationIndicator.qml | 33 ------------------- data/Notifications.qml | 20 ++++------- 4 files changed, 27 insertions(+), 55 deletions(-) delete mode 100644 components/StatusBarNotificationIndicator.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 2992abbc1..330c7c790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,7 +257,6 @@ set (VENUS_QML_MODULE_SOURCES components/SolarYieldModel.qml components/SplashView.qml components/StatusBar.qml - components/StatusBarNotificationIndicator.qml components/SwipePageModel.qml components/SwipeViewPage.qml components/SystemReason.qml diff --git a/components/StatusBar.qml b/components/StatusBar.qml index 2c7c7a19c..ab6a1f8a3 100644 --- a/components/StatusBar.qml +++ b/components/StatusBar.qml @@ -94,8 +94,8 @@ Rectangle { : "qrc:/images/icon_back_32.svg" enabled: !!Global.pageManager - && Global.pageManager.interactivity === VenusOS.PageManager_InteractionMode_Interactive - && root.leftButton != VenusOS.StatusBar_LeftButton_None + && Global.pageManager.interactivity === VenusOS.PageManager_InteractionMode_Interactive + && root.leftButton != VenusOS.StatusBar_LeftButton_None onClicked: root.leftButtonClicked() } @@ -189,10 +189,26 @@ Rectangle { } CP.IconImage { + id: notificationIcon + + readonly property color iconColor: Global.notifications?.statusBarNotifcationIconPriority === VenusOS.Notification_Alarm + ? Theme.color_critical + : Global.notifications?.statusBarNotifcationIconPriority === VenusOS.Notification_Warning + ? Theme.color_warning : notificationIcon.color + + // Latch the color so it doesn't change while fading out + onIconColorChanged: color = iconColor + anchors.verticalCenter: parent.verticalCenter - color: Theme.color_font_primary - source: "qrc:/images/notifications.svg" - visible: Global.notifications?.showNotificationBell ?? false + source: "qrc:/images/icon_warning_32.svg" + opacity: Global.notifications?.statusBarNotifcationIconVisible ? 1 : 0 + visible: opacity > 0 + + Behavior on opacity { + OpacityAnimator { + duration: Theme.animation_page_fade_duration + } + } } } @@ -279,6 +295,4 @@ Rectangle { onClicked: Global.screenBlanker.setDisplayOff() } } - - StatusBarNotificationIndicator { } } diff --git a/components/StatusBarNotificationIndicator.qml b/components/StatusBarNotificationIndicator.qml deleted file mode 100644 index 8c0961920..000000000 --- a/components/StatusBarNotificationIndicator.qml +++ /dev/null @@ -1,33 +0,0 @@ -/* -** Copyright (C) 2023 Victron Energy B.V. -** See LICENSE.txt for license information. -*/ - -import QtQuick -import Victron.VenusOS - -Rectangle { - id: root - - width: parent.width - height: 5 - - readonly property color notificationBarColor: Global.notifications?.highestPriortyUnsilenced === VenusOS.Notification_Alarm - ? Theme.color_critical - : Global.notifications?.highestPriortyUnsilenced === VenusOS.Notification_Warning - ? Theme.color_warning - : Global.notifications?.highestPriortyUnsilenced === VenusOS.Notification_Info - ? Theme.color_ok - : root.color - - // Latch the color so it doesn't change while fading out - onNotificationBarColorChanged: color = notificationBarColor - opacity: Global.notifications?.showNotificationBar ? 1 : 0 - visible: opacity > 0 - - Behavior on opacity { - OpacityAnimator { - duration: Theme.animation_page_fade_duration - } - } -} diff --git a/data/Notifications.qml b/data/Notifications.qml index 33e87757e..1da4f5e07 100644 --- a/data/Notifications.qml +++ b/data/Notifications.qml @@ -111,20 +111,12 @@ QtObject { warnings.hasUnsilenced || informations.hasUnsilenced - readonly property int highestPriortyUnsilenced: alarms.hasUnsilenced ? VenusOS.Notification_Alarm : - warnings.hasUnsilenced ? VenusOS.Notification_Warning : - informations.hasUnsilenced ? VenusOS.Notification_Info - : -1 - - readonly property bool showNotificationBar: alarms.hasUnsilenced || - warnings.hasUnsilenced || - (informations.hasUnsilenced && informations.hasActive) - - readonly property bool showNotificationBell: (alarms.hasActive || - !alarms.hasActive && alarms.hasUnsilenced) || - (warnings.hasActive || - !warnings.hasActive && warnings.hasUnsilenced) || - (informations.hasActive && informations.hasUnsilenced) + readonly property int statusBarNotifcationIconPriority: alarms.hasUnsilenced ? VenusOS.Notification_Alarm : + warnings.hasUnsilenced ? VenusOS.Notification_Warning : -1 + + readonly property bool statusBarNotifcationIconVisible: (alarms.hasActive || !alarms.hasActive && alarms.hasUnsilenced) || + (warnings.hasActive || !warnings.hasActive && warnings.hasUnsilenced) + component NotificationData: QtObject { property int activeCount: 0 property int unsilencedCount: 0