import QtQuick import QtQuick.Layouts import "../constants" import "../services" Row { id: root property string artist: "" property string title: "" property string artUrl: "" property int maxTextLength: 50 // if the artist - title text is too long, truncate it readonly property string displayText: { const fullText = artist !== "" ? (artist + " - " + title) : title return fullText.length > maxTextLength ? fullText.substring(0, maxTextLength - 3) + "..." : fullText } visible: title !== "" spacing: 6 //TODO add service that reads the data from cava // the fifo buffer is in /tmp/cava.fifo. Example data is: // 5;3;3;3;2;1;1;3;6;18;42;16;6;6;1;1;2;6;2;3;6;6;5;11;11;12;13;66;4;4;24;2;2;24;4;4;66;13;12;11;11;5;6;6;3;2;3;2;1;1;6;6;16;42;19;5;2;1;1;2;3;4;3;7; // where each number represents the amplitude of a frequency band. // this can be used to create a simple visualizer // also add cava to autostart Canvas { // implicitWidth: parent.implicitWidth // implicitHeight: parent.implicitHeight // anchors.fill: parent } CavaService { id: cavaService onCavaDataChanged: { // TODO update the canvas with the new data // console.log("Cava data changed: " + data) } } Image { width: 18 height: 18 source: root.artUrl fillMode: Image.PreserveAspectCrop anchors.verticalCenter: parent.verticalCenter } Text { text: root.displayText color: Colors.md3.primary font.family: Constants.fontFamily font.pixelSize: Constants.fontSize anchors.verticalCenter: parent.verticalCenter z: 1 } }