use status.keycard
This commit is contained in:
parent
2508b6b6f1
commit
0535886e6c
|
@ -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) =
|
||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue