Add all view
This commit is contained in:
1 parent
186cff1d73
commit
49d8524597
18 files changed
+1007
-98
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// Panneau de gauche avec le logo, affiché sur tous les écrans de connexion.
|
||||
Rectangle {
|
||||
color: Theme.panel
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: "../icon.png"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// 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
|
||||
|
||||
property alias title: titleText.text
|
||||
property alias subtitle: subtitleText.text
|
||||
default property alias content: body.data
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.5
|
||||
|
||||
// Correspondance des touches de la télécommande Freebox.
|
||||
// Plusieurs codes sont acceptés tant que le mapping exact sur la box n'est pas vérifié.
|
||||
QtObject {
|
||||
function isAccept(key) {
|
||||
return key === Qt.Key_Return || key === Qt.Key_Enter || key === Qt.Key_Select;
|
||||
}
|
||||
|
||||
function isBack(key) {
|
||||
return key === Qt.Key_Back || key === Qt.Key_Escape;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// Ligne de la liste des serveurs.
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property string name: ""
|
||||
property string address: ""
|
||||
property bool discovered: false
|
||||
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: root.discovered ? tag.left : 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
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: tag
|
||||
visible: root.discovered
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Theme.spacingM
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
width: tagText.implicitWidth + Theme.spacingM
|
||||
height: tagText.implicitHeight + Theme.spacingS
|
||||
radius: height / 2
|
||||
color: Theme.accentAlt
|
||||
|
||||
Text {
|
||||
id: tagText
|
||||
anchors.centerIn: parent
|
||||
text: "Réseau local"
|
||||
color: Theme.text
|
||||
font.pixelSize: Theme.fontSmall
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.clicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// 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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.5
|
||||
|
||||
// Couleurs, tailles et animations partagées par toute l'application.
|
||||
QtObject {
|
||||
// Couleurs (inspirées de la palette Jellyfin)
|
||||
readonly property color background: "#101010"
|
||||
readonly property color panel: "#000B25"
|
||||
readonly property color surface: "#202020"
|
||||
readonly property color border: "#3A3A3A"
|
||||
readonly property color focusBackground: "#FFFFFF"
|
||||
readonly property color text: "#FFFFFF"
|
||||
readonly property color textMuted: "#A0A0A0"
|
||||
readonly property color textOnFocus: "#101010"
|
||||
readonly property color textOnFocusMuted: "#505050"
|
||||
readonly property color accent: "#00A4DC"
|
||||
readonly property color accentAlt: "#AA5CC3"
|
||||
readonly property color error: "#FF5252"
|
||||
readonly property var avatarColors: ["#AA5CC3", "#00A4DC", "#E67E22", "#27AE60", "#C0392B", "#2C3E50"]
|
||||
|
||||
// Espacements
|
||||
readonly property int pageMargin: 48
|
||||
readonly property int spacingS: 8
|
||||
readonly property int spacingM: 16
|
||||
readonly property int spacingL: 24
|
||||
readonly property int spacingXL: 40
|
||||
|
||||
// Typographie
|
||||
readonly property int fontSmall: 14
|
||||
readonly property int fontBody: 18
|
||||
readonly property int fontTitle: 32
|
||||
readonly property int fontCode: 56
|
||||
|
||||
// Contrôles
|
||||
readonly property int controlHeight: 48
|
||||
readonly property int radius: 6
|
||||
readonly property int animFast: 120
|
||||
|
||||
// Couleur stable dérivée d'un nom (avatars, icônes de serveur).
|
||||
function avatarColor(name) {
|
||||
var hash = 0;
|
||||
for (var i = 0; i < name.length; i++)
|
||||
hash = (hash * 31 + name.charCodeAt(i)) % 100000;
|
||||
return avatarColors[hash % avatarColors.length];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import QtQuick 2.5
|
||||
import "."
|
||||
|
||||
// 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
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
singleton Theme 1.0 Theme.qml
|
||||
singleton Remote 1.0 Remote.qml
|
||||
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
|
||||
Reference in new issue
Block a user