Spectral/qml/Login.qml

151 lines
4.3 KiB
QML
Raw Normal View History

2018-07-12 01:44:41 +00:00
import QtQuick 2.9
import QtQuick.Layouts 1.3
2018-02-23 14:39:14 +00:00
import QtGraphicalEffects 1.0
2018-07-12 01:44:41 +00:00
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
2018-02-26 12:41:20 +00:00
import Qt.labs.settings 1.0
2018-02-23 14:39:14 +00:00
import "qrc:/qml/component"
Page {
2018-02-27 11:07:50 +00:00
property var controller
2018-02-26 12:41:20 +00:00
2018-02-23 14:39:14 +00:00
Row {
anchors.fill: parent
Pane {
width: parent.width / 2
height: parent.height
background: Item {
Image {
id: background
anchors.fill: parent
source: "qrc:/asset/img/background.jpg"
fillMode: Image.PreserveAspectCrop
}
ColorOverlay {
anchors.fill: background
source: background
2018-03-01 13:21:09 +00:00
color: Material.accent
opacity: 0.7
2018-02-23 14:39:14 +00:00
}
}
Column {
x: 32
anchors.verticalCenter: parent.verticalCenter
Label {
text: "MATRIX LOGIN."
2018-08-01 15:49:47 +00:00
font.pointSize: 28
2018-02-23 14:39:14 +00:00
font.bold: true
color: "white"
}
Label {
text: "A NEW METHOD OF MESSAGING"
font.pointSize: 12
color: "white"
}
}
}
Pane {
width: parent.width / 2
height: parent.height
padding: 64
ColumnLayout {
id: mainCol
width: parent.width
2018-02-23 14:39:14 +00:00
2018-07-09 02:45:26 +00:00
// ImageStatus {
// Layout.preferredWidth: 96
// Layout.preferredHeight: 96
// Layout.alignment: Qt.AlignHCenter
2018-07-09 02:45:26 +00:00
// source: "qrc:/asset/img/avatar.png"
// }
2018-02-23 14:39:14 +00:00
2018-02-27 11:37:53 +00:00
TextField {
id: serverField
Layout.fillWidth: true
2018-02-27 11:37:53 +00:00
leftPadding: 16
topPadding: 0
bottomPadding: 0
placeholderText: "Server"
2018-02-27 11:37:53 +00:00
background: Rectangle {
implicitHeight: 48
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
2018-02-27 11:37:53 +00:00
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
2018-02-27 11:07:50 +00:00
}
2018-02-27 11:37:53 +00:00
}
2018-02-27 11:07:50 +00:00
2018-02-27 11:37:53 +00:00
TextField {
id: usernameField
Layout.fillWidth: true
2018-02-27 11:37:53 +00:00
leftPadding: 16
topPadding: 0
bottomPadding: 0
placeholderText: "Username"
2018-02-27 11:37:53 +00:00
background: Rectangle {
implicitHeight: 48
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
2018-02-27 11:37:53 +00:00
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
2018-02-23 14:39:14 +00:00
}
}
TextField {
id: passwordField
Layout.fillWidth: true
2018-02-23 14:39:14 +00:00
leftPadding: 16
topPadding: 0
bottomPadding: 0
placeholderText: "Password"
echoMode: TextInput.Password
2018-02-23 14:39:14 +00:00
background: Rectangle {
implicitHeight: 48
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
2018-02-23 14:39:14 +00:00
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
Button {
id: loginButton
Layout.fillWidth: true
2018-02-26 12:41:20 +00:00
text: "LOGIN"
highlighted: true
2018-02-26 12:41:20 +00:00
onClicked: {
matriqueController.isLoginChanged.connect( function() {
if (matriqueController.isLogin) stackView.replace(roomPage)
})
controller.loginWithCredentials(serverField.text, usernameField.text, passwordField.text)
}
2018-02-26 12:41:20 +00:00
}
2018-02-23 14:39:14 +00:00
}
}
}
}