2022-07-21 11:29:18 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
import shared.popups.keycard.helpers 1.0
|
|
|
|
|
2022-07-21 11:29:18 +00:00
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property StartupStore startupStore
|
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
height: Constants.keycard.general.onboardingHeight
|
2022-09-29 13:30:17 +00:00
|
|
|
spacing: Style.current.bigPadding
|
2022-07-21 11:29:18 +00:00
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
KeycardImage {
|
|
|
|
id: image
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.preferredHeight: Constants.keycard.general.imageHeight
|
|
|
|
Layout.preferredWidth: Constants.keycard.general.imageWidth
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: title
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: info
|
2022-09-29 13:30:17 +00:00
|
|
|
visible: text.length > 0
|
2022-09-28 16:09:12 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-09-29 13:30:17 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-09-28 16:09:12 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
StatusButton {
|
|
|
|
id: button
|
|
|
|
visible: text.length > 0
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
focus: true
|
|
|
|
onClicked: {
|
|
|
|
root.startupStore.doPrimaryAction()
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: link
|
|
|
|
visible: text.length > 0
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
font.pixelSize: Constants.keycard.general.buttonFontSize
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
parent.font.underline = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
parent.font.underline = false
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
onClicked: {
|
2022-09-28 16:09:12 +00:00
|
|
|
root.startupStore.doSecondaryAction()
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: message
|
2022-09-29 13:30:17 +00:00
|
|
|
visible: text.length > 0
|
2022-09-28 16:09:12 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardNotEmpty
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardNotEmpty
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-09-28 16:09:12 +00:00
|
|
|
source: Style.png("keycard/card-inserted")
|
|
|
|
pattern: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("This Keycard already stores keys")
|
2022-09-28 16:09:12 +00:00
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
text: qsTr("To generate new keys, you will need to perform a factory reset first")
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
|
|
|
text: qsTr("Factory reset")
|
|
|
|
type: StatusBaseButton.Type.Normal
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
2022-09-28 16:09:12 +00:00
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: qsTr("Or remove Keycard and insert another Keycard and try again")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardEmpty
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardEmpty
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-09-28 16:09:12 +00:00
|
|
|
source: Style.png("keycard/card-empty")
|
|
|
|
pattern: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Keycard is empty")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("There is no key pair on this Keycard")
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
|
|
|
text: qsTr("Generate new keys for this Keycard")
|
|
|
|
type: StatusBaseButton.Type.Normal
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
|
|
|
text: ""
|
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: ""
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardLocked
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardLocked
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("Keycard locked and already stores keys")
|
2022-09-28 16:09:12 +00:00
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
text: qsTr("The Keycard you have inserted is locked, you will need to factory reset it before proceeding")
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
|
|
|
text: qsTr("Factory reset")
|
|
|
|
type: StatusBaseButton.Type.Normal
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
2022-09-28 16:09:12 +00:00
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: qsTr("Or remove Keycard and insert another Keycard and try again")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardNotKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardNotKeycard
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-09-28 16:09:12 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("This is not a Keycard")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
text: qsTr("The card inserted is not a recognised Keycard, please remove and try and again")
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
|
|
|
text: ""
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
2022-09-29 13:30:17 +00:00
|
|
|
name: "lockedState"
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPinRetriesReached ||
|
|
|
|
root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPukRetriesReached ||
|
|
|
|
root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPairingSlotsReached
|
|
|
|
|
2022-07-21 11:29:18 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("Keycard locked")
|
|
|
|
color: Theme.palette.dangerColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
2022-09-29 13:30:17 +00:00
|
|
|
text: {
|
|
|
|
let t = qsTr("You will need to unlock it before proceeding")
|
|
|
|
if (root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPinRetriesReached)
|
|
|
|
t += qsTr("\nMax PIN retries reached for this keycard")
|
|
|
|
if (root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPukRetriesReached)
|
|
|
|
t += qsTr("\nMax PUK retries reached for this keycard")
|
|
|
|
if (root.startupStore.currentStartupState.stateType === Constants.startupState.keycardMaxPairingSlotsReached)
|
|
|
|
t += qsTr("\nMax pairing slots reached for this keycard")
|
|
|
|
return t
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
color: Theme.palette.dangerColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Unlock Keycard")
|
2022-07-21 11:29:18 +00:00
|
|
|
type: StatusBaseButton.Type.Normal
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
2022-09-29 13:30:17 +00:00
|
|
|
text: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: ""
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
},
|
|
|
|
State {
|
2022-09-29 13:30:17 +00:00
|
|
|
name: Constants.startupState.keycardRecover
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardRecover
|
2022-07-21 11:29:18 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Unlock this Keycard")
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
2022-09-29 13:30:17 +00:00
|
|
|
text: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Unlock using seed phrase")
|
2022-07-21 11:29:18 +00:00
|
|
|
type: StatusBaseButton.Type.Normal
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Unlock using PUK")
|
|
|
|
enabled: !(root.startupStore.startupModuleInst.keycardData & Constants.predefinedKeycardData.maxPUKReached)
|
|
|
|
color: !enabled? Theme.palette.baseColor1 : Theme.palette.primaryColor1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
|
|
|
text: ""
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
},
|
|
|
|
State {
|
2022-09-29 13:30:17 +00:00
|
|
|
name: Constants.startupState.keycardWrongKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardWrongKeycard
|
2022-07-21 11:29:18 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.strongError.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.strongError.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.strongError.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.strongError.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.strongError.duration
|
|
|
|
loops: Constants.keycardAnimations.strongError.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Wrong Keycard inserted")
|
2022-07-21 11:29:18 +00:00
|
|
|
color: Theme.palette.dangerColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("The card inserted is not linked to your profile.")
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: button
|
2022-09-29 13:30:17 +00:00
|
|
|
text: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: link
|
2022-09-29 13:30:17 +00:00
|
|
|
text: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: message
|
2022-09-29 13:30:17 +00:00
|
|
|
text: qsTr("Remove Keycard and try again")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
2022-09-28 16:09:12 +00:00
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|