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,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user