aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-18 07:35:42 +0800
committerobscuren <geffobscura@gmail.com>2014-08-18 07:35:42 +0800
commita8409b0a8bfa7f8434ede495094fd8d892c28c91 (patch)
treef9ed41441280ad919da8be7d82a522209c30995b /ethereal
parent5ae3deea86a4916eee07b30195da280957e2fd2f (diff)
downloaddexon-a8409b0a8bfa7f8434ede495094fd8d892c28c91.tar.gz
dexon-a8409b0a8bfa7f8434ede495094fd8d892c28c91.tar.zst
dexon-a8409b0a8bfa7f8434ede495094fd8d892c28c91.zip
Implementing new wallet views
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/assets/qml/views/history.qml7
-rw-r--r--ethereal/assets/qml/views/info.qml2
-rw-r--r--ethereal/assets/qml/views/wallet.qml63
-rw-r--r--ethereal/assets/qml/wallet.qml78
-rw-r--r--ethereal/assets/qml/webapp.qml26
-rw-r--r--ethereal/assets/wallet.pngbin0 -> 1114 bytes
-rw-r--r--ethereal/gui.go3
7 files changed, 144 insertions, 35 deletions
diff --git a/ethereal/assets/qml/views/history.qml b/ethereal/assets/qml/views/history.qml
index 94ea29e61..d8c932f8f 100644
--- a/ethereal/assets/qml/views/history.qml
+++ b/ethereal/assets/qml/views/history.qml
@@ -11,14 +11,15 @@ Rectangle {
property var title: "Transactions"
property var menuItem
- property var txModel: ListModel {
- id: txModel
- }
id: historyView
+ visible: false
anchors.fill: parent
objectName: "transactionView"
+ property var txModel: ListModel {
+ id: txModel
+ }
TableView {
id: txTableView
anchors.fill: parent
diff --git a/ethereal/assets/qml/views/info.qml b/ethereal/assets/qml/views/info.qml
index c12977cbe..c4486aa6c 100644
--- a/ethereal/assets/qml/views/info.qml
+++ b/ethereal/assets/qml/views/info.qml
@@ -29,7 +29,7 @@ Rectangle {
text: "Address"
}
TextField {
- text: eth.getKey().address
+ text: eth.key().address
width: 500
}
diff --git a/ethereal/assets/qml/views/wallet.qml b/ethereal/assets/qml/views/wallet.qml
new file mode 100644
index 000000000..22b09640b
--- /dev/null
+++ b/ethereal/assets/qml/views/wallet.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.0
+import QtQuick.Controls 1.0;
+import QtQuick.Layouts 1.0;
+import QtQuick.Dialogs 1.0;
+import QtQuick.Window 2.1;
+import QtQuick.Controls.Styles 1.1
+import Ethereum 1.0
+
+Rectangle {
+ id: root
+ property var title: "Wallet"
+ property var iconFile: "../wallet.png"
+ property var menuItem
+
+ objectName: "walletView"
+ anchors.fill: parent
+
+ function onReady() {
+ menuItem.secondary = eth.numberToHuman(eth.balanceAt(eth.key().address))
+
+ }
+
+ ColumnLayout {
+ spacing: 10
+ y: 40
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Text {
+ text: "<b>Balance</b>: " + eth.numberToHuman(eth.balanceAt(eth.key().address))
+ font.pixelSize: 24
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ TableView {
+ id: txTableView
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+ TableViewColumn{ role: "num" ; title: "#" ; width: 30 }
+ TableViewColumn{ role: "from" ; title: "From" ; width: 280 }
+ TableViewColumn{ role: "to" ; title: "To" ; width: 280 }
+ TableViewColumn{ role: "value" ; title: "Amount" ; width: 100 }
+
+ model: ListModel {
+ id: txModel
+ Component.onCompleted: {
+ var messages = JSON.parse(eth.messages({latest: -1, from: "e6716f9544a56c530d868e4bfbacb172315bdead"}))
+ for(var i = 0; i < messages.length; i++) {
+ var message = messages[i];
+ this.insert(0, {num: i, from: message.from, to: message.to, value: eth.numberToHuman(message.value)})
+ }
+ }
+ }
+ }
+
+ }
+}
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index d1039518b..89126f600 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -6,6 +6,7 @@ import QtQuick.Window 2.1;
import QtQuick.Controls.Styles 1.1
import Ethereum 1.0
+
ApplicationWindow {
id: root
@@ -30,12 +31,14 @@ ApplicationWindow {
// Takes care of loading all default plugins
Component.onCompleted: {
- var historyView = addPlugin("./views/history.qml", {default: true})
- var newTxView = addPlugin("./views/transaction.qml", {default: true})
- var chainView = addPlugin("./views/chain.qml", {default: true})
- var infoView = addPlugin("./views/info.qml", {default: true})
- var pendingTxView = addPlugin("./views/pending_tx.qml", {default: true})
- var pendingTxView = addPlugin("./views/javascript.qml", {default: true})
+ var walletView = addPlugin("./views/wallet.qml", {section: "ethereum"})
+
+ var historyView = addPlugin("./views/history.qml", {section: "legacy"})
+ var newTxView = addPlugin("./views/transaction.qml", {section: "legacy"})
+ var chainView = addPlugin("./views/chain.qml", {section: "legacy"})
+ var infoView = addPlugin("./views/info.qml", {section: "legacy"})
+ var pendingTxView = addPlugin("./views/pending_tx.qml", {section: "legacy"})
+ var pendingTxView = addPlugin("./views/javascript.qml", {section: "legacy"})
// Call the ready handler
gui.done()
@@ -252,10 +255,10 @@ ApplicationWindow {
function setView(view, menu) {
for(var i = 0; i < views.length; i++) {
- views[i][0].visible = false
+ views[i].view.visible = false
- views[i][1].border.color = "#00000000"
- views[i][1].color = "#00000000"
+ views[i].menuItem.border.color = "#00000000"
+ views[i].menuItem.color = "#00000000"
}
view.visible = true
@@ -265,14 +268,21 @@ ApplicationWindow {
function addComponent(component, options) {
var view = mainView.createView(component, options)
+
if(!view.hasOwnProperty("iconFile")) {
console.log("Could not load plugin. Property 'iconFile' not found on view.");
return;
}
var menuItem = menu.createMenuItem(view.iconFile, view, options);
+ if(view.hasOwnProperty("menuItem")) {
+ view.menuItem = menuItem;
+ }
+ mainSplit.views.push({view: view, menuItem: menuItem});
- mainSplit.views.push([view, menuItem]);
+ if(view.hasOwnProperty("onReady")) {
+ view.onReady.call(view)
+ }
return view
}
@@ -294,6 +304,7 @@ ApplicationWindow {
property var view;
property alias title: label.text
+ property alias icon: icon.source
property alias secondary: secondary.text
width: 180
@@ -310,11 +321,13 @@ ApplicationWindow {
Image {
id: icon
+ height: 20
+ width: 20
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
+ leftMargin: 3
}
- source: "../pick.png"
}
Text {
@@ -322,10 +335,10 @@ ApplicationWindow {
anchors {
left: icon.right
verticalCenter: parent.verticalCenter
+ leftMargin: 3
}
- text: "Chain"
- font.bold: true
+ //font.bold: true
color: "#0D0A01"
font.pixelSize: 12
}
@@ -355,15 +368,29 @@ ApplicationWindow {
options = {};
}
- if(options.default) {
- var comp = menuItemTemplate.createObject(menuDefault)
+ var section;
+ switch(options.section) {
+ case "ethereum":
+ section = menuDefault;
+ break;
+ case "legacy":
+ section = menuLegacy;
+ break;
+ default:
+ section = menuApps;
+ break;
}
+
+ var comp = menuItemTemplate.createObject(section)
comp.view = view
comp.title = view.title
+ comp.icon = view.iconFile
+ /*
if(view.secondary !== undefined) {
comp.secondary = view.secondary
}
+ */
return comp
@@ -376,7 +403,7 @@ ApplicationWindow {
ColumnLayout {
id: menuColumn
- y: 30
+ y: 10
width: parent.width
anchors.left: parent.left
anchors.right: parent.right
@@ -402,6 +429,25 @@ ApplicationWindow {
}
Text {
+ text: "LEGACY"
+ font.bold: true
+ anchors {
+ left: parent.left
+ leftMargin: 5
+ }
+ color: "#888888"
+ }
+
+ ColumnLayout {
+ id: menuLegacy
+ spacing: 3
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+ }
+
+ Text {
text: "APPS"
font.bold: true
anchors {
diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml
index 22e404cc8..ca6860036 100644
--- a/ethereal/assets/qml/webapp.qml
+++ b/ethereal/assets/qml/webapp.qml
@@ -142,39 +142,39 @@ ApplicationWindow {
try {
switch(data.call) {
case "getCoinBase":
- postData(data._seed, eth.getCoinBase())
+ postData(data._seed, eth.coinBase())
break
case "getIsListening":
- postData(data._seed, eth.getIsListening())
+ postData(data._seed, eth.isListening())
break
case "getIsMining":
- postData(data._seed, eth.getIsMining())
+ postData(data._seed, eth.isMining())
break
case "getPeerCount":
- postData(data._seed, eth.getPeerCount())
+ postData(data._seed, eth.peerCount())
break
case "getTxCountAt":
require(1)
- postData(data._seed, eth.getTxCountAt(data.args[0]))
+ postData(data._seed, eth.txCountAt(data.args[0]))
break
case "getBlockByNumber":
- var block = eth.getBlockByNumber(data.args[0])
+ var block = eth.blockByNumber(data.args[0])
postData(data._seed, block)
break
case "getBlockByHash":
- var block = eth.getBlockByHash(data.args[0])
+ var block = eth.blockByHash(data.args[0])
postData(data._seed, block)
break
@@ -190,22 +190,22 @@ ApplicationWindow {
case "getStorage":
require(2);
- var stateObject = eth.getStateObject(data.args[0])
- var storage = stateObject.getStorage(data.args[1])
+ var stateObject = eth.stateObject(data.args[0])
+ var storage = stateObject.storageAt(data.args[1])
postData(data._seed, storage)
break
case "getEachStorage":
require(1);
- var storage = JSON.parse(eth.getEachStorage(data.args[0]))
+ var storage = JSON.parse(eth.eachStorage(data.args[0]))
postData(data._seed, storage)
break
case "getTransactionsFor":
require(1);
- var txs = eth.getTransactionsFor(data.args[0], true)
+ var txs = eth.transactionsFor(data.args[0], true)
postData(data._seed, txs)
break
@@ -213,12 +213,12 @@ ApplicationWindow {
case "getBalance":
require(1);
- postData(data._seed, eth.getStateObject(data.args[0]).value());
+ postData(data._seed, eth.stateObject(data.args[0]).value());
break
case "getKey":
- var key = eth.getKey().privateKey;
+ var key = eth.key().privateKey;
postData(data._seed, key)
break
diff --git a/ethereal/assets/wallet.png b/ethereal/assets/wallet.png
new file mode 100644
index 000000000..92c401e52
--- /dev/null
+++ b/ethereal/assets/wallet.png
Binary files differ
diff --git a/ethereal/gui.go b/ethereal/gui.go
index 7a36a8b02..1765c3fb2 100644
--- a/ethereal/gui.go
+++ b/ethereal/gui.go
@@ -334,7 +334,6 @@ func (gui *Gui) readPreviousTransactions() {
}
func (gui *Gui) processBlock(block *ethchain.Block, initial bool) {
- //name := ethpub.FindNameInNameReg(gui.eth.StateManager(), block.Coinbase)
name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00")
b := ethpipe.NewJSBlock(block)
b.Name = name
@@ -491,7 +490,7 @@ func (gui *Gui) setPeerInfo() {
gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers))
gui.win.Root().Call("resetPeers")
- for _, peer := range gui.pipe.GetPeers() {
+ for _, peer := range gui.pipe.Peers() {
gui.win.Root().Call("addPeer", peer)
}
}