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,82 @@
|
||||
import QtQuick 2.5
|
||||
import "../Components"
|
||||
import "../Shared"
|
||||
|
||||
// Écran 2 : saisie manuelle de l'adresse d'un serveur.
|
||||
// Le clavier virtuel de la box n'a ni « : » ni « / » : on saisit l'hôte seul, le port
|
||||
// à part (facultatif), et Session détecte le protocole (https/http) et le port.
|
||||
Page {
|
||||
id: page
|
||||
|
||||
property bool busy: false
|
||||
property string error: ""
|
||||
|
||||
title: "Ajouter un serveur"
|
||||
subtitle: "Saisissez l'adresse IP ou le nom de domaine de votre serveur Jellyfin. Le protocole et le port sont détectés automatiquement."
|
||||
initialFocus: addressField
|
||||
|
||||
function connect() {
|
||||
if (busy)
|
||||
return;
|
||||
error = "";
|
||||
busy = true;
|
||||
page.session.connectToServer(addressField.text, portField.text, function (err) {
|
||||
page.busy = false;
|
||||
if (err) {
|
||||
page.error = err;
|
||||
var port = portField.text.trim();
|
||||
(port !== "" && !page.session.isValidPort(port) ? portField : 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: "192.168.1.20 ou jellyfin.example.com"
|
||||
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
|
||||
KeyNavigation.down: portField
|
||||
onAccepted: portField.forceActiveFocus()
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: portField
|
||||
width: 200
|
||||
label: "Port (facultatif)"
|
||||
placeholder: "Auto"
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
validator: RegExpValidator { regExp: /\d{0,5}/ }
|
||||
maximumLength: 5
|
||||
KeyNavigation.up: addressField
|
||||
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 ? "Recherche du serveur…" : "Se connecter"
|
||||
KeyNavigation.up: portField
|
||||
onClicked: page.connect()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user