camper/src/LoginPage.qml

131 lines
2.9 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Page {
id: page
title: qsTr("Login")
ColumnLayout {
anchors.centerIn: parent
GridLayout {
columns: 2
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: user
mnemonic: qsTr("&User:")
}
TextField {
id: user
Layout.fillWidth: true
focus: true
onAccepted: loginAction.trigger()
}
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: password
mnemonic: qsTr("&Password:")
}
TextField {
id: password
Layout.fillWidth: true
echoMode: TextInput.Password
onAccepted: loginAction.trigger()
}
}
Expander {
Layout.fillWidth: true
Layout.topMargin: 8
title: qsTr("&Advanced options")
GridLayout {
columns: 2
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: hostName
mnemonic: qsTr("&Host name:")
}
TextField {
id: hostName
Layout.fillWidth: true
onAccepted: loginAction.trigger()
}
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: port
mnemonic: qsTr("Por&t:")
}
SpinBox {
id: port
Layout.fillWidth: true
editable: true
from: 1
to: 65535
}
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: databaseName
mnemonic: qsTr("&Database name:")
}
TextField {
id: databaseName
Layout.fillWidth: true
onAccepted: loginAction.trigger()
}
MnemonicLabel {
Layout.alignment: Qt.AlignRight
buddy: connectOptions
mnemonic: qsTr("&Options:")
}
TextField {
id: connectOptions
Layout.fillWidth: true
onAccepted: loginAction.trigger()
}
}
}
Button {
Layout.alignment: Qt.AlignRight
action: loginAction
}
}
MnemonicAction {
id: loginAction
mnemonic: qsTr("Log &in")
onTriggered: function () {
Database.open(user.text, password.text);
}
}
}