lena_pi/LenaPi/MusicPlayer.qml
2021-09-26 21:49:21 +02:00

84 lines
2.2 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 2.4
import QtGraphicalEffects 1.0
Item{
id: container
property int margins: 20
RoundImageButton{
id: backNavigation
anchors.left: parent.left
anchors.top: parent.top
anchors.margins: container.margins
onClicked: {
musicModel.navigateBack();
}
}
RoundImageButton{
id: closeAppButton
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: visible ? container.margins : 0
visible: container.height > 500 && uiStateModel.pShowQuitAppButton
diameter: visible ? defaultDiameter : 0
imageSource: "qrc:/icon_close"
onClicked: {
Qt.quit();
}
}
Rectangle{
id: coverBorder
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: container.margins
height: parent.height-controlPannel.height-2*container.margins
width: height
color: "blue"
Image{
id: cover
anchors.centerIn: parent
height: parent.height-10
width: height
source: musicModel.pCurrentItem.pImageSource
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask{
maskSource: coverBorder
}
}
}
VolumeSlider{
id: volumeSlider
visible: uiStateModel.pShowVolumeControls
anchors{
right: parent.right
top: closeAppButton.bottom
bottom: controlPannel.top
margins: container.margins
topMargin: closeAppButton.visible ? 2*container.margins : container.margins
}
from: 34 // we cannot hear anything if lower than 35%
to: 100
stepSize: 1
value: musicModel.pAudioVolume
onValueChanged: {
musicModel.pAudioVolume = value;
}
}
PlayerControlPannel {
id: controlPannel
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
model: musicModel
margins: container.margins
}
}