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) = method onSignal(self: WalletController, signal: string) =
echo "Received a signal in the wallet module: ", signal 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 type
WalletView* = ref object of QAbstractListModel WalletView* = ref object of QAbstractListModel
assets*: seq[Asset] assets*: seq[Asset]
lastMessage*: string
proc delete(self: WalletView) = proc delete(self: WalletView) =
self.QAbstractListModel.delete self.QAbstractListModel.delete
@ -30,6 +31,7 @@ QtObject:
proc newWalletView*(): WalletView = proc newWalletView*(): WalletView =
new(result, delete) new(result, delete)
result.assets = @[] result.assets = @[]
result.lastMessage = ""
result.setup result.setup
proc addAssetToList*(self: WalletView, name: string, symbol: string, value: string, fiatValue: string, image: string) {.slot.} = proc addAssetToList*(self: WalletView, name: string, symbol: string, value: string, fiatValue: string, image: string) {.slot.} =
@ -65,3 +67,20 @@ QtObject:
AssetRoles.Value.int:"value", AssetRoles.Value.int:"value",
AssetRoles.FiatValue.int:"fiatValue", AssetRoles.FiatValue.int:"fiatValue",
AssetRoles.Image.int:"image" }.toTable 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 { TabBar {
readonly property int btnHeight: 56 readonly property int btnHeight: 56