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,24 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
|
||||
// Écran d'accueil provisoire : confirme la connexion en attendant la vraie bibliothèque.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
title: page.session && page.session.currentUser
|
||||
? "Bonjour " + page.session.currentUser.name
|
||||
: "Accueil"
|
||||
subtitle: page.session && page.session.currentServer
|
||||
? "Connecté à " + page.session.currentServer.name + "."
|
||||
: ""
|
||||
initialFocus: logoutButton
|
||||
|
||||
FocusButton {
|
||||
id: logoutButton
|
||||
text: "Se déconnecter"
|
||||
onClicked: {
|
||||
page.session.logout();
|
||||
page.navigator.reset("UserSelect");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import QtQuick 2.5
|
||||
|
||||
Column {
|
||||
// Liste des labels et types
|
||||
property var fields: [
|
||||
{label: "Server", type: "text"},
|
||||
{label: "User", type: "text"},
|
||||
{label: "Password", type: "password"}
|
||||
]
|
||||
|
||||
property int currentIndex: 0
|
||||
|
||||
id: columnLogin
|
||||
|
||||
//anchors.centerIn: parent
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.margins: 20
|
||||
spacing: 15
|
||||
width: parent.width * 0.8
|
||||
|
||||
function updateSelection() {
|
||||
for (let i = 0; i < repeater.count; i++) {
|
||||
repeater.itemAt(i).color = i === columnLogin.currentIndex ? "lightblue" : "transparent";
|
||||
}
|
||||
}
|
||||
|
||||
// Repeater pour générer les champs basés sur la liste des labels et types
|
||||
Repeater {
|
||||
model: fields
|
||||
|
||||
Row {
|
||||
spacing: 10
|
||||
|
||||
Text {
|
||||
width: parent.width / 2 - 5
|
||||
text: modelData.label + ":"
|
||||
color: "white"
|
||||
font.pixelSize: 16
|
||||
}
|
||||
|
||||
// TextInput pour les champs Server et User, et mode Password pour Password
|
||||
Rectangle {
|
||||
width: 200
|
||||
height: 20
|
||||
color: "white"
|
||||
//border.color: "black"
|
||||
//border.width: 3
|
||||
//radius: 5
|
||||
|
||||
TextInput {
|
||||
font.pixelSize: 16
|
||||
color: "black"
|
||||
text: modelData.label
|
||||
|
||||
// Détermine le mode de saisie en fonction du type
|
||||
echoMode: modelData.type === "password" ? TextInput.Password : TextInput.Normal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.key === Qt.Key_Up) {
|
||||
if (currentIndex > 0) {
|
||||
currentIndex--;
|
||||
updateSelection();
|
||||
}
|
||||
} else if (event.key == Qt.Key_Down) {
|
||||
if (currentIndex < repeater.children.length - 1) {
|
||||
currentIndex++;
|
||||
updateSelection()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
|
||||
// Écran 4 : connexion par mot de passe ou par Quick Connect.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property string username: ""
|
||||
property bool quickConnect: false
|
||||
property string quickConnectCode: ""
|
||||
property bool busy: false
|
||||
property string error: ""
|
||||
|
||||
title: quickConnect ? "Quick Connect" : "Se connecter"
|
||||
subtitle: page.session && page.session.currentServer
|
||||
? "Serveur : " + page.session.currentServer.name
|
||||
: ""
|
||||
initialFocus: username !== "" ? passwordField : usernameField
|
||||
|
||||
function signIn() {
|
||||
if (busy)
|
||||
return;
|
||||
error = "";
|
||||
busy = true;
|
||||
page.session.authenticate(usernameField.text, passwordField.text, function (err) {
|
||||
page.busy = false;
|
||||
if (err) {
|
||||
page.error = err;
|
||||
(usernameField.text.trim() === "" ? usernameField : passwordField).forceActiveFocus();
|
||||
return;
|
||||
}
|
||||
// Réinitialise la pile : Retour ne doit pas revenir à l'écran de connexion.
|
||||
page.navigator.reset("Home");
|
||||
});
|
||||
}
|
||||
|
||||
function setQuickConnect(enabled) {
|
||||
error = "";
|
||||
quickConnect = enabled;
|
||||
if (enabled) {
|
||||
quickConnectCode = page.session.startQuickConnect();
|
||||
passwordModeButton.forceActiveFocus();
|
||||
} else {
|
||||
page.initialFocus.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: if (page.session) page.session.cancel()
|
||||
|
||||
Column {
|
||||
id: passwordForm
|
||||
visible: !page.quickConnect
|
||||
width: Math.min(parent.width, 560)
|
||||
spacing: Theme.spacingL
|
||||
|
||||
TextField {
|
||||
id: usernameField
|
||||
width: parent.width
|
||||
label: "Nom d'utilisateur"
|
||||
text: page.username
|
||||
KeyNavigation.down: passwordField
|
||||
onAccepted: passwordField.forceActiveFocus()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: passwordField
|
||||
width: parent.width
|
||||
label: "Mot de passe"
|
||||
password: true
|
||||
KeyNavigation.up: usernameField
|
||||
KeyNavigation.down: signInButton
|
||||
onAccepted: page.signIn()
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
visible: text !== ""
|
||||
text: page.error
|
||||
color: Theme.error
|
||||
font.pixelSize: Theme.fontBody
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: Theme.spacingM
|
||||
|
||||
FocusButton {
|
||||
id: signInButton
|
||||
primary: true
|
||||
text: page.busy ? "Connexion…" : "Se connecter"
|
||||
KeyNavigation.up: passwordField
|
||||
KeyNavigation.right: quickConnectButton
|
||||
onClicked: page.signIn()
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: quickConnectButton
|
||||
text: "Utiliser Quick Connect"
|
||||
KeyNavigation.up: passwordField
|
||||
KeyNavigation.left: signInButton
|
||||
onClicked: page.setQuickConnect(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: quickConnectPanel
|
||||
visible: page.quickConnect
|
||||
width: Math.min(parent.width, 560)
|
||||
spacing: Theme.spacingL
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
text: "Depuis un appareil déjà connecté, ouvrez Quick Connect dans les paramètres de votre compte Jellyfin et saisissez ce code :"
|
||||
color: Theme.textMuted
|
||||
font.pixelSize: Theme.fontBody
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Text {
|
||||
text: page.quickConnectCode
|
||||
color: Theme.accent
|
||||
font.pixelSize: Theme.fontCode
|
||||
font.bold: true
|
||||
font.letterSpacing: 8
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "En attente d'autorisation…"
|
||||
color: Theme.textMuted
|
||||
font.pixelSize: Theme.fontSmall
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: passwordModeButton
|
||||
text: "Utiliser un mot de passe"
|
||||
onClicked: page.setQuickConnect(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import QtQuick 2.5
|
||||
|
||||
// Display the logo
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
color: "#000B25"
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: "../icon.png"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
|
||||
// Écran 2 : saisie manuelle de l'adresse d'un serveur.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property bool busy: false
|
||||
property string error: ""
|
||||
|
||||
title: "Ajouter un serveur"
|
||||
subtitle: "Saisissez l'adresse de votre serveur Jellyfin, par exemple 192.168.1.20:8096."
|
||||
initialFocus: addressField
|
||||
|
||||
function connect() {
|
||||
if (busy)
|
||||
return;
|
||||
error = "";
|
||||
busy = true;
|
||||
page.session.connectToServer(addressField.text, function (err) {
|
||||
page.busy = false;
|
||||
if (err) {
|
||||
page.error = err;
|
||||
addressField.forceActiveFocus();
|
||||
return;
|
||||
}
|
||||
// Remplace cet écran : Retour depuis la liste des utilisateurs ramène aux serveurs.
|
||||
page.navigator.replace("UserSelect");
|
||||
});
|
||||
}
|
||||
|
||||
Component.onDestruction: if (page.session) page.session.cancel()
|
||||
|
||||
Column {
|
||||
width: Math.min(parent.width, 560)
|
||||
spacing: Theme.spacingL
|
||||
|
||||
TextField {
|
||||
id: addressField
|
||||
width: parent.width
|
||||
label: "Adresse du serveur"
|
||||
placeholder: "http://192.168.1.20:8096"
|
||||
KeyNavigation.down: connectButton
|
||||
onAccepted: page.connect()
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
visible: text !== ""
|
||||
text: page.error
|
||||
color: Theme.error
|
||||
font.pixelSize: Theme.fontBody
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: connectButton
|
||||
primary: true
|
||||
text: page.busy ? "Connexion…" : "Se connecter"
|
||||
KeyNavigation.up: addressField
|
||||
onClicked: page.connect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
|
||||
// Écran 1 : choix d'un serveur enregistré ou découvert sur le réseau local.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
title: "Sélectionner un serveur"
|
||||
subtitle: serverList.count > 0
|
||||
? "Choisissez le serveur Jellyfin auquel vous connecter."
|
||||
: "Aucun serveur enregistré. Ajoutez l'adresse de votre serveur Jellyfin."
|
||||
initialFocus: serverList.count > 0 ? serverList : addButton
|
||||
|
||||
function openServer(index) {
|
||||
page.session.selectServer(index);
|
||||
page.navigator.push("UserSelect");
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: serverList
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: addButton.top
|
||||
bottomMargin: Theme.spacingL
|
||||
}
|
||||
clip: true
|
||||
spacing: Theme.spacingS
|
||||
model: page.session ? page.session.servers : null
|
||||
|
||||
delegate: ServerItem {
|
||||
width: serverList.width
|
||||
name: model.name
|
||||
address: model.address
|
||||
discovered: model.discovered
|
||||
highlighted: ListView.isCurrentItem && serverList.activeFocus
|
||||
onClicked: {
|
||||
serverList.currentIndex = index;
|
||||
page.openServer(index);
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (Remote.isAccept(event.key) && currentIndex >= 0) {
|
||||
event.accepted = true;
|
||||
page.openServer(currentIndex);
|
||||
}
|
||||
}
|
||||
// Laisse la ListView gérer Haut/Bas ; on ne sort qu'en bout de liste.
|
||||
KeyNavigation.priority: KeyNavigation.AfterItem
|
||||
KeyNavigation.down: addButton
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: addButton
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
text: "Ajouter un serveur"
|
||||
KeyNavigation.up: serverList.count > 0 ? serverList : null
|
||||
onClicked: page.navigator.push("ServerAdd")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
|
||||
// Écran 3 : choix de l'utilisateur parmi les comptes publics du serveur.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property var users: page.session ? page.session.publicUsers() : []
|
||||
property bool busy: false
|
||||
property string error: ""
|
||||
|
||||
title: "Qui regarde ?"
|
||||
subtitle: page.session && page.session.currentServer
|
||||
? page.session.currentServer.name + " · " + page.session.currentServer.address
|
||||
: ""
|
||||
initialFocus: userList
|
||||
|
||||
function openUser(index) {
|
||||
if (busy)
|
||||
return;
|
||||
// Dernière carte : « Ajouter un compte » → identifiant libre.
|
||||
if (index >= users.length) {
|
||||
page.navigator.push("Login");
|
||||
return;
|
||||
}
|
||||
var user = users[index];
|
||||
if (user.hasPassword) {
|
||||
page.navigator.push("Login", { username: user.name });
|
||||
return;
|
||||
}
|
||||
// Compte sans mot de passe : connexion directe, comme sur Android TV.
|
||||
error = "";
|
||||
busy = true;
|
||||
page.session.authenticate(user.name, "", function (err) {
|
||||
page.busy = false;
|
||||
if (err) {
|
||||
page.error = err;
|
||||
return;
|
||||
}
|
||||
page.navigator.reset("Home");
|
||||
});
|
||||
}
|
||||
|
||||
Component.onDestruction: if (page.session) page.session.cancel()
|
||||
|
||||
ListView {
|
||||
id: userList
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: 220
|
||||
orientation: ListView.Horizontal
|
||||
spacing: Theme.spacingL
|
||||
model: page.users.concat([{ name: "Ajouter un compte", add: true }])
|
||||
|
||||
delegate: UserCard {
|
||||
name: modelData.name
|
||||
addCard: modelData.add === true
|
||||
highlighted: ListView.isCurrentItem && userList.activeFocus
|
||||
onClicked: {
|
||||
userList.currentIndex = index;
|
||||
page.openUser(index);
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (Remote.isAccept(event.key) && currentIndex >= 0) {
|
||||
event.accepted = true;
|
||||
page.openUser(currentIndex);
|
||||
}
|
||||
}
|
||||
KeyNavigation.priority: KeyNavigation.AfterItem
|
||||
KeyNavigation.down: changeServerButton
|
||||
}
|
||||
|
||||
Text {
|
||||
id: statusText
|
||||
anchors {
|
||||
top: userList.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
visible: text !== ""
|
||||
text: page.busy ? "Connexion…" : page.error
|
||||
color: page.busy ? Theme.textMuted : Theme.error
|
||||
font.pixelSize: Theme.fontBody
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
FocusButton {
|
||||
id: changeServerButton
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
text: "Changer de serveur"
|
||||
KeyNavigation.up: userList
|
||||
onClicked: page.navigator.pop()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user