Files
neochat/qml/Login.qml
Black Hat cfa8043596 A lot of improvements.
Fix laggish RoomListView when dragging.
Remove per-room timer and add timer in RoomForm.
Remove singleton module and use file as singleton.
Minor UI tweak in RoomListView.
Pass room to RoomListView via "currentRoom" delegate property and remove
RoomListForm-wide currentRoom.
Put menu files in a separate folder.
Show initial image in ImageStatus when avatar is not loaded.
Add about page.
Merge all setting pages into Setting.qml.
Add option to rearrange rooms by activity.
Add option to use RichText parser.
Add document url.
2018-08-24 13:25:41 +08:00

164 lines
4.9 KiB
QML

import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
import Qt.labs.settings 1.0
import Matrique.Settings 0.1
import "qrc:/qml/component"
Page {
property var controller
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
cache: false
}
ColorOverlay {
anchors.fill: background
source: background
color: Material.accent
opacity: 0.7
}
}
Column {
x: 32
anchors.verticalCenter: parent.verticalCenter
Label {
text: "MATRIX LOGIN."
font.pointSize: 28
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
TextField {
id: serverField
Layout.fillWidth: true
leftPadding: 16
topPadding: 0
bottomPadding: 0
text: "https://matrix.org"
placeholderText: "Server"
background: Rectangle {
implicitHeight: 48
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
TextField {
id: usernameField
Layout.fillWidth: true
leftPadding: 16
topPadding: 0
bottomPadding: 0
placeholderText: "Username"
background: Rectangle {
implicitHeight: 48
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
TextField {
id: passwordField
Layout.fillWidth: true
leftPadding: 16
topPadding: 0
bottomPadding: 0
placeholderText: "Password"
echoMode: TextInput.Password
background: Rectangle {
implicitHeight: 48
color: MSettings.darkTheme ? "#242424" : "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
Button {
id: loginButton
Layout.fillWidth: true
text: "LOGIN"
highlighted: true
ToolTip {
id: loginButtonTooltip
}
onClicked: {
if (!(serverField.text.startsWith("http") && serverField.text.includes("://"))) {
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
}
var replaceViewFunction = function() {
if (matriqueController.isLogin) stackView.replace(roomPage)
matriqueController.isLoginChanged.disconnect(replaceViewFunction)
}
matriqueController.isLoginChanged.connect(replaceViewFunction)
controller.loginWithCredentials(serverField.text, usernameField.text, passwordField.text)
}
}
}
}
}
}