Improve global notifications menu
- More descriptive menu entries - Indicate the current setting in the menu with a checkmark - Remove menu button tooltip that gets in the way - Remove unused icon
This commit is contained in:
@@ -67,24 +67,23 @@ Rectangle {
|
||||
backgroundColor: "transparent"
|
||||
|
||||
icon.name:
|
||||
window.notificationLevel === Window.NotificationLevel.All ?
|
||||
window.notificationLevel === Window.NotificationLevel.Enable ?
|
||||
"notifications-all" :
|
||||
|
||||
window.notificationLevel === Window.NotificationLevel.None ?
|
||||
window.notificationLevel === Window.NotificationLevel.Mute ?
|
||||
"notifications-none" :
|
||||
|
||||
"notifications-mentions-keywords"
|
||||
|
||||
icon.color:
|
||||
window.notificationLevel === Window.NotificationLevel.All ?
|
||||
window.notificationLevel === Window.NotificationLevel.Enable ?
|
||||
theme.icons.colorize :
|
||||
|
||||
window.notificationLevel === Window.NotificationLevel.None ?
|
||||
window.notificationLevel === Window.NotificationLevel.Mute ?
|
||||
theme.colors.negativeBackground :
|
||||
|
||||
theme.colors.middleBackground
|
||||
|
||||
toolTip.text: qsTr("Control global notifications")
|
||||
onClicked: notificationsMenu.open()
|
||||
|
||||
Layout.fillHeight: true
|
||||
@@ -94,29 +93,33 @@ Rectangle {
|
||||
y: parent.height
|
||||
|
||||
HMenuItem {
|
||||
icon.name: "notifications-all"
|
||||
text: qsTr("Normal notifications")
|
||||
text: qsTr("Enable notifications")
|
||||
checked:
|
||||
window.notificationLevel ===
|
||||
Window.NotificationLevel.Enable
|
||||
onTriggered:
|
||||
window.notificationLevel =
|
||||
Window.NotificationLevel.All
|
||||
Window.NotificationLevel.Enable
|
||||
}
|
||||
|
||||
HMenuItem {
|
||||
icon.name: "notifications-mentions-keywords"
|
||||
icon.color: theme.colors.middleBackground
|
||||
text: qsTr("Mentions & keywords")
|
||||
text: qsTr("Highlights only (replies, keywords...)")
|
||||
checked:
|
||||
window.notificationLevel ===
|
||||
Window.NotificationLevel.HighlightsOnly
|
||||
onTriggered:
|
||||
window.notificationLevel =
|
||||
Window.NotificationLevel.MentionsKeywords
|
||||
Window.NotificationLevel.HighlightsOnly
|
||||
}
|
||||
|
||||
HMenuItem {
|
||||
icon.name: "notifications-none"
|
||||
icon.color: theme.colors.negativeBackground
|
||||
text: qsTr("Nothing")
|
||||
text: qsTr("Mute all notifications")
|
||||
checked:
|
||||
window.notificationLevel ===
|
||||
Window.NotificationLevel.Mute
|
||||
onTriggered:
|
||||
window.notificationLevel =
|
||||
Window.NotificationLevel.None
|
||||
Window.NotificationLevel.Mute
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ QtObject {
|
||||
) {
|
||||
const level = window.notificationLevel
|
||||
|
||||
if (level === Window.NotificationLevel.None) return
|
||||
if (level === Window.MentionsKeywords && ! critical) return
|
||||
if (level === Window.NotificationLevel.Mute) return
|
||||
if (level === Window.HighlightsOnly && ! critical) return
|
||||
if (window.notifiedIds.has(id)) return
|
||||
|
||||
window.notifiedIds.add(id)
|
||||
|
@@ -10,7 +10,7 @@ import "PythonBridge"
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
|
||||
enum NotificationLevel { None, MentionsKeywords, All }
|
||||
enum NotificationLevel { Mute, HighlightsOnly, Enable }
|
||||
|
||||
// FIXME: Qt 5.13.1 bug, this randomly stops updating after the cursor
|
||||
// leaves the window until it's clicked again.
|
||||
@@ -21,7 +21,7 @@ ApplicationWindow {
|
||||
window.visibility === window.Minimized ||
|
||||
window.visibility === window.Hidden
|
||||
|
||||
property int notificationLevel: Window.NotificationLevel.All
|
||||
property int notificationLevel: Window.NotificationLevel.Enable
|
||||
property var notifiedIds: new Set()
|
||||
|
||||
property var mainUI: null
|
||||
|
Reference in New Issue
Block a user