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
|
|
|
|
|
2020-05-21 15:31:37 +00:00
|
|
|
// property string strGeneratedAccounts: onboardingLogic.generatedAddresses
|
2020-05-21 15:25:33 +00:00
|
|
|
// property var generatedAccounts: {}
|
|
|
|
// signal storeAccountAndLoginResult(response: var)
|
2020-05-21 16:16:00 +00:00
|
|
|
signal loginDone()
|
2020-05-21 15:25:33 +00:00
|
|
|
|
|
|
|
onCurrentItemChanged: {
|
|
|
|
currentItem.txtPassword.focus = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: generatedAccountsModel
|
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-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: columnLayout
|
|
|
|
width: 620
|
|
|
|
height: 427
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: "Generated accounts"
|
|
|
|
font.pointSize: 36
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
|
2020-05-19 13:22:38 +00:00
|
|
|
Row {
|
2020-05-21 15:25:33 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
spacing: 10
|
|
|
|
ButtonGroup {
|
|
|
|
id: accountGroup
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: addressViewDelegate
|
|
|
|
|
|
|
|
// Item {
|
|
|
|
// id: addressViewContainer
|
|
|
|
// height: 56
|
|
|
|
// anchors.right: parent.right
|
|
|
|
// anchors.rightMargin: 0
|
|
|
|
// anchors.left: parent.left
|
|
|
|
// anchors.leftMargin: 0
|
|
|
|
|
|
|
|
// Text {
|
|
|
|
// text: "address"
|
|
|
|
// font.pointSize: 24
|
|
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// font.pixelSize: 14
|
|
|
|
// font.strikeout: false
|
|
|
|
// anchors.left: parent.left
|
|
|
|
// anchors.leftMargin: 72
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
Item {
|
|
|
|
height: 56
|
|
|
|
// anchors.leftMargin: 20
|
|
|
|
// anchors.rightMargin: 20
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
|
|
|
|
// Text {
|
|
|
|
// id: keyValue
|
|
|
|
// text: key
|
|
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// font.pixelSize: 14
|
|
|
|
// font.strikeout: false
|
|
|
|
// anchors.left: parent.left
|
|
|
|
// anchors.leftMargin: 72
|
|
|
|
// }
|
|
|
|
|
|
|
|
Row {
|
|
|
|
RadioButton {
|
|
|
|
// checked: index == 0 ? true : false
|
|
|
|
checked: false
|
|
|
|
ButtonGroup.group: accountGroup
|
|
|
|
// onClicked: {
|
|
|
|
// wizardStep2.selectedIndex = index;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
Image {
|
|
|
|
source: identicon
|
|
|
|
// source: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAF0lEQVR42mPk+c9Qz0ACYBzVMKoBOwAA3IgShVgwlIUAAAAASUVORK5CYII="
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
Text {
|
|
|
|
text: username
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
text: key
|
|
|
|
width: 160
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: addressesView
|
|
|
|
contentWidth: 200
|
|
|
|
model: onboardingModel
|
|
|
|
delegate: addressViewDelegate
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
anchors.topMargin: 36
|
|
|
|
anchors.fill: parent
|
|
|
|
}
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-21 15:25:33 +00:00
|
|
|
|
|
|
|
Button {
|
|
|
|
text: "Select"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
console.log("button: " + wizardStep2.selectedIndex);
|
|
|
|
|
|
|
|
swipeView.incrementCurrentIndex();
|
2020-05-19 13:22:38 +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: {
|
|
|
|
console.log("password: " + txtPassword.text);
|
2020-05-19 13:22:38 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
swipeView.incrementCurrentIndex();
|
|
|
|
}
|
|
|
|
}
|
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: {
|
|
|
|
txtConfirmPassword.clear();
|
|
|
|
swipeView.currentIndex = 1
|
|
|
|
txtPassword.focus = true
|
|
|
|
}
|
|
|
|
}
|
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: "
|
|
|
|
// icon: StandardIcon.Error
|
|
|
|
standardButtons: StandardButton.Ok
|
2020-05-19 13:22:38 +00:00
|
|
|
}
|
2020-05-20 19:20:31 +00:00
|
|
|
|
2020-05-21 15:25:33 +00:00
|
|
|
Button {
|
|
|
|
text: "Finish"
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: 20
|
|
|
|
onClicked: {
|
|
|
|
console.log("confirm clicked " + txtConfirmPassword.text + " : " + txtPassword.text);
|
|
|
|
|
|
|
|
if (txtConfirmPassword.text != txtPassword.text) {
|
|
|
|
return passwordsDontMatchError.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
const selectedAccountIndex = wizardStep2.selectedIndex
|
|
|
|
|
|
|
|
const storeResponse = onboardingModel.storeAccountAndLogin(selectedAccountIndex, txtPassword.text)
|
|
|
|
|
2020-05-21 18:52:41 +00:00
|
|
|
// const response = JSON.parse(storeResponse);
|
2020-05-21 15:25:33 +00:00
|
|
|
// if (response.error) {
|
|
|
|
// storeAccountAndLoginError.text += response.error;
|
|
|
|
// return storeAccountAndLoginError.open();
|
|
|
|
// }
|
2020-05-21 16:16:00 +00:00
|
|
|
swipeView.loginDone();
|
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 {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|