2024-07-08 16:08:21 +02:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Window
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Window {
|
2024-07-09 12:36:14 +02:00
|
|
|
SystemPalette { id: systemColors; colorGroup: SystemPalette.Active }
|
|
|
|
|
2024-07-08 16:08:21 +02:00
|
|
|
id: root
|
|
|
|
width: 640
|
|
|
|
height: 480
|
|
|
|
visible: true
|
|
|
|
|
|
|
|
title: qsTr("Jukebox")
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: topbar
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
height: 50
|
2024-07-09 12:36:14 +02:00
|
|
|
color: systemColors.window
|
2024-07-08 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: mainSection
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
top: topbar.bottom
|
|
|
|
bottom: bottomBar.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
2024-07-09 12:36:14 +02:00
|
|
|
color: systemColors.window
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
AudioInfoBox {
|
|
|
|
id: firstSong
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
margins: 20
|
|
|
|
}
|
|
|
|
|
|
|
|
songIndex: 0
|
|
|
|
title: "The Record"
|
|
|
|
authorName: "Boygenius"
|
|
|
|
imageSource: "Assets/Images/Boygenius_-_the_record.jpg"
|
|
|
|
}
|
|
|
|
|
|
|
|
AudioInfoBox {
|
|
|
|
id: secondSong
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
margins: 20
|
|
|
|
}
|
|
|
|
|
|
|
|
songIndex: 1
|
|
|
|
title: "Desire, I Want to Turn Into You"
|
|
|
|
authorName: "Caroline Polachek"
|
2024-07-09 15:24:12 +02:00
|
|
|
imageSource: "Assets/Images/Boygenius_-_the_record.jpg"
|
2024-07-08 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
AudioInfoBox {
|
|
|
|
id: thirdSong
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
margins: 20
|
|
|
|
}
|
|
|
|
|
|
|
|
songIndex: 2
|
|
|
|
title: "Softscars"
|
|
|
|
authorName: "Yeule"
|
2024-07-09 15:24:12 +02:00
|
|
|
imageSource: "Assets/Images/Boygenius_-_the_record.jpg"
|
2024-07-08 16:08:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: bottomBar
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
height: 100
|
2024-07-09 12:36:14 +02:00
|
|
|
color: systemColors.window
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
id: previousButton
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
horizontalCenterOffset: -70
|
|
|
|
}
|
|
|
|
|
2024-07-09 15:24:12 +02:00
|
|
|
source: "Assets/Images/Boygenius_-_the_record.jpgg"
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
onClicked: playerController.switchToPreviousSong()
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
id: playPauseButton
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
2024-07-09 15:24:12 +02:00
|
|
|
source: playerController.playing ? "Assets/Images/Boygenius_-_the_record.jpg" : "Assets/Images/Boygenius_-_the_record.jpg"
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
onClicked: playerController.playPause()
|
|
|
|
}
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
id: nextButton
|
|
|
|
|
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
horizontalCenterOffset: 70
|
|
|
|
}
|
|
|
|
|
2024-07-09 15:24:12 +02:00
|
|
|
source: "Assets/Images/Boygenius_-_the_record.jpg"
|
2024-07-08 16:08:21 +02:00
|
|
|
|
|
|
|
onClicked: playerController.switchToNextSong()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: playerController
|
|
|
|
|
|
|
|
property int currentSongIndex: 0
|
|
|
|
property int songCount: 4
|
|
|
|
property bool playing: true
|
|
|
|
|
|
|
|
function playPause() {
|
|
|
|
playing = !playing
|
|
|
|
if (playing) {
|
|
|
|
fourthSong.video.play()
|
|
|
|
} else {
|
|
|
|
fourthSong.video.pause()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchToNextSong() {
|
|
|
|
currentSongIndex = (currentSongIndex + 1) % songCount
|
|
|
|
console.log(currentSongIndex)
|
|
|
|
}
|
|
|
|
|
|
|
|
function switchToPreviousSong() {
|
|
|
|
if (currentSongIndex == 0) currentSongIndex = songCount;
|
|
|
|
currentSongIndex = (currentSongIndex - 1) % songCount
|
|
|
|
console.log(currentSongIndex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|