parent
dbb1b08e58
commit
172c1a047d
2 changed files with 36 additions and 4 deletions
|
|
@ -78,6 +78,12 @@ StyledRect {
|
||||||
checked: GameMode.enabled
|
checked: GameMode.enabled
|
||||||
onClicked: GameMode.enabled = !GameMode.enabled
|
onClicked: GameMode.enabled = !GameMode.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toggle {
|
||||||
|
icon: "notifications_off"
|
||||||
|
checked: Notifs.dnd
|
||||||
|
onClicked: Notifs.dnd = !Notifs.dnd
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@ Singleton {
|
||||||
|
|
||||||
readonly property list<Notif> list: []
|
readonly property list<Notif> list: []
|
||||||
readonly property list<Notif> popups: list.filter(n => n.popup)
|
readonly property list<Notif> popups: list.filter(n => n.popup)
|
||||||
|
property alias dnd: props.dnd
|
||||||
|
|
||||||
|
PersistentProperties {
|
||||||
|
id: props
|
||||||
|
|
||||||
|
property bool dnd
|
||||||
|
|
||||||
|
reloadableId: "notifs"
|
||||||
|
}
|
||||||
|
|
||||||
NotificationServer {
|
NotificationServer {
|
||||||
id: server
|
id: server
|
||||||
|
|
@ -27,6 +36,7 @@ Singleton {
|
||||||
onNotification: notif => {
|
onNotification: notif => {
|
||||||
notif.tracked = true;
|
notif.tracked = true;
|
||||||
|
|
||||||
|
if (!props.dnd)
|
||||||
root.list.push(notifComp.createObject(root, {
|
root.list.push(notifComp.createObject(root, {
|
||||||
popup: true,
|
popup: true,
|
||||||
notification: notif
|
notification: notif
|
||||||
|
|
@ -50,6 +60,22 @@ Singleton {
|
||||||
for (const notif of root.list)
|
for (const notif of root.list)
|
||||||
notif.popup = false;
|
notif.popup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDndEnabled(): bool {
|
||||||
|
return props.dnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleDnd(): void {
|
||||||
|
props.dnd = !props.dnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableDnd(): void {
|
||||||
|
props.dnd = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function disableDnd(): void {
|
||||||
|
props.dnd = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component Notif: QtObject {
|
component Notif: QtObject {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue