add controller for onboarding

This commit is contained in:
Iuri Matias 2020-05-20 13:36:44 -04:00
parent 40fcc1538a
commit 6ef7c9008e
2 changed files with 32 additions and 6 deletions

View File

@ -0,0 +1,28 @@
import NimQml
# import "../../status/core" as status
import ../signals/types
import eventemitter
import onboarding
type OnboardingController* = ref object of SignalSubscriber
# view*: OnboardingView
view*: Onboarding
variant*: QVariant
proc newController*(events: EventEmitter): OnboardingController =
result = OnboardingController()
# result.view = newOnboardingView()
result.view = newOnboarding(events)
result.variant = newQVariant(result.view)
proc delete*(self: OnboardingController) =
delete self.view
delete self.variant
proc init*(self: OnboardingController) =
discard
# method onSignal(self: OnboardingController, data: Signal) =
# echo "new signal received"
# var msg = cast[WalletSignal](data)
# self.view.setLastMessage(msg.content)

View File

@ -5,7 +5,7 @@ import app/wallet/core as wallet
import app/node/core as node
import app/profile/core as profile
import app/signals/core as signals
import app/onboarding/onboarding as onboarding
import app/onboarding/core as onboarding
import state
import status/utils
import strformat
@ -75,13 +75,11 @@ proc mainProc() =
engine.setRootContextProperty("nodeModel", node.variant)
var onboarding = newOnboarding(events);
defer: onboarding.delete
let onboardingVariant = newQVariant(onboarding)
defer: onboardingVariant.delete
var onboarding = onboarding.newController(events)
# onboarding.init()
engine.setRootContextProperty("onboardingLogic", onboarding.variant)
engine.setRootContextProperty("onboardingLogic", onboardingVariant)
# TODO: figure out a way to prevent this from breaking Qt Creator
# var initLibStatusQml = proc(): LibStatusQml =