Added volume slider and mute bbutton to audio player, closed #45
This commit is contained in:
@@ -215,9 +215,8 @@ Window {
|
||||
|
||||
Page {
|
||||
anchors.fill: parent
|
||||
leftPadding: 5
|
||||
rightPadding: 5
|
||||
bottomPadding: 5
|
||||
leftPadding: 10
|
||||
bottomPadding: 10
|
||||
|
||||
header: MenuBar {
|
||||
id: topBar
|
||||
@@ -359,16 +358,18 @@ Window {
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 20
|
||||
spacing: 10
|
||||
|
||||
ColumnLayout {
|
||||
Layout.maximumWidth: 250
|
||||
|
||||
TextField {
|
||||
id: textFieldSearch
|
||||
Layout.preferredHeight: 39
|
||||
Layout.topMargin: 5
|
||||
enabled: false
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
|
||||
placeholderText: qsTr("Search")
|
||||
onTextChanged: {
|
||||
refreshList()
|
||||
@@ -417,16 +418,14 @@ Window {
|
||||
|
||||
TabBar {
|
||||
id: tabBar
|
||||
width: parent.width
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
TabButton {
|
||||
text: qsTr("Signal")
|
||||
text: qsTr("SIGNAL")
|
||||
}
|
||||
|
||||
TabButton {
|
||||
text: qsTr("Filter")
|
||||
text: qsTr("FILTERS")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,6 +447,7 @@ Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,6 +213,8 @@ Page {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
GridLayout {
|
||||
rows: 2
|
||||
|
||||
@@ -67,10 +67,10 @@ Window {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 15
|
||||
anchors.leftMargin: 15
|
||||
anchors.bottomMargin: 15
|
||||
anchors.topMargin: 15
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -168,6 +168,8 @@ Page {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
Label {
|
||||
id: signalName
|
||||
|
||||
@@ -34,10 +34,10 @@ Page {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 20
|
||||
anchors.leftMargin: 20
|
||||
anchors.bottomMargin: 20
|
||||
anchors.topMargin: 20
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
Image {
|
||||
id: imageBox
|
||||
|
||||
@@ -79,10 +79,10 @@ Page {
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 20
|
||||
anchors.leftMargin: 20
|
||||
anchors.bottomMargin: 20
|
||||
anchors.topMargin: 20
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
|
||||
@@ -38,10 +38,10 @@ Page {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 20
|
||||
anchors.leftMargin: 20
|
||||
anchors.bottomMargin: 20
|
||||
anchors.topMargin: 20
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
Image {
|
||||
id: imageBox
|
||||
|
||||
@@ -120,10 +120,10 @@ Page {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 20
|
||||
anchors.leftMargin: 20
|
||||
anchors.bottomMargin: 20
|
||||
anchors.topMargin: 20
|
||||
anchors.rightMargin: 10
|
||||
anchors.leftMargin: 10
|
||||
anchors.bottomMargin: 10
|
||||
anchors.topMargin: 10
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
|
||||
@@ -7,8 +7,8 @@ import QtMultimedia
|
||||
|
||||
|
||||
Item {
|
||||
width: 200
|
||||
height: 80
|
||||
width: 180
|
||||
height: 132
|
||||
|
||||
property bool loop: false
|
||||
|
||||
@@ -28,7 +28,7 @@ Item {
|
||||
buttonPause.enabled = true
|
||||
buttonStop.enabled = true
|
||||
buttonLoop.enabled = true
|
||||
playerPosition.enabled = player.seekable
|
||||
positionSlider.enabled = player.seekable
|
||||
player.play()
|
||||
}
|
||||
|
||||
@@ -65,10 +65,12 @@ Item {
|
||||
buttonPause.enabled = false
|
||||
buttonStop.enabled = false
|
||||
buttonLoop.enabled = false
|
||||
playerPosition.enabled = false
|
||||
positionSlider.enabled = false
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
RowLayout {
|
||||
spacing: 0
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
@@ -83,6 +85,10 @@ Item {
|
||||
onClicked: playSound()
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
id: buttonPause
|
||||
icon.color: Material.foreground
|
||||
@@ -93,6 +99,10 @@ Item {
|
||||
onClicked: pauseSound()
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
id: buttonStop
|
||||
icon.color: Material.foreground
|
||||
@@ -103,6 +113,10 @@ Item {
|
||||
onClicked: stopSound()
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
id: buttonLoop
|
||||
icon.color: Material.foreground
|
||||
@@ -122,21 +136,43 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: playerPosition
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.preferredHeight: 20
|
||||
enabled: player.seekable
|
||||
value: player.duration > 0 ? player.position / player.duration : 0
|
||||
onMoved: {
|
||||
player.position = player.duration * playerPosition.position
|
||||
RowLayout {
|
||||
Slider {
|
||||
id: positionSlider
|
||||
Layout.preferredHeight: 20
|
||||
enabled: player.seekable
|
||||
value: player.duration > 0 ? player.position / player.duration : 0
|
||||
Layout.fillWidth: true
|
||||
onMoved: {
|
||||
player.position = player.duration * positionSlider.position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Slider {
|
||||
id: volumeSlider
|
||||
Layout.preferredHeight: 20
|
||||
value: 0.5
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
id: buttonMute
|
||||
icon.color: Material.foreground
|
||||
icon.source: "qrc:/images/icons/player_mute.svg"
|
||||
display: AbstractButton.IconOnly
|
||||
enabled: true
|
||||
flat: true
|
||||
onClicked: {
|
||||
volumeSlider.value = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MediaPlayer {
|
||||
id: player
|
||||
audioOutput: audioOutput
|
||||
|
||||
onPlaybackStateChanged: {
|
||||
if (player.playbackState === MediaPlayer.StoppedState) {
|
||||
if (loop) {
|
||||
@@ -150,7 +186,7 @@ Item {
|
||||
|
||||
AudioOutput {
|
||||
id: audioOutput
|
||||
//volume: volumeSlider.value
|
||||
volume: volumeSlider.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user