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

@@ -6,12 +6,22 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
import QtGraphicalEffects 1.12
import "."
import "Base"
import "MainPane"
Item {
id: mainUI
enum NotificationLevel { Mute, HighlightsOnly, Enable }
property int notificationLevel:
settings.Notifications.start_level === "highlights_only" ?
UI.NotificationLevel.HighlightsOnly :
settings.Notifications.start_level === "mute" ?
UI.NotificationLevel.Mute :
UI.NotificationLevel.Enable
property bool accountsPresent:
ModelStore.get("accounts").count > 0 || py.startupAnyAccountsSaved
@@ -78,6 +88,25 @@ Item {
}
}
HShortcut {
sequences: window.settings.Keys.notifications_highlights_only
onActivated:
mainUI.notificationLevel =
mainUI.notificationLevel ===
UI.NotificationLevel.HighlightsOnly ?
UI.NotificationLevel.Enable :
UI.NotificationLevel.HighlightsOnly
}
HShortcut {
sequences: window.settings.Keys.notifications_mute
onActivated:
mainUI.notificationLevel =
mainUI.notificationLevel === UI.NotificationLevel.Mute ?
UI.NotificationLevel.Enable :
UI.NotificationLevel.Mute
}
FontMetrics {
id: fontMetrics
font.family: theme.fontFamily.sans