Refactoring: move all apps inside a sub folder
CI / Release Gitea (push) Successful in 32s
CI / Vérifications et paquet (push) Successful in 47s

This commit is contained in:
stilobique committed 2026-11-08 14:28:28 +01:00
1 parent 33e4fe0c4e
commit b1ca2a7cff
41 files changed
+54 -45

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
import QtQuick 2.5
import "../Shared"
import "../Shared/Remote.js" as Remote
// Bouton navigable à la télécommande : surbrillance blanche quand il a le focus.
Rectangle {
id: root
property alias text: label.text
property bool primary: false
signal clicked()
implicitWidth: Math.max(160, label.implicitWidth + Theme.spacingL * 2)
implicitHeight: Theme.controlHeight
radius: Theme.radius
opacity: enabled ? 1 : 0.5
color: activeFocus ? Theme.focusBackground : (primary ? Theme.accent : Theme.surface)
scale: activeFocus ? 1.05 : 1
Behavior on scale { NumberAnimation { duration: Theme.animFast } }
Behavior on color { ColorAnimation { duration: Theme.animFast } }
Text {
id: label
anchors.centerIn: parent
color: root.activeFocus ? Theme.textOnFocus : Theme.text
font.pixelSize: Theme.fontBody
font.bold: root.activeFocus
}
Keys.onPressed: {
if (Remote.isAccept(event.key)) {
event.accepted = true;
root.clicked();
}
}
// Souris : pratique pour tester hors de la box.
MouseArea {
anchors.fill: parent
enabled: root.enabled
onClicked: {
root.forceActiveFocus();
root.clicked();
}
}
}
+12
View File
@@ -0,0 +1,12 @@
import QtQuick 2.5
import "../Shared"
// Panneau de gauche avec le logo, affiché sur tous les écrans de connexion.
Rectangle {
color: Theme.panel
Image {
anchors.centerIn: parent
source: "../icon.png"
}
}
+115
View File
@@ -0,0 +1,115 @@
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()
}
}
+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]);
}
}
}
}
+73
View File
@@ -0,0 +1,73 @@
import QtQuick 2.5
import "../Shared"
// Base de chaque écran : en-tête (titre + sous-titre) et zone de contenu.
// `navigator` et `session` sont injectés par le Navigator au chargement.
FocusScope {
id: page
property var navigator: null
property var session: null
// Élément qui reçoit le focus quand l'écran s'affiche.
property Item initialFocus: null
// true : masque le panneau du logo (écrans du catalogue).
property bool fullscreen: false
// Image de fond facultative (assombrie).
property alias backdrop: backdropImage.source
property alias title: titleText.text
property alias subtitle: subtitleText.text
default property alias content: body.data
Image {
id: backdropImage
anchors.fill: parent
visible: status === Image.Ready
fillMode: Image.PreserveAspectCrop
asynchronous: true
opacity: 0.25
}
Column {
id: header
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: Theme.pageMargin
}
spacing: Theme.spacingS
Text {
id: titleText
width: parent.width
color: Theme.text
font.pixelSize: Theme.fontTitle
font.bold: true
elide: Text.ElideRight
}
Text {
id: subtitleText
width: parent.width
visible: text !== ""
color: Theme.textMuted
font.pixelSize: Theme.fontBody
wrapMode: Text.WordWrap
}
}
Item {
id: body
anchors {
top: header.bottom
topMargin: Theme.spacingXL
left: parent.left
right: parent.right
bottom: parent.bottom
leftMargin: Theme.pageMargin
rightMargin: Theme.pageMargin
bottomMargin: Theme.pageMargin
}
}
}
+71
View File
@@ -0,0 +1,71 @@
import QtQuick 2.5
import "../Shared"
// Ligne de la liste des serveurs.
Rectangle {
id: root
property string name: ""
property string address: ""
property bool highlighted: false
signal clicked()
height: 72
radius: Theme.radius
color: highlighted ? Theme.focusBackground : Theme.surface
Behavior on color { ColorAnimation { duration: Theme.animFast } }
Rectangle {
id: icon
anchors {
left: parent.left
leftMargin: Theme.spacingM
verticalCenter: parent.verticalCenter
}
width: 40
height: 40
radius: width / 2
color: Theme.avatarColor(root.name)
Text {
anchors.centerIn: parent
text: root.name.charAt(0).toUpperCase()
color: Theme.text
font.pixelSize: Theme.fontBody
font.bold: true
}
}
Column {
anchors {
left: icon.right
leftMargin: Theme.spacingM
right: parent.right
rightMargin: Theme.spacingM
verticalCenter: parent.verticalCenter
}
Text {
width: parent.width
text: root.name
color: root.highlighted ? Theme.textOnFocus : Theme.text
font.pixelSize: Theme.fontBody
font.bold: true
elide: Text.ElideRight
}
Text {
width: parent.width
text: root.address
color: root.highlighted ? Theme.textOnFocusMuted : Theme.textMuted
font.pixelSize: Theme.fontSmall
elide: Text.ElideRight
}
}
MouseArea {
anchors.fill: parent
onClicked: root.clicked()
}
}
+75
View File
@@ -0,0 +1,75 @@
import QtQuick 2.5
import "../Shared"
// Champ de saisie avec libellé. Haut/Bas ne sont pas consommés par le TextInput
// et remontent donc jusqu'au KeyNavigation posé sur ce composant.
FocusScope {
id: root
property alias label: labelText.text
property alias text: input.text
property alias placeholder: placeholderText.text
property bool password: false
// Ex. Qt.ImhDigitsOnly pour demander un clavier numérique (si le système le gère).
property alias inputMethodHints: input.inputMethodHints
property alias validator: input.validator
property alias maximumLength: input.maximumLength
signal accepted()
implicitWidth: 400
implicitHeight: column.implicitHeight
MouseArea {
anchors.fill: parent
onClicked: input.forceActiveFocus()
}
Column {
id: column
width: parent.width
spacing: Theme.spacingS
Text {
id: labelText
visible: text !== ""
color: root.activeFocus ? Theme.text : Theme.textMuted
font.pixelSize: Theme.fontSmall
}
Rectangle {
width: parent.width
height: Theme.controlHeight
radius: Theme.radius
color: Theme.surface
border.width: 2
border.color: root.activeFocus ? Theme.accent : Theme.border
TextInput {
id: input
anchors {
fill: parent
leftMargin: Theme.spacingM
rightMargin: Theme.spacingM
}
focus: true
clip: true
verticalAlignment: TextInput.AlignVCenter
color: Theme.text
selectionColor: Theme.accent
font.pixelSize: Theme.fontBody
echoMode: root.password ? TextInput.Password : TextInput.Normal
onAccepted: root.accepted()
}
Text {
id: placeholderText
anchors.fill: input
visible: input.text === ""
verticalAlignment: Text.AlignVCenter
color: Theme.textMuted
font: input.font
elide: Text.ElideRight
}
}
}
}
+60
View File
@@ -0,0 +1,60 @@
import QtQuick 2.5
import "../Shared"
// Carte utilisateur (avatar rond + nom). `addCard` affiche la carte « Ajouter un compte ».
Item {
id: root
property string name: ""
property bool addCard: false
property bool highlighted: false
signal clicked()
width: 140
height: 200
Rectangle {
id: avatar
anchors.horizontalCenter: parent.horizontalCenter
y: Theme.spacingS
width: 120
height: 120
radius: width / 2
color: root.addCard ? Theme.surface : Theme.avatarColor(root.name)
border.width: root.highlighted ? 4 : 0
border.color: Theme.focusBackground
scale: root.highlighted ? 1.1 : 1
Behavior on scale { NumberAnimation { duration: Theme.animFast } }
Text {
anchors.centerIn: parent
text: root.addCard ? "+" : root.name.charAt(0).toUpperCase()
color: Theme.text
font.pixelSize: 48
font.bold: true
}
}
Text {
anchors {
top: avatar.bottom
topMargin: Theme.spacingL
left: parent.left
right: parent.right
}
text: root.name
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
maximumLineCount: 2
elide: Text.ElideRight
color: root.highlighted ? Theme.text : Theme.textMuted
font.pixelSize: Theme.fontBody
font.bold: root.highlighted
}
MouseArea {
anchors.fill: parent
onClicked: root.clicked()
}
}
+162
View File
@@ -0,0 +1,162 @@
import QtQuick 2.5
// Surface vidéo avec une interface unique, quel que soit le lecteur disponible :
// - "fbx" : VideoPlayer de libfbxqml (fbx.media) — absent du Freebox Player testé,
// conservé en premier choix au cas où, mais jamais vérifié ;
// - "qtmultimedia" : Video de QtMultimedia — c'est lui qui lit sur la box (HLS, reprise,
// pause et déplacement vérifiés ; positions en millisecondes).
// Les deux sont créés dynamiquement : un module absent ne fait pas échouer le chargement.
//
// position / duration en millisecondes ; playerState : "idle", "loading", "playing",
// "paused", "ended" ou "error". Les états bruts du lecteur sont écrits dans le log.
Item {
id: root
property string source: ""
property real position: 0
property real duration: 0
property string playerState: "idle"
property string errorString: ""
property string backendName: ""
signal ended()
property var _backend: null
property string _lastRaw: ""
function play() {
if (_backend)
_backend.play();
}
function pause() {
if (_backend)
_backend.pause();
}
function togglePause() {
if (playerState === "playing")
pause();
else
play();
}
function seek(ms) {
if (!_backend)
return;
var target = Math.max(0, duration > 0 ? Math.min(ms, duration - 1000) : ms);
console.log("Lecteur : déplacement à " + Math.round(target / 1000) + " s");
_backend.seek(target);
}
function stop() {
if (!_backend)
return;
_backend.stop();
if (backendName === "fbx" && _backend.close)
_backend.close();
}
function _create() {
var attempts = [
{ name: "fbx", qml: 'import QtQuick 2.5; import fbx.media 1.0; VideoPlayer { anchors.fill: parent }' },
{ name: "qtmultimedia", qml: 'import QtQuick 2.5; import QtMultimedia 5.0; '
+ 'Video { anchors.fill: parent; fillMode: VideoOutput.PreserveAspectFit }' }
];
for (var i = 0; i < attempts.length && !_backend; i++) {
try {
_backend = Qt.createQmlObject(attempts[i].qml, root, "VideoSurface-" + attempts[i].name);
backendName = attempts[i].name;
} catch (e) {
console.log("Lecteur " + attempts[i].name + " indisponible : " + e);
}
}
if (!_backend) {
_fail("Aucun lecteur vidéo disponible.");
return;
}
console.log("Lecteur vidéo : " + backendName);
if (backendName === "fbx" && _backend.error) {
_backend.error.connect(function (message, fatal) {
console.log("Lecteur fbx : erreur " + message + (fatal ? " (fatale)" : ""));
if (fatal)
_fail(String(message));
});
}
if (source !== "")
_open();
}
function _open() {
errorString = "";
playerState = "loading";
_backend.source = source;
_backend.play();
}
function _fail(message) {
errorString = message;
playerState = "error";
}
// Lecture périodique de l'état du lecteur (identique pour les deux backends).
function _poll() {
if (!_backend || playerState === "error")
return;
var raw;
if (backendName === "fbx") {
raw = "mediaState=" + _backend.mediaState + " playbackState=" + _backend.playbackState
+ " status=" + _backend.status;
position = _backend.position || 0;
duration = _backend.duration || 0;
var media = String(_backend.mediaState);
var playback = String(_backend.playbackState);
if (media === "ended")
_setState("ended");
else if (playback === "playing")
_setState("playing");
else if (playback === "paused")
_setState("paused");
else
_setState("loading");
} else {
// Valeurs de MediaPlayer : playbackState 1 = lecture, 2 = pause ;
// status 7 = fin du média, 8 = média invalide.
raw = "status=" + _backend.status + " playbackState=" + _backend.playbackState;
position = _backend.position || 0;
duration = _backend.duration > 0 ? _backend.duration : 0;
if (_backend.status === 8 || (_backend.errorString && _backend.error !== 0))
_fail(_backend.errorString || "Média illisible.");
else if (_backend.status === 7)
_setState("ended");
else if (_backend.playbackState === 1)
_setState(_backend.status === 4 || _backend.status === 5 ? "loading" : "playing");
else if (_backend.playbackState === 2)
_setState("paused");
}
if (raw !== _lastRaw) {
_lastRaw = raw;
console.log("Lecteur " + backendName + " : " + raw + " position=" + Math.round(position)
+ " durée=" + Math.round(duration));
}
}
function _setState(state) {
if (state === playerState)
return;
playerState = state;
if (state === "ended")
ended();
}
onSourceChanged: if (_backend && source !== "") _open()
Timer {
interval: 250
repeat: true
running: root._backend !== null && root.source !== ""
onTriggered: root._poll()
}
Component.onCompleted: _create()
Component.onDestruction: stop()
}
+9
View File
@@ -0,0 +1,9 @@
Page 1.0 Page.qml
FocusButton 1.0 FocusButton.qml
TextField 1.0 TextField.qml
ServerItem 1.0 ServerItem.qml
UserCard 1.0 UserCard.qml
Logo 1.0 Logo.qml
MediaCard 1.0 MediaCard.qml
MediaRow 1.0 MediaRow.qml
VideoSurface 1.0 VideoSurface.qml