Add keybinds to control global notifications

Alt+M: toggle "mute all notifications except highlights"
Alt+Shift+M: toggle "mute all notifications"

The Keys.Rooms.(previous/next)_highlight keybinds, previously bound to
Alt+(Shift+)M (stood for "mention") now defaults to Alt+(Shift+)H.

The NotificationLevel enum and notificationLevel property had to be
moved from Window to UI due to QML having a global "Window" object that
causes conflicts when trying to access the enum as
"Window.NotificationLevel" from UI.qml.
This commit is contained in:
miruka
2021-02-28 10:53:19 -04:00
parent 93ced92cda
commit d7fbe8c222
6 changed files with 55 additions and 31 deletions

View File

@@ -67,19 +67,19 @@ Rectangle {
backgroundColor: "transparent"
icon.name:
window.notificationLevel === Window.NotificationLevel.Enable ?
mainUI.notificationLevel === UI.NotificationLevel.Enable ?
"notifications-all" :
window.notificationLevel === Window.NotificationLevel.Mute ?
mainUI.notificationLevel === UI.NotificationLevel.Mute ?
"notifications-none" :
"notifications-mentions-keywords"
icon.color:
window.notificationLevel === Window.NotificationLevel.Enable ?
mainUI.notificationLevel === UI.NotificationLevel.Enable ?
theme.icons.colorize :
window.notificationLevel === Window.NotificationLevel.Mute ?
mainUI.notificationLevel === UI.NotificationLevel.Mute ?
theme.colors.negativeBackground :
theme.colors.middleBackground
@@ -95,31 +95,29 @@ Rectangle {
HMenuItem {
text: qsTr("Enable notifications")
checked:
window.notificationLevel ===
Window.NotificationLevel.Enable
mainUI.notificationLevel ===
UI.NotificationLevel.Enable
onTriggered:
window.notificationLevel =
Window.NotificationLevel.Enable
mainUI.notificationLevel =
UI.NotificationLevel.Enable
}
HMenuItem {
text: qsTr("Highlights only (replies, keywords...)")
checked:
window.notificationLevel ===
Window.NotificationLevel.HighlightsOnly
mainUI.notificationLevel ===
UI.NotificationLevel.HighlightsOnly
onTriggered:
window.notificationLevel =
Window.NotificationLevel.HighlightsOnly
mainUI.notificationLevel =
UI.NotificationLevel.HighlightsOnly
}
HMenuItem {
text: qsTr("Mute all notifications")
checked:
window.notificationLevel ===
Window.NotificationLevel.Mute
mainUI.notificationLevel === UI.NotificationLevel.Mute
onTriggered:
window.notificationLevel =
Window.NotificationLevel.Mute
mainUI.notificationLevel = UI.NotificationLevel.Mute
}
}
}