From 1aba28b1cf9ce75b28016dcde44750243a3396ca Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Thu, 17 Sep 2020 12:18:16 +0200 Subject: [PATCH] uiux(Settings): add slider to control audio volume Closes #843 --- .../AppLayouts/Chat/ChatColumn/ChatInput.qml | 2 +- .../Profile/Sections/SoundsContainer.qml | 31 ++++++++++++++++--- ui/main.qml | 4 ++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatInput.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatInput.qml index 591416019c..d4ae20fe5b 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatInput.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatInput.qml @@ -23,7 +23,7 @@ Rectangle { Audio { id: sendMessageSound source: "../../../../sounds/send_message.wav" - volume: 0.2 + volume: appSettings.volume } function interpretMessage(msg) { diff --git a/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml b/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml index 5479528363..1049d1c4d4 100644 --- a/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/SoundsContainer.qml @@ -3,13 +3,14 @@ import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import "../../../../imports" import "../../../../shared" +import "../../../../shared/status" Item { id: soundsContainer - width: 200 - height: 200 - Layout.fillHeight: true - Layout.fillWidth: true + anchors.right: parent.right + anchors.rightMargin: contentMargin + anchors.left: parent.left + anchors.leftMargin: contentMargin StyledText { id: element5 @@ -22,4 +23,26 @@ Item { font.weight: Font.Bold font.pixelSize: 20 } + + StyledText { + id: labelVolume + anchors.top: element5.bottom + anchors.topMargin: Style.current.bigPadding + text: qsTrId("Sound volume") + " " + volume.value + font.pixelSize: 15 + } + + StatusSlider { + id: volume + anchors.top: labelVolume.bottom + anchors.topMargin: Style.current.padding + minimumValue: 0.0 + maximumValue: 1.0 + value: appSettings.volume + stepSize: 0.1 + onValueChanged: { + appSettings.volume = volume.value + } + } + } diff --git a/ui/main.qml b/ui/main.qml index 96c09add90..fa42804620 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -47,13 +47,14 @@ ApplicationWindow { id: sendMessageSound audioRole: Audio.NotificationRole source: "../../../../sounds/send_message.wav" + volume: appSettings.volume } Audio { id: notificationSound audioRole: Audio.NotificationRole source: "../../../../sounds/notification.wav" - volume: 0.2 + volume: appSettings.volume } signal settingsLoaded() @@ -68,6 +69,7 @@ ApplicationWindow { property bool compactMode property string locale: "en" property var recentEmojis: [] + property real volume: 0.2 } Connections { target: profileModel