Add Default and RememberAccount? pages
This commit is contained in:
@@ -7,7 +7,7 @@ import "sidePane" as SidePane
|
||||
import "chat" as Chat
|
||||
|
||||
Base.HImage {
|
||||
id: loginPage
|
||||
id: mainUI
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: "../images/login_background.jpg"
|
||||
anchors.fill: parent
|
||||
@@ -25,8 +25,8 @@ Base.HImage {
|
||||
}
|
||||
|
||||
StackView {
|
||||
function showPage(path, properties) {
|
||||
pageStack.replace(path, properties || {})
|
||||
function showPage(name, properties) {
|
||||
pageStack.replace("pages/" + name + ".qml", properties || {})
|
||||
}
|
||||
|
||||
function showRoom(userId, roomId) {
|
||||
@@ -36,7 +36,9 @@ Base.HImage {
|
||||
}
|
||||
|
||||
id: pageStack
|
||||
initialItem: accountsLoggedIn ? undefined : "pages/SignIn.qml"
|
||||
Component.onCompleted: showPage(
|
||||
accountsLoggedIn ? "Default" : "SignIn"
|
||||
)
|
||||
|
||||
onCurrentItemChanged: if (currentItem) {
|
||||
currentItem.forceActiveFocus()
|
||||
|
@@ -33,8 +33,12 @@ HScalingBox {
|
||||
}
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
|
||||
ColumnLayout { id: interfaceBody }
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
|
||||
HRowLayout {
|
||||
Repeater {
|
||||
id: interfaceButtonsRepeater
|
||||
|
@@ -1,8 +1,6 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
Rectangle {
|
||||
property var container: parent
|
||||
|
||||
property real widthForHeight: 0.75
|
||||
property int baseHeight: 300
|
||||
property int startScalingUpAboveHeight: 1080
|
||||
@@ -11,7 +9,7 @@ Rectangle {
|
||||
readonly property int margins: baseHeight * 0.03
|
||||
|
||||
color: Qt.hsla(1, 1, 1, 0.3)
|
||||
height: Math.min(container.height, baseHeight)
|
||||
width: Math.min(container.width, baseWidth)
|
||||
scale: Math.max(1, container.height / startScalingUpAboveHeight)
|
||||
height: Math.min(parent.height, baseHeight)
|
||||
width: Math.min(parent.width, baseWidth)
|
||||
scale: Math.max(1, parent.height / startScalingUpAboveHeight)
|
||||
}
|
||||
|
22
harmonyqml/components/pages/Default.qml
Normal file
22
harmonyqml/components/pages/Default.qml
Normal file
@@ -0,0 +1,22 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.4
|
||||
import "../base" as Base
|
||||
|
||||
Base.HRowLayout {
|
||||
Base.HLabel {
|
||||
text: "Select or add a room to start."
|
||||
wrapMode: Text.Wrap
|
||||
padding: 3
|
||||
leftPadding: 10
|
||||
rightPadding: 10
|
||||
|
||||
Layout.margins: 10
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
Layout.maximumWidth: parent.width - Layout.margins * 2
|
||||
|
||||
background: Rectangle {
|
||||
color: Qt.hsla(1, 1, 1, 0.3)
|
||||
}
|
||||
}
|
||||
}
|
44
harmonyqml/components/pages/RememberAccount.qml
Normal file
44
harmonyqml/components/pages/RememberAccount.qml
Normal file
@@ -0,0 +1,44 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.4
|
||||
import "../base" as Base
|
||||
|
||||
Item {
|
||||
property string loginWith: "username"
|
||||
property var client: null
|
||||
|
||||
Base.HInterfaceBox {
|
||||
id: rememberBox
|
||||
title: "Sign in"
|
||||
anchors.centerIn: parent
|
||||
|
||||
enterButtonTarget: "yes"
|
||||
|
||||
buttonModel: [
|
||||
{ name: "yes", text: qsTr("Yes") },
|
||||
{ name: "no", text: qsTr("No") },
|
||||
]
|
||||
|
||||
buttonCallbacks: {
|
||||
"yes": function(button) {
|
||||
Backend.clientManager.remember(client)
|
||||
pageStack.showPage("Default")
|
||||
},
|
||||
"no": function(button) { pageStack.showPage("Default") },
|
||||
}
|
||||
|
||||
Base.HLabel {
|
||||
text: qsTr(
|
||||
"Do you want to remember this account?\n\n" +
|
||||
"If yes, the " + loginWith + " and an access token will be " +
|
||||
"stored to automatically sign in on this device."
|
||||
)
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
Layout.margins: rememberBox.margins
|
||||
Layout.maximumWidth: rememberBox.width - Layout.margins * 2
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
}
|
@@ -25,11 +25,16 @@ Item {
|
||||
"register": function(button) {},
|
||||
|
||||
"login": function(button) {
|
||||
button.loadingUntilFutureDone(
|
||||
Backend.clientManager.new(
|
||||
"matrix.org", identifierField.text, passwordField.text
|
||||
)
|
||||
var future = Backend.clientManager.new(
|
||||
"matrix.org", identifierField.text, passwordField.text
|
||||
)
|
||||
button.loadingUntilFutureDone(future)
|
||||
future.onGotResult.connect(function(client) {
|
||||
pageStack.showPage(
|
||||
"RememberAccount",
|
||||
{"loginWith": loginWith, "client": client}
|
||||
)
|
||||
})
|
||||
},
|
||||
|
||||
"forgot": function(button) {}
|
||||
@@ -60,6 +65,7 @@ Item {
|
||||
loginWith === "phone" ? "Phone" :
|
||||
"Username"
|
||||
)
|
||||
text: "test_mary"
|
||||
onAccepted: signInBox.clickEnterButtonTarget()
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -67,6 +73,7 @@ Item {
|
||||
}
|
||||
|
||||
Base.HTextField {
|
||||
text: "1234"
|
||||
id: passwordField
|
||||
placeholderText: qsTr("Password")
|
||||
echoMode: TextField.Password
|
||||
|
Reference in New Issue
Block a user