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: "Network" property var iconSource: "../net.png" property var menuItem objectName: "chainView" visible: false anchors.fill: parent TableView { id: blockTable width: parent.width anchors.top: parent.top anchors.bottom: parent.bottom TableViewColumn{ role: "number" ; title: "#" ; width: 100 } TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } model: blockModel itemDelegate: Item { Text { anchors { left: parent.left right: parent.right leftMargin: 10 verticalCenter: parent.verticalCenter } color: styleData.textColor elide: styleData.elideMode text: styleData.value font.pixelSize: 11 MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton propagateComposedEvents: true anchors.fill: parent onClicked: { blockTable.selection.clear() blockTable.selection.select(styleData.row) if(mouse.button == Qt.RightButton) { contextMenu.row = styleData.row; contextMenu.popup() } } onDoubleClicked: { popup.visible = true popup.setDetails(blockModel.get(styleData.row)) } } } } Menu { id: contextMenu property var row; MenuItem { text: "Details" onTriggered: { popup.visible = true popup.setDetails(blockModel.get(this.row)) } } MenuSeparator{} MenuItem { text: "Copy" onTriggered: { copyToClipboard(blockModel.get(this.row).hash) } } MenuItem { text: "Dump State" onTriggered: { generalFileDialog.show(false, function(path) { var hash = blockModel.get(this.row).hash; gui.dumpState(hash, path); }); } } } } function addBlock(block, initial) { if(initial == undefined){ initial = false } /* var txs = JSON.parse(block.transactions); if(txs != null){ amount = txs.length } */ var txs = block.transactions; var amount = block.transactions.length; if(initial){ blockModel.append({size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } else { blockModel.insert(0, {size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } //root.secondary.text = "#" + block.number; } Window { id: popup visible: false //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint property var block width: root.width height: 300 Component{ id: blockDetailsDelegate Rectangle { color: "#252525" width: popup.width height: 150 Column { anchors.leftMargin: 10 anchors.topMargin: 5 anchors.top: parent.top anchors.left: parent.left Text { text: '