diff options
author | obscuren <geffobscura@gmail.com> | 2014-08-17 18:41:23 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-08-17 18:41:23 +0800 |
commit | 27735bbdfc4e32e2e5ca11f48591d62b766aa3f5 (patch) | |
tree | ceb02da5048d2f592944ff7bc41186fc81f8e76b /ethereal/assets/qml | |
parent | 2eab964a00b998068f49b088949730f4896e256c (diff) | |
download | dexon-27735bbdfc4e32e2e5ca11f48591d62b766aa3f5.tar.gz dexon-27735bbdfc4e32e2e5ca11f48591d62b766aa3f5.tar.zst dexon-27735bbdfc4e32e2e5ca11f48591d62b766aa3f5.zip |
State dumps from gui
Diffstat (limited to 'ethereal/assets/qml')
-rw-r--r-- | ethereal/assets/qml/views/chain.qml | 54 | ||||
-rw-r--r-- | ethereal/assets/qml/wallet.qml | 46 | ||||
-rw-r--r-- | ethereal/assets/qml/webapp.qml | 18 |
3 files changed, 95 insertions, 23 deletions
diff --git a/ethereal/assets/qml/views/chain.qml b/ethereal/assets/qml/views/chain.qml index 2b968d56c..0f5604a9f 100644 --- a/ethereal/assets/qml/views/chain.qml +++ b/ethereal/assets/qml/views/chain.qml @@ -25,9 +25,57 @@ Rectangle { model: blockModel - onDoubleClicked: { - popup.visible = true - popup.setDetails(blockModel.get(row)) + itemDelegate: Item { + Text { + anchors { + left: parent.left + right: parent.right + leftMargin: 10 + verticalCenter: parent.verticalCenter + } + color: styleData.textColor + elide: styleData.elideMode + text: styleData.value + font.pixelSize: 11 + MouseArea { + acceptedButtons: Qt.RightButton + propagateComposedEvents: true + anchors.fill: parent + onClicked: { + blockTable.selection.clear() + blockTable.selection.select(styleData.row) + + contextMenu.row = styleData.row; + contextMenu.popup() + } + } + } + + } + + Menu { + id: contextMenu + property var row; + MenuItem { + text: "Details" + onTriggered: { + popup.visible = true + popup.setDetails(blockModel.get(this.row)) + } + } + + MenuSeparator{} + + MenuItem { + text: "Dump State" + onTriggered: { + generalFileDialog.show(false, function(path) { + var hash = blockModel.get(this.row).hash; + + gui.dumpState(hash, path); + }); + } + } } } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index b35500209..30e1071f7 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -49,8 +49,7 @@ ApplicationWindow { text: "Import App" shortcut: "Ctrl+o" onTriggered: { - generalFileDialog.callback = importApp; - generalFileDialog.open() + generalFileDialog.show(true, importApp) } } @@ -62,10 +61,9 @@ ApplicationWindow { MenuItem { text: "Add plugin" onTriggered: { - generalFileDialog.callback = function(path) { + generalFileDialog.show(true, function(path) { addPlugin(path, {canClose: true}) - } - generalFileDialog.open() + }) } } @@ -75,10 +73,9 @@ ApplicationWindow { text: "Import key" shortcut: "Ctrl+i" onTriggered: { - generalFileDialog.callback = function(path) { - ui.importKey(path) - } - generalFileDialog.open() + generalFileDialog.show(true, function(path) { + gui.importKey(path) + }) } } @@ -86,9 +83,8 @@ ApplicationWindow { text: "Export keys" shortcut: "Ctrl+e" onTriggered: { - generalFileDialog.callback = function(path) { - } - generalFileDialog.open() + generalFileDialog.show(false, function(path) { + }) } } } @@ -111,10 +107,19 @@ ApplicationWindow { MenuItem { text: "Run JS file" onTriggered: { - generalFileDialog.callback = function(path) { + generalFileDialog.show(true, function(path) { eth.evalJavascriptFile(path) - } - generalFileDialog.open() + }) + } + } + + MenuItem { + text: "Dump state" + onTriggered: { + generalFileDialog.show(false, function(path) { + // Empty hash for latest + gui.dumpState("", path) + }) } } } @@ -396,8 +401,15 @@ ApplicationWindow { id: generalFileDialog property var callback; onAccepted: { - var path = this.fileUrl.toString() - callback.call(this, path) + var path = this.fileUrl.toString(); + callback.call(this, path); + } + + function show(selectExisting, callback) { + generalFileDialog.callback = callback; + generalFileDialog.selectExisting = selectExisting; + + this.open(); } } diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index e6d0f5c14..22e404cc8 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -78,6 +78,7 @@ ApplicationWindow { } } + WebView { objectName: "webView" id: webview @@ -127,6 +128,8 @@ ApplicationWindow { this.cleanPath = false; } } + + experimental.preferences.javascriptEnabled: true experimental.preferences.navigatorQtObjectEnabled: true experimental.preferences.developerExtrasEnabled: true @@ -251,9 +254,13 @@ ApplicationWindow { break - case "debug": - console.log(data.args[0]); - break; + case "mutan": + require(1) + + var code = eth.compileMutan(data.args[0]) + postData(data._seed, "0x"+code) + + break; } } catch(e) { console.log(data.call + ": " + e) @@ -262,6 +269,11 @@ ApplicationWindow { } } + function post(seed, data) { + console.log("data", data) + postData(data._seed, data) + } + function require(args, num) { if(args.length < num) { throw("required argument count of "+num+" got "+args.length); |