From 9411aa61e7392361852e6351d913652d9c5f0ee1 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 18 May 2020 11:22:46 -0400 Subject: [PATCH] feat: display message in wallet --- src/app/wallet/core.nim | 2 +- src/app/wallet/walletView.nim | 21 ++++++++++++++++++++- ui/app/AppLayouts/Wallet/LeftTab.qml | 10 ++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/app/wallet/core.nim b/src/app/wallet/core.nim index ae364be217..891c5f8c64 100644 --- a/src/app/wallet/core.nim +++ b/src/app/wallet/core.nim @@ -42,4 +42,4 @@ proc init*(self: WalletController) = method onSignal(self: WalletController, signal: string) = echo "Received a signal in the wallet module: ", signal - # TODO: do something with the signal \ No newline at end of file + self.view.setLastMessage(signal) \ No newline at end of file diff --git a/src/app/wallet/walletView.nim b/src/app/wallet/walletView.nim index ef995405b3..0bc77d3c38 100644 --- a/src/app/wallet/walletView.nim +++ b/src/app/wallet/walletView.nim @@ -17,6 +17,7 @@ QtObject: type WalletView* = ref object of QAbstractListModel assets*: seq[Asset] + lastMessage*: string proc delete(self: WalletView) = self.QAbstractListModel.delete @@ -30,8 +31,9 @@ QtObject: proc newWalletView*(): WalletView = new(result, delete) result.assets = @[] + result.lastMessage = "" result.setup - + proc addAssetToList*(self: WalletView, name: string, symbol: string, value: string, fiatValue: string, image: string) {.slot.} = self.beginInsertRows(newQModelIndex(), self.assets.len, self.assets.len) self.assets.add(Asset(name : name, @@ -65,3 +67,20 @@ QtObject: AssetRoles.Value.int:"value", AssetRoles.FiatValue.int:"fiatValue", AssetRoles.Image.int:"image" }.toTable + + + + + proc lastMessage*(self: WalletView): string {.slot.} = + result = self.lastMessage + + proc receivedMessage*(self: WalletView, lastMessage: string) {.signal.} + + proc setLastMessage*(self: WalletView, lastMessage: string) {.slot.} = + self.lastMessage = lastMessage + self.receivedMessage(lastMessage) + + QtProperty[string] lastMessage: + read = lastMessage + write = setLastMessage + notify = receivedMessage diff --git a/ui/app/AppLayouts/Wallet/LeftTab.qml b/ui/app/AppLayouts/Wallet/LeftTab.qml index f61ac069f0..f54341b814 100644 --- a/ui/app/AppLayouts/Wallet/LeftTab.qml +++ b/ui/app/AppLayouts/Wallet/LeftTab.qml @@ -73,6 +73,16 @@ ColumnLayout { } } + Text { + id: test + color: Theme.lightBlueText + text: assetsModel.lastMessage + anchors.left: walletAmountValue.right + anchors.leftMargin: 5 + font.weight: Font.Medium + font.pixelSize: 30 + } + TabBar { readonly property int btnHeight: 56