feat: display message in wallet

This commit is contained in:
Richard Ramos 2020-05-18 11:22:46 -04:00 committed by Iuri Matias
parent beb5f1520f
commit 9411aa61e7
3 changed files with 31 additions and 2 deletions

View File

@ -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
self.view.setLastMessage(signal)

View File

@ -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

View File

@ -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