use status.keycard

This commit is contained in:
Michele Balistreri 2021-09-28 13:31:18 +03:00 committed by Iuri Matias
parent 2508b6b6f1
commit 0535886e6c
2 changed files with 5 additions and 10 deletions

View File

@ -1,19 +1,16 @@
import NimQml, chronicles, std/wrapnils
import status/status
import status/keycard as keycardlib
import view
type KeycardController* = ref object
view*: KeycardView
variant*: QVariant
status: Status
keycard: KeycardModel
proc newController*(status: Status): KeycardController =
result = KeycardController()
result.status = status
result.keycard = keycardlib.newKeycardModel()
result.view = newKeycardView(status, result.keycard)
result.view = newKeycardView(status)
result.variant = newQVariant(result.view)
proc delete*(self: KeycardController) =

View File

@ -8,7 +8,6 @@ logScope:
QtObject:
type KeycardView* = ref object of QObject
status*: Status
keycard: KeycardModel
proc setup(self: KeycardView) =
self.QObject.setup
@ -16,10 +15,9 @@ QtObject:
proc delete*(self: KeycardView) =
self.QObject.delete
proc newKeycardView*(status: Status, keycard: KeycardModel): KeycardView =
proc newKeycardView*(status: Status): KeycardView =
new(result, delete)
result.status = status
result.keycard = keycard
result.setup
proc cardConnected*(self: KeycardView) {.signal.}
@ -33,6 +31,6 @@ QtObject:
self.cardConnected()
proc testConnection*(self: KeycardView) {.slot.} =
info "Connecting Keycard ", msg = self.keycard.start()
info "Selecting applet ", msg = self.keycard.select()
info "Disconnecting Keycard ", msg = self.keycard.stop()
info "Connecting Keycard ", msg = self.status.keycard.start()
info "Selecting applet ", msg = self.status.keycard.select()
info "Disconnecting Keycard ", msg = self.status.keycard.stop()