-
Notifications
You must be signed in to change notification settings - Fork 11
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
Notifications: Don't display 'acknowledge all' after clicking 'silenc… #1349
Conversation
pages/NotificationsPage.qml
Outdated
onClicked: Global.notifications.acknowledgeAll() | ||
onClicked: { | ||
// break bindings so that color, text and image don't change while fading out | ||
backgroundColor = backgroundColor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this cause problems the next time an alarm or alert occurs, and the binding is required again?
Would it be easier to create two separate buttons, one for alerts and one for alarms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does cause problems. Updated as suggested.
06240a9
to
ce6985f
Compare
ce6985f
to
9e1645b
Compare
components/NotificationButton.qml
Outdated
right: parent ? parent.rightSideRow.right : undefined | ||
verticalCenter: parent.verticalCenter | ||
} | ||
parent: !!Global.pageManager ? Global.pageManager.statusBar : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The button used to be parented to Global.pageManager.statusBar.rightSideRow
, I had to change to to Global.pageManager.statusBar
and anchor it to the RHS of Global.pageManager.statusBar.rightSideRow
, as Row
doesn't re-layout itself in a timely manner when its children's visibility changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if other buttons (aside from Display Sleep etc) get added to the rightSideRow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to add other stuff to rightSideRow, we will have to revisit this. It would depend how the new button is supposed to behave.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving the buttons to StatusBar.qml
and defining the NotificationButton component inline (like how StatusBarButton
is defined there)? That way the buttons are defined directly within the layout in StatusBar.qml, and we wouldn't need awkward alias properties like Global.pageManager.statusBar.rightSideRow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In mock mode, I pressed Shift+N to generate a new alarm. gui-v2 jumped to the Notifications page and showed the "Silence alarms" button, but then it quickly disappeared and was replaced by "Acknowledge alerts". I think I'd expect "Silence alarms" to take precedence if both alerts and alarms are present.
Also, if I click "Silence alarms" or "Acknowledge alerts", the button jumps slightly to the left before it disappears.
components/NotificationButton.qml
Outdated
opacity: enabled ? 1 : 0 | ||
Behavior on opacity { OpacityAnimator { duration: Theme.animation_toastNotification_fade_duration } } | ||
|
||
contentItem: Row { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button
already supports showing an icon and text side-by-side, so it should be possible to do:
NotificationButton {
icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
text: "Silence alarm"
}
instead of overriding the contentItem
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated as suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the side effect of the button text color changing while the button is pressed, as per our default Button behaviour. Looks ok to me.
components/NotificationButton.qml
Outdated
right: parent ? parent.rightSideRow.right : undefined | ||
verticalCenter: parent.verticalCenter | ||
} | ||
parent: !!Global.pageManager ? Global.pageManager.statusBar : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving the buttons to StatusBar.qml
and defining the NotificationButton component inline (like how StatusBarButton
is defined there)? That way the buttons are defined directly within the layout in StatusBar.qml, and we wouldn't need awkward alias properties like Global.pageManager.statusBar.rightSideRow.
Re. the "Silence alarms" button disappearing and being replaced by "Acknowledge alerts", I saw this as well, it is caused by a timer in the mock NotificationsImpl that sets Re. the button jumping slightly to the left, I don't see this. I'm hoping it is caused by the mock timers deactivating alarms - would you mind disabling the mock timers and checking again? |
It still occurs. But if it doesn't occur with real alarms on device/wasm, then it LGTM. |
e4a941b
to
89d9231
Compare
I managed to reproduce this on a cerbo. Fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well, some minor comments. LGTM
components/StatusBar.qml
Outdated
} | ||
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm | ||
backgroundColor: Theme.color_critical_background | ||
display: C.AbstractButton.TextBesideIcon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TextBesideIcon
is the default, so this is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
components/StatusBar.qml
Outdated
Rectangle { | ||
anchors.fill: rightSideRow | ||
color: "pink" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, whoops.
components/StatusBar.qml
Outdated
@@ -14,7 +15,8 @@ Rectangle { | |||
|
|||
property int leftButton: VenusOS.StatusBar_LeftButton_None | |||
property int rightButton: VenusOS.StatusBar_RightButton_None | |||
property alias rightSideRow: rightSideRow | |||
property bool notificationButtonsEnabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the value of notificationButtonsEnabled
can just be set from within StatusBar.qml (e.g. if it could find the current page url somehow to check whether it's the NotificationsPage.qml) to avoid needing to set this from MainView.qml and needing the extra property in SwipePageModel. But no big deal either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated as suggested
components/StatusBar.qml
Outdated
@@ -5,6 +5,7 @@ | |||
|
|||
import QtQuick | |||
import QtQuick.Controls as C | |||
import QtQuick.Controls.impl as CP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
7457eb4
to
09eab2c
Compare
…e alarm'
Fixes #1348