move block notification to node management tab
This commit is contained in:
parent
959f8277ce
commit
755fd6056b
|
@ -1,8 +1,9 @@
|
|||
import NimQml
|
||||
import "../../status/core" as status
|
||||
import ../signals/types
|
||||
import nodeView
|
||||
|
||||
type NodeController* = ref object
|
||||
type NodeController* = ref object of SignalSubscriber
|
||||
view*: NodeView
|
||||
variant*: QVariant
|
||||
|
||||
|
@ -21,3 +22,8 @@ proc delete*(self: NodeController) =
|
|||
|
||||
proc init*(self: NodeController) =
|
||||
discard
|
||||
|
||||
method onSignal(self: NodeController, data: Signal) =
|
||||
echo "new signal received"
|
||||
var msg = cast[WalletSignal](data)
|
||||
self.view.setLastMessage(msg.content)
|
||||
|
|
|
@ -4,6 +4,7 @@ QtObject:
|
|||
type NodeView* = ref object of QObject
|
||||
callResult: string
|
||||
sendRPCMessage: proc (msg: string): string
|
||||
lastMessage*: string
|
||||
|
||||
proc setup(self: NodeView) =
|
||||
self.QObject.setup
|
||||
|
@ -12,6 +13,7 @@ QtObject:
|
|||
new(result)
|
||||
result.sendRPCMessage = sendRPCMessage
|
||||
result.callResult = "Use this tool to call JSONRPC methods"
|
||||
result.lastMessage = ""
|
||||
result.setup
|
||||
|
||||
proc delete*(self: NodeView) =
|
||||
|
@ -41,3 +43,17 @@ QtObject:
|
|||
proc onMessage*(self: NodeView, message: string) {.slot.} =
|
||||
self.setCallResult(message)
|
||||
echo "Received message: ", message
|
||||
|
||||
proc lastMessage*(self: NodeView): string {.slot.} =
|
||||
result = self.lastMessage
|
||||
|
||||
proc receivedMessage*(self: NodeView, lastMessage: string) {.signal.}
|
||||
|
||||
proc setLastMessage*(self: NodeView, lastMessage: string) {.slot.} =
|
||||
self.lastMessage = lastMessage
|
||||
self.receivedMessage(lastMessage)
|
||||
|
||||
QtProperty[string] lastMessage:
|
||||
read = lastMessage
|
||||
write = setLastMessage
|
||||
notify = receivedMessage
|
||||
|
|
|
@ -43,7 +43,3 @@ proc init*(self: WalletController) =
|
|||
|
||||
let symbol = "ETH"
|
||||
self.view.addAssetToList("Ethereum", symbol, fmt"{eth_value:.6}", "$" & fmt"{usd_balance:.6}", fmt"../../img/token-icons/{toLowerAscii(symbol)}.svg")
|
||||
|
||||
method onSignal(self: WalletController, data: Signal) =
|
||||
var msg = cast[WalletSignal](data)
|
||||
self.view.setLastMessage(msg.content)
|
|
@ -17,7 +17,6 @@ QtObject:
|
|||
type
|
||||
WalletView* = ref object of QAbstractListModel
|
||||
assets*: seq[Asset]
|
||||
lastMessage*: string
|
||||
defaultAccount: string
|
||||
sendTransaction: proc(from_value: string, to: string, value: string, password: string): string
|
||||
|
||||
|
@ -35,9 +34,8 @@ QtObject:
|
|||
new(result, delete)
|
||||
result.sendTransaction = sendTransaction
|
||||
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,
|
||||
|
@ -80,20 +78,3 @@ 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
|
||||
|
|
|
@ -29,6 +29,21 @@ SplitView {
|
|||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
|
||||
RowLayout {
|
||||
id: messageContainer
|
||||
Layout.fillHeight: true
|
||||
Text {
|
||||
id: test
|
||||
color: Theme.lightBlueText
|
||||
text: nodeModel.lastMessage
|
||||
Layout.fillWidth: true
|
||||
anchors.left: walletAmountValue.right
|
||||
anchors.leftMargin: 5
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: 30
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: resultContainer
|
||||
Layout.fillHeight: true
|
||||
|
|
|
@ -73,16 +73,6 @@ 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