use StatusQ components

This commit is contained in:
Michele Balistreri 2021-10-05 12:12:10 +03:00 committed by Iuri Matias
parent 879550d332
commit 122314c060
4 changed files with 143 additions and 149 deletions

View File

@ -1,12 +1,16 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import "../../imports"
import StatusQ.Popups 0.1
import "../../imports/utils" as Imports
import "../../shared"
import "../../shared/keycard"
ModalPopup {
StatusModal {
property bool firstPINFieldValid: false
property bool repeatPINFieldValid: false
property string pinValidationError: ""
@ -14,7 +18,8 @@ ModalPopup {
property bool submitted: false
id: popup
title: qsTr("Create PIN")
header.title: qsTr("Create PIN")
anchors.centerIn: parent
height: 500
onOpened: {
@ -23,6 +28,7 @@ ModalPopup {
firstPINField.forceActiveFocus(Qt.MouseFocusReason)
}
contentItem: Item {
Input {
id: firstPINField
anchors.rightMargin: 56
@ -33,7 +39,7 @@ ModalPopup {
textField.echoMode: TextInput.Password
onTextChanged: {
[firstPINFieldValid, pinValidationError] =
Utils.validatePINs("first", firstPINField, repeatPINField);
Imports.Utils.validatePINs("first", firstPINField, repeatPINField);
}
}
@ -45,7 +51,7 @@ ModalPopup {
anchors.right: firstPINField.right
anchors.left: firstPINField.left
anchors.top: firstPINField.bottom
anchors.topMargin: Style.current.xlPadding
anchors.topMargin: 32
placeholderText: qsTr("Confirm PIN")
textField.echoMode: TextInput.Password
Keys.onReturnPressed: function(event) {
@ -55,11 +61,11 @@ ModalPopup {
}
onTextChanged: {
[repeatPINFieldValid, repeatPINValidationError] =
Utils.validatePINs("repeat", firstPINField, repeatPINField);
Imports.Utils.validatePINs("repeat", firstPINField, repeatPINField);
}
}
StyledText {
StatusBaseText {
id: validationError
text: {
if (pinValidationError !== "") return pinValidationError;
@ -69,37 +75,28 @@ ModalPopup {
anchors.top: repeatPINField.bottom
anchors.topMargin: 20
anchors.right: parent.right
anchors.rightMargin: Style.current.xlPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.xlPadding
horizontalAlignment: Text.AlignHCenter
color: Style.current.danger
color: Theme.palette.dangerColor1
font.pixelSize: 11
}
StyledText {
StatusBaseText {
text: qsTr("Create a 6 digit long PIN")
wrapMode: Text.WordWrap
anchors.right: parent.right
anchors.rightMargin: Style.current.xlPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.xlPadding
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
color: Style.current.secondaryText
anchors.bottomMargin: 20
color: Theme.palette.directColor1
font.pixelSize: 12
}
}
footer: Item {
width: parent.width
height: submitBtn.height
rightButtons: [
StatusButton {
id: submitBtn
anchors.bottom: parent.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
text: qsTr("Create PIN")
enabled: firstPINFieldValid && repeatPINFieldValid
@ -109,5 +106,5 @@ ModalPopup {
popup.close()
}
}
}
]
}

View File

@ -14,7 +14,6 @@ Item {
property int flow: OnboardingFlow.Recover
id: keycardView
anchors.fill: parent
Component.onCompleted: {
insertCard.open()
keycardModel.startConnection()

View File

@ -1,16 +1,21 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import "../../imports"
import StatusQ.Popups 0.1
import "../../imports/utils" as Imports
import "../../shared"
ModalPopup {
StatusModal {
property bool pinFieldValid: false
property bool submitted: false
id: popup
title: qsTr("Authenticate PIN")
header.title: qsTr("Authenticate PIN")
anchors.centerIn: parent
height: 400
onOpened: {
@ -19,6 +24,7 @@ ModalPopup {
pinField.forceActiveFocus(Qt.MouseFocusReason)
}
contentItem: Item {
Input {
id: pinField
anchors.rightMargin: 56
@ -29,33 +35,26 @@ ModalPopup {
textField.echoMode: TextInput.Password
onTextChanged: {
[pinFieldValid, _] =
Utils.validatePINs("first", pinField, pinField);
Imports.Utils.validatePINs("first", pinField, pinField);
}
}
StyledText {
StatusBaseText {
text: qsTr("Insert your 6-digit PIN")
wrapMode: Text.WordWrap
anchors.right: parent.right
anchors.rightMargin: Style.current.xlPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.xlPadding
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
color: Style.current.secondaryText
anchors.bottomMargin: 20
horizontalAlignment: Text.AlignHCenter
color: Theme.palette.directColor1
font.pixelSize: 12
}
}
footer: Item {
width: parent.width
height: submitBtn.height
rightButtons: [
StatusButton {
id: submitBtn
anchors.bottom: parent.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
text: qsTr("Authenticate")
enabled: pinFieldValid
@ -65,5 +64,6 @@ ModalPopup {
popup.close()
}
}
}
]
}

View File

@ -1,16 +1,19 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import "../../imports"
import StatusQ.Popups 0.1
import "../../shared"
ModalPopup {
StatusModal {
property bool pairingPasswordFieldValid: false
property bool submitted: false
id: popup
title: qsTr("Insert pairing code")
header.title: qsTr("Insert pairing code")
anchors.centerIn: parent
height: 400
onOpened: {
@ -19,12 +22,14 @@ ModalPopup {
pairingPasswordField.forceActiveFocus(Qt.MouseFocusReason)
}
contentItem: Item {
Input {
id: pairingPasswordField
anchors.rightMargin: 56
anchors.leftMargin: 56
anchors.top: parent.top
anchors.topMargin: 88
anchors.bottomMargin: 0
placeholderText: qsTr("Pairing code")
textField.echoMode: TextInput.Password
onTextChanged: {
@ -32,29 +37,22 @@ ModalPopup {
}
}
StyledText {
StatusBaseText {
text: qsTr("Insert the Keycard pairing code")
wrapMode: Text.WordWrap
anchors.right: parent.right
anchors.rightMargin: Style.current.xlPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.xlPadding
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
color: Style.current.secondaryText
anchors.bottomMargin: 20
horizontalAlignment: Text.AlignHCenter
color: Theme.palette.directColor1
font.pixelSize: 12
}
}
footer: Item {
width: parent.width
height: submitBtn.height
rightButtons: [
StatusButton {
id: submitBtn
anchors.bottom: parent.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
text: qsTr("Pair")
enabled: pairingPasswordFieldValid
@ -64,5 +62,5 @@ ModalPopup {
popup.close()
}
}
}
]
}