github.com/jonasnick/go-ethereum@v0.7.12-0.20150216215225-22176f05d387/cmd/mist/assets/qml/views/whisper.qml (about)

     1  
     2  import QtQuick 2.0
     3  import QtQuick.Controls 1.0;
     4  import QtQuick.Layouts 1.0;
     5  import QtQuick.Dialogs 1.0;
     6  import QtQuick.Window 2.1;
     7  import QtQuick.Controls.Styles 1.1
     8  import Ethereum 1.0
     9  
    10  Rectangle {
    11  	id: root
    12  	property var title: "Whisper Traffic"
    13  	property var menuItem
    14  
    15  	objectName: "whisperView"
    16  	anchors.fill: parent
    17  
    18  	property var identity: ""
    19  	Component.onCompleted: {
    20  		identity = shh.newIdentity()
    21  
    22  		var t = shh.watch({}, root)
    23  	}
    24  
    25  	function onShhMessage(message, i) {
    26  		whisperModel.insert(0, {from: message.from, payload: eth.toAscii(message.payload)})
    27  	}
    28  
    29  	RowLayout {
    30  		id: input
    31  		anchors {
    32  			left: parent.left
    33  			leftMargin: 20
    34  			top: parent.top
    35  			topMargin: 20
    36  		}
    37  
    38  		TextField {
    39  			id: to
    40  			placeholderText: "To"
    41  		}
    42  		TextField {
    43  			id: data
    44  			placeholderText: "Data"
    45  		}
    46  		TextField {
    47  			id: topics
    48  			placeholderText: "topic1, topic2, topic3, ..."
    49  		}
    50  		Button {
    51  			text: "Send"
    52  			onClicked: {
    53  				shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50)
    54  			}
    55  		}
    56  	}
    57  
    58  	TableView {
    59  		id: txTableView
    60  		anchors {
    61  			top: input.bottom
    62  			topMargin: 10
    63  			bottom: parent.bottom
    64  			left: parent.left
    65  			right: parent.right
    66  		}
    67  		TableViewColumn{ id: fromRole; role: "from" ; title: "From"; width: 300 }
    68  		TableViewColumn{ role: "payload" ; title: "Payload" ; width: parent.width -  fromRole.width - 2 }
    69  
    70  		model: ListModel {
    71  			id: whisperModel
    72  		}
    73  	}
    74  }