uiux(Settings): add slider to control audio volume

Closes #843
This commit is contained in:
Pascal Precht 2020-09-17 12:18:16 +02:00 committed by Iuri Matias
parent 02dcc106e4
commit 1aba28b1cf
3 changed files with 31 additions and 6 deletions

View File

@ -23,7 +23,7 @@ Rectangle {
Audio {
id: sendMessageSound
source: "../../../../sounds/send_message.wav"
volume: 0.2
volume: appSettings.volume
}
function interpretMessage(msg) {

View File

@ -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
}
}
}

View File

@ -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