Commit e100aa3c authored by obscuren's avatar obscuren

Changed to new "created address"

parent 5053ec21
...@@ -10,902 +10,902 @@ import "../ext/filter.js" as Eth ...@@ -10,902 +10,902 @@ import "../ext/filter.js" as Eth
import "../ext/http.js" as Http import "../ext/http.js" as Http
ApplicationWindow { ApplicationWindow {
id: root id: root
property alias miningButtonText: miningButton.text property alias miningButtonText: miningButton.text
property var ethx : Eth.ethx property var ethx : Eth.ethx
property var browser property var browser
width: 1200 width: 1200
height: 820 height: 820
minimumHeight: 300 minimumHeight: 300
title: "Mist" title: "Mist"
// This signal is used by the filter API. The filter API connects using this signal handler from // This signal is used by the filter API. The filter API connects using this signal handler from
// the different QML files and plugins. // the different QML files and plugins.
signal messages(var messages, int id); signal messages(var messages, int id);
function invokeFilterCallback(data, receiverSeed) { function invokeFilterCallback(data, receiverSeed) {
//var messages = JSON.parse(data) //var messages = JSON.parse(data)
// Signal handler // Signal handler
messages(data, receiverSeed); messages(data, receiverSeed);
root.browser.view.messages(data, receiverSeed); root.browser.view.messages(data, receiverSeed);
}
TextField {
id: copyElementHax
visible: false
}
function copyToClipboard(text) {
copyElementHax.text = text
copyElementHax.selectAll()
copyElementHax.copy()
}
// Takes care of loading all default plugins
Component.onCompleted: {
var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true});
var browser = addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true});
root.browser = browser;
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/javascript.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/jeffcoin/jeffcoin.qml", {noAdd: true, close: false, section: "apps"})
mainSplit.setView(wallet.view, wallet.menuItem);
// Call the ready handler
gui.done();
}
function addViews(view, path, options) {
var views = mainSplit.addComponent(view, options)
views.menuItem.path = path
mainSplit.views.push(views);
if(!options.noAdd) {
gui.addPlugin(path)
}
return views
}
function addPlugin(path, options) {
try {
if(typeof(path) === "string" && /^https?/.test(path)) {
console.log('load http')
Http.request(path, function(o) {
if(o.status === 200) {
var view = Qt.createQmlObject(o.responseText, mainView, path)
addViews(view, path, options)
}
})
return
}
var component = Qt.createComponent(path);
if(component.status != Component.Ready) {
if(component.status == Component.Error) {
ethx.note("error: ", component.errorString());
}
return
}
var view = mainView.createView(component, options)
var views = addViews(view, path, options)
return views
} catch(e) {
ethx.note(e)
}
}
menuBar: MenuBar {
Menu {
title: "File"
MenuItem {
text: "Import App"
shortcut: "Ctrl+o"
onTriggered: {
generalFileDialog.show(true, importApp)
}
}
/*
MenuItem {
text: "Browser"
onTriggered: eth.openBrowser()
}
*/
MenuItem {
text: "Add plugin"
onTriggered: {
generalFileDialog.show(true, function(path) {
addPlugin(path, {close: true, section: "apps"})
})
}
}
MenuSeparator {}
MenuItem {
text: "Import key"
shortcut: "Ctrl+i"
onTriggered: {
generalFileDialog.show(true, function(path) {
gui.importKey(path)
})
}
}
MenuItem {
text: "Export keys"
shortcut: "Ctrl+e"
onTriggered: {
generalFileDialog.show(false, function(path) {
})
}
}
}
Menu {
title: "Developer"
MenuItem {
iconSource: "../icecream.png"
text: "Debugger"
shortcut: "Ctrl+d"
onTriggered: eth.startDebugger()
}
MenuItem {
text: "Import Tx"
onTriggered: {
txImportDialog.visible = true
}
}
MenuItem {
text: "Run JS file"
onTriggered: {
generalFileDialog.show(true, function(path) {
eth.evalJavascriptFile(path)
})
}
}
MenuItem {
text: "Dump state"
onTriggered: {
generalFileDialog.show(false, function(path) {
// Empty hash for latest
gui.dumpState("", path)
})
}
}
MenuSeparator {}
/*
MenuItem {
id: miningSpeed
text: "Mining: Turbo"
onTriggered: {
gui.toggleTurboMining()
if(text == "Mining: Turbo") {
text = "Mining: Normal";
} else {
text = "Mining: Turbo";
}
}
}
*/
}
Menu {
title: "Network"
MenuItem {
text: "Add Peer"
shortcut: "Ctrl+p"
onTriggered: {
addPeerWin.visible = true
}
}
MenuItem {
text: "Show Peers"
shortcut: "Ctrl+e"
onTriggered: {
peerWindow.visible = true
}
}
}
Menu {
title: "Help"
MenuItem {
text: "About"
onTriggered: {
aboutWin.visible = true
}
}
}
Menu {
title: "GLOBAL SHORTCUTS"
visible: false
MenuItem {
visible: false
shortcut: "Ctrl+l"
onTriggered: {
url.focus = true
}
}
}
}
statusBar: StatusBar {
height: 32
id: statusBar
RowLayout {
Button {
id: miningButton
text: "Start Mining"
onClicked: {
gui.toggleMining()
}
}
RowLayout {
Label {
id: walletValueLabel
font.pixelSize: 10
styleColor: "#797979"
}
}
}
Label {
y: 6
objectName: "miningLabel"
visible: true
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
}
Label {
y: 6
id: lastBlockLabel
objectName: "lastBlockLabel"
visible: true
text: ""
font.pixelSize: 10
anchors.right: peerGroup.left
anchors.rightMargin: 5
}
ProgressBar {
id: downloadIndicator
value: 0
visible: true
objectName: "downloadIndicator"
y: 3
x: statusBar.width / 2 - this.width / 2
width: 160
}
Label {
objectName: "downloadLabel"
y: 7
anchors.left: downloadIndicator.right
anchors.leftMargin: 5
font.pixelSize: 10
text: "0 / 0"
} }
TextField {
id: copyElementHax
visible: false
}
function copyToClipboard(text) {
copyElementHax.text = text
copyElementHax.selectAll()
copyElementHax.copy()
}
// Takes care of loading all default plugins
Component.onCompleted: {
var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true});
var browser = addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true});
root.browser = browser;
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/javascript.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/jeffcoin/jeffcoin.qml", {noAdd: true, close: false, section: "apps"})
mainSplit.setView(wallet.view, wallet.menuItem);
// Call the ready handler
gui.done();
}
function addViews(view, path, options) {
var views = mainSplit.addComponent(view, options)
views.menuItem.path = path
mainSplit.views.push(views);
if(!options.noAdd) {
gui.addPlugin(path)
}
return views
}
function addPlugin(path, options) {
try {
if(typeof(path) === "string" && /^https?/.test(path)) {
console.log('load http')
Http.request(path, function(o) {
if(o.status === 200) {
var view = Qt.createQmlObject(o.responseText, mainView, path)
addViews(view, path, options)
}
})
return
}
var component = Qt.createComponent(path);
if(component.status != Component.Ready) {
if(component.status == Component.Error) {
ethx.note("error: ", component.errorString());
}
return
}
var view = mainView.createView(component, options)
var views = addViews(view, path, options)
return views
} catch(e) {
ethx.note(e)
}
}
menuBar: MenuBar {
Menu {
title: "File"
MenuItem {
text: "Import App"
shortcut: "Ctrl+o"
onTriggered: {
generalFileDialog.show(true, importApp)
}
}
/*
MenuItem {
text: "Browser"
onTriggered: eth.openBrowser()
}
*/
MenuItem {
text: "Add plugin"
onTriggered: {
generalFileDialog.show(true, function(path) {
addPlugin(path, {close: true, section: "apps"})
})
}
}
MenuSeparator {}
MenuItem {
text: "Import key"
shortcut: "Ctrl+i"
onTriggered: {
generalFileDialog.show(true, function(path) {
gui.importKey(path)
})
}
}
MenuItem {
text: "Export keys"
shortcut: "Ctrl+e"
onTriggered: {
generalFileDialog.show(false, function(path) {
})
}
}
}
Menu {
title: "Developer"
MenuItem {
iconSource: "../icecream.png"
text: "Debugger"
shortcut: "Ctrl+d"
onTriggered: eth.startDebugger()
}
MenuItem {
text: "Import Tx"
onTriggered: {
txImportDialog.visible = true
}
}
MenuItem {
text: "Run JS file"
onTriggered: {
generalFileDialog.show(true, function(path) {
eth.evalJavascriptFile(path)
})
}
}
MenuItem {
text: "Dump state"
onTriggered: {
generalFileDialog.show(false, function(path) {
// Empty hash for latest
gui.dumpState("", path)
})
}
}
MenuSeparator {}
/*
MenuItem {
id: miningSpeed
text: "Mining: Turbo"
onTriggered: {
gui.toggleTurboMining()
if(text == "Mining: Turbo") {
text = "Mining: Normal";
} else {
text = "Mining: Turbo";
}
}
}
*/
}
Menu {
title: "Network"
MenuItem {
text: "Add Peer"
shortcut: "Ctrl+p"
onTriggered: {
addPeerWin.visible = true
}
}
MenuItem {
text: "Show Peers"
shortcut: "Ctrl+e"
onTriggered: {
peerWindow.visible = true
}
}
}
Menu {
title: "Help"
MenuItem {
text: "About"
onTriggered: {
aboutWin.visible = true
}
}
}
Menu {
title: "GLOBAL SHORTCUTS"
visible: false
MenuItem {
visible: false
shortcut: "Ctrl+l"
onTriggered: {
url.focus = true
}
}
}
}
statusBar: StatusBar {
height: 32
id: statusBar
RowLayout {
Button {
id: miningButton
text: "Start Mining"
onClicked: {
gui.toggleMining()
}
}
RowLayout {
Label {
id: walletValueLabel
font.pixelSize: 10
styleColor: "#797979"
}
}
}
Label {
y: 6
objectName: "miningLabel"
visible: true
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
}
Label {
y: 6
id: lastBlockLabel
objectName: "lastBlockLabel"
visible: true
text: ""
font.pixelSize: 10
anchors.right: peerGroup.left
anchors.rightMargin: 5
}
ProgressBar {
id: downloadIndicator
value: 0
objectName: "downloadIndicator"
y: 3
x: statusBar.width / 2 - this.width / 2
width: 160
}
Label {
objectName: "downloadLabel"
y: 7
anchors.left: downloadIndicator.right
anchors.leftMargin: 5
font.pixelSize: 10
text: "0 / 0"
}
RowLayout {
id: peerGroup
y: 7
anchors.right: parent.right
MouseArea {
onDoubleClicked: peerWindow.visible = true
anchors.fill: parent
}
Label {
id: peerLabel
font.pixelSize: 8
text: "0 / 0"
}
Image {
id: peerImage
width: 10; height: 10
source: "../network.png"
}
}
}
property var blockModel: ListModel {
id: blockModel
}
RowLayout { SplitView {
id: peerGroup property var views: [];
y: 7
anchors.right: parent.right id: mainSplit
MouseArea { anchors.fill: parent
onDoubleClicked: peerWindow.visible = true resizing: false
anchors.fill: parent
} function setView(view, menu) {
for(var i = 0; i < views.length; i++) {
Label { views[i].view.visible = false
id: peerLabel views[i].menuItem.setSelection(false)
font.pixelSize: 8 }
text: "0 / 0" view.visible = true
}
Image { //menu.border.color = "#CCCCCC"
id: peerImage //menu.color = "#FFFFFFFF"
width: 10; height: 10 menu.setSelection(true)
source: "../network.png" }
}
} function addComponent(view, options) {
} view.visible = false
view.anchors.fill = mainView
property var blockModel: ListModel { if( !view.hasOwnProperty("iconSource") ) {
id: blockModel console.log("Could not load plugin. Property 'iconSourc' not found on view.");
} return;
}
SplitView {
property var views: []; var menuItem = menu.createMenuItem(view.iconSource, view, options);
if( view.hasOwnProperty("menuItem") ) {
id: mainSplit view.menuItem = menuItem;
anchors.fill: parent }
resizing: false
if( view.hasOwnProperty("onReady") ) {
function setView(view, menu) { view.onReady.call(view)
for(var i = 0; i < views.length; i++) { }
views[i].view.visible = false
views[i].menuItem.setSelection(false) if( options.active ) {
} setView(view, menuItem)
view.visible = true }
//menu.border.color = "#CCCCCC"
//menu.color = "#FFFFFFFF" return {view: view, menuItem: menuItem}
menu.setSelection(true) }
}
/*********************
function addComponent(view, options) { * Main menu.
view.visible = false ********************/
view.anchors.fill = mainView Rectangle {
id: menu
if( !view.hasOwnProperty("iconSource") ) { Layout.minimumWidth: 210
console.log("Could not load plugin. Property 'iconSourc' not found on view."); Layout.maximumWidth: 210
return; anchors.top: parent.top
} color: "#ececec"
var menuItem = menu.createMenuItem(view.iconSource, view, options); Component {
if( view.hasOwnProperty("menuItem") ) { id: menuItemTemplate
view.menuItem = menuItem; Rectangle {
} id: menuItem
property var view;
if( view.hasOwnProperty("onReady") ) { property var path;
view.onReady.call(view) property var closable;
}
property alias title: label.text
if( options.active ) { property alias icon: icon.source
setView(view, menuItem) property alias secondaryTitle: secondary.text
} function setSelection(on) {
sel.visible = on
}
return {view: view, menuItem: menuItem}
} width: 206
height: 28
/********************* color: "#00000000"
* Main menu.
********************/ anchors {
Rectangle { left: parent.left
id: menu leftMargin: 4
Layout.minimumWidth: 210 }
Layout.maximumWidth: 210
anchors.top: parent.top Rectangle {
color: "#ececec" id: sel
visible: false
Component { anchors.fill: parent
id: menuItemTemplate color: "#00000000"
Rectangle { Rectangle {
id: menuItem id: r
property var view; anchors.fill: parent
property var path; border.color: "#CCCCCC"
property var closable; border.width: 1
radius: 5
property alias title: label.text color: "#FFFFFFFF"
property alias icon: icon.source }
property alias secondaryTitle: secondary.text Rectangle {
function setSelection(on) { anchors {
sel.visible = on top: r.top
} bottom: r.bottom
right: r.right
width: 206 }
height: 28 width: 10
color: "#00000000" color: "#FFFFFFFF"
anchors { Rectangle {
left: parent.left anchors {
leftMargin: 4 left: parent.left
} right: parent.right
top: parent.top
Rectangle { }
id: sel height: 1
visible: false color: "#CCCCCC"
anchors.fill: parent }
color: "#00000000"
Rectangle { Rectangle {
id: r anchors {
anchors.fill: parent left: parent.left
border.color: "#CCCCCC" right: parent.right
border.width: 1 bottom: parent.bottom
radius: 5 }
color: "#FFFFFFFF" height: 1
} color: "#CCCCCC"
Rectangle { }
anchors { }
top: r.top }
bottom: r.bottom
right: r.right MouseArea {
} anchors.fill: parent
width: 10 onClicked: {
color: "#FFFFFFFF" mainSplit.setView(view, menuItem)
}
Rectangle { }
anchors {
left: parent.left Image {
right: parent.right id: icon
top: parent.top height: 20
} width: 20
height: 1 anchors {
color: "#CCCCCC" left: parent.left
} verticalCenter: parent.verticalCenter
leftMargin: 3
Rectangle { }
anchors { MouseArea {
left: parent.left anchors.fill: parent
right: parent.right onClicked: {
bottom: parent.bottom menuItem.closeApp()
} }
height: 1 }
color: "#CCCCCC" }
}
} Text {
} id: label
anchors {
MouseArea { left: icon.right
anchors.fill: parent verticalCenter: parent.verticalCenter
onClicked: { leftMargin: 3
mainSplit.setView(view, menuItem) }
}
} color: "#0D0A01"
font.pixelSize: 12
Image { }
id: icon
height: 20 Text {
width: 20 id: secondary
anchors { anchors {
left: parent.left right: parent.right
verticalCenter: parent.verticalCenter rightMargin: 8
leftMargin: 3 verticalCenter: parent.verticalCenter
} }
MouseArea { color: "#AEADBE"
anchors.fill: parent font.pixelSize: 12
onClicked: { }
menuItem.closeApp()
}
} function closeApp() {
} if(!this.closable) { return; }
Text { if(this.view.hasOwnProperty("onDestroy")) {
id: label this.view.onDestroy.call(this.view)
anchors { }
left: icon.right
verticalCenter: parent.verticalCenter this.view.destroy()
leftMargin: 3 this.destroy()
} gui.removePlugin(this.path)
}
color: "#0D0A01" }
font.pixelSize: 12 }
}
function createMenuItem(icon, view, options) {
Text { if(options === undefined) {
id: secondary options = {};
anchors { }
right: parent.right
rightMargin: 8 var section;
verticalCenter: parent.verticalCenter switch(options.section) {
} case "ethereum":
color: "#AEADBE" section = menuDefault;
font.pixelSize: 12 break;
} case "legacy":
section = menuLegacy;
break;
function closeApp() { default:
if(!this.closable) { return; } section = menuApps;
break;
if(this.view.hasOwnProperty("onDestroy")) { }
this.view.onDestroy.call(this.view)
} var comp = menuItemTemplate.createObject(section)
this.view.destroy() comp.view = view
this.destroy() comp.title = view.title
gui.removePlugin(this.path) comp.icon = view.iconSource
} comp.closable = options.close;
}
} return comp
}
function createMenuItem(icon, view, options) {
if(options === undefined) { ColumnLayout {
options = {}; id: menuColumn
} y: 10
width: parent.width
var section; anchors.left: parent.left
switch(options.section) { anchors.right: parent.right
case "ethereum": spacing: 3
section = menuDefault;
break; Text {
case "legacy": text: "ETHEREUM"
section = menuLegacy; font.bold: true
break; anchors {
default: left: parent.left
section = menuApps; leftMargin: 5
break; }
} color: "#888888"
}
var comp = menuItemTemplate.createObject(section)
ColumnLayout {
comp.view = view id: menuDefault
comp.title = view.title spacing: 3
comp.icon = view.iconSource anchors {
comp.closable = options.close; left: parent.left
right: parent.right
return comp }
} }
ColumnLayout {
id: menuColumn Text {
y: 10 text: "APPS"
width: parent.width font.bold: true
anchors.left: parent.left anchors {
anchors.right: parent.right left: parent.left
spacing: 3 leftMargin: 5
}
Text { color: "#888888"
text: "ETHEREUM" }
font.bold: true
anchors { ColumnLayout {
left: parent.left id: menuApps
leftMargin: 5 spacing: 3
} anchors {
color: "#888888" left: parent.left
} right: parent.right
}
ColumnLayout { }
id: menuDefault
spacing: 3 Text {
anchors { text: "DEBUG"
left: parent.left font.bold: true
right: parent.right anchors {
} left: parent.left
} leftMargin: 5
}
color: "#888888"
Text { }
text: "APPS"
font.bold: true ColumnLayout {
anchors { id: menuLegacy
left: parent.left spacing: 3
leftMargin: 5 anchors {
} left: parent.left
color: "#888888" right: parent.right
} }
}
ColumnLayout { }
id: menuApps }
spacing: 3
anchors { /*********************
left: parent.left * Main view
right: parent.right ********************/
} Rectangle {
} anchors.right: parent.right
anchors.left: menu.right
Text { anchors.bottom: parent.bottom
text: "DEBUG" anchors.top: parent.top
font.bold: true color: "#00000000"
anchors {
left: parent.left Rectangle {
leftMargin: 5 id: urlPane
} height: 40
color: "#888888" color: "#00000000"
} anchors {
left: parent.left
ColumnLayout { right: parent.right
id: menuLegacy leftMargin: 5
spacing: 3 rightMargin: 5
anchors { top: parent.top
left: parent.left topMargin: 5
right: parent.right }
} TextField {
} id: url
} objectName: "url"
} placeholderText: "DApp URL"
anchors {
/********************* left: parent.left
* Main view right: parent.right
********************/ top: parent.top
Rectangle { topMargin: 5
anchors.right: parent.right rightMargin: 5
anchors.left: menu.right leftMargin: 5
anchors.bottom: parent.bottom }
anchors.top: parent.top
color: "#00000000" Keys.onReturnPressed: {
if(/^https?/.test(this.text)) {
Rectangle { root.browser.view.open(this.text);
id: urlPane mainSplit.setView(root.browser.view, root.browser.menuItem);
height: 40 } else {
color: "#00000000" addPlugin(this.text, {close: true, section: "apps"})
anchors { }
left: parent.left }
right: parent.right }
leftMargin: 5
rightMargin: 5 }
top: parent.top
topMargin: 5 // Border
} Rectangle {
TextField { id: divider
id: url anchors {
objectName: "url" left: parent.left
placeholderText: "DApp URL" right: parent.right
anchors { top: urlPane.bottom
left: parent.left }
right: parent.right z: -1
top: parent.top height: 1
topMargin: 5 color: "#CCCCCC"
rightMargin: 5 }
leftMargin: 5
} Rectangle {
id: mainView
Keys.onReturnPressed: { color: "#00000000"
if(/^https?/.test(this.text)) { anchors.right: parent.right
root.browser.view.open(this.text); anchors.left: parent.left
mainSplit.setView(root.browser.view, root.browser.menuItem); anchors.bottom: parent.bottom
} else { anchors.top: divider.bottom
addPlugin(this.text, {close: true, section: "apps"})
} function createView(component) {
} var view = component.createObject(mainView)
}
return view;
} }
}
// Border }
Rectangle { }
id: divider
anchors {
left: parent.left /******************
right: parent.right * Dialogs
top: urlPane.bottom *****************/
} FileDialog {
z: -1 id: generalFileDialog
height: 1 property var callback;
color: "#CCCCCC" onAccepted: {
} var path = this.fileUrl.toString();
callback.call(this, path);
Rectangle { }
id: mainView
color: "#00000000" function show(selectExisting, callback) {
anchors.right: parent.right generalFileDialog.callback = callback;
anchors.left: parent.left generalFileDialog.selectExisting = selectExisting;
anchors.bottom: parent.bottom
anchors.top: divider.bottom this.open();
}
function createView(component) { }
var view = component.createObject(mainView)
return view; /******************
} * Wallet functions
} *****************/
} function importApp(path) {
} var ext = path.split('.').pop()
if(ext == "html" || ext == "htm") {
eth.openHtml(path)
/****************** }else if(ext == "qml"){
* Dialogs addPlugin(path, {close: true, section: "apps"})
*****************/ }
FileDialog { }
id: generalFileDialog
property var callback;
onAccepted: { function setWalletValue(value) {
var path = this.fileUrl.toString(); walletValueLabel.text = value
callback.call(this, path); }
}
function loadPlugin(name) {
function show(selectExisting, callback) { console.log("Loading plugin" + name)
generalFileDialog.callback = callback; var view = mainView.addPlugin(name)
generalFileDialog.selectExisting = selectExisting; }
this.open(); function setPeers(text) {
} peerLabel.text = text
} }
function addPeer(peer) {
/****************** // We could just append the whole peer object but it cries if you try to alter them
* Wallet functions peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version, caps: peer.caps})
*****************/ }
function importApp(path) {
var ext = path.split('.').pop() function resetPeers(){
if(ext == "html" || ext == "htm") { peerModel.clear()
eth.openHtml(path) }
}else if(ext == "qml"){
addPlugin(path, {close: true, section: "apps"}) function timeAgo(unixTs){
} var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000
} return (lapsed + " seconds ago")
}
function setWalletValue(value) { function convertToPretty(unixTs){
walletValueLabel.text = value var a = new Date(unixTs*1000);
} var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var year = a.getFullYear();
function loadPlugin(name) { var month = months[a.getMonth()];
console.log("Loading plugin" + name) var date = a.getDate();
var view = mainView.addPlugin(name) var hour = a.getHours();
} var min = a.getMinutes();
var sec = a.getSeconds();
function setPeers(text) { var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ;
peerLabel.text = text return time;
} }
function addPeer(peer) { /**********************
// We could just append the whole peer object but it cries if you try to alter them * Windows
peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version, caps: peer.caps}) *********************/
} Window {
id: peerWindow
function resetPeers(){ //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
peerModel.clear() height: 200
} width: 700
Rectangle {
function timeAgo(unixTs){ anchors.fill: parent
var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000 property var peerModel: ListModel {
return (lapsed + " seconds ago") id: peerModel
} }
TableView {
function convertToPretty(unixTs){ anchors.fill: parent
var a = new Date(unixTs*1000); id: peerTable
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; model: peerModel
var year = a.getFullYear(); TableViewColumn{width: 100; role: "ip" ; title: "IP" }
var month = months[a.getMonth()]; TableViewColumn{width: 60; role: "port" ; title: "Port" }
var date = a.getDate(); TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" }
var hour = a.getHours(); TableViewColumn{width: 100; role: "latency"; title: "Latency" }
var min = a.getMinutes(); TableViewColumn{width: 260; role: "version" ; title: "Version" }
var sec = a.getSeconds(); TableViewColumn{width: 80; role: "caps" ; title: "Capabilities" }
var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; }
return time; }
} }
/********************** Window {
* Windows id: aboutWin
*********************/ visible: false
Window { title: "About"
id: peerWindow minimumWidth: 350
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint maximumWidth: 350
height: 200 maximumHeight: 200
width: 700 minimumHeight: 200
Rectangle {
anchors.fill: parent Image {
property var peerModel: ListModel { id: aboutIcon
id: peerModel height: 150
} width: 150
TableView { fillMode: Image.PreserveAspectFit
anchors.fill: parent smooth: true
id: peerTable source: "../facet.png"
model: peerModel x: 10
TableViewColumn{width: 100; role: "ip" ; title: "IP" } y: 10
TableViewColumn{width: 60; role: "port" ; title: "Port" } }
TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" }
TableViewColumn{width: 100; role: "latency"; title: "Latency" } Text {
TableViewColumn{width: 260; role: "version" ; title: "Version" } anchors.left: aboutIcon.right
TableViewColumn{width: 80; role: "caps" ; title: "Capabilities" } anchors.leftMargin: 10
} anchors.top: parent.top
} anchors.topMargin: 30
} font.pointSize: 12
text: "<h2>Mist (0.6.5)</h2><h4>Amalthea</h4><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br><h3>Building</h3>Maran Hidskes"
Window { }
id: aboutWin }
visible: false
title: "About" Window {
minimumWidth: 350 id: txImportDialog
maximumWidth: 350 minimumWidth: 270
maximumHeight: 200 maximumWidth: 270
minimumHeight: 200 maximumHeight: 50
minimumHeight: 50
Image { TextField {
id: aboutIcon id: txImportField
height: 150 width: 170
width: 150 anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit anchors.left: parent.left
smooth: true anchors.leftMargin: 10
source: "../facet.png" onAccepted: {
x: 10 }
y: 10 }
} Button {
anchors.left: txImportField.right
Text { anchors.verticalCenter: parent.verticalCenter
anchors.left: aboutIcon.right anchors.leftMargin: 5
anchors.leftMargin: 10 text: "Import"
anchors.top: parent.top onClicked: {
anchors.topMargin: 30 eth.importTx(txImportField.text)
font.pointSize: 12 txImportField.visible = false
text: "<h2>Mist (0.6.5)</h2><h4>Amalthea</h4><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br><h3>Building</h3>Maran Hidskes" }
} }
} Component.onCompleted: {
addrField.focus = true
Window { }
id: txImportDialog }
minimumWidth: 270
maximumWidth: 270 Window {
maximumHeight: 50 id: addPeerWin
minimumHeight: 50 visible: false
TextField { minimumWidth: 300
id: txImportField maximumWidth: 300
width: 170 maximumHeight: 50
anchors.verticalCenter: parent.verticalCenter minimumHeight: 50
anchors.left: parent.left title: "Connect to peer"
anchors.leftMargin: 10
onAccepted: { ComboBox {
} id: addrField
} anchors.verticalCenter: parent.verticalCenter
Button { anchors.left: parent.left
anchors.left: txImportField.right anchors.right: addPeerButton.left
anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: 10
anchors.leftMargin: 5 anchors.rightMargin: 10
text: "Import" onAccepted: {
onClicked: { eth.connectToPeer(addrField.currentText)
eth.importTx(txImportField.text) addPeerWin.visible = false
txImportField.visible = false }
}
} editable: true
Component.onCompleted: { model: ListModel { id: pastPeers }
addrField.focus = true
} Component.onCompleted: {
} var ips = eth.pastPeers()
for(var i = 0; i < ips.length; i++) {
Window { pastPeers.append({text: ips.get(i)})
id: addPeerWin }
visible: false
minimumWidth: 300 pastPeers.insert(0, {text: "poc-6.ethdev.com:30303"})
maximumWidth: 300 }
maximumHeight: 50 }
minimumHeight: 50
title: "Connect to peer" Button {
id: addPeerButton
ComboBox { anchors.right: parent.right
id: addrField anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 10
anchors.left: parent.left text: "Add"
anchors.right: addPeerButton.left onClicked: {
anchors.leftMargin: 10 eth.connectToPeer(addrField.currentText)
anchors.rightMargin: 10 addPeerWin.visible = false
onAccepted: { }
eth.connectToPeer(addrField.currentText) }
addPeerWin.visible = false Component.onCompleted: {
} addrField.focus = true
}
editable: true }
model: ListModel { id: pastPeers }
Component.onCompleted: {
var ips = eth.pastPeers()
for(var i = 0; i < ips.length; i++) {
pastPeers.append({text: ips.get(i)})
}
pastPeers.insert(0, {text: "poc-6.ethdev.com:30303"})
}
}
Button {
id: addPeerButton
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 10
text: "Add"
onClicked: {
eth.connectToPeer(addrField.currentText)
addPeerWin.visible = false
}
}
Component.onCompleted: {
addrField.focus = true
}
}
} }
...@@ -271,7 +271,8 @@ func (gui *Gui) loadAddressBook() { ...@@ -271,7 +271,8 @@ func (gui *Gui) loadAddressBook() {
} }
func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
nameReg := ethpipe.New(gui.eth).World().Config().Get("NameReg") pipe := ethpipe.New(gui.eth)
nameReg := pipe.World().Config().Get("NameReg")
addr := gui.address() addr := gui.address()
var inout string var inout string
...@@ -282,14 +283,14 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { ...@@ -282,14 +283,14 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
} }
var ( var (
ptx = ethpipe.NewJSTx(tx) ptx = ethpipe.NewJSTx(tx, pipe.World().State())
send = nameReg.Storage(tx.Sender()) send = nameReg.Storage(tx.Sender())
rec = nameReg.Storage(tx.Recipient) rec = nameReg.Storage(tx.Recipient)
s, r string s, r string
) )
if tx.CreatesContract() { if tx.CreatesContract() {
rec = nameReg.Storage(tx.CreationAddress()) rec = nameReg.Storage(tx.CreationAddress(pipe.World().State()))
} }
if send.Len() != 0 { if send.Len() != 0 {
...@@ -301,7 +302,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { ...@@ -301,7 +302,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
r = strings.Trim(rec.Str(), "\x00") r = strings.Trim(rec.Str(), "\x00")
} else { } else {
if tx.CreatesContract() { if tx.CreatesContract() {
r = ethutil.Bytes2Hex(tx.CreationAddress()) r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State()))
} else { } else {
r = ethutil.Bytes2Hex(tx.Recipient) r = ethutil.Bytes2Hex(tx.Recipient)
} }
...@@ -468,16 +469,9 @@ func (gui *Gui) update() { ...@@ -468,16 +469,9 @@ func (gui *Gui) update() {
dlWidget = gui.win.Root().ObjectByName("downloadIndicator") dlWidget = gui.win.Root().ObjectByName("downloadIndicator")
dlLabel = gui.win.Root().ObjectByName("downloadLabel") dlLabel = gui.win.Root().ObjectByName("downloadLabel")
) )
if pct < 1.0 {
dlWidget.Set("visible", true)
dlWidget.Set("value", pct)
dlLabel.Set("visible", true) dlWidget.Set("value", pct)
dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength))
} else {
dlWidget.Set("visible", false)
dlLabel.Set("visible", false)
}
case <-statsUpdateTicker.C: case <-statsUpdateTicker.C:
gui.setStatsPane() gui.setStatsPane()
......
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