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-08-24 05:25:41 +00:00
|
|
|
import Matrique.Settings 0.1
|
|
|
|
|
2018-08-26 05:17:12 +00:00
|
|
|
import "component"
|
2018-02-23 14:39:14 +00:00
|
|
|
|
|
|
|
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
|
2018-08-14 06:45:32 +00:00
|
|
|
cache: false
|
2018-02-23 14:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2018-09-04 13:13:14 +00:00
|
|
|
|
2018-02-23 14:39:14 +00:00
|
|
|
padding: 64
|
|
|
|
|
2018-07-07 09:38:20 +00:00
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
2018-02-23 14:39:14 +00:00
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
id: mainCol
|
2018-07-07 09:38:20 +00:00
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
TextField {
|
2018-07-07 09:38:20 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
id: serverField
|
|
|
|
|
2018-02-27 11:37:53 +00:00
|
|
|
leftPadding: 16
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
|
2018-08-14 03:45:36 +00:00
|
|
|
text: "https://matrix.org"
|
2018-07-07 09:38:20 +00:00
|
|
|
placeholderText: "Server"
|
|
|
|
|
2018-02-27 11:37:53 +00:00
|
|
|
background: Rectangle {
|
2018-07-07 09:38:20 +00:00
|
|
|
implicitHeight: 48
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
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 {
|
2018-07-07 09:38:20 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
id: usernameField
|
|
|
|
|
2018-02-27 11:37:53 +00:00
|
|
|
leftPadding: 16
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
|
2018-07-07 09:38:20 +00:00
|
|
|
placeholderText: "Username"
|
|
|
|
|
2018-02-27 11:37:53 +00:00
|
|
|
background: Rectangle {
|
2018-07-07 09:38:20 +00:00
|
|
|
implicitHeight: 48
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
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 {
|
2018-07-07 09:38:20 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
id: passwordField
|
|
|
|
|
2018-02-23 14:39:14 +00:00
|
|
|
leftPadding: 16
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
|
2018-07-07 09:38:20 +00:00
|
|
|
placeholderText: "Password"
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
|
2018-02-23 14:39:14 +00:00
|
|
|
background: Rectangle {
|
2018-07-07 09:38:20 +00:00
|
|
|
implicitHeight: 48
|
|
|
|
|
2018-08-24 05:25:41 +00:00
|
|
|
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
|
2018-02-23 14:39:14 +00:00
|
|
|
border.color: parent.activeFocus ? Material.accent : "transparent"
|
|
|
|
border.width: 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2018-07-07 09:38:20 +00:00
|
|
|
Layout.fillWidth: true
|
2018-02-26 12:41:20 +00:00
|
|
|
|
2018-09-04 13:13:14 +00:00
|
|
|
id: loginButton
|
|
|
|
|
2018-07-07 09:38:20 +00:00
|
|
|
text: "LOGIN"
|
|
|
|
highlighted: true
|
2018-02-26 12:41:20 +00:00
|
|
|
|
2018-08-14 06:45:32 +00:00
|
|
|
ToolTip {
|
|
|
|
id: loginButtonTooltip
|
|
|
|
}
|
|
|
|
|
2018-07-15 08:02:26 +00:00
|
|
|
onClicked: {
|
2018-08-14 06:59:02 +00:00
|
|
|
if (!(serverField.text.startsWith("http") && serverField.text.includes("://"))) {
|
2018-08-14 06:45:32 +00:00
|
|
|
loginButtonTooltip.text = "Server address should start with http(s)://"
|
|
|
|
loginButtonTooltip.open()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (!(usernameField.text.startsWith("@") && usernameField.text.includes(":"))) {
|
|
|
|
loginButtonTooltip.text = "Username should be in format of @example:example.com"
|
|
|
|
loginButtonTooltip.open()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2018-07-15 08:02:26 +00:00
|
|
|
controller.loginWithCredentials(serverField.text, usernameField.text, passwordField.text)
|
|
|
|
}
|
2018-02-26 12:41:20 +00:00
|
|
|
}
|
2018-02-23 14:39:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|