Refactoring: move all apps inside a sub folder
This commit is contained in:
1 parent
33e4fe0c4e
commit
b1ca2a7cff
41 files changed
+54
-45
No files matched your search
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user