From 7577b3a2e6e2502b0c7d75fb5707c6be470ebd1a Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Thu, 15 Oct 2020 17:04:53 +0200 Subject: [PATCH] feat: allow users to turn of notification sounds --- .../AppLayouts/Profile/Sections/NotificationsContainer.qml | 5 ++++- ui/main.qml | 3 +++ ui/shared/status/StatusChatInput.qml | 1 + ui/sounds/ErrorSound.qml | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml b/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml index caad9574ae..e02808fba7 100644 --- a/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/NotificationsContainer.qml @@ -131,7 +131,10 @@ ScrollView { StatusSwitch { Layout.alignment: Qt.AlignRight - checked: true + checked: appSettings.notificationSoundsEnabled + onCheckedChanged: { + appSettings.notificationSoundsEnabled = this.checked + } } } diff --git a/ui/main.qml b/ui/main.qml index f32902e79e..6173daeaa4 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -54,6 +54,7 @@ ApplicationWindow { audioRole: Audio.NotificationRole source: "../../../../sounds/send_message.wav" volume: appSettings.volume + muted: !appSettings.notificationSoundsEnabled } Audio { @@ -61,6 +62,7 @@ ApplicationWindow { audioRole: Audio.NotificationRole source: "../../../../sounds/notification.wav" volume: appSettings.volume + muted: !appSettings.notificationSoundsEnabled } signal settingsLoaded() @@ -77,6 +79,7 @@ ApplicationWindow { property var recentEmojis: [] property real volume: 0.2 property int notificationSetting: 0 + property bool notificationSoundsEnabled: true } Connections { target: profileModel diff --git a/ui/shared/status/StatusChatInput.qml b/ui/shared/status/StatusChatInput.qml index 7fdf1995af..cd26cfa396 100644 --- a/ui/shared/status/StatusChatInput.qml +++ b/ui/shared/status/StatusChatInput.qml @@ -54,6 +54,7 @@ Rectangle { id: sendMessageSound source: "../../sounds/send_message.wav" volume: appSettings.volume + muted: !appSettings.notificationSoundsEnabled } function calculateExtraHeightFactor() { diff --git a/ui/sounds/ErrorSound.qml b/ui/sounds/ErrorSound.qml index 2ea957c9f5..d381907bf5 100644 --- a/ui/sounds/ErrorSound.qml +++ b/ui/sounds/ErrorSound.qml @@ -5,7 +5,8 @@ Audio { id: errorSound source: "./error.mp3" audioRole: Audio.NotificationRole - volume: 0.2 + volume: appSettings.volume + muted: !appSettings.notificationSoundsEnabled } /*##^##