Commit 540d3922 authored by obscuren's avatar obscuren

Merge branch 'master' into develop

parents 09728bf4 198ef971
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
}
}
}
}
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"
}
}
}
}
...@@ -8,686 +8,980 @@ import Ethereum 1.0 ...@@ -8,686 +8,980 @@ import Ethereum 1.0
ApplicationWindow { ApplicationWindow {
id: root id: root
width: 900 width: 900
height: 600 height: 600
minimumHeight: 300 minimumHeight: 300
title: "Ethereal" title: "Ethereal"
MenuBar { MenuBar {
Menu { Menu {
title: "File" title: "File"
MenuItem { MenuItem {
text: "Import App" text: "Import App"
shortcut: "Ctrl+o" shortcut: "Ctrl+o"
onTriggered: openAppDialog.open() onTriggered: openAppDialog.open()
} }
} }
Menu { Menu {
title: "Tools" title: "Tools"
MenuItem { MenuItem {
text: "Muted" text: "Muted"
shortcut: "Ctrl+e" shortcut: "Ctrl+e"
onTriggered: ui.muted("") onTriggered: ui.muted("")
} }
MenuItem { MenuItem {
text: "Debugger" text: "Debugger"
shortcut: "Ctrl+d" shortcut: "Ctrl+d"
onTriggered: ui.startDebugger() onTriggered: ui.startDebugger()
} }
} }
Menu { Menu {
title: "Network" title: "Network"
MenuItem { MenuItem {
text: "Add Peer" text: "Add Peer"
shortcut: "Ctrl+p" shortcut: "Ctrl+p"
onTriggered: { onTriggered: {
addPeerWin.visible = true addPeerWin.visible = true
} }
} }
MenuItem { MenuItem {
text: "Start" text: "Start"
onTriggered: ui.connect() onTriggered: ui.connect()
} }
} }
Menu { Menu {
title: "Help" title: "Help"
MenuItem { MenuItem {
text: "About" text: "About"
onTriggered: { onTriggered: {
aboutWin.visible = true aboutWin.visible = true
} }
} }
} }
} }
property var blockModel: ListModel { property var blockModel: ListModel {
id: blockModel id: blockModel
} }
function setView(view) { function setView(view) {
networkView.visible = false networkView.visible = false
historyView.visible = false historyView.visible = false
newTxView.visible = false newTxView.visible = false
infoView.visible = false infoView.visible = false
view.visible = true view.visible = true
//root.title = "Ethereal - " = view.title //root.title = "Ethereal - " = view.title
} }
SplitView { SplitView {
anchors.fill: parent anchors.fill: parent
resizing: false resizing: false
Rectangle { Rectangle {
id: menu id: menu
Layout.minimumWidth: 80 Layout.minimumWidth: 80
Layout.maximumWidth: 80 Layout.maximumWidth: 80
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.top: parent.top anchors.top: parent.top
//color: "#D9DDE7" //color: "#D9DDE7"
color: "#252525" color: "#252525"
ColumnLayout { ColumnLayout {
y: 50 y: 50
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 200 height: 200
Image { Image {
source: ui.assetPath("tx.png") source: ui.assetPath("tx.png")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
setView(historyView) setView(historyView)
} }
} }
} }
Image { Image {
source: ui.assetPath("new.png") source: ui.assetPath("new.png")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
setView(newTxView) setView(newTxView)
} }
} }
} }
Image { Image {
source: ui.assetPath("net.png") source: ui.assetPath("net.png")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
setView(networkView) setView(networkView)
} }
} }
} }
Image { Image {
source: ui.assetPath("heart.png") source: ui.assetPath("heart.png")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
setView(infoView) setView(infoView)
} }
} }
} }
} }
} }
Rectangle { Rectangle {
id: mainView id: mainView
color: "#00000000" color: "#00000000"
anchors.right: parent.right anchors.right: parent.right
anchors.left: menu.right anchors.left: menu.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.top: parent.top anchors.top: parent.top
property var txModel: ListModel { property var txModel: ListModel {
id: txModel id: txModel
} }
Rectangle { Rectangle {
id: historyView id: historyView
anchors.fill: parent anchors.fill: parent
property var title: "Transactions" property var title: "Transactions"
TableView { TableView {
id: txTableView id: txTableView
anchors.fill: parent anchors.fill: parent
TableViewColumn{ role: "inout" ; title: "" ; width: 40 } TableViewColumn{ role: "inout" ; title: "" ; width: 40 }
TableViewColumn{ role: "value" ; title: "Value" ; width: 100 } TableViewColumn{ role: "value" ; title: "Value" ; width: 100 }
TableViewColumn{ role: "address" ; title: "Address" ; width: 430 } TableViewColumn{ role: "address" ; title: "Address" ; width: 430 }
TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 } TableViewColumn{ role: "contract" ; title: "Contract" ; width: 100 }
model: txModel model: txModel
} }
} }
Rectangle { Rectangle {
id: newTxView id: newTxView
property var title: "New transaction" property var title: "New transaction"
visible: false visible: false
anchors.fill: parent anchors.fill: parent
color: "#00000000" color: "#00000000"
TabView{ TabView{
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.leftMargin: 5 anchors.leftMargin: 5
anchors.topMargin: 5 anchors.topMargin: 5
anchors.bottomMargin: 5 anchors.bottomMargin: 5
id: newTransactionTab id: newTransactionTab
Component.onCompleted:{ Component.onCompleted:{
var component = Qt.createComponent("newTransaction/_simple_send.qml") addTab("Simple send", newTransaction)
var newTransaction = component.createObject("newTransaction") addTab("Contracts", newContract)
}
component = Qt.createComponent("newTransaction/_new_contract.qml") }
var newContract = component.createObject("newContract") }
addTab("Simple send", newTransaction) Rectangle {
addTab("Contracts", newContract) id: networkView
} property var title: "Network"
} visible: false
} anchors.fill: parent
Rectangle { TableView {
id: networkView id: blockTable
property var title: "Network" width: parent.width
visible: false anchors.top: parent.top
anchors.fill: parent anchors.bottom: logView.top
TableViewColumn{ role: "number" ; title: "#" ; width: 100 }
TableView { TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 }
id: blockTable TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 }
width: parent.width
anchors.top: parent.top model: blockModel
anchors.bottom: logView.top
TableViewColumn{ role: "number" ; title: "#" ; width: 100 } onDoubleClicked: {
TableViewColumn{ role: "hash" ; title: "Hash" ; width: 560 } popup.visible = true
TableViewColumn{ role: "txAmount" ; title: "Tx amount" ; width: 100 } popup.setDetails(blockModel.get(row))
}
model: blockModel }
onDoubleClicked: { property var logModel: ListModel {
popup.visible = true id: logModel
popup.setDetails(blockModel.get(row)) }
}
} TableView {
id: logView
property var logModel: ListModel { width: parent.width
id: logModel height: 150
} anchors.bottom: parent.bottom
TableViewColumn{ role: "description" ; title: "log" }
TableView {
id: logView model: logModel
width: parent.width }
height: 150 }
anchors.bottom: parent.bottom
TableViewColumn{ role: "description" ; title: "log" } Rectangle {
id: infoView
model: logModel property var title: "Information"
} visible: false
} color: "#00000000"
anchors.fill: parent
Rectangle {
id: infoView Label {
property var title: "Information" id: addressLabel
visible: false text: "Address"
color: "#00000000" anchors {
anchors.fill: parent margins: 5
top: parent.top
Label { left: parent.left
id: addressLabel }
text: "Address" }
anchors { TextField {
margins: 5 anchors {
top: parent.top margins: 5
left: parent.left left: addressLabel.right
} top: parent.top
} }
TextField { text: pub.getKey().address
anchors { width: 500
margins: 5 }
left: addressLabel.right }
top: parent.top
} /*
text: pub.getKey().address signal addPlugin(string name)
width: 500 Component {
} id: pluginWindow
} Rectangle {
anchors.fill: parent
/* Label {
signal addPlugin(string name) id: pluginTitle
Component { anchors.centerIn: parent
id: pluginWindow text: "Hello world"
Rectangle { }
anchors.fill: parent Component.onCompleted: setView(this)
Label { }
id: pluginTitle }
anchors.centerIn: parent
text: "Hello world" onAddPlugin: {
} var pluginWin = pluginWindow.createObject(mainView)
Component.onCompleted: setView(this) console.log(pluginWin)
} pluginWin.pluginTitle.text = "Test"
} }
*/
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")))
FileDialog { ui.openHtml(openAppDialog.fileUrl.toString())
id: openAppDialog }
title: "Open QML Application" }
onAccepted: {
//ui.open(openAppDialog.fileUrl.toString()) statusBar: StatusBar {
//ui.openHtml(Qt.resolvedUrl(ui.assetPath("test.html"))) RowLayout {
ui.openHtml(openAppDialog.fileUrl.toString()) anchors.fill: parent
}
} Button {
property var enabled: true
statusBar: StatusBar { id: debuggerWindow
RowLayout { onClicked: {
anchors.fill: parent ui.startDebugger()
}
Button { text: "Debugger"
property var enabled: true }
id: debuggerWindow
onClicked: { Button {
ui.startDebugger() id: importAppButton
} anchors.left: debuggerWindow.right
text: "Debugger" anchors.leftMargin: 5
} onClicked: openAppDialog.open()
text: "Import App"
Button { }
id: importAppButton
anchors.left: debuggerWindow.right Label {
anchors.leftMargin: 5 anchors.left: importAppButton.right
onClicked: openAppDialog.open() anchors.leftMargin: 5
text: "Import App" id: walletValueLabel
} }
Label { Label {
anchors.left: importAppButton.right anchors.right: peerImage.left
anchors.leftMargin: 5 anchors.rightMargin: 5
id: walletValueLabel id: peerLabel
} font.pixelSize: 8
text: "0 / 0"
Label { }
anchors.right: peerImage.left Image {
anchors.rightMargin: 5 id: peerImage
id: peerLabel anchors.right: parent.right
font.pixelSize: 8 width: 10; height: 10
text: "0 / 0" source: ui.assetPath("network.png")
} }
Image { }
id: peerImage }
anchors.right: parent.right
width: 10; height: 10 Window {
source: ui.assetPath("network.png") id: popup
} visible: false
} property var block
} width: 800
height: 280
Window { x: root.x
id: popup y: root.y + root.height
visible: false Component{
property var block id: blockDetailsDelegate
width: 800 Rectangle {
height: 280 color: "#252525"
x: root.x width: popup.width
y: root.y + root.height height: 200
Component{ Column {
id: blockDetailsDelegate anchors.leftMargin: 10
Rectangle { anchors.topMargin: 5
color: "#252525" anchors.top: parent.top
width: popup.width anchors.left: parent.left
height: 200 Text { text: '<h3>Block details</h3>'; color: "#F2F2F2"}
Column { Text { text: '<b>Block number:</b> ' + number; color: "#F2F2F2"}
anchors.leftMargin: 10 Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"}
anchors.topMargin: 5 Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"}
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"} ListView {
Text { text: '<b>Hash:</b> ' + hash; color: "#F2F2F2"} model: singleBlock
Text { text: '<b>Block found at:</b> ' + prettyTime; color: "#F2F2F2"} delegate: blockDetailsDelegate
} anchors.top: parent.top
} height: 70
} anchors.leftMargin: 20
ListView { id: listViewThing
model: singleBlock Layout.maximumHeight: 40
delegate: blockDetailsDelegate }
anchors.top: parent.top TableView {
height: 70 id: txView
anchors.leftMargin: 20 anchors.top: listViewThing.bottom
id: listViewThing anchors.topMargin: 50
Layout.maximumHeight: 40 width: parent.width
}
TableView { TableViewColumn{width: 90; role: "value" ; title: "Value" }
id: txView TableViewColumn{width: 200; role: "hash" ; title: "Hash" }
anchors.top: listViewThing.bottom TableViewColumn{width: 200; role: "sender" ; title: "Sender" }
anchors.topMargin: 50 TableViewColumn{width: 200;role: "address" ; title: "Receiver" }
width: parent.width TableViewColumn{width: 60; role: "gas" ; title: "Gas" }
TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" }
TableViewColumn{width: 90; role: "value" ; title: "Value" } TableViewColumn{width: 60; role: "isContract" ; title: "Contract" }
TableViewColumn{width: 200; role: "hash" ; title: "Hash" }
TableViewColumn{width: 200; role: "sender" ; title: "Sender" } model: transactionModel
TableViewColumn{width: 200;role: "address" ; title: "Receiver" } onClicked: {
TableViewColumn{width: 60; role: "gas" ; title: "Gas" } var tx = transactionModel.get(row)
TableViewColumn{width: 60; role: "gasPrice" ; title: "Gas Price" } if(tx.data) {
TableViewColumn{width: 60; role: "isContract" ; title: "Contract" } popup.showContractData(tx.data)
}else{
model: transactionModel popup.height = 230
onClicked: { }
var tx = transactionModel.get(row) }
if(tx.data) { }
popup.showContractData(tx.data) function showContractData(data) {
}else{ contractData.text = data
popup.height = 230 popup.height = 400
} }
} Rectangle {
} width: popup.width
function showContractData(data) { height: 300
contractData.text = data anchors.left: listViewThing.left
popup.height = 400 anchors.top: txView.bottom
} Label {
Rectangle { text: "<h4>Contract data</h4>"
width: popup.width anchors.top: parent.top
height: 300 anchors.left: parent.left
anchors.left: listViewThing.left id: contractLabel
anchors.top: txView.bottom anchors.leftMargin: 10
Label { }
text: "<h4>Contract data</h4>" TextArea {
anchors.top: parent.top id: contractData
anchors.left: parent.left text: "Contract"
id: contractLabel anchors.top: contractLabel.bottom
anchors.leftMargin: 10 anchors.left: parent.left
} wrapMode: Text.Wrap
TextArea { width: parent.width - 30
id: contractData height: 80
text: "Contract" anchors.leftMargin: 10
anchors.top: contractLabel.bottom }
anchors.left: parent.left }
wrapMode: Text.Wrap property var transactionModel: ListModel {
width: parent.width - 30 id: transactionModel
height: 80 }
anchors.leftMargin: 10 property var singleBlock: ListModel {
} id: singleBlock
} }
property var transactionModel: ListModel { function setDetails(block){
id: transactionModel singleBlock.set(0,block)
} popup.height = 230
property var singleBlock: ListModel { transactionModel.clear()
id: singleBlock if(block.txs != undefined){
} for(var i = 0; i < block.txs.count; ++i) {
function setDetails(block){ transactionModel.insert(0, block.txs.get(i))
singleBlock.set(0,block) }
popup.height = 230 if(block.txs.get(0).data){
transactionModel.clear() popup.showContractData(block.txs.get(0).data)
if(block.txs != undefined){ }
for(var i = 0; i < block.txs.count; ++i) { }
transactionModel.insert(0, block.txs.get(i)) txView.forceActiveFocus()
} }
if(block.txs.get(0).data){ }
popup.showContractData(block.txs.get(0).data)
} Window {
} id: addPeerWin
txView.forceActiveFocus() visible: false
} minimumWidth: 230
} maximumWidth: 230
maximumHeight: 50
Window { minimumHeight: 50
id: addPeerWin
visible: false TextField {
minimumWidth: 230 id: addrField
maximumWidth: 230 anchors.verticalCenter: parent.verticalCenter
maximumHeight: 50 anchors.left: parent.left
minimumHeight: 50 anchors.leftMargin: 10
placeholderText: "address:port"
TextField { onAccepted: {
id: addrField ui.connectToPeer(addrField.text)
anchors.verticalCenter: parent.verticalCenter addPeerWin.visible = false
anchors.left: parent.left }
anchors.leftMargin: 10 }
placeholderText: "address:port" Button {
onAccepted: { anchors.left: addrField.right
ui.connectToPeer(addrField.text) anchors.verticalCenter: parent.verticalCenter
addPeerWin.visible = false anchors.leftMargin: 5
} text: "Add"
} onClicked: {
Button { ui.connectToPeer(addrField.text)
anchors.left: addrField.right addPeerWin.visible = false
anchors.verticalCenter: parent.verticalCenter }
anchors.leftMargin: 5 }
text: "Add" Component.onCompleted: {
onClicked: { addrField.focus = true
ui.connectToPeer(addrField.text) }
addPeerWin.visible = false }
}
} Window {
Component.onCompleted: { id: aboutWin
addrField.focus = true visible: false
} title: "About"
} minimumWidth: 350
maximumWidth: 350
Window { maximumHeight: 200
id: aboutWin minimumHeight: 200
visible: false
title: "About" Image {
minimumWidth: 350 id: aboutIcon
maximumWidth: 350 height: 150
maximumHeight: 200 width: 150
minimumHeight: 200 fillMode: Image.PreserveAspectFit
smooth: true
Image { source: ui.assetPath("facet.png")
id: aboutIcon x: 10
height: 150 y: 10
width: 150 }
fillMode: Image.PreserveAspectFit
smooth: true Text {
source: ui.assetPath("facet.png") anchors.left: aboutIcon.right
x: 10 anchors.leftMargin: 10
y: 10 font.pointSize: 12
} text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>"
}
Text {
anchors.left: aboutIcon.right }
anchors.leftMargin: 10
font.pointSize: 12 ApplicationWindow {
text: "<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>" id: debugWindow
} visible: false
title: "Debugger"
} minimumWidth: 600
minimumHeight: 600
ApplicationWindow { width: 800
id: debugWindow height: 600
visible: false
title: "Debugger"
minimumWidth: 600 Item {
minimumHeight: 600 id: keyHandler
width: 800 focus: true
height: 600 Keys.onPressed: {
if (event.key == Qt.Key_Space) {
ui.next()
Item { }
id: keyHandler }
focus: true }
Keys.onPressed: { SplitView {
if (event.key == Qt.Key_Space) { anchors.fill: parent
ui.next() property var asmModel: ListModel {
} id: asmModel
} }
} TableView {
SplitView { id: asmTableView
anchors.fill: parent width: 200
property var asmModel: ListModel { TableViewColumn{ role: "value" ; title: "" ; width: 100 }
id: asmModel model: asmModel
} }
TableView {
id: asmTableView Rectangle {
width: 200 anchors.left: asmTableView.right
TableViewColumn{ role: "value" ; title: "" ; width: 100 } anchors.right: parent.right
model: asmModel SplitView {
} orientation: Qt.Vertical
anchors.fill: parent
Rectangle {
anchors.left: asmTableView.right TableView {
anchors.right: parent.right property var memModel: ListModel {
SplitView { id: memModel
orientation: Qt.Vertical }
anchors.fill: parent height: parent.height/2
width: parent.width
TableView { TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50}
property var memModel: ListModel { TableViewColumn{ role: "value" ; title: "Memory" ; width: 750}
id: memModel model: memModel
} }
height: parent.height/2
width: parent.width SplitView {
TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} orientation: Qt.Horizontal
TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} id: debugSplitView
model: memModel TableView {
} property var debuggerLog: ListModel {
id: debuggerLog
SplitView { }
orientation: Qt.Horizontal TableViewColumn{ role: "value"; title: "Debug messages" }
id: debugSplitView model: debuggerLog
TableView { }
property var debuggerLog: ListModel { TableView {
id: debuggerLog property var stackModel: ListModel {
} id: stackModel
TableViewColumn{ role: "value"; title: "Debug messages" } }
model: debuggerLog height: parent.height/2
} width: parent.width
TableView { TableViewColumn{ role: "value" ; title: "Stack" ; width: debugSplitView.width }
property var stackModel: ListModel { model: stackModel
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
statusBar: StatusBar { onClicked: {
RowLayout { ui.next()
anchors.fill: parent }
Button { text: "Next"
property var enabled: true }
id: debugNextButton }
onClicked: { }
ui.next() }
}
text: "Next" function setAsm(asm) {
} asmModel.append({asm: asm})
} }
}
} function setInstruction(num) {
asmTableView.selection.clear()
function setAsm(asm) { asmTableView.selection.select(num-1)
asmModel.append({asm: asm}) }
}
function clearAsm() {
function setInstruction(num) { asmModel.clear()
asmTableView.selection.clear() }
asmTableView.selection.select(num-1)
} function setMem(mem) {
memModel.append({num: mem.num, value: mem.value})
function clearAsm() { }
asmModel.clear() function clearMem(){
} memModel.clear()
}
function setMem(mem) {
memModel.append({num: mem.num, value: mem.value}) function setStack(stack) {
} stackModel.append({value: stack})
function clearMem(){ }
memModel.clear() function addDebugMessage(message){
} console.log("WOOP:")
debuggerLog.append({value: message})
function setStack(stack) { }
stackModel.append({value: stack})
} function clearStack() {
function addDebugMessage(message){ stackModel.clear()
console.log("WOOP:") }
debuggerLog.append({value: message})
} function loadPlugin(name) {
console.log("Loading plugin" + name)
function clearStack() { mainView.addPlugin(name)
stackModel.clear() }
}
function setWalletValue(value) {
function loadPlugin(name) { walletValueLabel.text = value
console.log("Loading plugin" + name) }
mainView.addPlugin(name)
} function addTx(tx, inout) {
var isContract
function setWalletValue(value) { if (tx.contract == true){
walletValueLabel.text = value isContract = "Yes"
} }else{
isContract = "No"
function addTx(tx, inout) { }
var isContract txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract})
if (tx.contract == true){ }
isContract = "Yes"
}else{ function addBlock(block, initial) {
isContract = "No" var txs = JSON.parse(block.transactions);
} var amount = 0
txModel.insert(0, {inout: inout, hash: tx.hash, address: tx.address, value: tx.value, contract: isContract}) if(initial == undefined){
} initial = false
}
function addBlock(block, initial) {
var txs = JSON.parse(block.transactions); if(txs != null){
var amount = 0 amount = txs.length
if(initial == undefined){ }
initial = false
} if(initial){
blockModel.append({number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
if(txs != null){ }else{
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)}) function addLog(str) {
}else{ if(str.len != 0) {
blockModel.insert(0, {number: block.number, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) logModel.append({description: str})
} }
} }
function addLog(str) { function setPeers(text) {
if(str.len != 0) { peerLabel.text = text
logModel.append({description: str}) }
} function convertToPretty(unixTs){
} var a = new Date(unixTs*1000);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
function setPeers(text) { var year = a.getFullYear();
peerLabel.text = text var month = months[a.getMonth()];
} var date = a.getDate();
function convertToPretty(unixTs){ var hour = a.getHours();
var a = new Date(unixTs*1000); var min = a.getMinutes();
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; var sec = a.getSeconds();
var year = a.getFullYear(); var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ;
var month = months[a.getMonth()]; return time;
var date = a.getDate(); }
var hour = a.getHours(); // *******************************************
var min = a.getMinutes(); // Components
var sec = a.getSeconds(); // *******************************************
var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ;
return time; // 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"
}
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment