test connection/disconnection events
This commit is contained in:
parent
303e40bdcf
commit
1e4dc0acbf
|
@ -24,4 +24,7 @@ QtObject:
|
|||
proc cardDisconnected*(self: KeycardView) {.signal.}
|
||||
|
||||
proc simulateDisconnected*(self: KeycardView) {.slot.} =
|
||||
self.cardDisconnected()
|
||||
self.cardDisconnected()
|
||||
|
||||
proc simulateConnected*(self: KeycardView) {.slot.} =
|
||||
self.cardConnected()
|
|
@ -5,12 +5,22 @@ import "../shared/keycard"
|
|||
// this will be the entry point. for now it opens all keycard-related dialogs in sequence for test
|
||||
Item {
|
||||
property var onClosed: function () {}
|
||||
property bool connected: false
|
||||
|
||||
id: keycardView
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
createPinModal.open()
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 2000; running: true; repeat: true
|
||||
onTriggered: {
|
||||
connected? keycardModel.simulateDisconnected() : keycardModel.simulateConnected()
|
||||
connected = !connected
|
||||
}
|
||||
}
|
||||
|
||||
CreatePINModal {
|
||||
id: createPinModal
|
||||
onClosed: function () {
|
||||
|
@ -28,28 +38,14 @@ Item {
|
|||
PINModal {
|
||||
id: pinModal
|
||||
onClosed: function () {
|
||||
insertCard.open()
|
||||
keycardView.open()
|
||||
}
|
||||
}
|
||||
|
||||
InsertCard {
|
||||
id: insertCard
|
||||
onClosed: function() {
|
||||
onCancel: function() {
|
||||
keycardView.onClosed()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
id: connection
|
||||
target: keycardModel
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
onCardConnected: {
|
||||
insertCard.close()
|
||||
}
|
||||
|
||||
onCardDisconnected: {
|
||||
insertCard.open()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -102,7 +102,6 @@ ModalPopup {
|
|||
enabled: firstPINFieldValid && repeatPINFieldValid
|
||||
|
||||
onClicked: {
|
||||
keycardModel.simulateDisconnected()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import StatusQ.Controls 0.1
|
|||
import StatusQ.Popups 0.1
|
||||
|
||||
StatusModal {
|
||||
property var onCancel: function() {}
|
||||
|
||||
id: insertCard
|
||||
anchors.centerIn: parent
|
||||
|
||||
|
@ -46,7 +48,24 @@ StatusModal {
|
|||
StatusButton {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: { insertCard.close() }
|
||||
onClicked: {
|
||||
insertCard.close()
|
||||
onCancel()
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Connections {
|
||||
id: connection
|
||||
target: keycardModel
|
||||
ignoreUnknownSignals: true
|
||||
|
||||
onCardConnected: {
|
||||
insertCard.close()
|
||||
}
|
||||
|
||||
onCardDisconnected: {
|
||||
insertCard.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue