1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
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 onShhMessage(message, i) {
whisperModel.insert(0, {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{ id: fromRole; role: "from" ; title: "From"; width: 300 }
TableViewColumn{ role: "payload" ; title: "Payload" ; width: parent.width - fromRole.width - 2 }
model: ListModel {
id: whisperModel
}
}
}
|