Skip to content

Commit

Permalink
Disable ScreenBlanker while notification buttons are animating
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcInnes committed Aug 6, 2024
1 parent d58c913 commit 6d423dc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
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
18 changes: 14 additions & 4 deletions components/StatusBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import QtQuick
import QtQuick.Controls as C
import QtQuick.Controls.impl as CP
import Victron.VenusOS

Rectangle {
Expand All @@ -15,7 +14,8 @@ Rectangle {

property int leftButton: VenusOS.StatusBar_LeftButton_None
property int rightButton: VenusOS.StatusBar_RightButton_None
property bool notificationButtonsEnabled
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 @@ -57,14 +57,22 @@ 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 { duration: Theme.animation_toastNotification_fade_duration } }
Behavior on opacity {
OpacityAnimator {
id: animator

duration: Theme.animation_toastNotification_fade_duration
}
}
}


Expand Down Expand Up @@ -103,9 +111,12 @@ 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
Expand All @@ -126,7 +137,6 @@ Rectangle {
}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm
backgroundColor: Theme.color_critical_background
display: C.AbstractButton.TextBesideIcon
icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
//% "Silence alarm"
text: qsTrId("notifications_silence_alarm")
Expand Down
3 changes: 0 additions & 3 deletions components/SwipePageModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ObjectModel {
readonly property bool showLevelsPage: tankCount > 0 || environmentInputCount > 0
readonly property bool tankCount: Global.tanks ? Global.tanks.totalTankCount : 0
readonly property bool environmentInputCount: Global.environmentInputs ? Global.environmentInputs.model.count : 0
readonly property alias notificationsPage: _notificationsPage

property bool _completed: false
readonly property Component levelsPage: Component {
Expand All @@ -27,8 +26,6 @@ ObjectModel {
}

NotificationsPage {
id: _notificationsPage

view: root.view
}

Expand Down
1 change: 0 additions & 1 deletion pages/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ Item {
rightButton: !!root.currentPage ? root.currentPage.topRightButton : VenusOS.StatusBar_RightButton_None
animationEnabled: BackendConnection.applicationVisible
color: root.backgroundColor
notificationButtonsEnabled: swipePageModel.notificationsPage.isCurrentPage

onLeftButtonClicked: {
switch (leftButton) {
Expand Down

0 comments on commit 6d423dc

Please sign in to comment.