mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-05 18:22:46 +00:00
Update UI to bare minimum to allow for core lib testing
This commit is contained in:
parent
56d7c1486e
commit
3cd1fd3e23
8 changed files with 206 additions and 12 deletions
|
@ -1,10 +1,14 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import nl.netsoj.chris.Jellyfin 1.0
|
||||
|
||||
import "../../components"
|
||||
import "../../.."
|
||||
|
||||
Page {
|
||||
property string loginMessage
|
||||
property StackView stackView: StackView.view
|
||||
header: ToolBar {
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
@ -20,11 +24,27 @@ Page {
|
|||
TextField {
|
||||
id: usernameField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Username")
|
||||
EnterKey.type: Qt.EnterKeyNext
|
||||
}
|
||||
TextField {
|
||||
id: passwordField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Password")
|
||||
echoMode: TextInput.Password
|
||||
}
|
||||
|
||||
Label {
|
||||
id: loginError
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("Invalid username/password")
|
||||
visible: false
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Login")
|
||||
onClicked: login()
|
||||
}
|
||||
Label {
|
||||
width: parent.width
|
||||
|
@ -32,4 +52,29 @@ Page {
|
|||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
BusyDialog {
|
||||
id: busyDialog
|
||||
anchors.centerIn: Overlay.overlay
|
||||
title: qsTr("Logging in as %1").arg(usernameField.text)
|
||||
}
|
||||
|
||||
function login() {
|
||||
busyDialog.open()
|
||||
ApiClient.authenticate(usernameField.text, passwordField.text, true)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ApiClient
|
||||
onAuthenticatedChanged: {
|
||||
busyDialog.close()
|
||||
if (authenticated) {
|
||||
stackView.replace(null, Qt.resolvedUrl("../MainPage.qml"), {})
|
||||
}
|
||||
}
|
||||
onAuthenticationError: {
|
||||
busyDialog.close()
|
||||
loginError.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue