mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
notifications: fix dnd tooltip & silence sounds on do not disturb
This commit is contained in:
@@ -34,39 +34,18 @@ Item {
|
|||||||
buttonSize: 28
|
buttonSize: 28
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
|
onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb)
|
||||||
|
onEntered: {
|
||||||
Rectangle {
|
tooltipLoader.active = true
|
||||||
id: doNotDisturbTooltip
|
if (tooltipLoader.item) {
|
||||||
|
const p = mapToItem(null, width / 2, 0)
|
||||||
width: tooltipText.contentWidth + Theme.spacingS * 2
|
tooltipLoader.item.show(I18n.tr("Do Not Disturb"), p.x, p.y - 40, null)
|
||||||
height: tooltipText.contentHeight + Theme.spacingXS * 2
|
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: Theme.surfaceContainer
|
|
||||||
border.color: Theme.outline
|
|
||||||
border.width: 1
|
|
||||||
anchors.bottom: parent.top
|
|
||||||
anchors.bottomMargin: Theme.spacingS
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
visible: doNotDisturbButton.children[1].containsMouse
|
|
||||||
opacity: visible ? 1 : 0
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
id: tooltipText
|
|
||||||
|
|
||||||
text: I18n.tr("Do Not Disturb")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.surfaceText
|
|
||||||
font.weight: Font.Medium
|
|
||||||
anchors.centerIn: parent
|
|
||||||
font.hintingPreference: Font.PreferFullHinting
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onExited: {
|
||||||
|
if (tooltipLoader.item) {
|
||||||
|
tooltipLoader.item.hide()
|
||||||
|
}
|
||||||
|
tooltipLoader.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,4 +118,11 @@ Item {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: tooltipLoader
|
||||||
|
|
||||||
|
active: false
|
||||||
|
sourceComponent: DankTooltip {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,13 +342,13 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function playNormalNotificationSound() {
|
function playNormalNotificationSound() {
|
||||||
if (soundsAvailable && normalNotificationSound) {
|
if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb) {
|
||||||
normalNotificationSound.play()
|
normalNotificationSound.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function playCriticalNotificationSound() {
|
function playCriticalNotificationSound() {
|
||||||
if (soundsAvailable && criticalNotificationSound) {
|
if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb) {
|
||||||
criticalNotificationSound.play()
|
criticalNotificationSound.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user