From 6b115659ca3f5879f27c45723ef567b67133bc93 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Thu, 22 May 2014 10:27:21 +0200 Subject: Hide inspector by default --- ethereal/assets/qml/webapp.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index f00b04599..d3cffeeca 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -188,7 +188,7 @@ ApplicationWindow { WebView { id: inspector - visible:true + visible: false url: webview.experimental.remoteInspectorUrl anchors { left: root.left -- cgit v1.2.3 From b42c70be9c669ba372ed99d820a5a9e807191619 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Mon, 26 May 2014 00:10:38 +0200 Subject: Recv send for txs --- ethereal/assets/qml/wallet.qml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 51f064adf..f23f182f3 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -85,7 +85,6 @@ ApplicationWindow { //color: "#D9DDE7" color: "#252525" - ColumnLayout { y: 50 anchors.left: parent.left @@ -155,6 +154,7 @@ ApplicationWindow { TableView { id: txTableView anchors.fill: parent + TableViewColumn{ role: "inout" ; title: "" ; width: 40 } TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } @@ -404,7 +404,7 @@ ApplicationWindow { anchors.left: aboutIcon.right anchors.leftMargin: 10 font.pointSize: 12 - text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br><h3>Binary Distribution</h3>Jarrad Hope<br>" + text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" } } @@ -429,7 +429,6 @@ ApplicationWindow { } } SplitView { - anchors.fill: parent property var asmModel: ListModel { id: asmModel @@ -524,14 +523,14 @@ ApplicationWindow { walletValueLabel.text = value } - function addTx(tx) { + function addTx(tx, inout) { var isContract if (tx.contract == true){ isContract = "Yes" }else{ isContract = "No" } - txModel.insert(0, {hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) } function addBlock(block) { -- cgit v1.2.3 From 5fc6ee6a4acd1db22a38abb4cff5e5196bf1538e Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Mon, 26 May 2014 17:07:20 +0200 Subject: Implemented simple block/tx explorer --- ethereal/assets/qml/wallet.qml | 139 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 126 insertions(+), 13 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 7a6750f63..8903fb14f 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -65,6 +65,7 @@ ApplicationWindow { } function setView(view) { + console.log("Setting view") networkView.visible = false historyView.visible = false newTxView.visible = false @@ -203,16 +204,14 @@ ApplicationWindow { anchors.bottom: logView.top TableViewColumn{ role: "number" ; title: "#" ; width: 100 } TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } + TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } model: blockModel - /* - onDoubleClicked: { - popup.visible = true - popup.block = eth.getBlock(blockModel.get(row).hash) - popup.hashLabel.text = popup.block.hash - } - */ + onDoubleClicked: { + popup.visible = true + popup.setDetails(blockModel.get(row)) + } } property var logModel: ListModel { @@ -340,10 +339,107 @@ ApplicationWindow { id: popup visible: false property var block - Label { - id: hashLabel - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter + width: 800 + height: 230 + x: root.x + y: root.y + root.height + Component{ + id: blockDetailsDelegate + Rectangle { + color: "#252525" + width: popup.width + height: 200 + Column { + anchors.leftMargin: 10 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} + Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} + Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} + Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} + } + } + } + ListView { + model: singleBlock + delegate: blockDetailsDelegate + anchors.top: parent.top + height: 70 + anchors.leftMargin: 20 + id: listViewThing + Layout.maximumHeight: 40 + } + TableView { + id: txView + anchors.top: listViewThing.bottom + anchors.topMargin: 50 + width: parent.width + + TableViewColumn{width: 90; role: "value" ; title: "Value" } + TableViewColumn{width: 200; role: "hash" ; title: "Hash" } + TableViewColumn{width: 200; role: "sender" ; title: "Sender" } + TableViewColumn{width: 200;role: "address" ; title: "Receiver" } + TableViewColumn{width: 60; role: "gas" ; title: "Gas" } + TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } + TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } + + model: transactionModel + onClicked: { + var tx = transactionModel.get(row) + if(tx.data) { + popup.showContractData(tx.data) + }else{ + popup.height = 230 + } + } + } + function showContractData(data) { + contractData.text = data + popup.height = 400 + } + Rectangle { + width: popup.width + height: 200 + anchors.left: listViewThing.left + anchors.top: txView.bottom + Label { + text: "<h4>Contract data</h4>" + anchors.top: parent.top + anchors.left: parent.left + id: contractLabel + anchors.leftMargin: 10 + } + TextArea { + id: contractData + text: "Contract" + anchors.top: contractLabel.bottom + anchors.left: parent.left + wrapMode: Text.Wrap + width: parent.width - 30 + height: 80 + anchors.leftMargin: 10 + } + } + property var transactionModel: ListModel { + id: transactionModel + } + property var singleBlock: ListModel { + id: singleBlock + } + function setDetails(block){ + singleBlock.set(0,block) + popup.height = 230 + transactionModel.clear() + if(block.txs != undefined){ + for(var i = 0; i < block.txs.count; ++i) { + transactionModel.insert(0, block.txs.get(i)) + } + if(block.txs.get(0).data){ + popup.showContractData(block.txs.get(0).data) + } + } + txView.forceActiveFocus() } } @@ -474,7 +570,7 @@ ApplicationWindow { } height: parent.height/2 width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + TableViewColumn{ role: "value" ; title: "Stack"} model: stackModel } } @@ -535,7 +631,12 @@ ApplicationWindow { } function addBlock(block) { - blockModel.insert(0, {number: block.number, hash: block.hash}) + var objtt = JSON.parse(block.transactions); + var amount = 0 + if(objtt != null){ + amount = objtt.length + } + blockModel.insert(0, {number: block.number, hash: block.hash, txs: objtt, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } function addLog(str) { @@ -547,4 +648,16 @@ ApplicationWindow { function setPeers(text) { peerLabel.text = text } + function convertToPretty(unixTs){ + var a = new Date(unixTs*1000); + var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; + return time; + } } -- cgit v1.2.3 From f7eb4e587f83e4472e3d214076ba0c28102daefd Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Mon, 26 May 2014 17:18:34 +0200 Subject: Remove extra log statement --- ethereal/assets/qml/wallet.qml | 1 - 1 file changed, 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 8903fb14f..81ad7ef24 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -65,7 +65,6 @@ ApplicationWindow { } function setView(view) { - console.log("Setting view") networkView.visible = false historyView.visible = false newTxView.visible = false -- cgit v1.2.3 From d694e00a3340a36c39872950bb7a2404e9686c18 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Mon, 26 May 2014 21:11:38 +0200 Subject: Fixed debugger --- ethereal/assets/qml/wallet.qml | 75 ++++++++++++++++++------------ ethereal/assets/samplecoin/samplecoin.html | 2 +- 2 files changed, 45 insertions(+), 32 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index f23f182f3..f42cf3b1b 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -409,7 +409,7 @@ ApplicationWindow { } - Window { + ApplicationWindow { id: debugWindow visible: false title: "Debugger" @@ -447,36 +447,49 @@ ApplicationWindow { orientation: Qt.Vertical anchors.fill: parent - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } - model: stackModel - } - } + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + ui.next() + } + text: "Next" } } } diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html index 3892141cd..e780aefb4 100644 --- a/ethereal/assets/samplecoin/samplecoin.html +++ b/ethereal/assets/samplecoin/samplecoin.html @@ -9,7 +9,7 @@ <script type="text/javascript"> -var jefcoinAddr = "fc0a9436890478bb9b1c6ed7455c2535366f4a99" +var jefcoinAddr = "518546ffa883dcc838a64bc2dabada0fd64af459" var mAddr = "" function createTransaction() { -- cgit v1.2.3 From 47a58b40cd4ba764c9823448687307bb4a80c697 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 27 May 2014 10:29:39 +0200 Subject: Removed recursive function for loop --- ethereal/assets/qml/wallet.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index f318ad173..b467982c4 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -643,12 +643,12 @@ ApplicationWindow { } function addBlock(block) { - var objtt = JSON.parse(block.transactions); + var txs = JSON.parse(block.transactions); var amount = 0 - if(objtt != null){ - amount = objtt.length + if(txs != null){ + amount = txs.length } - blockModel.insert(0, {number: block.number, hash: block.hash, txs: objtt, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } function addLog(str) { -- cgit v1.2.3 From 07204f129e277fb5f63f080d6a146e28603f872e Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 27 May 2014 10:38:51 +0200 Subject: Increase size for asm --- ethereal/assets/qml/wallet.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index b467982c4..911422f91 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -339,7 +339,7 @@ ApplicationWindow { visible: false property var block width: 800 - height: 230 + height: 280 x: root.x y: root.y + root.height Component{ @@ -399,7 +399,7 @@ ApplicationWindow { } Rectangle { width: popup.width - height: 200 + height: 300 anchors.left: listViewThing.left anchors.top: txView.bottom Label { -- cgit v1.2.3 From 4fd267a7785ea06014f38f9be4e8e380c7f1cb1e Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Tue, 27 May 2014 10:42:37 +0200 Subject: Sep debugger from main --- ethereal/assets/debugger/debugger.qml | 114 ++++++++++++++++++++++++++++++++++ ethereal/assets/qml/wallet.qml | 14 ++++- 2 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 ethereal/assets/debugger/debugger.qml (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml new file mode 100644 index 000000000..b7d954e73 --- /dev/null +++ b/ethereal/assets/debugger/debugger.qml @@ -0,0 +1,114 @@ +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 + +ApplicationWindow { + id: debugWindow + visible: false + title: "Debugger" + minimumWidth: 600 + minimumHeight: 600 + width: 800 + height: 600 + + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + //db.next() + } + text: "Next" + } + } + } + + function setAsm(asm) { + asmModel.append({asm: asm}) + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num-1) + } + + function clearAsm() { + asmModel.clear() + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } +} diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index f42cf3b1b..40de8624e 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -294,6 +294,7 @@ ApplicationWindow { statusBar: StatusBar { RowLayout { anchors.fill: parent + /* Button { property var enabled: true id: connectButton @@ -304,10 +305,19 @@ ApplicationWindow { } text: "Connect" } + */ + Button { + property var enabled: true + id: debuggerWindow + onClicked: { + ui.startDebugger() + } + text: "Debugger" + } Button { id: importAppButton - anchors.left: connectButton.right + anchors.left: debuggerWindow.right anchors.leftMargin: 5 onClicked: openAppDialog.open() text: "Import App" @@ -473,7 +483,7 @@ ApplicationWindow { } height: parent.height/2 width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + TableViewColumn{ role: "value" ; title: "Stack" ; width: 300 } model: stackModel } } -- cgit v1.2.3 From 1ab865a994758cef8a6bf75a3cc263f16a97d847 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 27 May 2014 11:49:42 +0200 Subject: Adding new blocks on broadcast --- ethereal/assets/qml/wallet.qml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 911422f91..e59e85ab3 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -642,13 +642,22 @@ ApplicationWindow { txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) } - function addBlock(block) { + function addBlock(block, initial) { var txs = JSON.parse(block.transactions); var amount = 0 + if(initial == undefined){ + initial = false + } + if(txs != null){ amount = txs.length } - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + + if(initial){ + blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + }else{ + blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + } } function addLog(str) { -- cgit v1.2.3 From 6fe42f007c6f4816de88a2c4aad10754036d41b8 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 27 May 2014 12:46:02 +0200 Subject: Uhm what --- ethereal/assets/qml/wallet.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index e59e85ab3..0c0c977c1 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -556,6 +556,7 @@ ApplicationWindow { SplitView { orientation: Qt.Horizontal + id: debugSplitView TableView { property var debuggerLog: ListModel { id: debuggerLog @@ -569,7 +570,7 @@ ApplicationWindow { } height: parent.height/2 width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } model: stackModel } } -- cgit v1.2.3 From d0b31e203053f3f176e61719d877dcaa04169bb3 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Tue, 27 May 2014 13:09:47 +0200 Subject: New debugger --- ethereal/assets/debugger/debugger.qml | 310 ++++++++++++++++++++++------------ 1 file changed, 206 insertions(+), 104 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index b7d954e73..07a78411b 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -7,108 +7,210 @@ import QtQuick.Controls.Styles 1.1 import Ethereum 1.0 ApplicationWindow { - id: debugWindow - visible: false - title: "Debugger" - minimumWidth: 600 - minimumHeight: 600 - width: 800 - height: 600 - - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } - model: stackModel - } - } - } - } - } - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - Button { - property var enabled: true - id: debugNextButton - onClicked: { - //db.next() - } - text: "Next" - } - } - } - - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } - function addDebugMessage(message){ - debuggerLog.append({value: message}) - } - - function clearStack() { - stackModel.clear() - } + visible: false + title: "Debugger" + minimumWidth: 1280 + minimumHeight: 900 + width: 1290 + height: 900 + + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + color: "#00000000" + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + Rectangle { + color: "#00000000" + height: 500 + anchors.left: parent.left + anchors.right: parent.right + + TextArea { + id: codeEditor + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: settings.left + } + + Column { + id: settings + spacing: 5 + width: 300 + height: parent.height + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + + Label { + text: "Data" + } + TextArea { + anchors.left: parent.left + anchors.right: parent.right + height: 150 + } + + Label { + text: "Amount" + } + TextField { + id: txValue + width: 200 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + } + Label { + text: "Amount of gas" + } + TextField { + id: txGas + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + text: "10000" + placeholderText: "Gas" + } + Label { + text: "Gas price" + } + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + text: "1000000000000" + validator: RegExpValidator { regExp: /\d*/ } + } + } + } + + SplitView { + orientation: Qt.Vertical + id: inspectorPane + height: 500 + + SplitView { + orientation: Qt.Horizontal + height: 300 + + TableView { + id: stackTableView + property var stackModel: ListModel { + id: stackModel + } + height: parent.height + width: 300 + TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } + model: stackModel + } + + TableView { + id: memoryTableView + property var memModel: ListModel { + id: memModel + } + height: parent.height + width: parent.width - stackTableView.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + } + + SplitView { + height: 300 + TableView { + id: storageTableView + property var memModel: ListModel { + id: storageModel + } + height: parent.height + width: parent.width - stackTableView.width + TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2} + TableViewColumn{ role: "value" ; title: "value" ; width: storageTableView.width / 2} + model: storageModel + } + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + spacing: 5 + anchors.fill: parent + + Button { + property var enabled: true + id: debugStart + onClicked: { + dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text) + } + text: "Debug" + } + + Button { + property var enabled: true + id: debugNextButton + onClicked: { + dbg.next() + } + text: "Next" + } + } + } + + function setAsm(asm) { + console.log("set asm", asm) + asmModel.append({asm: asm}) + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num-1) + } + + function clearAsm() { + asmModel.clear() + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } + + function clearStorage() { + storageModel.clear() + } + + function setStorage(storage) { + storageModel.append({key: storage.key, value: storage.value}) + } } -- cgit v1.2.3 From 47417506c377dd0848739473fa14a51708b6a034 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Tue, 27 May 2014 13:28:11 +0200 Subject: New debugger implemented --- ethereal/assets/debugger/debugger.qml | 9 ++++----- ethereal/assets/qml/wallet.qml | 8 -------- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 07a78411b..bf69b4254 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -175,19 +175,18 @@ ApplicationWindow { } function setAsm(asm) { - console.log("set asm", asm) asmModel.append({asm: asm}) } + function clearAsm() { + asmModel.clear() + } + function setInstruction(num) { asmTableView.selection.clear() asmTableView.selection.select(num-1) } - function clearAsm() { - asmModel.clear() - } - function setMem(mem) { memModel.append({num: mem.num, value: mem.value}) } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 40de8624e..4aa22dddc 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -306,14 +306,6 @@ ApplicationWindow { text: "Connect" } */ - Button { - property var enabled: true - id: debuggerWindow - onClicked: { - ui.startDebugger() - } - text: "Debugger" - } Button { id: importAppButton -- cgit v1.2.3 From a0f73c2703aacab189c5cf26a5c95e156039eb9e Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Tue, 27 May 2014 16:09:04 +0200 Subject: Minor fixes and improvements to the ui --- ethereal/assets/debugger/debugger.qml | 12 ++++++------ ethereal/assets/heart.png | Bin 0 -> 4277 bytes ethereal/assets/qml/wallet.qml | 21 ++++----------------- 3 files changed, 10 insertions(+), 23 deletions(-) create mode 100644 ethereal/assets/heart.png (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index bf69b4254..9ea131d7d 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -8,7 +8,7 @@ import Ethereum 1.0 ApplicationWindow { visible: false - title: "Debugger" + title: "IceCream" minimumWidth: 1280 minimumHeight: 900 width: 1290 @@ -58,9 +58,10 @@ ApplicationWindow { anchors.bottom: parent.bottom Label { - text: "Data" + text: "Arbitrary data" } TextArea { + id: rawDataField anchors.left: parent.left anchors.right: parent.right height: 150 @@ -105,7 +106,7 @@ ApplicationWindow { SplitView { orientation: Qt.Horizontal - height: 300 + height: 250 TableView { id: stackTableView @@ -149,16 +150,15 @@ ApplicationWindow { } } } - statusBar: StatusBar { + toolBar: ToolBar { RowLayout { spacing: 5 - anchors.fill: parent Button { property var enabled: true id: debugStart onClicked: { - dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text) + dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) } text: "Debug" } diff --git a/ethereal/assets/heart.png b/ethereal/assets/heart.png new file mode 100644 index 000000000..3c874ab7f Binary files /dev/null and b/ethereal/assets/heart.png differ diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 3063bb10d..5e0904a20 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -123,7 +123,7 @@ ApplicationWindow { } Image { - source: ui.assetPath("net.png") + source: ui.assetPath("heart.png") anchors.horizontalCenter: parent.horizontalCenter MouseArea { anchors.fill: parent @@ -284,27 +284,14 @@ ApplicationWindow { title: "Open QML Application" onAccepted: { //ui.open(openAppDialog.fileUrl.toString()) - //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) - ui.openHtml(openAppDialog.fileUrl.toString()) - + //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) + ui.openHtml(openAppDialog.fileUrl.toString()) } } statusBar: StatusBar { RowLayout { anchors.fill: parent - /* - Button { - property var enabled: true - id: connectButton - onClicked: { - if(this.enabled) { - ui.connect(this) - } - } - text: "Connect" - } - */ Button { property var enabled: true @@ -369,8 +356,8 @@ ApplicationWindow { Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} } + } } - } ListView { model: singleBlock delegate: blockDetailsDelegate -- cgit v1.2.3 From 969b4a4a36c2f465de3ab980d13ec513ec6db780 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Tue, 27 May 2014 16:23:53 +0200 Subject: Added some shortcuts --- ethereal/assets/debugger/debugger.qml | 23 ++++++++++++++++++++++- ethereal/assets/qml/wallet.qml | 10 ++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 9ea131d7d..7c3ffbceb 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -14,6 +14,23 @@ ApplicationWindow { width: 1290 height: 900 + MenuBar { + Menu { + title: "Debugger" + MenuItem { + text: "Run" + shortcut: "Ctrl+r" + onTriggered: debugCurrent() + } + + MenuItem { + text: "Next" + shortcut: "Ctrl+n" + onTriggered: dbg.next() + } + } + } + SplitView { anchors.fill: parent property var asmModel: ListModel { @@ -158,7 +175,7 @@ ApplicationWindow { property var enabled: true id: debugStart onClicked: { - dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) + debugCurrent() } text: "Debug" } @@ -174,6 +191,10 @@ ApplicationWindow { } } + function debugCurrent() { + dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) + } + function setAsm(asm) { asmModel.append({asm: asm}) } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 5e0904a20..e5a2bc249 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -24,11 +24,21 @@ ApplicationWindow { shortcut: "Ctrl+o" onTriggered: openAppDialog.open() } + } + + Menu { + title: "Tools" MenuItem { text: "Muted" shortcut: "Ctrl+e" onTriggered: ui.muted("") } + + MenuItem { + text: "Debugger" + shortcut: "Ctrl+d" + onTriggered: ui.startDebugger() + } } Menu { -- cgit v1.2.3 From 138b7fe2d83d61b87204ecb5f00f34f474e57a1f Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 28 May 2014 11:52:52 +0200 Subject: Consolidated external qml files to hopefully prevent crashing bug --- .../assets/qml/newTransaction/_new_contract.qml | 196 --- .../assets/qml/newTransaction/_simple_send.qml | 112 -- ethereal/assets/qml/wallet.qml | 1658 ++++++++++++-------- 3 files changed, 976 insertions(+), 990 deletions(-) delete mode 100644 ethereal/assets/qml/newTransaction/_new_contract.qml delete mode 100644 ethereal/assets/qml/newTransaction/_simple_send.qml (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/newTransaction/_new_contract.qml b/ethereal/assets/qml/newTransaction/_new_contract.qml deleted file mode 100644 index e3c7229eb..000000000 --- a/ethereal/assets/qml/newTransaction/_new_contract.qml +++ /dev/null @@ -1,196 +0,0 @@ -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 - -Component { - id: newContract - Column { - id: mainContractColumn - function contractFormReady(){ - if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { - txButton.state = "READY" - }else{ - txButton.state = "NOTREADY" - } - } - states: [ - State{ - name: "ERROR" - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: codeView; visible:true} - }, - State { - name: "DONE" - PropertyChanges { target: txValue; visible:false} - PropertyChanges { target: txGas; visible:false} - PropertyChanges { target: txGasPrice; visible:false} - PropertyChanges { target: codeView; visible:false} - PropertyChanges { target: txButton; visible:false} - PropertyChanges { target: txDataLabel; visible:false} - - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: txOutput; visible:true} - PropertyChanges { target: newTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txValue; visible:true; text: ""} - PropertyChanges { target: txGas; visible:true; text: ""} - PropertyChanges { target: txGasPrice; visible:true; text: ""} - PropertyChanges { target: codeView; visible:true; text: ""} - PropertyChanges { target: txButton; visible:true} - PropertyChanges { target: txDataLabel; visible:true} - - PropertyChanges { target: txResult; visible:false} - PropertyChanges { target: txOutput; visible:false} - PropertyChanges { target: newTxButton; visible:false} - } - ] - width: 400 - spacing: 5 - anchors.left: parent.left - anchors.top: parent.top - anchors.leftMargin: 5 - anchors.topMargin: 5 - - TextField { - id: txValue - width: 200 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGas - width: 200 - validator: RegExpValidator { regExp: /\d*/ } - placeholderText: "Gas" - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGasPrice - width: 200 - placeholderText: "Gas price" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - - Row { - id: rowContract - ExclusiveGroup { id: contractTypeGroup } - RadioButton { - id: createContractRadio - text: "Create contract" - checked: true - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = false - txDataLabel.text = "Contract code" - } - } - RadioButton { - id: runContractRadio - text: "Run contract" - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = true - txDataLabel.text = "Contract arguments" - } - } - } - - - Label { - id: txDataLabel - text: "Contract code" - } - - TextArea { - id: codeView - height: 300 - anchors.topMargin: 5 - Layout.fillWidth: true - width: parent.width /2 - onTextChanged: { - contractFormReady() - } - } - - TextField { - id: txFuelRecipient - placeholderText: "Contract address" - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - visible: false - width: 530 - } - - Button { - id: txButton - /* enabled: false */ - states: [ - State { - name: "READY" - PropertyChanges { target: txButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txButton; /*enabled:false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) - if(res[1]) { - txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" - txResult.text += res[1].error() - txResult.text += "</b>" - mainContractColumn.state = "ERROR" - } else { - txResult.text = "Your transaction has been submitted:\n" - txOutput.text = res[0].address - mainContractColumn.state = "DONE" - } - } - } - Text { - id: txResult - visible: false - } - TextField { - id: txOutput - visible: false - width: 530 - } - Button { - id: newTxButton - visible: false - text: "Create an other contract" - onClicked: { - this.visible = false - txResult.text = "" - txOutput.text = "" - mainContractColumn.state = "SETUP" - } - } - - Button { - id: debugButton - text: "Debug" - onClicked: { - var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) - debugWindow.visible = true - } - } - } -} diff --git a/ethereal/assets/qml/newTransaction/_simple_send.qml b/ethereal/assets/qml/newTransaction/_simple_send.qml deleted file mode 100644 index cd1ef55b6..000000000 --- a/ethereal/assets/qml/newTransaction/_simple_send.qml +++ /dev/null @@ -1,112 +0,0 @@ -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 - -Component { - id: newTransaction - Column { - id: simpleSendColumn - states: [ - State{ - name: "ERROR" - }, - State { - name: "DONE" - PropertyChanges { target: txSimpleValue; visible:false} - PropertyChanges { target: txSimpleRecipient; visible:false} - PropertyChanges { target:newSimpleTxButton; visible:false} - - PropertyChanges { target: txSimpleResult; visible:true} - PropertyChanges { target: txSimpleOutput; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txSimpleValue; visible:true; text: ""} - PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} - PropertyChanges { target: txSimpleButton; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:false} - } - ] - spacing: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - - function checkFormState(){ - if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { - txSimpleButton.state = "READY" - }else{ - txSimpleButton.state = "NOTREADY" - } - } - - TextField { - id: txSimpleRecipient - placeholderText: "Recipient address" - Layout.fillWidth: true - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - width: 530 - onTextChanged: { checkFormState() } - } - TextField { - id: txSimpleValue - width: 200 - placeholderText: "Amount" - anchors.rightMargin: 5 - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { checkFormState() } - } - Button { - id: txSimpleButton - /*enabled: false*/ - states: [ - State { - name: "READY" - PropertyChanges { target: txSimpleButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txSimpleButton; /*enabled: false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text,"","","") - if(res[1]) { - txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() - } else { - txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" - txSimpleOutput.text = res[0].hash - this.visible = false - simpleSendColumn.state = "DONE" - } - } - } - Text { - id: txSimpleResult - visible: false - - } - TextField { - id: txSimpleOutput - visible: false - width: 530 - } - Button { - id: newSimpleTxButton - visible: false - text: "Create an other transaction" - onClicked: { - this.visible = false - simpleSendColumn.state = "SETUP" - } - } - } -} diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index e5a2bc249..bba9c1d3b 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -8,686 +8,980 @@ import Ethereum 1.0 ApplicationWindow { - id: root - - width: 900 - height: 600 - minimumHeight: 300 - - title: "Ethereal" - - MenuBar { - Menu { - title: "File" - MenuItem { - text: "Import App" - shortcut: "Ctrl+o" - onTriggered: openAppDialog.open() - } - } - - Menu { - title: "Tools" - MenuItem { - text: "Muted" - shortcut: "Ctrl+e" - onTriggered: ui.muted("") - } - - MenuItem { - text: "Debugger" - shortcut: "Ctrl+d" - onTriggered: ui.startDebugger() - } - } - - Menu { - title: "Network" - MenuItem { - text: "Add Peer" - shortcut: "Ctrl+p" - onTriggered: { - addPeerWin.visible = true - } - } - - MenuItem { - text: "Start" - onTriggered: ui.connect() - } - } - - Menu { - title: "Help" - MenuItem { - text: "About" - onTriggered: { - aboutWin.visible = true - } - } - } - - } - - - property var blockModel: ListModel { - id: blockModel - } - - function setView(view) { - networkView.visible = false - historyView.visible = false - newTxView.visible = false - infoView.visible = false - view.visible = true - //root.title = "Ethereal - " = view.title - } - - SplitView { - anchors.fill: parent - resizing: false - - Rectangle { - id: menu - Layout.minimumWidth: 80 - Layout.maximumWidth: 80 - anchors.bottom: parent.bottom - anchors.top: parent.top - //color: "#D9DDE7" - color: "#252525" - - ColumnLayout { - y: 50 - anchors.left: parent.left - anchors.right: parent.right - height: 200 - Image { - source: ui.assetPath("tx.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(historyView) - } - } - } - Image { - source: ui.assetPath("new.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(newTxView) - } - } - } - Image { - source: ui.assetPath("net.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(networkView) - } - } - } - - Image { - source: ui.assetPath("heart.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(infoView) - } - } - } - } - } - - Rectangle { - id: mainView - color: "#00000000" - anchors.right: parent.right - anchors.left: menu.right - anchors.bottom: parent.bottom - anchors.top: parent.top - - property var txModel: ListModel { - id: txModel - } - - Rectangle { - id: historyView - anchors.fill: parent - - property var title: "Transactions" - TableView { - id: txTableView - anchors.fill: parent - TableViewColumn{ role: "inout" ; title: "" ; width: 40 } - TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } - TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } - TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } - - model: txModel - } - } - - Rectangle { - id: newTxView - property var title: "New transaction" - visible: false - anchors.fill: parent - color: "#00000000" - TabView{ - anchors.fill: parent - anchors.rightMargin: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.bottomMargin: 5 - id: newTransactionTab - Component.onCompleted:{ - var component = Qt.createComponent("newTransaction/_simple_send.qml") - var newTransaction = component.createObject("newTransaction") - - component = Qt.createComponent("newTransaction/_new_contract.qml") - var newContract = component.createObject("newContract") - - addTab("Simple send", newTransaction) - addTab("Contracts", newContract) - } - } - } - - Rectangle { - id: networkView - property var title: "Network" - visible: false - anchors.fill: parent - - TableView { - id: blockTable - width: parent.width - anchors.top: parent.top - anchors.bottom: logView.top - TableViewColumn{ role: "number" ; title: "#" ; width: 100 } - TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } - TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } - - model: blockModel - - onDoubleClicked: { - popup.visible = true - popup.setDetails(blockModel.get(row)) - } - } - - property var logModel: ListModel { - id: logModel - } - - TableView { - id: logView - width: parent.width - height: 150 - anchors.bottom: parent.bottom - TableViewColumn{ role: "description" ; title: "log" } - - model: logModel - } - } - - Rectangle { - id: infoView - property var title: "Information" - visible: false - color: "#00000000" - anchors.fill: parent - - Label { - id: addressLabel - text: "Address" - anchors { - margins: 5 - top: parent.top - left: parent.left - } - } - TextField { - anchors { - margins: 5 - left: addressLabel.right - top: parent.top - } - text: pub.getKey().address - width: 500 - } - } - - /* - signal addPlugin(string name) - Component { - id: pluginWindow - Rectangle { - anchors.fill: parent - Label { - id: pluginTitle - anchors.centerIn: parent - text: "Hello world" - } - Component.onCompleted: setView(this) - } - } - - onAddPlugin: { - var pluginWin = pluginWindow.createObject(mainView) - console.log(pluginWin) - pluginWin.pluginTitle.text = "Test" - } - */ - } - } - - FileDialog { - id: openAppDialog - title: "Open QML Application" - onAccepted: { - //ui.open(openAppDialog.fileUrl.toString()) - //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) - ui.openHtml(openAppDialog.fileUrl.toString()) - } - } - - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - - Button { - property var enabled: true - id: debuggerWindow - onClicked: { - ui.startDebugger() - } - text: "Debugger" - } - - Button { - id: importAppButton - anchors.left: debuggerWindow.right - anchors.leftMargin: 5 - onClicked: openAppDialog.open() - text: "Import App" - } - - Label { - anchors.left: importAppButton.right - anchors.leftMargin: 5 - id: walletValueLabel - } - - Label { - anchors.right: peerImage.left - anchors.rightMargin: 5 - id: peerLabel - font.pixelSize: 8 - text: "0 / 0" - } - Image { - id: peerImage - anchors.right: parent.right - width: 10; height: 10 - source: ui.assetPath("network.png") - } - } - } - - Window { - id: popup - visible: false - property var block - width: 800 - height: 280 - x: root.x - y: root.y + root.height - Component{ - id: blockDetailsDelegate - Rectangle { - color: "#252525" - width: popup.width - height: 200 - Column { - anchors.leftMargin: 10 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} - Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} - Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} - Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} - } - } - } - ListView { - model: singleBlock - delegate: blockDetailsDelegate - anchors.top: parent.top - height: 70 - anchors.leftMargin: 20 - id: listViewThing - Layout.maximumHeight: 40 - } - TableView { - id: txView - anchors.top: listViewThing.bottom - anchors.topMargin: 50 - width: parent.width - - TableViewColumn{width: 90; role: "value" ; title: "Value" } - TableViewColumn{width: 200; role: "hash" ; title: "Hash" } - TableViewColumn{width: 200; role: "sender" ; title: "Sender" } - TableViewColumn{width: 200;role: "address" ; title: "Receiver" } - TableViewColumn{width: 60; role: "gas" ; title: "Gas" } - TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } - TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } - - model: transactionModel - onClicked: { - var tx = transactionModel.get(row) - if(tx.data) { - popup.showContractData(tx.data) - }else{ - popup.height = 230 - } - } - } - function showContractData(data) { - contractData.text = data - popup.height = 400 - } - Rectangle { - width: popup.width - height: 300 - anchors.left: listViewThing.left - anchors.top: txView.bottom - Label { - text: "<h4>Contract data</h4>" - anchors.top: parent.top - anchors.left: parent.left - id: contractLabel - anchors.leftMargin: 10 - } - TextArea { - id: contractData - text: "Contract" - anchors.top: contractLabel.bottom - anchors.left: parent.left - wrapMode: Text.Wrap - width: parent.width - 30 - height: 80 - anchors.leftMargin: 10 - } - } - property var transactionModel: ListModel { - id: transactionModel - } - property var singleBlock: ListModel { - id: singleBlock - } - function setDetails(block){ - singleBlock.set(0,block) - popup.height = 230 - transactionModel.clear() - if(block.txs != undefined){ - for(var i = 0; i < block.txs.count; ++i) { - transactionModel.insert(0, block.txs.get(i)) - } - if(block.txs.get(0).data){ - popup.showContractData(block.txs.get(0).data) - } - } - txView.forceActiveFocus() - } - } - - Window { - id: addPeerWin - visible: false - minimumWidth: 230 - maximumWidth: 230 - maximumHeight: 50 - minimumHeight: 50 - - TextField { - id: addrField - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 10 - placeholderText: "address:port" - onAccepted: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Button { - anchors.left: addrField.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 5 - text: "Add" - onClicked: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Component.onCompleted: { - addrField.focus = true - } - } - - Window { - id: aboutWin - visible: false - title: "About" - minimumWidth: 350 - maximumWidth: 350 - maximumHeight: 200 - minimumHeight: 200 - - Image { - id: aboutIcon - height: 150 - width: 150 - fillMode: Image.PreserveAspectFit - smooth: true - source: ui.assetPath("facet.png") - x: 10 - y: 10 - } - - Text { - anchors.left: aboutIcon.right - anchors.leftMargin: 10 - font.pointSize: 12 - text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" - } - - } - - ApplicationWindow { - id: debugWindow - visible: false - title: "Debugger" - minimumWidth: 600 - minimumHeight: 600 - width: 800 - height: 600 - - - Item { - id: keyHandler - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Space) { - ui.next() - } - } - } - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - id: debugSplitView - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } - model: stackModel - } - } - } - } - } - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - Button { - property var enabled: true - id: debugNextButton - onClicked: { - ui.next() - } - text: "Next" - } - } - } - } - - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } - function addDebugMessage(message){ - console.log("WOOP:") - debuggerLog.append({value: message}) - } - - function clearStack() { - stackModel.clear() - } - - function loadPlugin(name) { - console.log("Loading plugin" + name) - mainView.addPlugin(name) - } - - function setWalletValue(value) { - walletValueLabel.text = value - } - - function addTx(tx, inout) { - var isContract - if (tx.contract == true){ - isContract = "Yes" - }else{ - isContract = "No" - } - txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) - } - - function addBlock(block, initial) { - var txs = JSON.parse(block.transactions); - var amount = 0 - if(initial == undefined){ - initial = false - } - - if(txs != null){ - amount = txs.length - } - - if(initial){ - blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - }else{ - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - } - } - - function addLog(str) { - if(str.len != 0) { - logModel.append({description: str}) - } - } - - function setPeers(text) { - peerLabel.text = text - } - function convertToPretty(unixTs){ - var a = new Date(unixTs*1000); - var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - var year = a.getFullYear(); - var month = months[a.getMonth()]; - var date = a.getDate(); - var hour = a.getHours(); - var min = a.getMinutes(); - var sec = a.getSeconds(); - var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; - return time; - } + id: root + + width: 900 + height: 600 + minimumHeight: 300 + + title: "Ethereal" + + MenuBar { + Menu { + title: "File" + MenuItem { + text: "Import App" + shortcut: "Ctrl+o" + onTriggered: openAppDialog.open() + } + } + + Menu { + title: "Tools" + MenuItem { + text: "Muted" + shortcut: "Ctrl+e" + onTriggered: ui.muted("") + } + + MenuItem { + text: "Debugger" + shortcut: "Ctrl+d" + onTriggered: ui.startDebugger() + } + } + + Menu { + title: "Network" + MenuItem { + text: "Add Peer" + shortcut: "Ctrl+p" + onTriggered: { + addPeerWin.visible = true + } + } + + MenuItem { + text: "Start" + onTriggered: ui.connect() + } + } + + Menu { + title: "Help" + MenuItem { + text: "About" + onTriggered: { + aboutWin.visible = true + } + } + } + + } + + + property var blockModel: ListModel { + id: blockModel + } + + function setView(view) { + networkView.visible = false + historyView.visible = false + newTxView.visible = false + infoView.visible = false + view.visible = true + //root.title = "Ethereal - " = view.title + } + + SplitView { + anchors.fill: parent + resizing: false + + Rectangle { + id: menu + Layout.minimumWidth: 80 + Layout.maximumWidth: 80 + anchors.bottom: parent.bottom + anchors.top: parent.top + //color: "#D9DDE7" + color: "#252525" + + ColumnLayout { + y: 50 + anchors.left: parent.left + anchors.right: parent.right + height: 200 + Image { + source: ui.assetPath("tx.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(historyView) + } + } + } + Image { + source: ui.assetPath("new.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(newTxView) + } + } + } + Image { + source: ui.assetPath("net.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(networkView) + } + } + } + + Image { + source: ui.assetPath("heart.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(infoView) + } + } + } + } + } + + Rectangle { + id: mainView + color: "#00000000" + anchors.right: parent.right + anchors.left: menu.right + anchors.bottom: parent.bottom + anchors.top: parent.top + + property var txModel: ListModel { + id: txModel + } + + Rectangle { + id: historyView + anchors.fill: parent + + property var title: "Transactions" + TableView { + id: txTableView + anchors.fill: parent + TableViewColumn{ role: "inout" ; title: "" ; width: 40 } + TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } + TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } + TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } + + model: txModel + } + } + + Rectangle { + id: newTxView + property var title: "New transaction" + visible: false + anchors.fill: parent + color: "#00000000" + TabView{ + anchors.fill: parent + anchors.rightMargin: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.bottomMargin: 5 + id: newTransactionTab + Component.onCompleted:{ + addTab("Simple send", newTransaction) + addTab("Contracts", newContract) + } + } + } + + Rectangle { + id: networkView + property var title: "Network" + visible: false + anchors.fill: parent + + TableView { + id: blockTable + width: parent.width + anchors.top: parent.top + anchors.bottom: logView.top + TableViewColumn{ role: "number" ; title: "#" ; width: 100 } + TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } + TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } + + model: blockModel + + onDoubleClicked: { + popup.visible = true + popup.setDetails(blockModel.get(row)) + } + } + + property var logModel: ListModel { + id: logModel + } + + TableView { + id: logView + width: parent.width + height: 150 + anchors.bottom: parent.bottom + TableViewColumn{ role: "description" ; title: "log" } + + model: logModel + } + } + + Rectangle { + id: infoView + property var title: "Information" + visible: false + color: "#00000000" + anchors.fill: parent + + Label { + id: addressLabel + text: "Address" + anchors { + margins: 5 + top: parent.top + left: parent.left + } + } + TextField { + anchors { + margins: 5 + left: addressLabel.right + top: parent.top + } + text: pub.getKey().address + width: 500 + } + } + + /* + signal addPlugin(string name) + Component { + id: pluginWindow + Rectangle { + anchors.fill: parent + Label { + id: pluginTitle + anchors.centerIn: parent + text: "Hello world" + } + Component.onCompleted: setView(this) + } + } + + onAddPlugin: { + var pluginWin = pluginWindow.createObject(mainView) + console.log(pluginWin) + pluginWin.pluginTitle.text = "Test" + } + */ + } + } + + FileDialog { + id: openAppDialog + title: "Open QML Application" + onAccepted: { + //ui.open(openAppDialog.fileUrl.toString()) + //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) + ui.openHtml(openAppDialog.fileUrl.toString()) + } + } + + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + + Button { + property var enabled: true + id: debuggerWindow + onClicked: { + ui.startDebugger() + } + text: "Debugger" + } + + Button { + id: importAppButton + anchors.left: debuggerWindow.right + anchors.leftMargin: 5 + onClicked: openAppDialog.open() + text: "Import App" + } + + Label { + anchors.left: importAppButton.right + anchors.leftMargin: 5 + id: walletValueLabel + } + + Label { + anchors.right: peerImage.left + anchors.rightMargin: 5 + id: peerLabel + font.pixelSize: 8 + text: "0 / 0" + } + Image { + id: peerImage + anchors.right: parent.right + width: 10; height: 10 + source: ui.assetPath("network.png") + } + } + } + + Window { + id: popup + visible: false + property var block + width: 800 + height: 280 + x: root.x + y: root.y + root.height + Component{ + id: blockDetailsDelegate + Rectangle { + color: "#252525" + width: popup.width + height: 200 + Column { + anchors.leftMargin: 10 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} + Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} + Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} + Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} + } + } + } + ListView { + model: singleBlock + delegate: blockDetailsDelegate + anchors.top: parent.top + height: 70 + anchors.leftMargin: 20 + id: listViewThing + Layout.maximumHeight: 40 + } + TableView { + id: txView + anchors.top: listViewThing.bottom + anchors.topMargin: 50 + width: parent.width + + TableViewColumn{width: 90; role: "value" ; title: "Value" } + TableViewColumn{width: 200; role: "hash" ; title: "Hash" } + TableViewColumn{width: 200; role: "sender" ; title: "Sender" } + TableViewColumn{width: 200;role: "address" ; title: "Receiver" } + TableViewColumn{width: 60; role: "gas" ; title: "Gas" } + TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } + TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } + + model: transactionModel + onClicked: { + var tx = transactionModel.get(row) + if(tx.data) { + popup.showContractData(tx.data) + }else{ + popup.height = 230 + } + } + } + function showContractData(data) { + contractData.text = data + popup.height = 400 + } + Rectangle { + width: popup.width + height: 300 + anchors.left: listViewThing.left + anchors.top: txView.bottom + Label { + text: "<h4>Contract data</h4>" + anchors.top: parent.top + anchors.left: parent.left + id: contractLabel + anchors.leftMargin: 10 + } + TextArea { + id: contractData + text: "Contract" + anchors.top: contractLabel.bottom + anchors.left: parent.left + wrapMode: Text.Wrap + width: parent.width - 30 + height: 80 + anchors.leftMargin: 10 + } + } + property var transactionModel: ListModel { + id: transactionModel + } + property var singleBlock: ListModel { + id: singleBlock + } + function setDetails(block){ + singleBlock.set(0,block) + popup.height = 230 + transactionModel.clear() + if(block.txs != undefined){ + for(var i = 0; i < block.txs.count; ++i) { + transactionModel.insert(0, block.txs.get(i)) + } + if(block.txs.get(0).data){ + popup.showContractData(block.txs.get(0).data) + } + } + txView.forceActiveFocus() + } + } + + Window { + id: addPeerWin + visible: false + minimumWidth: 230 + maximumWidth: 230 + maximumHeight: 50 + minimumHeight: 50 + + TextField { + id: addrField + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 10 + placeholderText: "address:port" + onAccepted: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Button { + anchors.left: addrField.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 5 + text: "Add" + onClicked: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Component.onCompleted: { + addrField.focus = true + } + } + + Window { + id: aboutWin + visible: false + title: "About" + minimumWidth: 350 + maximumWidth: 350 + maximumHeight: 200 + minimumHeight: 200 + + Image { + id: aboutIcon + height: 150 + width: 150 + fillMode: Image.PreserveAspectFit + smooth: true + source: ui.assetPath("facet.png") + x: 10 + y: 10 + } + + Text { + anchors.left: aboutIcon.right + anchors.leftMargin: 10 + font.pointSize: 12 + text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" + } + + } + + ApplicationWindow { + id: debugWindow + visible: false + title: "Debugger" + minimumWidth: 600 + minimumHeight: 600 + width: 800 + height: 600 + + + Item { + id: keyHandler + focus: true + Keys.onPressed: { + if (event.key == Qt.Key_Space) { + ui.next() + } + } + } + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + id: debugSplitView + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + ui.next() + } + text: "Next" + } + } + } + } + + function setAsm(asm) { + asmModel.append({asm: asm}) + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num-1) + } + + function clearAsm() { + asmModel.clear() + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + console.log("WOOP:") + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } + + function loadPlugin(name) { + console.log("Loading plugin" + name) + mainView.addPlugin(name) + } + + function setWalletValue(value) { + walletValueLabel.text = value + } + + function addTx(tx, inout) { + var isContract + if (tx.contract == true){ + isContract = "Yes" + }else{ + isContract = "No" + } + txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + } + + function addBlock(block, initial) { + var txs = JSON.parse(block.transactions); + var amount = 0 + if(initial == undefined){ + initial = false + } + + if(txs != null){ + amount = txs.length + } + + if(initial){ + blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + }else{ + blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + } + } + + function addLog(str) { + if(str.len != 0) { + logModel.append({description: str}) + } + } + + function setPeers(text) { + peerLabel.text = text + } + function convertToPretty(unixTs){ + var a = new Date(unixTs*1000); + var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; + return time; + } + // ******************************************* + // Components + // ******************************************* + + // New Contract component + Component { + id: newContract + Column { + id: mainContractColumn + function contractFormReady(){ + if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { + txButton.state = "READY" + }else{ + txButton.state = "NOTREADY" + } + } + states: [ + State{ + name: "ERROR" + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: codeView; visible:true} + }, + State { + name: "DONE" + PropertyChanges { target: txValue; visible:false} + PropertyChanges { target: txGas; visible:false} + PropertyChanges { target: txGasPrice; visible:false} + PropertyChanges { target: codeView; visible:false} + PropertyChanges { target: txButton; visible:false} + PropertyChanges { target: txDataLabel; visible:false} + + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: txOutput; visible:true} + PropertyChanges { target: newTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txValue; visible:true; text: ""} + PropertyChanges { target: txGas; visible:true; text: ""} + PropertyChanges { target: txGasPrice; visible:true; text: ""} + PropertyChanges { target: codeView; visible:true; text: ""} + PropertyChanges { target: txButton; visible:true} + PropertyChanges { target: txDataLabel; visible:true} + + PropertyChanges { target: txResult; visible:false} + PropertyChanges { target: txOutput; visible:false} + PropertyChanges { target: newTxButton; visible:false} + } + ] + width: 400 + spacing: 5 + anchors.left: parent.left + anchors.top: parent.top + anchors.leftMargin: 5 + anchors.topMargin: 5 + + TextField { + id: txValue + width: 200 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGas + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + placeholderText: "Gas" + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + + Row { + id: rowContract + ExclusiveGroup { id: contractTypeGroup } + RadioButton { + id: createContractRadio + text: "Create contract" + checked: true + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = false + txDataLabel.text = "Contract code" + } + } + RadioButton { + id: runContractRadio + text: "Run contract" + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = true + txDataLabel.text = "Contract arguments" + } + } + } + + + Label { + id: txDataLabel + text: "Contract code" + } + + TextArea { + id: codeView + height: 300 + anchors.topMargin: 5 + Layout.fillWidth: true + width: parent.width /2 + onTextChanged: { + contractFormReady() + } + } + + TextField { + id: txFuelRecipient + placeholderText: "Contract address" + validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + visible: false + width: 530 + } + + Button { + id: txButton + /* enabled: false */ + states: [ + State { + name: "READY" + PropertyChanges { target: txButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txButton; /*enabled:false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) + if(res[1]) { + txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" + txResult.text += res[1].error() + txResult.text += "</b>" + mainContractColumn.state = "ERROR" + } else { + txResult.text = "Your transaction has been submitted:\n" + txOutput.text = res[0].address + mainContractColumn.state = "DONE" + } + } + } + Text { + id: txResult + visible: false + } + TextField { + id: txOutput + visible: false + width: 530 + } + Button { + id: newTxButton + visible: false + text: "Create an other contract" + onClicked: { + this.visible = false + txResult.text = "" + txOutput.text = "" + mainContractColumn.state = "SETUP" + } + } + + Button { + id: debugButton + text: "Debug" + onClicked: { + var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) + debugWindow.visible = true + } + } + } + } + + // New Transaction component + Component { + id: newTransaction + Column { + id: simpleSendColumn + states: [ + State{ + name: "ERROR" + }, + State { + name: "DONE" + PropertyChanges { target: txSimpleValue; visible:false} + PropertyChanges { target: txSimpleRecipient; visible:false} + PropertyChanges { target:newSimpleTxButton; visible:false} + + PropertyChanges { target: txSimpleResult; visible:true} + PropertyChanges { target: txSimpleOutput; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txSimpleValue; visible:true; text: ""} + PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} + PropertyChanges { target: txSimpleButton; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:false} + } + ] + spacing: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + + function checkFormState(){ + if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { + txSimpleButton.state = "READY" + }else{ + txSimpleButton.state = "NOTREADY" + } + } + + TextField { + id: txSimpleRecipient + placeholderText: "Recipient address" + Layout.fillWidth: true + validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + width: 530 + onTextChanged: { checkFormState() } + } + TextField { + id: txSimpleValue + width: 200 + placeholderText: "Amount" + anchors.rightMargin: 5 + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { checkFormState() } + } + Button { + id: txSimpleButton + /*enabled: false*/ + states: [ + State { + name: "READY" + PropertyChanges { target: txSimpleButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txSimpleButton; /*enabled: false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text,"","","") + if(res[1]) { + txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() + } else { + txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" + txSimpleOutput.text = res[0].hash + this.visible = false + simpleSendColumn.state = "DONE" + } + } + } + Text { + id: txSimpleResult + visible: false + + } + TextField { + id: txSimpleOutput + visible: false + width: 530 + } + Button { + id: newSimpleTxButton + visible: false + text: "Create an other transaction" + onClicked: { + this.visible = false + simpleSendColumn.state = "SETUP" + } + } + } + } + } -- cgit v1.2.3 From 09728bf43ce5eaed3060d0ce8aae323055aa6cba Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Wed, 28 May 2014 13:00:45 +0200 Subject: Debugger script&data now accept "0x" values --- ethereal/assets/debugger/debugger.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 7c3ffbceb..40b0b68b1 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -14,6 +14,9 @@ ApplicationWindow { width: 1290 height: 900 + property alias codeText: codeEditor.text + property alias dataText: rawDataField.text + MenuBar { Menu { title: "Debugger" @@ -167,6 +170,7 @@ ApplicationWindow { } } } + toolBar: ToolBar { RowLayout { spacing: 5 @@ -205,7 +209,7 @@ ApplicationWindow { function setInstruction(num) { asmTableView.selection.clear() - asmTableView.selection.select(num-1) + asmTableView.selection.select(num) } function setMem(mem) { -- cgit v1.2.3 From 1eda1d25b0d27fe57287698fb883c9153ddda292 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 28 May 2014 15:48:17 +0200 Subject: Hooked up the Block Explorer to the Debugger so we can instantly debug made transactions --- ethereal/assets/qml/wallet.qml | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index bba9c1d3b..82b680913 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -340,8 +340,8 @@ ApplicationWindow { id: popup visible: false property var block - width: 800 - height: 280 + width: root.width + height: 240 x: root.x y: root.y + root.height Component{ @@ -389,17 +389,27 @@ ApplicationWindow { onClicked: { var tx = transactionModel.get(row) if(tx.data) { - popup.showContractData(tx.data) + popup.showContractData(tx) }else{ popup.height = 230 } } } - function showContractData(data) { - contractData.text = data + + function showContractData(tx) { + txDetailsDebugButton.tx = tx + if(tx.createsContract) { + contractData.text = tx.data + contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" + }else{ + contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" + contractData.text = tx.rawData + } popup.height = 400 } + Rectangle { + id: txDetails width: popup.width height: 300 anchors.left: listViewThing.left @@ -411,6 +421,22 @@ ApplicationWindow { id: contractLabel anchors.leftMargin: 10 } + Button { + property var tx + id: txDetailsDebugButton + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + text: "Debug contract" + onClicked: { + if(tx.createsContract){ + ui.startDbWithCode(tx.rawData) + }else { + ui.startDbWithContractAndData(tx.address, tx.rawData) + } + } + } TextArea { id: contractData text: "Contract" @@ -437,7 +463,7 @@ ApplicationWindow { transactionModel.insert(0, block.txs.get(i)) } if(block.txs.get(0).data){ - popup.showContractData(block.txs.get(0).data) + popup.showContractData(block.txs.get(0)) } } txView.forceActiveFocus() -- cgit v1.2.3 From d4f9daa631fa832d556c16f3a29eaf73bd849f32 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 28 May 2014 16:14:24 +0200 Subject: Refactor hex encode and remove coupling of popup to main window --- ethereal/assets/qml/wallet.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 82b680913..0e0e3d78d 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -342,8 +342,6 @@ ApplicationWindow { property var block width: root.width height: 240 - x: root.x - y: root.y + root.height Component{ id: blockDetailsDelegate Rectangle { @@ -442,6 +440,7 @@ ApplicationWindow { text: "Contract" anchors.top: contractLabel.bottom anchors.left: parent.left + anchors.bottom: popup.bottom wrapMode: Text.Wrap width: parent.width - 30 height: 80 -- cgit v1.2.3 From 8fab7ce37d6748cbf34ebee96622448ec8a4c9e3 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Wed, 28 May 2014 23:14:23 +0200 Subject: Fixes and improved debugger --- ethereal/assets/debugger/debugger.qml | 442 +++--- ethereal/assets/qml/wallet.qml | 2002 ++++++++++++++-------------- ethereal/assets/samplecoin/samplecoin.html | 2 +- 3 files changed, 1233 insertions(+), 1213 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 40b0b68b1..bff653fb8 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -7,12 +7,12 @@ import QtQuick.Controls.Styles 1.1 import Ethereum 1.0 ApplicationWindow { - visible: false - title: "IceCream" - minimumWidth: 1280 - minimumHeight: 900 - width: 1290 - height: 900 + visible: false + title: "IceCream" + minimumWidth: 1280 + minimumHeight: 900 + width: 1290 + height: 900 property alias codeText: codeEditor.text property alias dataText: rawDataField.text @@ -32,209 +32,229 @@ ApplicationWindow { onTriggered: dbg.next() } } - } - - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - color: "#00000000" - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - Rectangle { - color: "#00000000" - height: 500 - anchors.left: parent.left - anchors.right: parent.right - - TextArea { - id: codeEditor - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: settings.left - } - - Column { - id: settings - spacing: 5 - width: 300 - height: parent.height - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - - Label { - text: "Arbitrary data" - } - TextArea { - id: rawDataField - anchors.left: parent.left - anchors.right: parent.right - height: 150 - } - - Label { - text: "Amount" - } - TextField { - id: txValue - width: 200 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - } - Label { - text: "Amount of gas" - } - TextField { - id: txGas - width: 200 - validator: RegExpValidator { regExp: /\d*/ } - text: "10000" - placeholderText: "Gas" - } - Label { - text: "Gas price" - } - TextField { - id: txGasPrice - width: 200 - placeholderText: "Gas price" - text: "1000000000000" - validator: RegExpValidator { regExp: /\d*/ } - } - } - } - - SplitView { - orientation: Qt.Vertical - id: inspectorPane - height: 500 - - SplitView { - orientation: Qt.Horizontal - height: 250 - - TableView { - id: stackTableView - property var stackModel: ListModel { - id: stackModel - } - height: parent.height - width: 300 - TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } - model: stackModel - } - - TableView { - id: memoryTableView - property var memModel: ListModel { - id: memModel - } - height: parent.height - width: parent.width - stackTableView.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - } - - SplitView { - height: 300 - TableView { - id: storageTableView - property var memModel: ListModel { - id: storageModel - } - height: parent.height - width: parent.width - stackTableView.width - TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2} - TableViewColumn{ role: "value" ; title: "value" ; width: storageTableView.width / 2} - model: storageModel - } - } - } - } - } - } - - toolBar: ToolBar { - RowLayout { - spacing: 5 - - Button { - property var enabled: true - id: debugStart - onClicked: { - debugCurrent() - } - text: "Debug" - } - - Button { - property var enabled: true - id: debugNextButton - onClicked: { - dbg.next() - } - text: "Next" - } - } - } - - function debugCurrent() { - dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) - } - - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function clearAsm() { - asmModel.clear() - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num) - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } - function addDebugMessage(message){ - debuggerLog.append({value: message}) - } - - function clearStack() { - stackModel.clear() - } - - function clearStorage() { - storageModel.clear() - } - - function setStorage(storage) { - storageModel.append({key: storage.key, value: storage.value}) - } + } + + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + color: "#00000000" + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + Rectangle { + color: "#00000000" + height: 500 + anchors.left: parent.left + anchors.right: parent.right + + TextArea { + id: codeEditor + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: settings.left + } + + Column { + id: settings + spacing: 5 + width: 300 + height: parent.height + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + + Label { + text: "Arbitrary data" + } + TextArea { + id: rawDataField + anchors.left: parent.left + anchors.right: parent.right + height: 150 + } + + Label { + text: "Amount" + } + TextField { + id: txValue + width: 200 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + } + Label { + text: "Amount of gas" + } + TextField { + id: txGas + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + text: "10000" + placeholderText: "Gas" + } + Label { + text: "Gas price" + } + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + text: "1000000000000" + validator: RegExpValidator { regExp: /\d*/ } + } + } + } + + SplitView { + orientation: Qt.Vertical + id: inspectorPane + height: 500 + + SplitView { + orientation: Qt.Horizontal + height: 150 + + TableView { + id: stackTableView + property var stackModel: ListModel { + id: stackModel + } + height: parent.height + width: 300 + TableViewColumn{ role: "value" ; title: "Stack" ; width: 200 } + model: stackModel + } + + TableView { + id: memoryTableView + property var memModel: ListModel { + id: memModel + } + height: parent.height + width: parent.width - stackTableView.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + } + + Rectangle { + height: 100 + width: parent.width + TableView { + id: storageTableView + property var memModel: ListModel { + id: storageModel + } + height: parent.height + width: parent.width + TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2} + TableViewColumn{ role: "value" ; title: "value" ; width: storageTableView.width / 2} + model: storageModel + } + } + + Rectangle { + height: 200 + width: parent.width + TableView { + id: logTableView + property var logModel: ListModel { + id: logModel + } + height: parent.height + width: parent.width + TableViewColumn{ id: message ; role: "message" ; title: "log" ; width: logTableView.width } + model: logModel + } + } + } + } + } + } + + toolBar: ToolBar { + RowLayout { + spacing: 5 + + Button { + property var enabled: true + id: debugStart + onClicked: { + debugCurrent() + } + text: "Debug" + } + + Button { + property var enabled: true + id: debugNextButton + onClicked: { + dbg.next() + } + text: "Next" + } + } + } + + function debugCurrent() { + dbg.debug(txValue.text, txGas.text, txGasPrice.text, codeEditor.text, rawDataField.text) + } + + function setAsm(asm) { + asmModel.append({asm: asm}) + } + + function clearAsm() { + asmModel.clear() + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num) + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } + + function clearStorage() { + storageModel.clear() + } + + function setStorage(storage) { + storageModel.append({key: storage.key, value: storage.value}) + } + + function setLog(msg) { + logModel.append({message: msg}) + } } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 82b680913..ce8ba5745 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -8,1006 +8,1006 @@ import Ethereum 1.0 ApplicationWindow { - id: root - - width: 900 - height: 600 - minimumHeight: 300 - - title: "Ethereal" - - MenuBar { - Menu { - title: "File" - MenuItem { - text: "Import App" - shortcut: "Ctrl+o" - onTriggered: openAppDialog.open() - } - } - - Menu { - title: "Tools" - MenuItem { - text: "Muted" - shortcut: "Ctrl+e" - onTriggered: ui.muted("") - } - - MenuItem { - text: "Debugger" - shortcut: "Ctrl+d" - onTriggered: ui.startDebugger() - } - } - - Menu { - title: "Network" - MenuItem { - text: "Add Peer" - shortcut: "Ctrl+p" - onTriggered: { - addPeerWin.visible = true - } - } - - MenuItem { - text: "Start" - onTriggered: ui.connect() - } - } - - Menu { - title: "Help" - MenuItem { - text: "About" - onTriggered: { - aboutWin.visible = true - } - } - } - - } - - - property var blockModel: ListModel { - id: blockModel - } - - function setView(view) { - networkView.visible = false - historyView.visible = false - newTxView.visible = false - infoView.visible = false - view.visible = true - //root.title = "Ethereal - " = view.title - } - - SplitView { - anchors.fill: parent - resizing: false - - Rectangle { - id: menu - Layout.minimumWidth: 80 - Layout.maximumWidth: 80 - anchors.bottom: parent.bottom - anchors.top: parent.top - //color: "#D9DDE7" - color: "#252525" - - ColumnLayout { - y: 50 - anchors.left: parent.left - anchors.right: parent.right - height: 200 - Image { - source: ui.assetPath("tx.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(historyView) - } - } - } - Image { - source: ui.assetPath("new.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(newTxView) - } - } - } - Image { - source: ui.assetPath("net.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(networkView) - } - } - } - - Image { - source: ui.assetPath("heart.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(infoView) - } - } - } - } - } - - Rectangle { - id: mainView - color: "#00000000" - anchors.right: parent.right - anchors.left: menu.right - anchors.bottom: parent.bottom - anchors.top: parent.top - - property var txModel: ListModel { - id: txModel - } - - Rectangle { - id: historyView - anchors.fill: parent - - property var title: "Transactions" - TableView { - id: txTableView - anchors.fill: parent - TableViewColumn{ role: "inout" ; title: "" ; width: 40 } - TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } - TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } - TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } - - model: txModel - } - } - - Rectangle { - id: newTxView - property var title: "New transaction" - visible: false - anchors.fill: parent - color: "#00000000" - TabView{ - anchors.fill: parent - anchors.rightMargin: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.bottomMargin: 5 - id: newTransactionTab - Component.onCompleted:{ - addTab("Simple send", newTransaction) - addTab("Contracts", newContract) - } - } - } - - Rectangle { - id: networkView - property var title: "Network" - visible: false - anchors.fill: parent - - TableView { - id: blockTable - width: parent.width - anchors.top: parent.top - anchors.bottom: logView.top - TableViewColumn{ role: "number" ; title: "#" ; width: 100 } - TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } - TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } - - model: blockModel - - onDoubleClicked: { - popup.visible = true - popup.setDetails(blockModel.get(row)) - } - } - - property var logModel: ListModel { - id: logModel - } - - TableView { - id: logView - width: parent.width - height: 150 - anchors.bottom: parent.bottom - TableViewColumn{ role: "description" ; title: "log" } - - model: logModel - } - } - - Rectangle { - id: infoView - property var title: "Information" - visible: false - color: "#00000000" - anchors.fill: parent - - Label { - id: addressLabel - text: "Address" - anchors { - margins: 5 - top: parent.top - left: parent.left - } - } - TextField { - anchors { - margins: 5 - left: addressLabel.right - top: parent.top - } - text: pub.getKey().address - width: 500 - } - } - - /* - signal addPlugin(string name) - Component { - id: pluginWindow - Rectangle { - anchors.fill: parent - Label { - id: pluginTitle - anchors.centerIn: parent - text: "Hello world" - } - Component.onCompleted: setView(this) - } - } - - onAddPlugin: { - var pluginWin = pluginWindow.createObject(mainView) - console.log(pluginWin) - pluginWin.pluginTitle.text = "Test" - } - */ - } - } - - FileDialog { - id: openAppDialog - title: "Open QML Application" - onAccepted: { - //ui.open(openAppDialog.fileUrl.toString()) - //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) - ui.openHtml(openAppDialog.fileUrl.toString()) - } - } - - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - - Button { - property var enabled: true - id: debuggerWindow - onClicked: { - ui.startDebugger() - } - text: "Debugger" - } - - Button { - id: importAppButton - anchors.left: debuggerWindow.right - anchors.leftMargin: 5 - onClicked: openAppDialog.open() - text: "Import App" - } - - Label { - anchors.left: importAppButton.right - anchors.leftMargin: 5 - id: walletValueLabel - } - - Label { - anchors.right: peerImage.left - anchors.rightMargin: 5 - id: peerLabel - font.pixelSize: 8 - text: "0 / 0" - } - Image { - id: peerImage - anchors.right: parent.right - width: 10; height: 10 - source: ui.assetPath("network.png") - } - } - } - - Window { - id: popup - visible: false - property var block - width: root.width - height: 240 - x: root.x - y: root.y + root.height - Component{ - id: blockDetailsDelegate - Rectangle { - color: "#252525" - width: popup.width - height: 200 - Column { - anchors.leftMargin: 10 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} - Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} - Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} - Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} - } - } - } - ListView { - model: singleBlock - delegate: blockDetailsDelegate - anchors.top: parent.top - height: 70 - anchors.leftMargin: 20 - id: listViewThing - Layout.maximumHeight: 40 - } - TableView { - id: txView - anchors.top: listViewThing.bottom - anchors.topMargin: 50 - width: parent.width - - TableViewColumn{width: 90; role: "value" ; title: "Value" } - TableViewColumn{width: 200; role: "hash" ; title: "Hash" } - TableViewColumn{width: 200; role: "sender" ; title: "Sender" } - TableViewColumn{width: 200;role: "address" ; title: "Receiver" } - TableViewColumn{width: 60; role: "gas" ; title: "Gas" } - TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } - TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } - - model: transactionModel - onClicked: { - var tx = transactionModel.get(row) - if(tx.data) { - popup.showContractData(tx) - }else{ - popup.height = 230 - } - } - } - - function showContractData(tx) { - txDetailsDebugButton.tx = tx - if(tx.createsContract) { - contractData.text = tx.data - contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" - }else{ - contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" - contractData.text = tx.rawData - } - popup.height = 400 - } - - Rectangle { - id: txDetails - width: popup.width - height: 300 - anchors.left: listViewThing.left - anchors.top: txView.bottom - Label { - text: "<h4>Contract data</h4>" - anchors.top: parent.top - anchors.left: parent.left - id: contractLabel - anchors.leftMargin: 10 - } - Button { - property var tx - id: txDetailsDebugButton - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - text: "Debug contract" - onClicked: { - if(tx.createsContract){ - ui.startDbWithCode(tx.rawData) - }else { - ui.startDbWithContractAndData(tx.address, tx.rawData) - } - } - } - TextArea { - id: contractData - text: "Contract" - anchors.top: contractLabel.bottom - anchors.left: parent.left - wrapMode: Text.Wrap - width: parent.width - 30 - height: 80 - anchors.leftMargin: 10 - } - } - property var transactionModel: ListModel { - id: transactionModel - } - property var singleBlock: ListModel { - id: singleBlock - } - function setDetails(block){ - singleBlock.set(0,block) - popup.height = 230 - transactionModel.clear() - if(block.txs != undefined){ - for(var i = 0; i < block.txs.count; ++i) { - transactionModel.insert(0, block.txs.get(i)) - } - if(block.txs.get(0).data){ - popup.showContractData(block.txs.get(0)) - } - } - txView.forceActiveFocus() - } - } - - Window { - id: addPeerWin - visible: false - minimumWidth: 230 - maximumWidth: 230 - maximumHeight: 50 - minimumHeight: 50 - - TextField { - id: addrField - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 10 - placeholderText: "address:port" - onAccepted: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Button { - anchors.left: addrField.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 5 - text: "Add" - onClicked: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Component.onCompleted: { - addrField.focus = true - } - } - - Window { - id: aboutWin - visible: false - title: "About" - minimumWidth: 350 - maximumWidth: 350 - maximumHeight: 200 - minimumHeight: 200 - - Image { - id: aboutIcon - height: 150 - width: 150 - fillMode: Image.PreserveAspectFit - smooth: true - source: ui.assetPath("facet.png") - x: 10 - y: 10 - } - - Text { - anchors.left: aboutIcon.right - anchors.leftMargin: 10 - font.pointSize: 12 - text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" - } - - } - - ApplicationWindow { - id: debugWindow - visible: false - title: "Debugger" - minimumWidth: 600 - minimumHeight: 600 - width: 800 - height: 600 - - - Item { - id: keyHandler - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Space) { - ui.next() - } - } - } - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - id: debugSplitView - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } - model: stackModel - } - } - } - } - } - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - Button { - property var enabled: true - id: debugNextButton - onClicked: { - ui.next() - } - text: "Next" - } - } - } - } - - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } - function addDebugMessage(message){ - console.log("WOOP:") - debuggerLog.append({value: message}) - } - - function clearStack() { - stackModel.clear() - } - - function loadPlugin(name) { - console.log("Loading plugin" + name) - mainView.addPlugin(name) - } - - function setWalletValue(value) { - walletValueLabel.text = value - } - - function addTx(tx, inout) { - var isContract - if (tx.contract == true){ - isContract = "Yes" - }else{ - isContract = "No" - } - txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) - } - - function addBlock(block, initial) { - var txs = JSON.parse(block.transactions); - var amount = 0 - if(initial == undefined){ - initial = false - } - - if(txs != null){ - amount = txs.length - } - - if(initial){ - blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - }else{ - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - } - } - - function addLog(str) { - if(str.len != 0) { - logModel.append({description: str}) - } - } - - function setPeers(text) { - peerLabel.text = text - } - function convertToPretty(unixTs){ - var a = new Date(unixTs*1000); - var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - var year = a.getFullYear(); - var month = months[a.getMonth()]; - var date = a.getDate(); - var hour = a.getHours(); - var min = a.getMinutes(); - var sec = a.getSeconds(); - var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; - return time; - } - // ******************************************* - // Components - // ******************************************* - - // New Contract component - Component { - id: newContract - Column { - id: mainContractColumn - function contractFormReady(){ - if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { - txButton.state = "READY" - }else{ - txButton.state = "NOTREADY" - } - } - states: [ - State{ - name: "ERROR" - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: codeView; visible:true} - }, - State { - name: "DONE" - PropertyChanges { target: txValue; visible:false} - PropertyChanges { target: txGas; visible:false} - PropertyChanges { target: txGasPrice; visible:false} - PropertyChanges { target: codeView; visible:false} - PropertyChanges { target: txButton; visible:false} - PropertyChanges { target: txDataLabel; visible:false} - - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: txOutput; visible:true} - PropertyChanges { target: newTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txValue; visible:true; text: ""} - PropertyChanges { target: txGas; visible:true; text: ""} - PropertyChanges { target: txGasPrice; visible:true; text: ""} - PropertyChanges { target: codeView; visible:true; text: ""} - PropertyChanges { target: txButton; visible:true} - PropertyChanges { target: txDataLabel; visible:true} - - PropertyChanges { target: txResult; visible:false} - PropertyChanges { target: txOutput; visible:false} - PropertyChanges { target: newTxButton; visible:false} - } - ] - width: 400 - spacing: 5 - anchors.left: parent.left - anchors.top: parent.top - anchors.leftMargin: 5 - anchors.topMargin: 5 - - TextField { - id: txValue - width: 200 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGas - width: 200 - validator: RegExpValidator { regExp: /\d*/ } - placeholderText: "Gas" - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGasPrice - width: 200 - placeholderText: "Gas price" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - - Row { - id: rowContract - ExclusiveGroup { id: contractTypeGroup } - RadioButton { - id: createContractRadio - text: "Create contract" - checked: true - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = false - txDataLabel.text = "Contract code" - } - } - RadioButton { - id: runContractRadio - text: "Run contract" - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = true - txDataLabel.text = "Contract arguments" - } - } - } - - - Label { - id: txDataLabel - text: "Contract code" - } - - TextArea { - id: codeView - height: 300 - anchors.topMargin: 5 - Layout.fillWidth: true - width: parent.width /2 - onTextChanged: { - contractFormReady() - } - } - - TextField { - id: txFuelRecipient - placeholderText: "Contract address" - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - visible: false - width: 530 - } - - Button { - id: txButton - /* enabled: false */ - states: [ - State { - name: "READY" - PropertyChanges { target: txButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txButton; /*enabled:false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) - if(res[1]) { - txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" - txResult.text += res[1].error() - txResult.text += "</b>" - mainContractColumn.state = "ERROR" - } else { - txResult.text = "Your transaction has been submitted:\n" - txOutput.text = res[0].address - mainContractColumn.state = "DONE" - } - } - } - Text { - id: txResult - visible: false - } - TextField { - id: txOutput - visible: false - width: 530 - } - Button { - id: newTxButton - visible: false - text: "Create an other contract" - onClicked: { - this.visible = false - txResult.text = "" - txOutput.text = "" - mainContractColumn.state = "SETUP" - } - } - - Button { - id: debugButton - text: "Debug" - onClicked: { - var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) - debugWindow.visible = true - } - } - } - } - - // New Transaction component - Component { - id: newTransaction - Column { - id: simpleSendColumn - states: [ - State{ - name: "ERROR" - }, - State { - name: "DONE" - PropertyChanges { target: txSimpleValue; visible:false} - PropertyChanges { target: txSimpleRecipient; visible:false} - PropertyChanges { target:newSimpleTxButton; visible:false} - - PropertyChanges { target: txSimpleResult; visible:true} - PropertyChanges { target: txSimpleOutput; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txSimpleValue; visible:true; text: ""} - PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} - PropertyChanges { target: txSimpleButton; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:false} - } - ] - spacing: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - - function checkFormState(){ - if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { - txSimpleButton.state = "READY" - }else{ - txSimpleButton.state = "NOTREADY" - } - } - - TextField { - id: txSimpleRecipient - placeholderText: "Recipient address" - Layout.fillWidth: true - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - width: 530 - onTextChanged: { checkFormState() } - } - TextField { - id: txSimpleValue - width: 200 - placeholderText: "Amount" - anchors.rightMargin: 5 - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { checkFormState() } - } - Button { - id: txSimpleButton - /*enabled: false*/ - states: [ - State { - name: "READY" - PropertyChanges { target: txSimpleButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txSimpleButton; /*enabled: false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text,"","","") - if(res[1]) { - txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() - } else { - txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" - txSimpleOutput.text = res[0].hash - this.visible = false - simpleSendColumn.state = "DONE" - } - } - } - Text { - id: txSimpleResult - visible: false - - } - TextField { - id: txSimpleOutput - visible: false - width: 530 - } - Button { - id: newSimpleTxButton - visible: false - text: "Create an other transaction" - onClicked: { - this.visible = false - simpleSendColumn.state = "SETUP" - } - } - } - } + id: root + + width: 900 + height: 600 + minimumHeight: 300 + + title: "Ethereal" + + MenuBar { + Menu { + title: "File" + MenuItem { + text: "Import App" + shortcut: "Ctrl+o" + onTriggered: openAppDialog.open() + } + } + + Menu { + title: "Tools" + MenuItem { + text: "Muted" + shortcut: "Ctrl+e" + onTriggered: ui.muted("") + } + + MenuItem { + text: "Debugger" + shortcut: "Ctrl+d" + onTriggered: ui.startDebugger() + } + } + + Menu { + title: "Network" + MenuItem { + text: "Add Peer" + shortcut: "Ctrl+p" + onTriggered: { + addPeerWin.visible = true + } + } + + MenuItem { + text: "Start" + onTriggered: ui.connect() + } + } + + Menu { + title: "Help" + MenuItem { + text: "About" + onTriggered: { + aboutWin.visible = true + } + } + } + + } + + + property var blockModel: ListModel { + id: blockModel + } + + function setView(view) { + networkView.visible = false + historyView.visible = false + newTxView.visible = false + infoView.visible = false + view.visible = true + //root.title = "Ethereal - " = view.title + } + + SplitView { + anchors.fill: parent + resizing: false + + Rectangle { + id: menu + Layout.minimumWidth: 80 + Layout.maximumWidth: 80 + anchors.bottom: parent.bottom + anchors.top: parent.top + //color: "#D9DDE7" + color: "#252525" + + ColumnLayout { + y: 50 + anchors.left: parent.left + anchors.right: parent.right + height: 200 + Image { + source: ui.assetPath("tx.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(historyView) + } + } + } + Image { + source: ui.assetPath("new.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(newTxView) + } + } + } + Image { + source: ui.assetPath("net.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(networkView) + } + } + } + + Image { + source: ui.assetPath("heart.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(infoView) + } + } + } + } + } + + Rectangle { + id: mainView + color: "#00000000" + anchors.right: parent.right + anchors.left: menu.right + anchors.bottom: parent.bottom + anchors.top: parent.top + + property var txModel: ListModel { + id: txModel + } + + Rectangle { + id: historyView + anchors.fill: parent + + property var title: "Transactions" + TableView { + id: txTableView + anchors.fill: parent + TableViewColumn{ role: "inout" ; title: "" ; width: 40 } + TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } + TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } + TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } + + model: txModel + } + } + + Rectangle { + id: newTxView + property var title: "New transaction" + visible: false + anchors.fill: parent + color: "#00000000" + TabView{ + anchors.fill: parent + anchors.rightMargin: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.bottomMargin: 5 + id: newTransactionTab + Component.onCompleted:{ + addTab("Simple send", newTransaction) + addTab("Contracts", newContract) + } + } + } + + Rectangle { + id: networkView + property var title: "Network" + visible: false + anchors.fill: parent + + TableView { + id: blockTable + width: parent.width + anchors.top: parent.top + anchors.bottom: logView.top + TableViewColumn{ role: "number" ; title: "#" ; width: 100 } + TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } + TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } + + model: blockModel + + onDoubleClicked: { + popup.visible = true + popup.setDetails(blockModel.get(row)) + } + } + + property var logModel: ListModel { + id: logModel + } + + TableView { + id: logView + width: parent.width + height: 150 + anchors.bottom: parent.bottom + TableViewColumn{ role: "description" ; title: "log" } + + model: logModel + } + } + + Rectangle { + id: infoView + property var title: "Information" + visible: false + color: "#00000000" + anchors.fill: parent + + Label { + id: addressLabel + text: "Address" + anchors { + margins: 5 + top: parent.top + left: parent.left + } + } + TextField { + anchors { + margins: 5 + left: addressLabel.right + top: parent.top + } + text: pub.getKey().address + width: 500 + } + } + + /* + signal addPlugin(string name) + Component { + id: pluginWindow + Rectangle { + anchors.fill: parent + Label { + id: pluginTitle + anchors.centerIn: parent + text: "Hello world" + } + Component.onCompleted: setView(this) + } + } + + onAddPlugin: { + var pluginWin = pluginWindow.createObject(mainView) + console.log(pluginWin) + pluginWin.pluginTitle.text = "Test" + } + */ + } + } + + FileDialog { + id: openAppDialog + title: "Open QML Application" + onAccepted: { + //ui.open(openAppDialog.fileUrl.toString()) + //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) + ui.openHtml(openAppDialog.fileUrl.toString()) + } + } + + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + + Button { + property var enabled: true + id: debuggerWindow + onClicked: { + ui.startDebugger() + } + text: "Debugger" + } + + Button { + id: importAppButton + anchors.left: debuggerWindow.right + anchors.leftMargin: 5 + onClicked: openAppDialog.open() + text: "Import App" + } + + Label { + anchors.left: importAppButton.right + anchors.leftMargin: 5 + id: walletValueLabel + } + + Label { + anchors.right: peerImage.left + anchors.rightMargin: 5 + id: peerLabel + font.pixelSize: 8 + text: "0 / 0" + } + Image { + id: peerImage + anchors.right: parent.right + width: 10; height: 10 + source: ui.assetPath("network.png") + } + } + } + + Window { + id: popup + visible: false + property var block + width: root.width + height: 240 + x: root.x + y: root.y + root.height + Component{ + id: blockDetailsDelegate + Rectangle { + color: "#252525" + width: popup.width + height: 200 + Column { + anchors.leftMargin: 10 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} + Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} + Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} + Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} + } + } + } + ListView { + model: singleBlock + delegate: blockDetailsDelegate + anchors.top: parent.top + height: 70 + anchors.leftMargin: 20 + id: listViewThing + Layout.maximumHeight: 40 + } + TableView { + id: txView + anchors.top: listViewThing.bottom + anchors.topMargin: 50 + width: parent.width + + TableViewColumn{width: 90; role: "value" ; title: "Value" } + TableViewColumn{width: 200; role: "hash" ; title: "Hash" } + TableViewColumn{width: 200; role: "sender" ; title: "Sender" } + TableViewColumn{width: 200;role: "address" ; title: "Receiver" } + TableViewColumn{width: 60; role: "gas" ; title: "Gas" } + TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } + TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } + + model: transactionModel + onClicked: { + var tx = transactionModel.get(row) + if(tx.data) { + popup.showContractData(tx) + }else{ + popup.height = 230 + } + } + } + + function showContractData(tx) { + txDetailsDebugButton.tx = tx + if(tx.createsContract) { + contractData.text = tx.data + contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" + }else{ + contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" + contractData.text = tx.rawData + } + popup.height = 400 + } + + Rectangle { + id: txDetails + width: popup.width + height: 300 + anchors.left: listViewThing.left + anchors.top: txView.bottom + Label { + text: "<h4>Contract data</h4>" + anchors.top: parent.top + anchors.left: parent.left + id: contractLabel + anchors.leftMargin: 10 + } + Button { + property var tx + id: txDetailsDebugButton + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + text: "Debug contract" + onClicked: { + if(tx.createsContract){ + ui.startDbWithCode(tx.rawData) + }else { + ui.startDbWithContractAndData(tx.address, tx.rawData) + } + } + } + TextArea { + id: contractData + text: "Contract" + anchors.top: contractLabel.bottom + anchors.left: parent.left + wrapMode: Text.Wrap + width: parent.width - 30 + height: 80 + anchors.leftMargin: 10 + } + } + property var transactionModel: ListModel { + id: transactionModel + } + property var singleBlock: ListModel { + id: singleBlock + } + function setDetails(block){ + singleBlock.set(0,block) + popup.height = 230 + transactionModel.clear() + if(block.txs != undefined){ + for(var i = 0; i < block.txs.count; ++i) { + transactionModel.insert(0, block.txs.get(i)) + } + if(block.txs.get(0).data){ + popup.showContractData(block.txs.get(0)) + } + } + txView.forceActiveFocus() + } + } + + Window { + id: addPeerWin + visible: false + minimumWidth: 230 + maximumWidth: 230 + maximumHeight: 50 + minimumHeight: 50 + + TextField { + id: addrField + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 10 + placeholderText: "address:port" + onAccepted: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Button { + anchors.left: addrField.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 5 + text: "Add" + onClicked: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Component.onCompleted: { + addrField.focus = true + } + } + + Window { + id: aboutWin + visible: false + title: "About" + minimumWidth: 350 + maximumWidth: 350 + maximumHeight: 200 + minimumHeight: 200 + + Image { + id: aboutIcon + height: 150 + width: 150 + fillMode: Image.PreserveAspectFit + smooth: true + source: ui.assetPath("facet.png") + x: 10 + y: 10 + } + + Text { + anchors.left: aboutIcon.right + anchors.leftMargin: 10 + font.pointSize: 12 + text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" + } + + } + + ApplicationWindow { + id: debugWindow + visible: false + title: "Debugger" + minimumWidth: 600 + minimumHeight: 600 + width: 800 + height: 600 + + + Item { + id: keyHandler + focus: true + Keys.onPressed: { + if (event.key == Qt.Key_Space) { + ui.next() + } + } + } + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + id: debugSplitView + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + ui.next() + } + text: "Next" + } + } + } + } + + function setAsm(asm) { + asmModel.append({asm: asm}) + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num-1) + } + + function clearAsm() { + asmModel.clear() + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + console.log("WOOP:") + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } + + function loadPlugin(name) { + console.log("Loading plugin" + name) + mainView.addPlugin(name) + } + + function setWalletValue(value) { + walletValueLabel.text = value + } + + function addTx(tx, inout) { + var isContract + if (tx.contract == true){ + isContract = "Yes" + }else{ + isContract = "No" + } + txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + } + + function addBlock(block, initial) { + var txs = JSON.parse(block.transactions); + var amount = 0 + if(initial == undefined){ + initial = false + } + + if(txs != null){ + amount = txs.length + } + + if(initial){ + blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + }else{ + blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + } + } + + function addLog(str) { + if(str.len != 0) { + logModel.append({description: str}) + } + } + + function setPeers(text) { + peerLabel.text = text + } + function convertToPretty(unixTs){ + var a = new Date(unixTs*1000); + var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; + return time; + } + // ******************************************* + // Components + // ******************************************* + + // New Contract component + Component { + id: newContract + Column { + id: mainContractColumn + function contractFormReady(){ + if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { + txButton.state = "READY" + }else{ + txButton.state = "NOTREADY" + } + } + states: [ + State{ + name: "ERROR" + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: codeView; visible:true} + }, + State { + name: "DONE" + PropertyChanges { target: txValue; visible:false} + PropertyChanges { target: txGas; visible:false} + PropertyChanges { target: txGasPrice; visible:false} + PropertyChanges { target: codeView; visible:false} + PropertyChanges { target: txButton; visible:false} + PropertyChanges { target: txDataLabel; visible:false} + + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: txOutput; visible:true} + PropertyChanges { target: newTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txValue; visible:true; text: ""} + PropertyChanges { target: txGas; visible:true; text: ""} + PropertyChanges { target: txGasPrice; visible:true; text: ""} + PropertyChanges { target: codeView; visible:true; text: ""} + PropertyChanges { target: txButton; visible:true} + PropertyChanges { target: txDataLabel; visible:true} + + PropertyChanges { target: txResult; visible:false} + PropertyChanges { target: txOutput; visible:false} + PropertyChanges { target: newTxButton; visible:false} + } + ] + width: 400 + spacing: 5 + anchors.left: parent.left + anchors.top: parent.top + anchors.leftMargin: 5 + anchors.topMargin: 5 + + TextField { + id: txValue + width: 200 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGas + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + placeholderText: "Gas" + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + + Row { + id: rowContract + ExclusiveGroup { id: contractTypeGroup } + RadioButton { + id: createContractRadio + text: "Create contract" + checked: true + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = false + txDataLabel.text = "Contract code" + } + } + RadioButton { + id: runContractRadio + text: "Run contract" + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = true + txDataLabel.text = "Contract arguments" + } + } + } + + + Label { + id: txDataLabel + text: "Contract code" + } + + TextArea { + id: codeView + height: 300 + anchors.topMargin: 5 + Layout.fillWidth: true + width: parent.width /2 + onTextChanged: { + contractFormReady() + } + } + + TextField { + id: txFuelRecipient + placeholderText: "Contract address" + validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + visible: false + width: 530 + } + + Button { + id: txButton + /* enabled: false */ + states: [ + State { + name: "READY" + PropertyChanges { target: txButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txButton; /*enabled:false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) + if(res[1]) { + txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" + txResult.text += res[1].error() + txResult.text += "</b>" + mainContractColumn.state = "ERROR" + } else { + txResult.text = "Your transaction has been submitted:\n" + txOutput.text = res[0].address + mainContractColumn.state = "DONE" + } + } + } + Text { + id: txResult + visible: false + } + TextField { + id: txOutput + visible: false + width: 530 + } + Button { + id: newTxButton + visible: false + text: "Create an other contract" + onClicked: { + this.visible = false + txResult.text = "" + txOutput.text = "" + mainContractColumn.state = "SETUP" + } + } + + Button { + id: debugButton + text: "Debug" + onClicked: { + var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) + debugWindow.visible = true + } + } + } + } + + // New Transaction component + Component { + id: newTransaction + Column { + id: simpleSendColumn + states: [ + State{ + name: "ERROR" + }, + State { + name: "DONE" + PropertyChanges { target: txSimpleValue; visible:false} + PropertyChanges { target: txSimpleRecipient; visible:false} + PropertyChanges { target:newSimpleTxButton; visible:false} + + PropertyChanges { target: txSimpleResult; visible:true} + PropertyChanges { target: txSimpleOutput; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txSimpleValue; visible:true; text: ""} + PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} + PropertyChanges { target: txSimpleButton; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:false} + } + ] + spacing: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + + function checkFormState(){ + if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { + txSimpleButton.state = "READY" + }else{ + txSimpleButton.state = "NOTREADY" + } + } + + TextField { + id: txSimpleRecipient + placeholderText: "Recipient address" + Layout.fillWidth: true + validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + width: 530 + onTextChanged: { checkFormState() } + } + TextField { + id: txSimpleValue + width: 200 + placeholderText: "Amount" + anchors.rightMargin: 5 + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { checkFormState() } + } + Button { + id: txSimpleButton + /*enabled: false*/ + states: [ + State { + name: "READY" + PropertyChanges { target: txSimpleButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txSimpleButton; /*enabled: false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text,"","","") + if(res[1]) { + txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() + } else { + txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" + txSimpleOutput.text = res[0].hash + this.visible = false + simpleSendColumn.state = "DONE" + } + } + } + Text { + id: txSimpleResult + visible: false + + } + TextField { + id: txSimpleOutput + visible: false + width: 530 + } + Button { + id: newSimpleTxButton + visible: false + text: "Create an other transaction" + onClicked: { + this.visible = false + simpleSendColumn.state = "SETUP" + } + } + } + } } diff --git a/ethereal/assets/samplecoin/samplecoin.html b/ethereal/assets/samplecoin/samplecoin.html index e780aefb4..dc8d0b7e9 100644 --- a/ethereal/assets/samplecoin/samplecoin.html +++ b/ethereal/assets/samplecoin/samplecoin.html @@ -9,7 +9,7 @@ <script type="text/javascript"> -var jefcoinAddr = "518546ffa883dcc838a64bc2dabada0fd64af459" +var jefcoinAddr = "de0bd4ea1947deabf1749d7ed633f289358c9f6c" var mAddr = "" function createTransaction() { -- cgit v1.2.3 From 0b4c42d75694787d47697288266c073a3cf41c48 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Thu, 29 May 2014 02:05:06 +0200 Subject: Disabled instruction selection --- ethereal/assets/debugger/debugger.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index bff653fb8..247d4de67 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -224,8 +224,8 @@ ApplicationWindow { } function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num) + //asmTableView.selection.clear() + //asmTableView.selection.select(num) } function setMem(mem) { -- cgit v1.2.3 From efb3ee044b6bc05b73794450ec4b1953fe38350a Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Thu, 29 May 2014 11:49:59 +0200 Subject: Removed regexp for namereg --- ethereal/assets/qml/wallet.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 847f219a9..98cccd767 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -837,7 +837,7 @@ ApplicationWindow { TextField { id: txFuelRecipient placeholderText: "Contract address" - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } visible: false width: 530 } @@ -948,7 +948,7 @@ ApplicationWindow { id: txSimpleRecipient placeholderText: "Recipient address" Layout.fillWidth: true - validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } width: 530 onTextChanged: { checkFormState() } } -- cgit v1.2.3 From 8ee6574d12601df7a8edb56ee9ccc4cfce7ef6a8 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Thu, 29 May 2014 12:14:25 +0200 Subject: Minimal fee for sending transactions --- ethereal/assets/qml/wallet.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 98cccd767..f48b9a85b 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -976,7 +976,7 @@ ApplicationWindow { text: "Send" onClicked: { //this.enabled = false - var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text,"","","") + var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text, "500", "1000000", "") if(res[1]) { txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() } else { -- cgit v1.2.3 From efadfbfb1779549c2898304dce4bbce30b067ceb Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Thu, 29 May 2014 12:24:14 +0200 Subject: Minor UI changes * Moved log from block view * Prepend instead of append for logs --- ethereal/assets/debugger/debugger.qml | 6 +++++- ethereal/assets/qml/wallet.qml | 31 ++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 247d4de67..84d9a0732 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -255,6 +255,10 @@ ApplicationWindow { } function setLog(msg) { - logModel.append({message: msg}) + logModel.insert(0, {message: msg}) + } + + function clearLog() { + logModel.clear() } } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index f48b9a85b..eaf7c1b92 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -204,7 +204,7 @@ ApplicationWindow { id: blockTable width: parent.width anchors.top: parent.top - anchors.bottom: logView.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 } @@ -217,19 +217,6 @@ ApplicationWindow { } } - property var logModel: ListModel { - id: logModel - } - - TableView { - id: logView - width: parent.width - height: 150 - anchors.bottom: parent.bottom - TableViewColumn{ role: "description" ; title: "log" } - - model: logModel - } } Rectangle { @@ -257,6 +244,20 @@ ApplicationWindow { text: pub.getKey().address width: 500 } + + property var logModel: ListModel { + id: logModel + } + + TableView { + id: logView + width: parent.width + height: 200 + anchors.bottom: parent.bottom + TableViewColumn{ role: "description" ; title: "log" } + + model: logModel + } } /* @@ -690,7 +691,7 @@ ApplicationWindow { function addLog(str) { if(str.len != 0) { - logModel.append({description: str}) + logModel.insert(0, {description: str}) } } -- cgit v1.2.3 From 40d72ff40bac19bb1b51bd1d382e75438673dbf2 Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Thu, 29 May 2014 12:24:56 +0200 Subject: . --- ethereal/assets/qml/wallet.qml | 2002 ++++++++++++++++++++-------------------- 1 file changed, 1001 insertions(+), 1001 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index eaf7c1b92..cfe005507 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -8,1005 +8,1005 @@ import Ethereum 1.0 ApplicationWindow { - id: root - - width: 900 - height: 600 - minimumHeight: 300 - - title: "Ethereal" - - MenuBar { - Menu { - title: "File" - MenuItem { - text: "Import App" - shortcut: "Ctrl+o" - onTriggered: openAppDialog.open() - } - } - - Menu { - title: "Tools" - MenuItem { - text: "Muted" - shortcut: "Ctrl+e" - onTriggered: ui.muted("") - } - - MenuItem { - text: "Debugger" - shortcut: "Ctrl+d" - onTriggered: ui.startDebugger() - } - } - - Menu { - title: "Network" - MenuItem { - text: "Add Peer" - shortcut: "Ctrl+p" - onTriggered: { - addPeerWin.visible = true - } - } - - MenuItem { - text: "Start" - onTriggered: ui.connect() - } - } - - Menu { - title: "Help" - MenuItem { - text: "About" - onTriggered: { - aboutWin.visible = true - } - } - } - - } - - - property var blockModel: ListModel { - id: blockModel - } - - function setView(view) { - networkView.visible = false - historyView.visible = false - newTxView.visible = false - infoView.visible = false - view.visible = true - //root.title = "Ethereal - " = view.title - } - - SplitView { - anchors.fill: parent - resizing: false - - Rectangle { - id: menu - Layout.minimumWidth: 80 - Layout.maximumWidth: 80 - anchors.bottom: parent.bottom - anchors.top: parent.top - //color: "#D9DDE7" - color: "#252525" - - ColumnLayout { - y: 50 - anchors.left: parent.left - anchors.right: parent.right - height: 200 - Image { - source: ui.assetPath("tx.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(historyView) - } - } - } - Image { - source: ui.assetPath("new.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(newTxView) - } - } - } - Image { - source: ui.assetPath("net.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(networkView) - } - } - } - - Image { - source: ui.assetPath("heart.png") - anchors.horizontalCenter: parent.horizontalCenter - MouseArea { - anchors.fill: parent - onClicked: { - setView(infoView) - } - } - } - } - } - - Rectangle { - id: mainView - color: "#00000000" - anchors.right: parent.right - anchors.left: menu.right - anchors.bottom: parent.bottom - anchors.top: parent.top - - property var txModel: ListModel { - id: txModel - } - - Rectangle { - id: historyView - anchors.fill: parent - - property var title: "Transactions" - TableView { - id: txTableView - anchors.fill: parent - TableViewColumn{ role: "inout" ; title: "" ; width: 40 } - TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } - TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } - TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } - - model: txModel - } - } - - Rectangle { - id: newTxView - property var title: "New transaction" - visible: false - anchors.fill: parent - color: "#00000000" - TabView{ - anchors.fill: parent - anchors.rightMargin: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.bottomMargin: 5 - id: newTransactionTab - Component.onCompleted:{ - addTab("Simple send", newTransaction) - addTab("Contracts", newContract) - } - } - } - - Rectangle { - id: networkView - property var title: "Network" - 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 - - onDoubleClicked: { - popup.visible = true - popup.setDetails(blockModel.get(row)) - } - } - - } - - Rectangle { - id: infoView - property var title: "Information" - visible: false - color: "#00000000" - anchors.fill: parent - - Label { - id: addressLabel - text: "Address" - anchors { - margins: 5 - top: parent.top - left: parent.left - } - } - TextField { - anchors { - margins: 5 - left: addressLabel.right - top: parent.top - } - text: pub.getKey().address - width: 500 - } - - property var logModel: ListModel { - id: logModel - } - - TableView { - id: logView - width: parent.width - height: 200 - anchors.bottom: parent.bottom - TableViewColumn{ role: "description" ; title: "log" } - - model: logModel - } - } - - /* - signal addPlugin(string name) - Component { - id: pluginWindow - Rectangle { - anchors.fill: parent - Label { - id: pluginTitle - anchors.centerIn: parent - text: "Hello world" - } - Component.onCompleted: setView(this) - } - } - - onAddPlugin: { - var pluginWin = pluginWindow.createObject(mainView) - console.log(pluginWin) - pluginWin.pluginTitle.text = "Test" - } - */ - } - } - - FileDialog { - id: openAppDialog - title: "Open QML Application" - onAccepted: { - //ui.open(openAppDialog.fileUrl.toString()) - //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) - ui.openHtml(openAppDialog.fileUrl.toString()) - } - } - - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - - Button { - property var enabled: true - id: debuggerWindow - onClicked: { - ui.startDebugger() - } - text: "Debugger" - } - - Button { - id: importAppButton - anchors.left: debuggerWindow.right - anchors.leftMargin: 5 - onClicked: openAppDialog.open() - text: "Import App" - } - - Label { - anchors.left: importAppButton.right - anchors.leftMargin: 5 - id: walletValueLabel - } - - Label { - anchors.right: peerImage.left - anchors.rightMargin: 5 - id: peerLabel - font.pixelSize: 8 - text: "0 / 0" - } - Image { - id: peerImage - anchors.right: parent.right - width: 10; height: 10 - source: ui.assetPath("network.png") - } - } - } - - Window { - id: popup - visible: false - property var block - width: root.width - height: 240 - Component{ - id: blockDetailsDelegate - Rectangle { - color: "#252525" - width: popup.width - height: 200 - Column { - anchors.leftMargin: 10 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} - Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} - Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} - Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} - } - } - } - ListView { - model: singleBlock - delegate: blockDetailsDelegate - anchors.top: parent.top - height: 70 - anchors.leftMargin: 20 - id: listViewThing - Layout.maximumHeight: 40 - } - TableView { - id: txView - anchors.top: listViewThing.bottom - anchors.topMargin: 50 - width: parent.width - - TableViewColumn{width: 90; role: "value" ; title: "Value" } - TableViewColumn{width: 200; role: "hash" ; title: "Hash" } - TableViewColumn{width: 200; role: "sender" ; title: "Sender" } - TableViewColumn{width: 200;role: "address" ; title: "Receiver" } - TableViewColumn{width: 60; role: "gas" ; title: "Gas" } - TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } - TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } - - model: transactionModel - onClicked: { - var tx = transactionModel.get(row) - if(tx.data) { - popup.showContractData(tx) - }else{ - popup.height = 230 - } - } - } - - function showContractData(tx) { - txDetailsDebugButton.tx = tx - if(tx.createsContract) { - contractData.text = tx.data - contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" - }else{ - contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" - contractData.text = tx.rawData - } - popup.height = 400 - } - - Rectangle { - id: txDetails - width: popup.width - height: 300 - anchors.left: listViewThing.left - anchors.top: txView.bottom - Label { - text: "<h4>Contract data</h4>" - anchors.top: parent.top - anchors.left: parent.left - id: contractLabel - anchors.leftMargin: 10 - } - Button { - property var tx - id: txDetailsDebugButton - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - text: "Debug contract" - onClicked: { - if(tx.createsContract){ - ui.startDbWithCode(tx.rawData) - }else { - ui.startDbWithContractAndData(tx.address, tx.rawData) - } - } - } - TextArea { - id: contractData - text: "Contract" - anchors.top: contractLabel.bottom - anchors.left: parent.left - anchors.bottom: popup.bottom - wrapMode: Text.Wrap - width: parent.width - 30 - height: 80 - anchors.leftMargin: 10 - } - } - property var transactionModel: ListModel { - id: transactionModel - } - property var singleBlock: ListModel { - id: singleBlock - } - function setDetails(block){ - singleBlock.set(0,block) - popup.height = 230 - transactionModel.clear() - if(block.txs != undefined){ - for(var i = 0; i < block.txs.count; ++i) { - transactionModel.insert(0, block.txs.get(i)) - } - if(block.txs.get(0).data){ - popup.showContractData(block.txs.get(0)) - } - } - txView.forceActiveFocus() - } - } - - Window { - id: addPeerWin - visible: false - minimumWidth: 230 - maximumWidth: 230 - maximumHeight: 50 - minimumHeight: 50 - - TextField { - id: addrField - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 10 - placeholderText: "address:port" - onAccepted: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Button { - anchors.left: addrField.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 5 - text: "Add" - onClicked: { - ui.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Component.onCompleted: { - addrField.focus = true - } - } - - Window { - id: aboutWin - visible: false - title: "About" - minimumWidth: 350 - maximumWidth: 350 - maximumHeight: 200 - minimumHeight: 200 - - Image { - id: aboutIcon - height: 150 - width: 150 - fillMode: Image.PreserveAspectFit - smooth: true - source: ui.assetPath("facet.png") - x: 10 - y: 10 - } - - Text { - anchors.left: aboutIcon.right - anchors.leftMargin: 10 - font.pointSize: 12 - text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" - } - - } - - ApplicationWindow { - id: debugWindow - visible: false - title: "Debugger" - minimumWidth: 600 - minimumHeight: 600 - width: 800 - height: 600 - - - Item { - id: keyHandler - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Space) { - ui.next() - } - } - } - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - id: debugSplitView - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } - model: stackModel - } - } - } - } - } - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - Button { - property var enabled: true - id: debugNextButton - onClicked: { - ui.next() - } - text: "Next" - } - } - } - } - - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } - function addDebugMessage(message){ - console.log("WOOP:") - debuggerLog.append({value: message}) - } - - function clearStack() { - stackModel.clear() - } - - function loadPlugin(name) { - console.log("Loading plugin" + name) - mainView.addPlugin(name) - } - - function setWalletValue(value) { - walletValueLabel.text = value - } - - function addTx(tx, inout) { - var isContract - if (tx.contract == true){ - isContract = "Yes" - }else{ - isContract = "No" - } - txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) - } - - function addBlock(block, initial) { - var txs = JSON.parse(block.transactions); - var amount = 0 - if(initial == undefined){ - initial = false - } - - if(txs != null){ - amount = txs.length - } - - if(initial){ - blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - }else{ - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) - } - } - - function addLog(str) { - if(str.len != 0) { - logModel.insert(0, {description: str}) - } - } - - function setPeers(text) { - peerLabel.text = text - } - function convertToPretty(unixTs){ - var a = new Date(unixTs*1000); - var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - var year = a.getFullYear(); - var month = months[a.getMonth()]; - var date = a.getDate(); - var hour = a.getHours(); - var min = a.getMinutes(); - var sec = a.getSeconds(); - var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; - return time; - } - // ******************************************* - // Components - // ******************************************* - - // New Contract component - Component { - id: newContract - Column { - id: mainContractColumn - function contractFormReady(){ - if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { - txButton.state = "READY" - }else{ - txButton.state = "NOTREADY" - } - } - states: [ - State{ - name: "ERROR" - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: codeView; visible:true} - }, - State { - name: "DONE" - PropertyChanges { target: txValue; visible:false} - PropertyChanges { target: txGas; visible:false} - PropertyChanges { target: txGasPrice; visible:false} - PropertyChanges { target: codeView; visible:false} - PropertyChanges { target: txButton; visible:false} - PropertyChanges { target: txDataLabel; visible:false} - - PropertyChanges { target: txResult; visible:true} - PropertyChanges { target: txOutput; visible:true} - PropertyChanges { target: newTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txValue; visible:true; text: ""} - PropertyChanges { target: txGas; visible:true; text: ""} - PropertyChanges { target: txGasPrice; visible:true; text: ""} - PropertyChanges { target: codeView; visible:true; text: ""} - PropertyChanges { target: txButton; visible:true} - PropertyChanges { target: txDataLabel; visible:true} - - PropertyChanges { target: txResult; visible:false} - PropertyChanges { target: txOutput; visible:false} - PropertyChanges { target: newTxButton; visible:false} - } - ] - width: 400 - spacing: 5 - anchors.left: parent.left - anchors.top: parent.top - anchors.leftMargin: 5 - anchors.topMargin: 5 - - TextField { - id: txValue - width: 200 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGas - width: 200 - validator: RegExpValidator { regExp: /\d*/ } - placeholderText: "Gas" - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGasPrice - width: 200 - placeholderText: "Gas price" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - - Row { - id: rowContract - ExclusiveGroup { id: contractTypeGroup } - RadioButton { - id: createContractRadio - text: "Create contract" - checked: true - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = false - txDataLabel.text = "Contract code" - } - } - RadioButton { - id: runContractRadio - text: "Run contract" - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = true - txDataLabel.text = "Contract arguments" - } - } - } - - - Label { - id: txDataLabel - text: "Contract code" - } - - TextArea { - id: codeView - height: 300 - anchors.topMargin: 5 - Layout.fillWidth: true - width: parent.width /2 - onTextChanged: { - contractFormReady() - } - } - - TextField { - id: txFuelRecipient - placeholderText: "Contract address" - //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - visible: false - width: 530 - } - - Button { - id: txButton - /* enabled: false */ - states: [ - State { - name: "READY" - PropertyChanges { target: txButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txButton; /*enabled:false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) - if(res[1]) { - txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" - txResult.text += res[1].error() - txResult.text += "</b>" - mainContractColumn.state = "ERROR" - } else { - txResult.text = "Your transaction has been submitted:\n" - txOutput.text = res[0].address - mainContractColumn.state = "DONE" - } - } - } - Text { - id: txResult - visible: false - } - TextField { - id: txOutput - visible: false - width: 530 - } - Button { - id: newTxButton - visible: false - text: "Create an other contract" - onClicked: { - this.visible = false - txResult.text = "" - txOutput.text = "" - mainContractColumn.state = "SETUP" - } - } - - Button { - id: debugButton - text: "Debug" - onClicked: { - var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) - debugWindow.visible = true - } - } - } - } - - // New Transaction component - Component { - id: newTransaction - Column { - id: simpleSendColumn - states: [ - State{ - name: "ERROR" - }, - State { - name: "DONE" - PropertyChanges { target: txSimpleValue; visible:false} - PropertyChanges { target: txSimpleRecipient; visible:false} - PropertyChanges { target:newSimpleTxButton; visible:false} - - PropertyChanges { target: txSimpleResult; visible:true} - PropertyChanges { target: txSimpleOutput; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:true} - }, - State { - name: "SETUP" - PropertyChanges { target: txSimpleValue; visible:true; text: ""} - PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} - PropertyChanges { target: txSimpleButton; visible:true} - PropertyChanges { target:newSimpleTxButton; visible:false} - } - ] - spacing: 5 - anchors.leftMargin: 5 - anchors.topMargin: 5 - anchors.top: parent.top - anchors.left: parent.left - - function checkFormState(){ - if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { - txSimpleButton.state = "READY" - }else{ - txSimpleButton.state = "NOTREADY" - } - } - - TextField { - id: txSimpleRecipient - placeholderText: "Recipient address" - Layout.fillWidth: true - //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - width: 530 - onTextChanged: { checkFormState() } - } - TextField { - id: txSimpleValue - width: 200 - placeholderText: "Amount" - anchors.rightMargin: 5 - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { checkFormState() } - } - Button { - id: txSimpleButton - /*enabled: false*/ - states: [ - State { - name: "READY" - PropertyChanges { target: txSimpleButton; /*enabled: true*/} - }, - State { - name: "NOTREADY" - PropertyChanges { target: txSimpleButton; /*enabled: false*/} - } - ] - text: "Send" - onClicked: { - //this.enabled = false - var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text, "500", "1000000", "") - if(res[1]) { - txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() - } else { - txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" - txSimpleOutput.text = res[0].hash - this.visible = false - simpleSendColumn.state = "DONE" - } - } - } - Text { - id: txSimpleResult - visible: false - - } - TextField { - id: txSimpleOutput - visible: false - width: 530 - } - Button { - id: newSimpleTxButton - visible: false - text: "Create an other transaction" - onClicked: { - this.visible = false - simpleSendColumn.state = "SETUP" - } - } - } - } + id: root + + width: 900 + height: 600 + minimumHeight: 300 + + title: "Ethereal" + + MenuBar { + Menu { + title: "File" + MenuItem { + text: "Import App" + shortcut: "Ctrl+o" + onTriggered: openAppDialog.open() + } + } + + Menu { + title: "Tools" + MenuItem { + text: "Muted" + shortcut: "Ctrl+e" + onTriggered: ui.muted("") + } + + MenuItem { + text: "Debugger" + shortcut: "Ctrl+d" + onTriggered: ui.startDebugger() + } + } + + Menu { + title: "Network" + MenuItem { + text: "Add Peer" + shortcut: "Ctrl+p" + onTriggered: { + addPeerWin.visible = true + } + } + + MenuItem { + text: "Start" + onTriggered: ui.connect() + } + } + + Menu { + title: "Help" + MenuItem { + text: "About" + onTriggered: { + aboutWin.visible = true + } + } + } + + } + + + property var blockModel: ListModel { + id: blockModel + } + + function setView(view) { + networkView.visible = false + historyView.visible = false + newTxView.visible = false + infoView.visible = false + view.visible = true + //root.title = "Ethereal - " = view.title + } + + SplitView { + anchors.fill: parent + resizing: false + + Rectangle { + id: menu + Layout.minimumWidth: 80 + Layout.maximumWidth: 80 + anchors.bottom: parent.bottom + anchors.top: parent.top + //color: "#D9DDE7" + color: "#252525" + + ColumnLayout { + y: 50 + anchors.left: parent.left + anchors.right: parent.right + height: 200 + Image { + source: ui.assetPath("tx.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(historyView) + } + } + } + Image { + source: ui.assetPath("new.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(newTxView) + } + } + } + Image { + source: ui.assetPath("net.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(networkView) + } + } + } + + Image { + source: ui.assetPath("heart.png") + anchors.horizontalCenter: parent.horizontalCenter + MouseArea { + anchors.fill: parent + onClicked: { + setView(infoView) + } + } + } + } + } + + Rectangle { + id: mainView + color: "#00000000" + anchors.right: parent.right + anchors.left: menu.right + anchors.bottom: parent.bottom + anchors.top: parent.top + + property var txModel: ListModel { + id: txModel + } + + Rectangle { + id: historyView + anchors.fill: parent + + property var title: "Transactions" + TableView { + id: txTableView + anchors.fill: parent + TableViewColumn{ role: "inout" ; title: "" ; width: 40 } + TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } + TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } + TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } + + model: txModel + } + } + + Rectangle { + id: newTxView + property var title: "New transaction" + visible: false + anchors.fill: parent + color: "#00000000" + TabView{ + anchors.fill: parent + anchors.rightMargin: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.bottomMargin: 5 + id: newTransactionTab + Component.onCompleted:{ + addTab("Simple send", newTransaction) + addTab("Contracts", newContract) + } + } + } + + Rectangle { + id: networkView + property var title: "Network" + 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 + + onDoubleClicked: { + popup.visible = true + popup.setDetails(blockModel.get(row)) + } + } + + } + + Rectangle { + id: infoView + property var title: "Information" + visible: false + color: "#00000000" + anchors.fill: parent + + Label { + id: addressLabel + text: "Address" + anchors { + margins: 5 + top: parent.top + left: parent.left + } + } + TextField { + anchors { + margins: 5 + left: addressLabel.right + top: parent.top + } + text: pub.getKey().address + width: 500 + } + + property var logModel: ListModel { + id: logModel + } + + TableView { + id: logView + width: parent.width + height: 200 + anchors.bottom: parent.bottom + TableViewColumn{ role: "description" ; title: "log" } + + model: logModel + } + } + + /* + signal addPlugin(string name) + Component { + id: pluginWindow + Rectangle { + anchors.fill: parent + Label { + id: pluginTitle + anchors.centerIn: parent + text: "Hello world" + } + Component.onCompleted: setView(this) + } + } + + onAddPlugin: { + var pluginWin = pluginWindow.createObject(mainView) + console.log(pluginWin) + pluginWin.pluginTitle.text = "Test" + } + */ + } + } + + FileDialog { + id: openAppDialog + title: "Open QML Application" + onAccepted: { + //ui.open(openAppDialog.fileUrl.toString()) + //ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) + ui.openHtml(openAppDialog.fileUrl.toString()) + } + } + + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + + Button { + property var enabled: true + id: debuggerWindow + onClicked: { + ui.startDebugger() + } + text: "Debugger" + } + + Button { + id: importAppButton + anchors.left: debuggerWindow.right + anchors.leftMargin: 5 + onClicked: openAppDialog.open() + text: "Import App" + } + + Label { + anchors.left: importAppButton.right + anchors.leftMargin: 5 + id: walletValueLabel + } + + Label { + anchors.right: peerImage.left + anchors.rightMargin: 5 + id: peerLabel + font.pixelSize: 8 + text: "0 / 0" + } + Image { + id: peerImage + anchors.right: parent.right + width: 10; height: 10 + source: ui.assetPath("network.png") + } + } + } + + Window { + id: popup + visible: false + property var block + width: root.width + height: 240 + Component{ + id: blockDetailsDelegate + Rectangle { + color: "#252525" + width: popup.width + height: 200 + Column { + anchors.leftMargin: 10 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} + Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} + Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} + Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} + } + } + } + ListView { + model: singleBlock + delegate: blockDetailsDelegate + anchors.top: parent.top + height: 70 + anchors.leftMargin: 20 + id: listViewThing + Layout.maximumHeight: 40 + } + TableView { + id: txView + anchors.top: listViewThing.bottom + anchors.topMargin: 50 + width: parent.width + + TableViewColumn{width: 90; role: "value" ; title: "Value" } + TableViewColumn{width: 200; role: "hash" ; title: "Hash" } + TableViewColumn{width: 200; role: "sender" ; title: "Sender" } + TableViewColumn{width: 200;role: "address" ; title: "Receiver" } + TableViewColumn{width: 60; role: "gas" ; title: "Gas" } + TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } + TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } + + model: transactionModel + onClicked: { + var tx = transactionModel.get(row) + if(tx.data) { + popup.showContractData(tx) + }else{ + popup.height = 230 + } + } + } + + function showContractData(tx) { + txDetailsDebugButton.tx = tx + if(tx.createsContract) { + contractData.text = tx.data + contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" + }else{ + contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" + contractData.text = tx.rawData + } + popup.height = 400 + } + + Rectangle { + id: txDetails + width: popup.width + height: 300 + anchors.left: listViewThing.left + anchors.top: txView.bottom + Label { + text: "<h4>Contract data</h4>" + anchors.top: parent.top + anchors.left: parent.left + id: contractLabel + anchors.leftMargin: 10 + } + Button { + property var tx + id: txDetailsDebugButton + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + text: "Debug contract" + onClicked: { + if(tx.createsContract){ + ui.startDbWithCode(tx.rawData) + }else { + ui.startDbWithContractAndData(tx.address, tx.rawData) + } + } + } + TextArea { + id: contractData + text: "Contract" + anchors.top: contractLabel.bottom + anchors.left: parent.left + anchors.bottom: popup.bottom + wrapMode: Text.Wrap + width: parent.width - 30 + height: 80 + anchors.leftMargin: 10 + } + } + property var transactionModel: ListModel { + id: transactionModel + } + property var singleBlock: ListModel { + id: singleBlock + } + function setDetails(block){ + singleBlock.set(0,block) + popup.height = 230 + transactionModel.clear() + if(block.txs != undefined){ + for(var i = 0; i < block.txs.count; ++i) { + transactionModel.insert(0, block.txs.get(i)) + } + if(block.txs.get(0).data){ + popup.showContractData(block.txs.get(0)) + } + } + txView.forceActiveFocus() + } + } + + Window { + id: addPeerWin + visible: false + minimumWidth: 230 + maximumWidth: 230 + maximumHeight: 50 + minimumHeight: 50 + + TextField { + id: addrField + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 10 + placeholderText: "address:port" + onAccepted: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Button { + anchors.left: addrField.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 5 + text: "Add" + onClicked: { + ui.connectToPeer(addrField.text) + addPeerWin.visible = false + } + } + Component.onCompleted: { + addrField.focus = true + } + } + + Window { + id: aboutWin + visible: false + title: "About" + minimumWidth: 350 + maximumWidth: 350 + maximumHeight: 200 + minimumHeight: 200 + + Image { + id: aboutIcon + height: 150 + width: 150 + fillMode: Image.PreserveAspectFit + smooth: true + source: ui.assetPath("facet.png") + x: 10 + y: 10 + } + + Text { + anchors.left: aboutIcon.right + anchors.leftMargin: 10 + font.pointSize: 12 + text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" + } + + } + + ApplicationWindow { + id: debugWindow + visible: false + title: "Debugger" + minimumWidth: 600 + minimumHeight: 600 + width: 800 + height: 600 + + + Item { + id: keyHandler + focus: true + Keys.onPressed: { + if (event.key == Qt.Key_Space) { + ui.next() + } + } + } + SplitView { + anchors.fill: parent + property var asmModel: ListModel { + id: asmModel + } + TableView { + id: asmTableView + width: 200 + TableViewColumn{ role: "value" ; title: "" ; width: 100 } + model: asmModel + } + + Rectangle { + anchors.left: asmTableView.right + anchors.right: parent.right + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + id: debugSplitView + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } + model: stackModel + } + } + } + } + } + statusBar: StatusBar { + RowLayout { + anchors.fill: parent + Button { + property var enabled: true + id: debugNextButton + onClicked: { + ui.next() + } + text: "Next" + } + } + } + } + + function setAsm(asm) { + asmModel.append({asm: asm}) + } + + function setInstruction(num) { + asmTableView.selection.clear() + asmTableView.selection.select(num-1) + } + + function clearAsm() { + asmModel.clear() + } + + function setMem(mem) { + memModel.append({num: mem.num, value: mem.value}) + } + function clearMem(){ + memModel.clear() + } + + function setStack(stack) { + stackModel.append({value: stack}) + } + function addDebugMessage(message){ + console.log("WOOP:") + debuggerLog.append({value: message}) + } + + function clearStack() { + stackModel.clear() + } + + function loadPlugin(name) { + console.log("Loading plugin" + name) + mainView.addPlugin(name) + } + + function setWalletValue(value) { + walletValueLabel.text = value + } + + function addTx(tx, inout) { + var isContract + if (tx.contract == true){ + isContract = "Yes" + }else{ + isContract = "No" + } + txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + } + + function addBlock(block, initial) { + var txs = JSON.parse(block.transactions); + var amount = 0 + if(initial == undefined){ + initial = false + } + + if(txs != null){ + amount = txs.length + } + + if(initial){ + blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + }else{ + blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + } + } + + function addLog(str) { + if(str.len != 0) { + logModel.insert(0, {description: str}) + } + } + + function setPeers(text) { + peerLabel.text = text + } + function convertToPretty(unixTs){ + var a = new Date(unixTs*1000); + var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; + var year = a.getFullYear(); + var month = months[a.getMonth()]; + var date = a.getDate(); + var hour = a.getHours(); + var min = a.getMinutes(); + var sec = a.getSeconds(); + var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; + return time; + } + // ******************************************* + // Components + // ******************************************* + + // New Contract component + Component { + id: newContract + Column { + id: mainContractColumn + function contractFormReady(){ + if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { + txButton.state = "READY" + }else{ + txButton.state = "NOTREADY" + } + } + states: [ + State{ + name: "ERROR" + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: codeView; visible:true} + }, + State { + name: "DONE" + PropertyChanges { target: txValue; visible:false} + PropertyChanges { target: txGas; visible:false} + PropertyChanges { target: txGasPrice; visible:false} + PropertyChanges { target: codeView; visible:false} + PropertyChanges { target: txButton; visible:false} + PropertyChanges { target: txDataLabel; visible:false} + + PropertyChanges { target: txResult; visible:true} + PropertyChanges { target: txOutput; visible:true} + PropertyChanges { target: newTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txValue; visible:true; text: ""} + PropertyChanges { target: txGas; visible:true; text: ""} + PropertyChanges { target: txGasPrice; visible:true; text: ""} + PropertyChanges { target: codeView; visible:true; text: ""} + PropertyChanges { target: txButton; visible:true} + PropertyChanges { target: txDataLabel; visible:true} + + PropertyChanges { target: txResult; visible:false} + PropertyChanges { target: txOutput; visible:false} + PropertyChanges { target: newTxButton; visible:false} + } + ] + width: 400 + spacing: 5 + anchors.left: parent.left + anchors.top: parent.top + anchors.leftMargin: 5 + anchors.topMargin: 5 + + TextField { + id: txValue + width: 200 + placeholderText: "Amount" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGas + width: 200 + validator: RegExpValidator { regExp: /\d*/ } + placeholderText: "Gas" + onTextChanged: { + contractFormReady() + } + } + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { + contractFormReady() + } + } + + Row { + id: rowContract + ExclusiveGroup { id: contractTypeGroup } + RadioButton { + id: createContractRadio + text: "Create contract" + checked: true + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = false + txDataLabel.text = "Contract code" + } + } + RadioButton { + id: runContractRadio + text: "Run contract" + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = true + txDataLabel.text = "Contract arguments" + } + } + } + + + Label { + id: txDataLabel + text: "Contract code" + } + + TextArea { + id: codeView + height: 300 + anchors.topMargin: 5 + Layout.fillWidth: true + width: parent.width /2 + onTextChanged: { + contractFormReady() + } + } + + TextField { + id: txFuelRecipient + placeholderText: "Contract address" + //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + visible: false + width: 530 + } + + Button { + id: txButton + /* enabled: false */ + states: [ + State { + name: "READY" + PropertyChanges { target: txButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txButton; /*enabled:false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.create(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) + if(res[1]) { + txResult.text = "Your contract <b>could not</b> be send over the network:\n<b>" + txResult.text += res[1].error() + txResult.text += "</b>" + mainContractColumn.state = "ERROR" + } else { + txResult.text = "Your transaction has been submitted:\n" + txOutput.text = res[0].address + mainContractColumn.state = "DONE" + } + } + } + Text { + id: txResult + visible: false + } + TextField { + id: txOutput + visible: false + width: 530 + } + Button { + id: newTxButton + visible: false + text: "Create an other contract" + onClicked: { + this.visible = false + txResult.text = "" + txOutput.text = "" + mainContractColumn.state = "SETUP" + } + } + + Button { + id: debugButton + text: "Debug" + onClicked: { + var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) + debugWindow.visible = true + } + } + } + } + + // New Transaction component + Component { + id: newTransaction + Column { + id: simpleSendColumn + states: [ + State{ + name: "ERROR" + }, + State { + name: "DONE" + PropertyChanges { target: txSimpleValue; visible:false} + PropertyChanges { target: txSimpleRecipient; visible:false} + PropertyChanges { target:newSimpleTxButton; visible:false} + + PropertyChanges { target: txSimpleResult; visible:true} + PropertyChanges { target: txSimpleOutput; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:true} + }, + State { + name: "SETUP" + PropertyChanges { target: txSimpleValue; visible:true; text: ""} + PropertyChanges { target: txSimpleRecipient; visible:true; text: ""} + PropertyChanges { target: txSimpleButton; visible:true} + PropertyChanges { target:newSimpleTxButton; visible:false} + } + ] + spacing: 5 + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.top: parent.top + anchors.left: parent.left + + function checkFormState(){ + if(txSimpleRecipient.text.length == 40 && txSimpleValue.text.length > 0) { + txSimpleButton.state = "READY" + }else{ + txSimpleButton.state = "NOTREADY" + } + } + + TextField { + id: txSimpleRecipient + placeholderText: "Recipient address" + Layout.fillWidth: true + //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + width: 530 + onTextChanged: { checkFormState() } + } + TextField { + id: txSimpleValue + width: 200 + placeholderText: "Amount" + anchors.rightMargin: 5 + validator: RegExpValidator { regExp: /\d*/ } + onTextChanged: { checkFormState() } + } + Button { + id: txSimpleButton + /*enabled: false*/ + states: [ + State { + name: "READY" + PropertyChanges { target: txSimpleButton; /*enabled: true*/} + }, + State { + name: "NOTREADY" + PropertyChanges { target: txSimpleButton; /*enabled: false*/} + } + ] + text: "Send" + onClicked: { + //this.enabled = false + var res = eth.transact(txSimpleRecipient.text, txSimpleValue.text, "500", "1000000", "") + if(res[1]) { + txSimpleResult.text = "There has been an error broadcasting your transaction:" + res[1].error() + } else { + txSimpleResult.text = "Your transaction has been broadcasted over the network.\nYour transaction id is:" + txSimpleOutput.text = res[0].hash + this.visible = false + simpleSendColumn.state = "DONE" + } + } + } + Text { + id: txSimpleResult + visible: false + + } + TextField { + id: txSimpleOutput + visible: false + width: 530 + } + Button { + id: newSimpleTxButton + visible: false + text: "Create an other transaction" + onClicked: { + this.visible = false + simpleSendColumn.state = "SETUP" + } + } + } + } } -- cgit v1.2.3 From fcbf99a30a15b445c35d70a8a781190a2739845b Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Fri, 30 May 2014 11:50:30 +0200 Subject: Minor GUI updates * IceCream => IceCREAM * Added coin base to block info --- ethereal/assets/debugger/debugger.qml | 2 +- ethereal/assets/qml/wallet.qml | 65 ++++++++++++++++------------------- 2 files changed, 31 insertions(+), 36 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index 84d9a0732..ca67e857d 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -8,7 +8,7 @@ import Ethereum 1.0 ApplicationWindow { visible: false - title: "IceCream" + title: "IceCREAM" minimumWidth: 1280 minimumHeight: 900 width: 1290 diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index cfe005507..2ab1f31de 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -245,10 +245,25 @@ ApplicationWindow { width: 500 } + + property var addressModel: ListModel { + id: addressModel + } + TableView { + id: addressView + width: parent.width + height: 200 + anchors.bottom: logView.top + TableViewColumn{ role: "name"; title: "name" } + TableViewColumn{ role: "address"; title: "address"; width: 300} + + model: addressModel + } + + property var logModel: ListModel { id: logModel } - TableView { id: logView width: parent.width @@ -342,13 +357,13 @@ ApplicationWindow { visible: false property var block width: root.width - height: 240 + height: 300 Component{ id: blockDetailsDelegate Rectangle { color: "#252525" width: popup.width - height: 200 + height: 150 Column { anchors.leftMargin: 10 anchors.topMargin: 5 @@ -357,6 +372,7 @@ ApplicationWindow { Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"} Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"} Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} + Text { text: '<b>Coinbase:</b> ' + coinbase; color: "#F2F2F2"} Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} } } @@ -365,7 +381,7 @@ ApplicationWindow { model: singleBlock delegate: blockDetailsDelegate anchors.top: parent.top - height: 70 + height: 100 anchors.leftMargin: 20 id: listViewThing Layout.maximumHeight: 40 @@ -390,7 +406,7 @@ ApplicationWindow { if(tx.data) { popup.showContractData(tx) }else{ - popup.height = 230 + popup.height = 440 } } } @@ -404,7 +420,7 @@ ApplicationWindow { contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" contractData.text = tx.rawData } - popup.height = 400 + popup.height = 540 } Rectangle { @@ -456,7 +472,7 @@ ApplicationWindow { } function setDetails(block){ singleBlock.set(0,block) - popup.height = 230 + popup.height = 300 transactionModel.clear() if(block.txs != undefined){ for(var i = 0; i < block.txs.count; ++i) { @@ -620,36 +636,15 @@ ApplicationWindow { } } - function setAsm(asm) { - asmModel.append({asm: asm}) - } - - function setInstruction(num) { - asmTableView.selection.clear() - asmTableView.selection.select(num-1) - } - - function clearAsm() { - asmModel.clear() - } - - function setMem(mem) { - memModel.append({num: mem.num, value: mem.value}) - } - function clearMem(){ - memModel.clear() - } - - function setStack(stack) { - stackModel.append({value: stack}) - } function addDebugMessage(message){ - console.log("WOOP:") debuggerLog.append({value: message}) } - function clearStack() { - stackModel.clear() + function addAddress(address) { + addressModel.append({name: address.name, address: address.address}) + } + function clearAddress() { + addressModel.clear() } function loadPlugin(name) { @@ -683,9 +678,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) }else{ - blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } -- cgit v1.2.3 From e7c9b86a5aba022afd812f1a4fb554ee17a74bbd Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Fri, 30 May 2014 13:28:31 +0200 Subject: Improved UI * Added mining button --- ethereal/assets/qml/wallet.qml | 148 +++++++---------------------------------- 1 file changed, 25 insertions(+), 123 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 2ab1f31de..4ad4cd7f6 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -10,6 +10,8 @@ import Ethereum 1.0 ApplicationWindow { id: root + property alias miningButtonText: miningButton.text + width: 900 height: 600 minimumHeight: 300 @@ -27,13 +29,6 @@ ApplicationWindow { } Menu { - title: "Tools" - MenuItem { - text: "Muted" - shortcut: "Ctrl+e" - onTriggered: ui.muted("") - } - MenuItem { text: "Debugger" shortcut: "Ctrl+d" @@ -50,11 +45,6 @@ ApplicationWindow { addPeerWin.visible = true } } - - MenuItem { - text: "Start" - onTriggered: ui.connect() - } } Menu { @@ -310,8 +300,15 @@ ApplicationWindow { } statusBar: StatusBar { + height: 30 RowLayout { - anchors.fill: parent + Button { + id: miningButton + onClicked: { + eth.toggleMining() + } + text: "Start Mining" + } Button { property var enabled: true @@ -335,20 +332,22 @@ ApplicationWindow { anchors.leftMargin: 5 id: walletValueLabel } + } - Label { - anchors.right: peerImage.left - anchors.rightMargin: 5 - id: peerLabel - font.pixelSize: 8 - text: "0 / 0" - } - Image { - id: peerImage - anchors.right: parent.right - width: 10; height: 10 - source: ui.assetPath("network.png") - } + Label { + y: 7 + anchors.right: peerImage.left + anchors.rightMargin: 5 + id: peerLabel + font.pixelSize: 8 + text: "0 / 0" + } + Image { + y: 7 + id: peerImage + anchors.right: parent.right + width: 10; height: 10 + source: ui.assetPath("network.png") } } @@ -546,94 +545,6 @@ ApplicationWindow { font.pointSize: 12 text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" } - - } - - ApplicationWindow { - id: debugWindow - visible: false - title: "Debugger" - minimumWidth: 600 - minimumHeight: 600 - width: 800 - height: 600 - - - Item { - id: keyHandler - focus: true - Keys.onPressed: { - if (event.key == Qt.Key_Space) { - ui.next() - } - } - } - SplitView { - anchors.fill: parent - property var asmModel: ListModel { - id: asmModel - } - TableView { - id: asmTableView - width: 200 - TableViewColumn{ role: "value" ; title: "" ; width: 100 } - model: asmModel - } - - Rectangle { - anchors.left: asmTableView.right - anchors.right: parent.right - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Horizontal - id: debugSplitView - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width } - model: stackModel - } - } - } - } - } - statusBar: StatusBar { - RowLayout { - anchors.fill: parent - Button { - property var enabled: true - id: debugNextButton - onClicked: { - ui.next() - } - text: "Next" - } - } - } } function addDebugMessage(message){ @@ -887,15 +798,6 @@ ApplicationWindow { mainContractColumn.state = "SETUP" } } - - Button { - id: debugButton - text: "Debug" - onClicked: { - var res = ui.debugTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) - debugWindow.visible = true - } - } } } -- cgit v1.2.3 From 1020d7ff67e4888abbe27f8e1a4d516b4c48231c Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Fri, 30 May 2014 16:14:46 +0200 Subject: Unified the contract interface and tx interface. Fixes #62 --- ethereal/assets/qml/wallet.qml | 103 +++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 50 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 4ad4cd7f6..458ce90e4 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -170,6 +170,7 @@ ApplicationWindow { visible: false anchors.fill: parent color: "#00000000" + /* TabView{ anchors.fill: parent anchors.rightMargin: 5 @@ -182,6 +183,10 @@ ApplicationWindow { addTab("Contracts", newContract) } } + */ + Component.onCompleted: { + newContract.createObject(newTxView) + } } Rectangle { @@ -574,7 +579,14 @@ ApplicationWindow { }else{ isContract = "No" } - txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) + + var address; + if(inout == "recv") { + address = tx.sender; + } else { + address = tx.address; + } + txModel.insert(0, {inout: inout, hash: tx.hash, address: address, value: tx.value, contract: isContract}) } function addBlock(block, initial) { @@ -625,6 +637,7 @@ ApplicationWindow { id: newContract Column { id: mainContractColumn + anchors.fill: parent function contractFormReady(){ if(codeView.text.length > 0 && txValue.text.length > 0 && txGas.text.length > 0 && txGasPrice.length > 0) { txButton.state = "READY" @@ -646,6 +659,8 @@ ApplicationWindow { PropertyChanges { target: codeView; visible:false} PropertyChanges { target: txButton; visible:false} PropertyChanges { target: txDataLabel; visible:false} + PropertyChanges { target: atLabel; visible:false} + PropertyChanges { target: txFuelRecipient; visible:false} PropertyChanges { target: txResult; visible:true} PropertyChanges { target: txOutput; visible:true} @@ -673,81 +688,69 @@ ApplicationWindow { anchors.topMargin: 5 TextField { - id: txValue - width: 200 - placeholderText: "Amount" - validator: RegExpValidator { regExp: /\d*/ } - onTextChanged: { - contractFormReady() - } - } - TextField { - id: txGas - width: 200 - validator: RegExpValidator { regExp: /\d*/ } - placeholderText: "Gas" - onTextChanged: { - contractFormReady() - } + id: txFuelRecipient + placeholderText: "Address / Name or empty for contract" + //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + width: 400 } + TextField { - id: txGasPrice - width: 200 - placeholderText: "Gas price" + id: txValue + width: 222 + placeholderText: "Amount" validator: RegExpValidator { regExp: /\d*/ } onTextChanged: { contractFormReady() } } - Row { - id: rowContract - ExclusiveGroup { id: contractTypeGroup } - RadioButton { - id: createContractRadio - text: "Create contract" - checked: true - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = false - txDataLabel.text = "Contract code" + RowLayout { + TextField { + id: txGas + width: 50 + validator: RegExpValidator { regExp: /\d*/ } + placeholderText: "Gas" + text: "500" + /* + onTextChanged: { + contractFormReady() } + */ + } + Label { + id: atLabel + text: "@" } - RadioButton { - id: runContractRadio - text: "Run contract" - exclusiveGroup: contractTypeGroup - onClicked: { - txFuelRecipient.visible = true - txDataLabel.text = "Contract arguments" + + TextField { + id: txGasPrice + width: 200 + placeholderText: "Gas price" + text: "1000000" + validator: RegExpValidator { regExp: /\d*/ } + /* + onTextChanged: { + contractFormReady() } + */ } } - Label { id: txDataLabel - text: "Contract code" + text: "Data" } TextArea { id: codeView height: 300 anchors.topMargin: 5 - Layout.fillWidth: true - width: parent.width /2 + width: 400 onTextChanged: { contractFormReady() } } - TextField { - id: txFuelRecipient - placeholderText: "Contract address" - //validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } - visible: false - width: 530 - } Button { id: txButton @@ -790,7 +793,7 @@ ApplicationWindow { Button { id: newTxButton visible: false - text: "Create an other contract" + text: "Create a new transaction" onClicked: { this.visible = false txResult.text = "" -- cgit v1.2.3 From 0bdb0a9d58be08e210eb94dc6893f6103202ae7c Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Fri, 30 May 2014 19:36:05 +0200 Subject: Added ini file for ethereum. fixes #66 --- ethereal/assets/qml/wallet.qml | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 458ce90e4..bbb147d89 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -221,23 +221,30 @@ ApplicationWindow { color: "#00000000" anchors.fill: parent - Label { - id: addressLabel - text: "Address" - anchors { - margins: 5 - top: parent.top - left: parent.left + Column { + spacing: 3 + anchors.fill: parent + anchors.topMargin: 5 + anchors.leftMargin: 5 + + Label { + id: addressLabel + text: "Address" } - } - TextField { - anchors { - margins: 5 - left: addressLabel.right - top: parent.top + TextField { + text: pub.getKey().address + width: 500 + } + + Label { + text: "Client ID" + } + TextField { + text: eth.clientId() + onTextChanged: { + eth.changeClientId(text) + } } - text: pub.getKey().address - width: 500 } -- cgit v1.2.3 From a6f4eef1dadee9d8caa9b0ac20e2ce4a3034a100 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Mon, 2 Jun 2014 15:16:37 +0200 Subject: Added Peer Window --- ethereal/assets/qml/wallet.qml | 50 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index bbb147d89..8c04c6344 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -45,6 +45,13 @@ ApplicationWindow { addPeerWin.visible = true } } + MenuItem { + text: "Show Peers" + shortcut: "Ctrl+e" + onTriggered: { + peerWindow.visible = true + } + } } Menu { @@ -359,6 +366,10 @@ ApplicationWindow { id: peerImage anchors.right: parent.right width: 10; height: 10 + MouseArea { + onDoubleClicked: peerWindow.visible = true + anchors.fill: parent + } source: ui.assetPath("network.png") } } @@ -623,6 +634,20 @@ ApplicationWindow { function setPeers(text) { peerLabel.text = text } + + function addPeer(peer) { + // We could just append the whole peer object but it cries if you try to alter them + peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), version: peer.version}) + } + + function resetPeers(){ + peerModel.clear() + } + + function timeAgo(unixTs){ + var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000 + return (lapsed + " seconds ago") + } function convertToPretty(unixTs){ var a = new Date(unixTs*1000); var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; @@ -635,6 +660,30 @@ ApplicationWindow { var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; return time; } + // ****************************************** + // Windows + // ****************************************** + Window { + id: peerWindow + height: 200 + width: 500 + Rectangle { + anchors.fill: parent + property var peerModel: ListModel { + id: peerModel + } + TableView { + anchors.fill: parent + id: peerTable + model: peerModel + TableViewColumn{width: 120; role: "ip" ; title: "IP" } + TableViewColumn{width: 60; role: "port" ; title: "Port" } + TableViewColumn{width: 120; role: "lastResponse"; title: "Last event" } + TableViewColumn{width: 180; role: "version" ; title: "Version" } + } + } + } + // ******************************************* // Components // ******************************************* @@ -810,7 +859,6 @@ ApplicationWindow { } } } - // New Transaction component Component { id: newTransaction -- cgit v1.2.3 From 9e411d785bc4e104183dda537488f8aa2906ec13 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 3 Jun 2014 10:42:36 +0200 Subject: Tweaks and latency added to peeroverview --- ethereal/assets/qml/wallet.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 8c04c6344..b626bf044 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -637,7 +637,7 @@ ApplicationWindow { function addPeer(peer) { // We could just append the whole peer object but it cries if you try to alter them - peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), version: peer.version}) + peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version}) } function resetPeers(){ @@ -666,7 +666,7 @@ ApplicationWindow { Window { id: peerWindow height: 200 - width: 500 + width: 700 Rectangle { anchors.fill: parent property var peerModel: ListModel { @@ -676,10 +676,11 @@ ApplicationWindow { anchors.fill: parent id: peerTable model: peerModel - TableViewColumn{width: 120; role: "ip" ; title: "IP" } + TableViewColumn{width: 100; role: "ip" ; title: "IP" } TableViewColumn{width: 60; role: "port" ; title: "Port" } - TableViewColumn{width: 120; role: "lastResponse"; title: "Last event" } - TableViewColumn{width: 180; role: "version" ; title: "Version" } + TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" } + TableViewColumn{width: 100; role: "latency"; title: "Latency" } + TableViewColumn{width: 260; role: "version" ; title: "Version" } } } } -- cgit v1.2.3 From 3755616a2912f47a963d4ecc781bddd4229fe290 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Tue, 3 Jun 2014 14:30:26 +0200 Subject: Added namereg register option to qml wallet --- ethereal/assets/qml/wallet.qml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index b626bf044..fece8e7d6 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -254,13 +254,12 @@ ApplicationWindow { } } - property var addressModel: ListModel { id: addressModel } TableView { id: addressView - width: parent.width + width: parent.width - 200 height: 200 anchors.bottom: logView.top TableViewColumn{ role: "name"; title: "name" } @@ -269,6 +268,30 @@ ApplicationWindow { model: addressModel } + Rectangle { + anchors.top: addressView.top + anchors.left: addressView.right + anchors.leftMargin: 20 + + TextField { + placeholderText: "Name to register" + id: nameToReg + width: 150 + } + + Button { + anchors.top: nameToReg.bottom + text: "Register" + MouseArea{ + anchors.fill: parent + onClicked: { + eth.registerName(nameToReg.text) + nameToReg.text = "" + } + } + } + } + property var logModel: ListModel { id: logModel -- cgit v1.2.3 From 7843390ecd52df37a28282d76be198d5456ce385 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 4 Jun 2014 15:54:33 +0200 Subject: Implement getStateKeyVal for JS bindings. Gives JS the option to 'loop' over contract key/val storage --- ethereal/assets/ext/ethereum.js | 4 ++++ ethereal/assets/qml/webapp.qml | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/ext/ethereum.js b/ethereal/assets/ext/ethereum.js index d4eaf97fd..c58fe24c2 100644 --- a/ethereal/assets/ext/ethereum.js +++ b/ethereal/assets/ext/ethereum.js @@ -32,6 +32,10 @@ window.eth = { postData({call: "getStorage", args: [address, storageAddress]}, cb); }, + getStateKeyVals: function(address, cb){ + postData({call: "getStateKeyVals", args: [address]}, cb); + }, + getKey: function(cb) { postData({call: "getKey"}, cb); }, diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index d3cffeeca..ec236a18c 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -34,7 +34,6 @@ ApplicationWindow { top: parent.top } */ - onTitleChanged: { window.title = title } experimental.preferences.javascriptEnabled: true experimental.preferences.navigatorQtObjectEnabled: true @@ -97,6 +96,12 @@ ApplicationWindow { var storage = stateObject.getStorage(data.args[1]) postData(data._seed, storage) + break + case "getStateKeyVals": + require(1); + var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) + postData(data._seed,stateObject) + break case "getBalance": require(1); @@ -188,7 +193,7 @@ ApplicationWindow { WebView { id: inspector - visible: false + visible: true url: webview.experimental.remoteInspectorUrl anchors { left: root.left -- cgit v1.2.3 From ba3623d0cc0608f2d73e10e61a184238924fccdb Mon Sep 17 00:00:00 2001 From: obscuren <geffobscura@gmail.com> Date: Mon, 9 Jun 2014 22:04:16 +0200 Subject: Fixed debugger hang --- ethereal/assets/debugger/debugger.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/debugger/debugger.qml b/ethereal/assets/debugger/debugger.qml index ca67e857d..bc34233fd 100644 --- a/ethereal/assets/debugger/debugger.qml +++ b/ethereal/assets/debugger/debugger.qml @@ -163,7 +163,7 @@ ApplicationWindow { height: parent.height width: parent.width TableViewColumn{ id: key ; role: "key" ; title: "#" ; width: storageTableView.width / 2} - TableViewColumn{ role: "value" ; title: "value" ; width: storageTableView.width / 2} + TableViewColumn{ role: "value" ; title: "Storage" ; width: storageTableView.width / 2} model: storageModel } } -- cgit v1.2.3 From 0ee258bb75a4b6649f67499884871d4ca774cd1f Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 11 Jun 2014 10:27:58 +0200 Subject: Add GasLimit to the block explorer --- ethereal/assets/qml/wallet.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index fece8e7d6..70e877be6 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -419,6 +419,7 @@ ApplicationWindow { Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} Text { text: '<b>Coinbase:</b> ' + coinbase; color: "#F2F2F2"} Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} + Text { text: '<b>Gas Limit:</b> ' + gasLimit; color: "#F2F2F2"} } } } @@ -642,9 +643,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) }else{ - blockModel.insert(0, {number: block.number, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } -- cgit v1.2.3 From 57e3b1b093a2533e26198e9198b85556bf362b27 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 11 Jun 2014 11:40:13 +0200 Subject: Implemented usedGas to the explorer --- ethereal/assets/qml/wallet.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 70e877be6..0555cd2f2 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -419,7 +419,7 @@ ApplicationWindow { Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} Text { text: '<b>Coinbase:</b> ' + coinbase; color: "#F2F2F2"} Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} - Text { text: '<b>Gas Limit:</b> ' + gasLimit; color: "#F2F2F2"} + Text { text: '<b>Gas used:</b> ' + gasUsed + " / " + gasLimit; color: "#F2F2F2"} } } } @@ -643,9 +643,9 @@ ApplicationWindow { } if(initial){ - blockModel.append({number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.append({number: block.number, 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, {number: block.number, gasLimit: block.gasLimit, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) + blockModel.insert(0, {number: block.number, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } } -- cgit v1.2.3 From 1d300bbc108f9d404d2eb5cbc8990042c0129f04 Mon Sep 17 00:00:00 2001 From: Maran <maran.hidskes@gmail.com> Date: Wed, 11 Jun 2014 15:55:47 +0200 Subject: Toggle inspector / reload using magic rectangle --- ethereal/assets/qml/webapp.qml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'ethereal/assets') diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index ec236a18c..4a5a1293a 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -170,6 +170,30 @@ ApplicationWindow { postEvent(ev, [storageObject.address, storageObject.value]) } } + Rectangle { + id: toggleInspector + color: "#bcbcbc" + visible: true + height: 12 + width: 12 + anchors { + right: root.right + } + MouseArea { + onClicked: { + if(inspector.visible == true){ + inspector.visible = false + }else{ + inspector.visible = true + } + } + onDoubleClicked: { + console.log('refreshing') + webView.reload() + } + anchors.fill: parent + } + } Rectangle { id: sizeGrip @@ -193,7 +217,7 @@ ApplicationWindow { WebView { id: inspector - visible: true + visible: false url: webview.experimental.remoteInspectorUrl anchors { left: root.left -- cgit v1.2.3