feat: display message in wallet
This commit is contained in:
parent
beb5f1520f
commit
9411aa61e7
|
@ -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)
|
|
@ -17,6 +17,7 @@ QtObject:
|
|||
type
|
||||
WalletView* = ref object of QAbstractListModel
|
||||
assets*: seq[Asset]
|
||||
lastMessage*: string
|
||||
|
||||
proc delete(self: WalletView) =
|
||||
self.QAbstractListModel.delete
|
||||
|
@ -30,6 +31,7 @@ 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.} =
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue