2020-05-19 13:22:38 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Layouts 1.11
|
|
|
|
import QtQuick.Window 2.11
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
|
|
|
|
SwipeView {
|
2020-05-21 15:25:33 +00:00
|
|
|
id: swipeView
|
|
|
|
anchors.fill: parent
|
|
|
|
currentIndex: 0
|
|
|
|
|
|
|
|
onCurrentItemChanged: {
|
2020-05-27 07:15:42 +00:00
|
|
|
currentItem.txtPassword.focus = true;
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 13:22:38 +00:00
|
|
|
Item {
|
2020-05-21 15:25:33 +00:00
|
|
|
id: wizardStep2
|
|
|
|
property int selectedIndex: 0
|
2020-05-27 17:26:21 +00:00
|
|
|
width: 620
|
|
|
|
height: 427
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: title
|
|
|
|
text: "Generated accounts"
|
|
|
|
font.pointSize: 36
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.topMargin: 20
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
|
|
|
|
ButtonGroup {
|
2020-05-27 17:26:21 +00:00
|
|
|
id: accountGroup
|
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
|
2020-05-27 17:26:21 +00:00
|
|
|
Component {
|
|
|
|
id: addressViewDelegate
|
|
|
|
|
|
|
|
Item {
|
|
|
|
height: 56
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
|
|
|
|
Row {
|
|
|
|
RadioButton {
|
|
|
|
checked: index == 0 ? true : false
|
|
|
|
ButtonGroup.group: accountGroup
|
|
|
|
onClicked: {
|
|
|
|
wizardStep2.selectedIndex = index
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
Image {
|
|
|
|
source: identicon
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
Text {
|
|
|
|
text: username
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: key
|
|
|
|
width: 160
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
}
|
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-27 17:26:21 +00:00
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
|
2020-05-27 17:26:21 +00:00
|
|
|
ListView {
|
|
|
|
id: addressesView
|
|
|
|
contentWidth: 200
|
|
|
|
model: onboardingModel
|
|
|
|
delegate: addressViewDelegate
|
|
|
|
anchors.fill: parent
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
|
2020-05-27 07:15:42 +00:00
|
|
|
Button {
|
|
|
|
text: "Select"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
swipeView.incrementCurrentIndex();
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-27 07:15:42 +00:00
|
|
|
}
|
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: wizardStep3
|
|
|
|
property Item txtPassword: txtPassword
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: "Enter password"
|
|
|
|
font.pointSize: 36
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
color: "#EEEEEE"
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.centerIn: parent
|
|
|
|
height: 32
|
|
|
|
width: parent.width - 40
|
|
|
|
TextInput {
|
|
|
|
id: txtPassword
|
|
|
|
anchors.fill: parent
|
|
|
|
focus: true
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
selectByMouse: true
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Button {
|
|
|
|
text: "Next"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
onClicked: {
|
2020-05-27 07:15:42 +00:00
|
|
|
swipeView.incrementCurrentIndex();
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Item {
|
|
|
|
id: wizardStep4
|
|
|
|
property Item txtPassword: txtConfirmPassword
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Text {
|
|
|
|
text: "Confirm password"
|
|
|
|
font.pointSize: 36
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Rectangle {
|
|
|
|
color: "#EEEEEE"
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.centerIn: parent
|
|
|
|
height: 32
|
|
|
|
width: parent.width - 40
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
TextInput {
|
|
|
|
id: txtConfirmPassword
|
|
|
|
anchors.fill: parent
|
|
|
|
focus: true
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
selectByMouse: true
|
|
|
|
}
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
MessageDialog {
|
|
|
|
id: passwordsDontMatchError
|
|
|
|
title: "Error"
|
|
|
|
text: "Passwords don't match"
|
|
|
|
icon: StandardIcon.Warning
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
onAccepted: {
|
2020-05-27 07:15:42 +00:00
|
|
|
txtConfirmPassword.clear();
|
|
|
|
swipeView.currentIndex = 1;
|
|
|
|
txtPassword.focus = true;
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
MessageDialog {
|
|
|
|
id: storeAccountAndLoginError
|
|
|
|
title: "Error storing account and logging in"
|
|
|
|
text: "An error occurred while storing your account and logging in: "
|
2020-05-27 07:15:42 +00:00
|
|
|
icon: StandardIcon.Critical
|
2020-05-21 15:25:33 +00:00
|
|
|
standardButtons: StandardButton.Ok
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-20 19:20:31 +00:00
|
|
|
|
2020-05-27 07:15:42 +00:00
|
|
|
Connections {
|
|
|
|
target: onboardingModel
|
|
|
|
onLoginResponseChanged: {
|
|
|
|
const loginResponse = JSON.parse(response);
|
|
|
|
if(loginResponse.error){
|
|
|
|
storeAccountAndLoginError.text += loginResponse.error;
|
|
|
|
storeAccountAndLoginError.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Button {
|
|
|
|
text: "Finish"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
if (txtConfirmPassword.text != txtPassword.text) {
|
2020-05-27 07:15:42 +00:00
|
|
|
return passwordsDontMatchError.open();
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
|
|
|
const selectedAccountIndex = wizardStep2.selectedIndex
|
2020-05-27 07:15:42 +00:00
|
|
|
onboardingModel.storeAccountAndLogin(selectedAccountIndex, txtPassword.text)
|
2020-05-21 15:25:33 +00:00
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
|
2020-05-19 13:22:38 +00:00
|
|
|
/*##^##
|
|
|
|
Designer {
|
2020-05-27 17:26:21 +00:00
|
|
|
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
|
|
|
##^##*/
|
2020-05-27 17:26:21 +00:00
|
|
|
|