Implementing new wallet views

pull/122/head
obscuren 10 years ago
parent 5ae3deea86
commit a8409b0a8b
  1. 7
      ethereal/assets/qml/views/history.qml
  2. 2
      ethereal/assets/qml/views/info.qml
  3. 63
      ethereal/assets/qml/views/wallet.qml
  4. 78
      ethereal/assets/qml/wallet.qml
  5. 26
      ethereal/assets/qml/webapp.qml
  6. BIN
      ethereal/assets/wallet.png
  7. 3
      ethereal/gui.go
  8. 6
      javascript/types.go

@ -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

@ -29,7 +29,7 @@ Rectangle {
text: "Address"
}
TextField {
text: eth.getKey().address
text: eth.key().address
width: 500
}

@ -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)})
}
}
}
}
}
}

@ -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
@ -401,6 +428,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

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -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)
}
}

@ -73,15 +73,15 @@ type JSEthereum struct {
}
func (self *JSEthereum) GetBlock(hash string) otto.Value {
return self.toVal(&JSBlock{self.JSPipe.GetBlockByHash(hash), self})
return self.toVal(&JSBlock{self.JSPipe.BlockByHash(hash), self})
}
func (self *JSEthereum) GetPeers() otto.Value {
return self.toVal(self.JSPipe.GetPeers())
return self.toVal(self.JSPipe.Peers())
}
func (self *JSEthereum) GetKey() otto.Value {
return self.toVal(self.JSPipe.GetKey())
return self.toVal(self.JSPipe.Key())
}
func (self *JSEthereum) GetStateObject(addr string) otto.Value {

Loading…
Cancel
Save