Add basic behavior to play, show catalog and more basic feature

This commit is contained in:
stilobique committed 2026-11-08 12:06:15 +01:00
1 parent df847becc8
commit 8e6392a84c
17 files changed
+1455 -34

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
import QtQuick 2.5
import "../Shared"
import "../Shared/Remote.js" as Remote
import "../Shared/Format.js" as Format
// Rangée horizontale de cartes avec un titre (accueil, saisons…).
// `items` : éléments aplatis par Session._toItem().
FocusScope {
id: row
property string title: ""
property var items: []
property bool landscape: false
property var session: null
property alias currentIndex: list.currentIndex
signal activated(var item)
readonly property int cardWidth: landscape ? Theme.thumbWidth : Theme.posterWidth
readonly property int imageHeight: landscape ? Theme.thumbHeight : Theme.posterHeight
height: titleText.height + Theme.spacingM + imageHeight + Theme.cardTextHeight + Theme.spacingM
Text {
id: titleText
text: row.title
color: row.activeFocus ? Theme.text : Theme.textMuted
font.pixelSize: Theme.fontBody
font.bold: true
}
ListView {
id: list
anchors {
top: titleText.bottom
topMargin: Theme.spacingM
left: parent.left
right: parent.right
bottom: parent.bottom
}
orientation: ListView.Horizontal
spacing: Theme.spacingM
focus: true
// Marge pour la carte agrandie (scale) au bord gauche.
leftMargin: 8
rightMargin: 8
highlightMoveDuration: 150
model: row.items
delegate: MediaCard {
width: row.cardWidth
imageHeight: row.imageHeight
title: Format.cardTitle(modelData)
subtitle: Format.cardSubtitle(modelData)
imageSource: !row.session ? ""
: row.landscape ? row.session.thumbUrl(modelData)
: row.session.posterUrl(modelData)
progress: Format.progress(modelData)
played: modelData.played
highlighted: ListView.isCurrentItem && list.activeFocus
onClicked: {
list.currentIndex = index;
row.activated(modelData);
}
}
Keys.onPressed: {
if (Remote.isAccept(event.key) && currentIndex >= 0) {
event.accepted = true;
row.activated(row.items[currentIndex]);
}
}
}
}