diff --git a/Modules/Notifications/Center/NotificationHeader.qml b/Modules/Notifications/Center/NotificationHeader.qml index 9d0a7ef0..d3187676 100644 --- a/Modules/Notifications/Center/NotificationHeader.qml +++ b/Modules/Notifications/Center/NotificationHeader.qml @@ -34,39 +34,18 @@ Item { buttonSize: 28 anchors.verticalCenter: parent.verticalCenter onClicked: SessionData.setDoNotDisturb(!SessionData.doNotDisturb) - - Rectangle { - id: doNotDisturbTooltip - - width: tooltipText.contentWidth + Theme.spacingS * 2 - 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 + onEntered: { + tooltipLoader.active = true + if (tooltipLoader.item) { + const p = mapToItem(null, width / 2, 0) + tooltipLoader.item.show(I18n.tr("Do Not Disturb"), p.x, p.y - 40, null) } - - 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 {} + } } diff --git a/Services/AudioService.qml b/Services/AudioService.qml index cacf4915..eb7f8082 100644 --- a/Services/AudioService.qml +++ b/Services/AudioService.qml @@ -342,13 +342,13 @@ Singleton { } function playNormalNotificationSound() { - if (soundsAvailable && normalNotificationSound) { + if (soundsAvailable && normalNotificationSound && !SessionData.doNotDisturb) { normalNotificationSound.play() } } function playCriticalNotificationSound() { - if (soundsAvailable && criticalNotificationSound) { + if (soundsAvailable && criticalNotificationSound && !SessionData.doNotDisturb) { criticalNotificationSound.play() } }