erigon-pulse/cmd/mist/assets/qml/views/whisper.qml
obscuren 0e5aed63dd Updated QWhisper
* changed api
* general whisper debug interface
2014-12-21 15:06:35 +01:00

76 lines
1.4 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 1.0;
import QtQuick.Layouts 1.0;
import QtQuick.Dialogs 1.0;
import QtQuick.Window 2.1;
import QtQuick.Controls.Styles 1.1
import Ethereum 1.0
Rectangle {
id: root
property var title: "Whisper Traffic"
property var iconSource: "../facet.png"
property var menuItem
objectName: "whisperView"
anchors.fill: parent
property var identity: ""
Component.onCompleted: {
identity = shh.newIdentity()
console.log("New identity:", identity)
var t = shh.watch({}, root)
}
function onMessage(message) {
whisperModel.insert(0, {data: JSON.stringify({from: message.from, payload: eth.toAscii(message.payload)})})
}
RowLayout {
id: input
anchors {
left: parent.left
leftMargin: 20
top: parent.top
topMargin: 20
}
TextField {
id: to
placeholderText: "To"
}
TextField {
id: data
placeholderText: "Data"
}
TextField {
id: topics
placeholderText: "topic1, topic2, topic3, ..."
}
Button {
text: "Send"
onClicked: {
shh.post(eth.toHex(data.text), "", identity, topics.text.split(","), 500, 50)
}
}
}
TableView {
id: txTableView
anchors {
top: input.bottom
topMargin: 10
bottom: parent.bottom
left: parent.left
right: parent.right
}
TableViewColumn{ role: "data" ; title: "Data" ; width: parent.width - 2 }
model: ListModel {
id: whisperModel
}
}
}