From 11cdd608f31a82806b8563038d28fb7f443084bf Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Sun, 17 Oct 2021 12:59:26 +0200 Subject: [PATCH] Log out the app on NodeStopped signal --- src/app/modules/startup/controller.nim | 2 +- src/app/modules/startup/module.nim | 5 ++++- .../module_controller_delegate_interface.nim | 5 ++++- src/app/modules/startup/view.nim | 7 ++++++- ui/main.qml | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/app/modules/startup/controller.nim b/src/app/modules/startup/controller.nim index 3d8b7d72f3..5de3432530 100644 --- a/src/app/modules/startup/controller.nim +++ b/src/app/modules/startup/controller.nim @@ -48,7 +48,7 @@ method init*(self: Controller) = self.events.on(SignalType.NodeStopped.event) do(e:Args): echo "-NEW-EVENT-- NodeStopped: ", repr(e) self.events.emit("nodeStopped", Args()) - #self.view.onLoggedOut() + self.delegate.emitLogOut() self.events.on(SignalType.NodeReady.event) do(e:Args): echo "-NEW-EVENT-- NodeReady: ", repr(e) diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim index 8e36537b9c..e4a5df8c2d 100644 --- a/src/app/modules/startup/module.nim +++ b/src/app/modules/startup/module.nim @@ -87,4 +87,7 @@ method userLoggedIn*[T](self: Module[T]) = self.delegate.userLoggedIn() method moveToAppState*[T](self: Module[T]) = - self.view.setAppState(AppState.MainAppState) \ No newline at end of file + self.view.setAppState(AppState.MainAppState) + +method emitLogOut*[T](self: Module[T]) = + self.view.emitLogOut() \ No newline at end of file diff --git a/src/app/modules/startup/private_interfaces/module_controller_delegate_interface.nim b/src/app/modules/startup/private_interfaces/module_controller_delegate_interface.nim index 58295a2bd4..3bc2d2e781 100644 --- a/src/app/modules/startup/private_interfaces/module_controller_delegate_interface.nim +++ b/src/app/modules/startup/private_interfaces/module_controller_delegate_interface.nim @@ -1,2 +1,5 @@ method userLoggedIn*(self: AccessInterface) {.base.} = - raise newException(ValueError, "No implementation available") \ No newline at end of file + raise newException(ValueError, "No implementation available") + +method emitLogOut*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/startup/view.nim b/src/app/modules/startup/view.nim index af4e0bff07..5cc0acb9dd 100644 --- a/src/app/modules/startup/view.nim +++ b/src/app/modules/startup/view.nim @@ -40,4 +40,9 @@ QtObject: QtProperty[int] appState: read = getAppState - notify = appStateChanged \ No newline at end of file + notify = appStateChanged + + proc logOut*(self: View) {.signal.} + + proc emitLogOut*(self: View) = + self.logOut() \ No newline at end of file diff --git a/ui/main.qml b/ui/main.qml index 53366035ae..d02182f3dc 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -474,7 +474,7 @@ StatusWindow { DSM.SignalTransition { targetState: stateLogin - signal: loginModel.onLoggedOut + signal: startupModule.logOut } } }