diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-14 06:18:37 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-14 06:18:37 +0800 |
commit | 95ba340d07a02da40000d4bcf2b1bb24bd7856ef (patch) | |
tree | 79a067c70f5a1624c87b17c8efed02d160a0b0b8 /ethereal/assets/qml | |
parent | d518423b9c493bf5b42e6575db9a32106812e6bc (diff) | |
download | dexon-95ba340d07a02da40000d4bcf2b1bb24bd7856ef.tar.gz dexon-95ba340d07a02da40000d4bcf2b1bb24bd7856ef.tar.zst dexon-95ba340d07a02da40000d4bcf2b1bb24bd7856ef.zip |
Tweaks and fixes + added webview debugger
* Require better icons .. someone? :-)
Diffstat (limited to 'ethereal/assets/qml')
-rw-r--r-- | ethereal/assets/qml/views/history.qml | 2 | ||||
-rw-r--r-- | ethereal/assets/qml/views/info.qml | 27 | ||||
-rw-r--r-- | ethereal/assets/qml/views/javascript.qml | 45 | ||||
-rw-r--r-- | ethereal/assets/qml/views/pending_tx.qml | 2 | ||||
-rw-r--r-- | ethereal/assets/qml/wallet.qml | 9 | ||||
-rw-r--r-- | ethereal/assets/qml/webapp.qml | 209 |
6 files changed, 169 insertions, 125 deletions
diff --git a/ethereal/assets/qml/views/history.qml b/ethereal/assets/qml/views/history.qml index f50ae8004..a73b7367d 100644 --- a/ethereal/assets/qml/views/history.qml +++ b/ethereal/assets/qml/views/history.qml @@ -29,7 +29,7 @@ Rectangle { model: txModel } - function addTx(type, tx, inout) { + function addTx(tx, inout) { var isContract if (tx.contract == true){ isContract = "Yes" diff --git a/ethereal/assets/qml/views/info.qml b/ethereal/assets/qml/views/info.qml index 9e05e2f8e..fcddd46e2 100644 --- a/ethereal/assets/qml/views/info.qml +++ b/ethereal/assets/qml/views/info.qml @@ -17,6 +17,7 @@ Rectangle { color: "#00000000" Column { + id: info spacing: 3 anchors.fill: parent anchors.topMargin: 5 @@ -49,7 +50,7 @@ Rectangle { } TableView { id: addressView - width: parent.width - 200 + width: parent.width height: 200 anchors.bottom: logLayout.top TableViewColumn{ role: "name"; title: "name" } @@ -58,30 +59,6 @@ Rectangle { 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: { - gui.registerName(nameToReg.text) - nameToReg.text = "" - } - } - } - } - property var logModel: ListModel { id: logModel } diff --git a/ethereal/assets/qml/views/javascript.qml b/ethereal/assets/qml/views/javascript.qml new file mode 100644 index 000000000..376397130 --- /dev/null +++ b/ethereal/assets/qml/views/javascript.qml @@ -0,0 +1,45 @@ +import QtQuick 2.0 +import QtQuick.Controls 1.0; +import QtQuick.Layouts 1.0; +import QtQuick.Dialogs 1.0; +import QtQuick.Window 2.1; +import QtQuick.Controls.Styles 1.1 +import Ethereum 1.0 + +Rectangle { + property var title: "JavaScript" + property var iconFile: "../tx.png" + + objectName: "javascriptView" + visible: false + anchors.fill: parent + + TextField { + id: input + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 20 + + Keys.onReturnPressed: { + var res = eth.evalJavascriptString(this.text); + this.text = ""; + + output.append(res) + } + } + + TextArea { + id: output + verticalAlignment: TextEdit.AlignBottom + text: "> JSRE Ready..." + anchors { + top: parent.top + left: parent.left + right: parent.right + bottom: input.top + } + } +} diff --git a/ethereal/assets/qml/views/pending_tx.qml b/ethereal/assets/qml/views/pending_tx.qml index 18572e3e2..5c5c496d6 100644 --- a/ethereal/assets/qml/views/pending_tx.qml +++ b/ethereal/assets/qml/views/pending_tx.qml @@ -30,7 +30,7 @@ Rectangle { model: pendingTxModel } - function addTx(type, tx, inout) { + function addTx(tx, inout) { var isContract if (tx.contract == true){ isContract = "Yes" diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 3fc9a024c..769edfc6a 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -24,6 +24,7 @@ ApplicationWindow { var chainView = addPlugin("./views/chain.qml", {title: "Block chain"}) var infoView = addPlugin("./views/info.qml", {title: "Info"}) var pendingTxView = addPlugin("./views/pending_tx.qml", {title: "Pending", canClose: true}) + var pendingTxView = addPlugin("./views/javascript.qml", {title: "JavaScript", canClose: true}) // Call the ready handler gui.done() @@ -259,8 +260,8 @@ ApplicationWindow { ********************/ Rectangle { id: menu - Layout.minimumWidth: 180 - Layout.maximumWidth: 180 + Layout.minimumWidth: 80 + Layout.maximumWidth: 80 anchors.top: parent.top color: "#252525" @@ -398,9 +399,9 @@ ApplicationWindow { function importApp(path) { var ext = path.split('.').pop() if(ext == "html" || ext == "htm") { - ui.openHtml(path) + eth.openHtml(path) }else if(ext == "qml"){ - ui.openQml(path) + eth.openQml(path) } } diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index a848adf45..ec2f01741 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -21,46 +21,62 @@ ApplicationWindow { id: root anchors.fill: parent state: "inspectorShown" - TextField { + + RowLayout { + id: navBar anchors { - top: parent.top left: parent.left right: parent.right } - id: uriNav - //text: webview.url - Keys.onReturnPressed: { - var uri = this.text; - if(!/.*\:\/\/.*/.test(uri)) { - uri = "http://" + uri; + Button { + id: back + iconSource: "../back.png" + onClicked: { + webview.goBack() + } + } + + TextField { + anchors { + top: parent.top + left: back.right + right: parent.right } + id: uriNav + + Keys.onReturnPressed: { + var uri = this.text; + if(!/.*\:\/\/.*/.test(uri)) { + uri = "http://" + uri; + } - var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ + var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/ - if(reg.test(uri)) { - this.text.replace(reg, function(match, pre, domain, path) { - uri = pre; + if(reg.test(uri)) { + this.text.replace(reg, function(match, pre, domain, path) { + uri = pre; - var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); - var ip = []; - for(var i = 0, l = lookup.length; i < l; i++) { - ip.push(lookup.charCodeAt(i)) - } + var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4)); + var ip = []; + for(var i = 0, l = lookup.length; i < l; i++) { + ip.push(lookup.charCodeAt(i)) + } - if(ip.length != 0) { - uri += lookup; - } else { - uri += domain; - } + if(ip.length != 0) { + uri += lookup; + } else { + uri += domain; + } - uri += path; - }); - } + uri += path; + }); + } - console.log("connecting to ...", uri) + console.log("connecting to ...", uri) - webview.url = uri; + webview.url = uri; + } } } @@ -71,7 +87,7 @@ ApplicationWindow { left: parent.left right: parent.right bottom: parent.bottom - top: uriNav.bottom + top: navBar.bottom } onTitleChanged: { window.title = title } experimental.preferences.javascriptEnabled: true @@ -86,103 +102,107 @@ ApplicationWindow { try { switch(data.call) { case "getCoinBase": - postData(data._seed, eth.getCoinBase()) + postData(data._seed, eth.getCoinBase()) + + break - break case "getIsListening": - postData(data._seed, eth.getIsListening()) + postData(data._seed, eth.getIsListening()) + + break - break case "getIsMining": - postData(data._seed, eth.getIsMining()) + postData(data._seed, eth.getIsMining()) + + break - break case "getPeerCount": - postData(data._seed, eth.getPeerCount()) + postData(data._seed, eth.getPeerCount()) - break + break case "getTxCountAt": - require(1) - postData(data._seed, eth.getTxCountAt(data.args[0])) + require(1) + postData(data._seed, eth.getTxCountAt(data.args[0])) + + break - break case "getBlockByNumber": - var block = eth.getBlock(data.args[0]) - postData(data._seed, block) + var block = eth.getBlock(data.args[0]) + postData(data._seed, block) + + break - break case "getBlockByHash": - var block = eth.getBlock(data.args[0]) - postData(data._seed, block) + var block = eth.getBlock(data.args[0]) + postData(data._seed, block) + + break - break case "transact": - require(5) + require(5) - var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5]) - postData(data._seed, tx) + var tx = eth.transact(data.args[0], data.args[1], data.args[2],data.args[3],data.args[4],data.args[5]) + postData(data._seed, tx) - break - case "create": - postData(data._seed, null) + break - break case "getStorage": - require(2); + require(2); - var stateObject = eth.getStateObject(data.args[0]) - var storage = stateObject.getStorage(data.args[1]) - postData(data._seed, storage) + var stateObject = eth.getStateObject(data.args[0]) + var storage = stateObject.getStorage(data.args[1]) + postData(data._seed, storage) + + break - break case "getStateKeyVals": - require(1); - var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) - postData(data._seed,stateObject) + require(1); + var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true) + postData(data._seed,stateObject) + + break - break case "getTransactionsFor": - require(1); - var txs = eth.getTransactionsFor(data.args[0], true) - postData(data._seed, txs) + require(1); + var txs = eth.getTransactionsFor(data.args[0], true) + postData(data._seed, txs) + + break - break case "getBalance": - require(1); + require(1); + + postData(data._seed, eth.getStateObject(data.args[0]).value()); - postData(data._seed, eth.getStateObject(data.args[0]).value()); + break - break case "getKey": - var key = eth.getKey().privateKey; + var key = eth.getKey().privateKey; + + postData(data._seed, key) + break - postData(data._seed, key) - break case "watch": - require(1) - eth.watch(data.args[0], data.args[1]); - break + require(1) + eth.watch(data.args[0], data.args[1]); + + break + case "disconnect": - require(1) - postData(data._seed, null) - break; - case "set": - console.log("'Set' has been depcrecated") - /* - for(var key in data.args) { - if(webview.hasOwnProperty(key)) { - window[key] = data.args[key]; - } - } - */ - break; + require(1) + postData(data._seed, null) + + break; + case "getSecretToAddress": - require(1) - postData(data._seed, eth.secretToAddress(data.args[0])) - break; + require(1) + postData(data._seed, eth.secretToAddress(data.args[0])) + + break; + case "debug": - console.log(data.args[0]); + console.log(data.args[0]); break; } } catch(e) { @@ -215,12 +235,13 @@ ApplicationWindow { postEvent(ev, [storageObject.address, storageObject.value]) } } + Rectangle { id: toggleInspector color: "#bcbcbc" visible: true - height: 12 - width: 12 + height: 20 + width: 20 anchors { right: root.right } @@ -233,8 +254,8 @@ ApplicationWindow { inspector.url = webview.experimental.remoteInspectorUrl } } + onDoubleClicked: { - console.log('refreshing') webView.reload() } anchors.fill: parent |