| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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 | 
					
						
							| 
									
										
										
										
											2014-12-21 15:06:35 +01:00
										 |  |  | 	property var title: "Whisper Traffic" | 
					
						
							| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | 	property var menuItem | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	objectName: "whisperView" | 
					
						
							|  |  |  | 	anchors.fill: parent | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	property var identity: "" | 
					
						
							|  |  |  | 	Component.onCompleted: { | 
					
						
							|  |  |  | 		identity = shh.newIdentity() | 
					
						
							| 
									
										
										
										
											2014-12-16 19:55:57 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-21 15:06:35 +01:00
										 |  |  | 		var t = shh.watch({}, root) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-22 13:23:11 +01:00
										 |  |  | 	function onShhMessage(message, i) { | 
					
						
							| 
									
										
										
										
											2014-12-22 10:58:28 +01:00
										 |  |  | 		whisperModel.insert(0, {from: message.from, payload: eth.toAscii(message.payload)}) | 
					
						
							| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	RowLayout { | 
					
						
							| 
									
										
										
										
											2014-12-21 15:06:35 +01:00
										 |  |  | 		id: input | 
					
						
							|  |  |  | 		anchors { | 
					
						
							|  |  |  | 			left: parent.left | 
					
						
							|  |  |  | 			leftMargin: 20 | 
					
						
							|  |  |  | 			top: parent.top | 
					
						
							|  |  |  | 			topMargin: 20 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | 		TextField { | 
					
						
							|  |  |  | 			id: to | 
					
						
							|  |  |  | 			placeholderText: "To" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		TextField { | 
					
						
							|  |  |  | 			id: data | 
					
						
							|  |  |  | 			placeholderText: "Data" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		TextField { | 
					
						
							|  |  |  | 			id: topics | 
					
						
							|  |  |  | 			placeholderText: "topic1, topic2, topic3, ..." | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		Button { | 
					
						
							|  |  |  | 			text: "Send" | 
					
						
							|  |  |  | 			onClicked: { | 
					
						
							| 
									
										
										
										
											2014-12-22 14:59:52 +01:00
										 |  |  | 				shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50) | 
					
						
							| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-12-21 15:06:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	TableView { | 
					
						
							|  |  |  | 		id: txTableView | 
					
						
							|  |  |  | 		anchors { | 
					
						
							|  |  |  | 			top: input.bottom | 
					
						
							|  |  |  | 			topMargin: 10 | 
					
						
							|  |  |  | 			bottom: parent.bottom | 
					
						
							|  |  |  | 			left: parent.left | 
					
						
							|  |  |  | 			right: parent.right | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-12-22 10:58:28 +01:00
										 |  |  | 		TableViewColumn{ id: fromRole; role: "from" ; title: "From"; width: 300 } | 
					
						
							|  |  |  | 		TableViewColumn{ role: "payload" ; title: "Payload" ; width: parent.width -  fromRole.width - 2 } | 
					
						
							| 
									
										
										
										
											2014-12-21 15:06:35 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		model: ListModel { | 
					
						
							|  |  |  | 			id: whisperModel | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-12-15 17:09:27 +01:00
										 |  |  | } |