Files
stilobique b1ca2a7cff
CI / Release Gitea (push) Successful in 32s
CI / Vérifications et paquet (push) Successful in 47s
Refactoring: move all apps inside a sub folder
2026-11-08 14:28:28 +01:00

116 lines
3.2 KiB
QML

import QtQuick 2.5
import "../Shared"
// Carte du catalogue : image (affiche ou vignette), titre, sous-titre, avancement.
Item {
id: card
property string title: ""
property string subtitle: ""
property url imageSource: ""
property int imageHeight: Theme.posterHeight
property real progress: 0
property bool played: false
property bool highlighted: false
property bool showText: true
signal clicked()
height: imageHeight + (showText ? Theme.cardTextHeight : 0)
z: highlighted ? 1 : 0
Rectangle {
id: frame
width: parent.width
height: card.imageHeight
radius: Theme.radius
color: Theme.surface
border.width: card.highlighted ? 3 : 0
border.color: Theme.focusBackground
scale: card.highlighted ? 1.06 : 1
Behavior on scale { NumberAnimation { duration: Theme.animFast } }
// Initiale tant que l'image n'est pas chargée (ou absente).
Text {
anchors.centerIn: parent
visible: image.status !== Image.Ready
text: card.title.charAt(0).toUpperCase()
color: Theme.textMuted
font.pixelSize: 48
font.bold: true
}
Image {
id: image
anchors.fill: parent
anchors.margins: frame.border.width
source: card.imageSource
fillMode: Image.PreserveAspectCrop
asynchronous: true
clip: true
sourceSize.height: card.imageHeight
}
Rectangle {
visible: card.progress > 0.01 && !card.played
anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: 8 }
height: 4
radius: 2
color: "#99000000"
Rectangle {
width: parent.width * Math.min(1, card.progress)
height: parent.height
radius: 2
color: Theme.accent
}
}
Rectangle {
visible: card.played
anchors { top: parent.top; right: parent.right; margins: 8 }
width: playedText.implicitWidth + Theme.spacingS * 2
height: playedText.implicitHeight + 4
radius: height / 2
color: Theme.accent
Text {
id: playedText
anchors.centerIn: parent
text: "VU"
color: Theme.text
font.pixelSize: 11
font.bold: true
}
}
}
Column {
visible: card.showText
anchors { top: frame.bottom; topMargin: Theme.spacingS; left: parent.left; right: parent.right }
Text {
width: parent.width
text: card.title
elide: Text.ElideRight
color: card.highlighted ? Theme.text : Theme.textMuted
font.pixelSize: Theme.fontSmall + 1
font.bold: card.highlighted
}
Text {
width: parent.width
visible: text !== ""
text: card.subtitle
elide: Text.ElideRight
color: Theme.textMuted
font.pixelSize: Theme.fontSmall - 1
}
}
MouseArea {
anchors.fill: parent
onClicked: card.clicked()
}
}