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
|
2022-09-28 16:09:12 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import shared.popups.keycard.helpers 1.0
|
2022-07-21 11:29:18 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "../stores"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property StartupStore startupStore
|
|
|
|
|
|
|
|
Timer {
|
2022-09-28 16:09:12 +00:00
|
|
|
id: timer
|
|
|
|
interval: 1000
|
|
|
|
running: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardRecognizedKeycard
|
2022-07-21 11:29:18 +00:00
|
|
|
onTriggered: {
|
2022-09-28 16:09:12 +00:00
|
|
|
root.startupStore.currentStartupState.doPrimaryAction()
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.centerIn: parent
|
2023-05-09 16:23:48 +00:00
|
|
|
height: Constants.onboarding.loginHeight
|
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
|
2022-07-21 11:29:18 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-09-28 16:09:12 +00:00
|
|
|
Layout.preferredHeight: Constants.keycard.general.imageHeight
|
|
|
|
Layout.preferredWidth: Constants.keycard.general.imageWidth
|
|
|
|
|
|
|
|
onAnimationCompleted: {
|
|
|
|
if (root.startupStore.currentStartupState.stateType === Constants.startupState.keycardInsertedKeycard ||
|
|
|
|
root.startupStore.currentStartupState.stateType === Constants.startupState.keycardReadingKeycard) {
|
|
|
|
root.startupStore.currentStartupState.doPrimaryAction()
|
|
|
|
}
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
|
2022-09-28 16:09:12 +00:00
|
|
|
Row {
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: Constants.keycard.general.titleHeight
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
id: icon
|
|
|
|
visible: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardRecognizedKeycard
|
|
|
|
width: Style.current.padding
|
|
|
|
height: Style.current.padding
|
|
|
|
icon: "checkmark"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
StatusLoadingIndicator {
|
|
|
|
id: loading
|
|
|
|
visible: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardReadingKeycard
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
id: title
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
2022-08-12 07:33:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: info
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-09-28 16:09:12 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardPluginReader
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardPluginReader
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
2022-08-12 16:01:38 +00:00
|
|
|
text: qsTr("Plug in Keycard reader...")
|
2022-07-21 11:29:18 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
|
|
|
source: Style.png("keycard/empty-reader")
|
|
|
|
pattern: ""
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-08-12 07:33:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
visible: false
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardInsertKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardInsertKeycard
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
2022-08-12 16:01:38 +00:00
|
|
|
text: qsTr("Insert your Keycard...")
|
2022-07-21 11:29:18 +00:00
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
color: Theme.palette.directColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.cardInsert.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.cardInsert.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.cardInsert.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.cardInsert.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.cardInsert.duration
|
|
|
|
loops: Constants.keycardAnimations.cardInsert.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-08-12 07:33:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
2022-09-29 13:30:17 +00:00
|
|
|
visible: root.startupStore.startupModuleInst.keycardData & Constants.predefinedKeycardData.wronglyInsertedCard
|
2022-08-12 07:33:12 +00:00
|
|
|
text: qsTr("Check the card, it might be wrongly inserted")
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize3
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
},
|
2022-09-28 16:09:12 +00:00
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardInsertedKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardInsertedKeycard
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("Keycard inserted...")
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize1
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.cardInserted.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.cardInserted.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.cardInserted.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.cardInserted.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.cardInserted.duration
|
|
|
|
loops: Constants.keycardAnimations.cardInserted.loops
|
2022-09-28 16:09:12 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
},
|
2022-07-21 11:29:18 +00:00
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardReadingKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardReadingKeycard
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("Reading Keycard...")
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
color: Theme.palette.baseColor1
|
2022-09-28 16:09:12 +00:00
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.warning.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.warning.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.warning.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.warning.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.warning.duration
|
|
|
|
loops: Constants.keycardAnimations.warning.loops
|
2022-09-28 16:09:12 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: Constants.startupState.keycardRecognizedKeycard
|
|
|
|
when: root.startupStore.currentStartupState.stateType === Constants.startupState.keycardRecognizedKeycard
|
|
|
|
PropertyChanges {
|
|
|
|
target: title
|
|
|
|
text: qsTr("Keycard recognized")
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
font.weight: Font.Normal
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
2022-10-18 08:31:23 +00:00
|
|
|
pattern: Constants.keycardAnimations.success.pattern
|
2022-09-28 16:09:12 +00:00
|
|
|
source: ""
|
2022-10-18 08:31:23 +00:00
|
|
|
startImgIndexForTheFirstLoop: Constants.keycardAnimations.success.startImgIndexForTheFirstLoop
|
|
|
|
startImgIndexForOtherLoops: Constants.keycardAnimations.success.startImgIndexForOtherLoops
|
|
|
|
endImgIndex: Constants.keycardAnimations.success.endImgIndex
|
|
|
|
duration: Constants.keycardAnimations.success.duration
|
|
|
|
loops: Constants.keycardAnimations.success.loops
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
2022-08-12 07:33:12 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: info
|
|
|
|
visible: false
|
|
|
|
}
|
2022-07-21 11:29:18 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|