Commit d953415d authored by Joseph Goulden's avatar Joseph Goulden

Fix tabs

parent 06a9ee74
...@@ -10,909 +10,888 @@ import "../ext/filter.js" as Eth ...@@ -10,909 +10,888 @@ 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
width: 900 width: 900
height: 600 height: 600
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 message(var callback, int seed); signal message(var callback, int seed);
function invokeFilterCallback(data, receiverSeed) { function invokeFilterCallback(data, receiverSeed) {
//var messages = JSON.parse(data) //var messages = JSON.parse(data)
// Signal handler // Signal handler
message(data, receiverSeed); message(data, receiverSeed);
} }
TextField { TextField {
id: copyElementHax id: copyElementHax
visible: false visible: false
} }
function copyToClipboard(text) { function copyToClipboard(text) {
copyElementHax.text = text copyElementHax.text = text
copyElementHax.selectAll() copyElementHax.selectAll()
copyElementHax.copy() copyElementHax.copy()
} }
// Takes care of loading all default plugins // Takes care of loading all default plugins
Component.onCompleted: { Component.onCompleted: {
addPlugin("./views/wallet.qml", {noAdd: true, section: "ethereum", active: true}); addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true});
addPlugin("./webapp.qml", {noAdd: true, section: "ethereum", active: true}); addPlugin("./webapp.qml", {noAdd: true, close: false, section: "ethereum", active: true});
addPlugin("./views/transaction.qml", {noAdd: true, section: "legacy"}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/chain.qml", {noAdd: true, section: "legacy"}); addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/info.qml", {noAdd: true, section: "legacy"}); addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/pending_tx.qml", {noAdd: true, section: "legacy"}); addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/javascript.qml", {noAdd: true, section: "legacy"}); addPlugin("./views/javascript.qml", {noAdd: true, close: false, section: "legacy"});
// Call the ready handler // Call the ready handler
gui.done(); gui.done();
} }
function addViews(view, path, options) { function addViews(view, path, options) {
var views = mainSplit.addComponent(view, options) var views = mainSplit.addComponent(view, options)
views.menuItem.path = path views.menuItem.path = path
mainSplit.views.push(views); mainSplit.views.push(views);
if(!options.noAdd) { if(!options.noAdd) {
gui.addPlugin(path) gui.addPlugin(path)
} }
return views return views
} }
function addPlugin(path, options) { function addPlugin(path, options) {
try { try {
if(typeof(path) === "string" && /^https?/.test(path)) { if(typeof(path) === "string" && /^https?/.test(path)) {
console.log('load http') console.log('load http')
Http.request(path, function(o) { Http.request(path, function(o) {
if(o.status === 200) { if(o.status === 200) {
var view = Qt.createQmlObject(o.responseText, mainView, path) var view = Qt.createQmlObject(o.responseText, mainView, path)
addViews(view, path, options) addViews(view, path, options)
} }
}) })
return return
} }
var component = Qt.createComponent(path); var component = Qt.createComponent(path);
if(component.status != Component.Ready) { if(component.status != Component.Ready) {
if(component.status == Component.Error) { if(component.status == Component.Error) {
ethx.note("error: ", component.errorString()); ethx.note("error: ", component.errorString());
} }
return return
} }
var view = mainView.createView(component, options) var view = mainView.createView(component, options)
var views = addViews(view, path, options) var views = addViews(view, path, options)
return views.view return views.view
} catch(e) { } catch(e) {
ethx.note(e) ethx.note(e)
} }
} }
menuBar: MenuBar { menuBar: MenuBar {
Menu { Menu {
title: "File" title: "File"
MenuItem { MenuItem {
text: "Import App" text: "Import App"
shortcut: "Ctrl+o" shortcut: "Ctrl+o"
onTriggered: { onTriggered: {
generalFileDialog.show(true, importApp) generalFileDialog.show(true, importApp)
} }
} }
/* /*
MenuItem { MenuItem {
text: "Browser" text: "Browser"
onTriggered: eth.openBrowser() onTriggered: eth.openBrowser()
} }
*/ */
MenuItem { MenuItem {
text: "Add plugin" text: "Add plugin"
onTriggered: { onTriggered: {
generalFileDialog.show(true, function(path) { generalFileDialog.show(true, function(path) {
addPlugin(path, {canClose: true, section: "apps"}) addPlugin(path, {close: true, section: "apps"})
}) })
} }
} }
MenuSeparator {} MenuSeparator {}
MenuItem { MenuItem {
text: "Import key" text: "Import key"
shortcut: "Ctrl+i" shortcut: "Ctrl+i"
onTriggered: { onTriggered: {
generalFileDialog.show(true, function(path) { generalFileDialog.show(true, function(path) {
gui.importKey(path) gui.importKey(path)
}) })
} }
} }
MenuItem { MenuItem {
text: "Export keys" text: "Export keys"
shortcut: "Ctrl+e" shortcut: "Ctrl+e"
onTriggered: { onTriggered: {
generalFileDialog.show(false, function(path) { generalFileDialog.show(false, function(path) {
}) })
} }
} }
} }
Menu { Menu {
title: "Developer" title: "Developer"
MenuItem { MenuItem {
text: "Debugger" text: "Debugger"
shortcut: "Ctrl+d" shortcut: "Ctrl+d"
onTriggered: eth.startDebugger() onTriggered: eth.startDebugger()
} }
MenuItem { MenuItem {
text: "Import Tx" text: "Import Tx"
onTriggered: { onTriggered: {
txImportDialog.visible = true txImportDialog.visible = true
} }
} }
MenuItem { MenuItem {
text: "Run JS file" text: "Run JS file"
onTriggered: { onTriggered: {
generalFileDialog.show(true, function(path) { generalFileDialog.show(true, function(path) {
eth.evalJavascriptFile(path) eth.evalJavascriptFile(path)
}) })
} }
} }
MenuItem { MenuItem {
text: "Dump state" text: "Dump state"
onTriggered: { onTriggered: {
generalFileDialog.show(false, function(path) { generalFileDialog.show(false, function(path) {
// Empty hash for latest // Empty hash for latest
gui.dumpState("", path) gui.dumpState("", path)
}) })
} }
} }
MenuSeparator {} MenuSeparator {}
MenuItem { MenuItem {
id: miningSpeed id: miningSpeed
text: "Mining: Turbo" text: "Mining: Turbo"
onTriggered: { onTriggered: {
gui.toggleTurboMining() gui.toggleTurboMining()
if(text == "Mining: Turbo") { if(text == "Mining: Turbo") {
text = "Mining: Normal"; text = "Mining: Normal";
} else { } else {
text = "Mining: Turbo"; text = "Mining: Turbo";
} }
} }
} }
} }
Menu { Menu {
title: "Network" title: "Network"
MenuItem { MenuItem {
text: "Add Peer" text: "Add Peer"
shortcut: "Ctrl+p" shortcut: "Ctrl+p"
onTriggered: { onTriggered: {
addPeerWin.visible = true addPeerWin.visible = true
} }
} }
MenuItem { MenuItem {
text: "Show Peers" text: "Show Peers"
shortcut: "Ctrl+e" shortcut: "Ctrl+e"
onTriggered: { onTriggered: {
peerWindow.visible = true peerWindow.visible = true
} }
} }
} }
Menu { Menu {
title: "Help" title: "Help"
MenuItem { MenuItem {
text: "About" text: "About"
onTriggered: { onTriggered: {
aboutWin.visible = true aboutWin.visible = true
} }
} }
} }
Menu { Menu {
title: "GLOBAL SHORTCUTS" title: "GLOBAL SHORTCUTS"
visible: false visible: false
MenuItem { MenuItem {
visible: false visible: false
shortcut: "Ctrl+l" shortcut: "Ctrl+l"
onTriggered: { onTriggered: {
url.focus = true url.focus = true
} }
} }
} }
} }
statusBar: StatusBar { statusBar: StatusBar {
height: 32 height: 32
RowLayout { RowLayout {
Button { Button {
id: miningButton id: miningButton
text: "Start Mining" text: "Start Mining"
onClicked: { onClicked: {
gui.toggleMining() gui.toggleMining()
} }
} }
/* /*
Button { Button {
id: importAppButton id: importAppButton
text: "Browser" text: "Browser"
onClicked: { onClicked: {
eth.openBrowser() eth.openBrowser()
} }
} }
*/ */
RowLayout { RowLayout {
Label { Label {
id: walletValueLabel id: walletValueLabel
font.pixelSize: 10 font.pixelSize: 10
styleColor: "#797979" styleColor: "#797979"
} }
} }
} }
Label { Label {
y: 6 y: 6
objectName: "miningLabel" objectName: "miningLabel"
visible: true visible: true
font.pixelSize: 10 font.pixelSize: 10
anchors.right: lastBlockLabel.left anchors.right: lastBlockLabel.left
anchors.rightMargin: 5 anchors.rightMargin: 5
} }
Label { Label {
y: 6 y: 6
id: lastBlockLabel id: lastBlockLabel
objectName: "lastBlockLabel" objectName: "lastBlockLabel"
visible: true visible: true
text: "" text: ""
font.pixelSize: 10 font.pixelSize: 10
anchors.right: peerGroup.left anchors.right: peerGroup.left
anchors.rightMargin: 5 anchors.rightMargin: 5
} }
ProgressBar { ProgressBar {
id: syncProgressIndicator id: syncProgressIndicator
visible: false visible: false
objectName: "syncProgressIndicator" objectName: "syncProgressIndicator"
y: 3 y: 3
width: 140 width: 140
indeterminate: true indeterminate: true
anchors.right: peerGroup.left anchors.right: peerGroup.left
anchors.rightMargin: 5 anchors.rightMargin: 5
} }
RowLayout { RowLayout {
id: peerGroup id: peerGroup
y: 7 y: 7
anchors.right: parent.right anchors.right: parent.right
MouseArea { MouseArea {
onDoubleClicked: peerWindow.visible = true onDoubleClicked: peerWindow.visible = true
anchors.fill: parent anchors.fill: parent
} }
Label { Label {
id: peerLabel id: peerLabel
font.pixelSize: 8 font.pixelSize: 8
text: "0 / 0" text: "0 / 0"
} }
Image { Image {
id: peerImage id: peerImage
width: 10; height: 10 width: 10; height: 10
source: "../network.png" source: "../network.png"
} }
} }
} }
property var blockModel: ListModel { property var blockModel: ListModel {
id: blockModel id: blockModel
} }
SplitView { SplitView {
property var views: []; property var views: [];
id: mainSplit id: mainSplit
anchors.fill: parent anchors.fill: parent
resizing: false resizing: false
function setView(view, menu) { function setView(view, menu) {
for(var i = 0; i < views.length; i++) { for(var i = 0; i < views.length; i++) {
views[i].view.visible = false views[i].view.visible = false
views[i].menuItem.setSelection(false) views[i].menuItem.setSelection(false)
} }
view.visible = true view.visible = true
//menu.border.color = "#CCCCCC" //menu.border.color = "#CCCCCC"
//menu.color = "#FFFFFFFF" //menu.color = "#FFFFFFFF"
menu.setSelection(true) menu.setSelection(true)
} }
function addComponent(view, options) { function addComponent(view, options) {
view.visible = false view.visible = false
view.anchors.fill = mainView view.anchors.fill = mainView
if( !view.hasOwnProperty("iconSource") ) { if( !view.hasOwnProperty("iconSource") ) {
console.log("Could not load plugin. Property 'iconSourc' not found on view."); console.log("Could not load plugin. Property 'iconSourc' not found on view.");
return; return;
} }
var menuItem = menu.createMenuItem(view.iconSource, view, options); var menuItem = menu.createMenuItem(view.iconSource, view, options);
if( view.hasOwnProperty("menuItem") ) { if( view.hasOwnProperty("menuItem") ) {
view.menuItem = menuItem; view.menuItem = menuItem;
} }
if( view.hasOwnProperty("onReady") ) { if( view.hasOwnProperty("onReady") ) {
view.onReady.call(view) view.onReady.call(view)
} }
if( options.active ) { if( options.active ) {
setView(view, menuItem) setView(view, menuItem)
} }
return {view: view, menuItem: menuItem} return {view: view, menuItem: menuItem}
} }
/********************* /*********************
* Main menu. * Main menu.
********************/ ********************/
Rectangle { Rectangle {
id: menu id: menu
Layout.minimumWidth: 180 Layout.minimumWidth: 180
Layout.maximumWidth: 180 Layout.maximumWidth: 180
anchors.top: parent.top anchors.top: parent.top
color: "#ececec" color: "#ececec"
Component { Component {
id: menuItemTemplate id: menuItemTemplate
Rectangle { Rectangle {
id: menuItem id: menuItem
property var view; property var view;
property var path; property var path;
property var closable;
property alias title: label.text
property alias icon: icon.source property alias title: label.text
property alias secondaryTitle: secondary.text property alias icon: icon.source
function setSelection(on) { property alias secondaryTitle: secondary.text
sel.visible = on function setSelection(on) {
} sel.visible = on
}
width: 176
height: 28 width: 176
color: "#00000000" height: 28
color: "#00000000"
anchors {
left: parent.left anchors {
leftMargin: 4 left: parent.left
} leftMargin: 4
}
Rectangle {
id: sel Rectangle {
visible: false id: sel
anchors.fill: parent visible: false
color: "#00000000" anchors.fill: parent
Rectangle { color: "#00000000"
id: r Rectangle {
anchors.fill: parent id: r
border.color: "#CCCCCC" anchors.fill: parent
border.width: 1 border.color: "#CCCCCC"
radius: 5 border.width: 1
color: "#FFFFFFFF" radius: 5
} color: "#FFFFFFFF"
Rectangle { }
anchors { Rectangle {
top: r.top anchors {
bottom: r.bottom top: r.top
right: r.right bottom: r.bottom
} right: r.right
width: 10 }
color: "#FFFFFFFF" width: 10
color: "#FFFFFFFF"
Rectangle {
anchors { Rectangle {
left: parent.left anchors {
right: parent.right left: parent.left
top: parent.top right: parent.right
} top: parent.top
height: 1 }
color: "#CCCCCC" height: 1
} color: "#CCCCCC"
}
Rectangle {
anchors { Rectangle {
left: parent.left anchors {
right: parent.right left: parent.left
bottom: parent.bottom right: parent.right
} bottom: parent.bottom
height: 1 }
color: "#CCCCCC" height: 1
} color: "#CCCCCC"
} }
} }
}
MouseArea {
anchors.fill: parent MouseArea {
onClicked: { anchors.fill: parent
mainSplit.setView(view, menuItem) onClicked: {
} mainSplit.setView(view, menuItem)
} }
}
Image {
id: icon Image {
height: 20 id: icon
width: 20 height: 20
anchors { width: 20
left: parent.left anchors {
verticalCenter: parent.verticalCenter left: parent.left
leftMargin: 3 verticalCenter: parent.verticalCenter
} leftMargin: 3
MouseArea { }
anchors.fill: parent MouseArea {
onClicked: { anchors.fill: parent
menuItem.closeApp() onClicked: {
} menuItem.closeApp()
} }
} }
}
Text {
id: label Text {
anchors { id: label
left: icon.right anchors {
verticalCenter: parent.verticalCenter left: icon.right
leftMargin: 3 verticalCenter: parent.verticalCenter
} leftMargin: 3
}
color: "#0D0A01"
font.pixelSize: 12 color: "#0D0A01"
} font.pixelSize: 12
}
Text {
id: secondary Text {
anchors { id: secondary
right: parent.right anchors {
rightMargin: 8 right: parent.right
verticalCenter: parent.verticalCenter rightMargin: 8
} verticalCenter: parent.verticalCenter
color: "#AEADBE" }
font.pixelSize: 12 color: "#AEADBE"
} font.pixelSize: 12
}
function closeApp() {
if(this.view.hasOwnProperty("onDestroy")) { function closeApp() {
this.view.onDestroy.call(this.view) if(!this.closable) { return; }
}
if(this.view.hasOwnProperty("onDestroy")) {
this.view.destroy() this.view.onDestroy.call(this.view)
this.destroy() }
gui.removePlugin(this.path)
} this.view.destroy()
} this.destroy()
} gui.removePlugin(this.path)
}
function createMenuItem(icon, view, options) { }
if(options === undefined) { }
options = {};
} function createMenuItem(icon, view, options) {
if(options === undefined) {
var section; options = {};
switch(options.section) { }
case "ethereum":
section = menuDefault; var section;
break; switch(options.section) {
case "legacy": case "ethereum":
section = menuLegacy; section = menuDefault;
break; break;
default: case "legacy":
section = menuApps; section = menuLegacy;
break; break;
} default:
section = menuApps;
var comp = menuItemTemplate.createObject(section) break;
}
comp.view = view
comp.title = view.title var comp = menuItemTemplate.createObject(section)
comp.icon = view.iconSource
/* comp.view = view
if(view.secondary !== undefined) { comp.title = view.title
comp.secondary = view.secondary comp.icon = view.iconSource
} comp.closable = options.close;
*/
return comp
return comp }
/* ColumnLayout {
if(options.canClose) { id: menuColumn
//comp.closeButton.visible = options.canClose y: 10
} width: parent.width
*/ anchors.left: parent.left
} anchors.right: parent.right
spacing: 3
ColumnLayout {
id: menuColumn Text {
y: 10 text: "ETHEREUM"
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: menuDefault
leftMargin: 5 spacing: 3
} anchors {
color: "#888888" left: parent.left
} right: parent.right
}
ColumnLayout { }
id: menuDefault
spacing: 3
anchors { Text {
left: parent.left text: "APPS"
right: parent.right font.bold: true
} anchors {
} left: parent.left
leftMargin: 5
}
Text { color: "#888888"
text: "APPS" }
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: menuApps
spacing: 3 Text {
anchors { text: "DEBUG"
left: parent.left font.bold: true
right: parent.right anchors {
} left: parent.left
} leftMargin: 5
}
Text { color: "#888888"
text: "DEBUG" }
font.bold: true
anchors { ColumnLayout {
left: parent.left id: menuLegacy
leftMargin: 5 spacing: 3
} anchors {
color: "#888888" left: parent.left
} right: parent.right
}
ColumnLayout { }
id: menuLegacy }
spacing: 3 }
anchors {
left: parent.left /*********************
right: parent.right * Main view
} ********************/
} Rectangle {
} anchors.right: parent.right
} anchors.left: menu.right
anchors.bottom: parent.bottom
/********************* anchors.top: parent.top
* Main view color: "#00000000"
********************/
Rectangle { Rectangle {
anchors.right: parent.right id: urlPane
anchors.left: menu.right height: 40
anchors.bottom: parent.bottom color: "#00000000"
anchors.top: parent.top anchors {
color: "#00000000" left: parent.left
right: parent.right
Rectangle { leftMargin: 5
id: urlPane rightMargin: 5
height: 40 top: parent.top
color: "#00000000" topMargin: 5
anchors { }
left: parent.left TextField {
right: parent.right id: url
leftMargin: 5 objectName: "url"
rightMargin: 5 placeholderText: "DApp URL"
top: parent.top anchors {
topMargin: 5 left: parent.left
} right: parent.right
TextField { top: parent.top
id: url topMargin: 5
objectName: "url" rightMargin: 5
placeholderText: "DApp URL" leftMargin: 5
anchors { }
left: parent.left
right: parent.right Keys.onReturnPressed: {
top: parent.top addPlugin(this.text, {close: true, section: "apps"})
topMargin: 5 }
rightMargin: 5 }
leftMargin: 5
} }
Keys.onReturnPressed: { // Border
addPlugin(this.text, {canClose: true, section: "apps"}) Rectangle {
} id: divider
} anchors {
left: parent.left
} right: parent.right
top: urlPane.bottom
// Border }
Rectangle { z: -1
id: divider height: 1
anchors { color: "#CCCCCC"
left: parent.left }
right: parent.right
top: urlPane.bottom Rectangle {
} id: mainView
z: -1
height: 1
color: "#CCCCCC" anchors.right: parent.right
} anchors.left: parent.left
anchors.bottom: parent.bottom
Rectangle { anchors.top: divider.bottom
id: mainView
function createView(component) {
var view = component.createObject(mainView)
anchors.right: parent.right
anchors.left: parent.left return view;
anchors.bottom: parent.bottom }
anchors.top: divider.bottom }
}
function createView(component) { }
var view = component.createObject(mainView)
return view; /******************
} * Dialogs
} *****************/
} FileDialog {
} id: generalFileDialog
property var callback;
onAccepted: {
/****************** var path = this.fileUrl.toString();
* Dialogs callback.call(this, path);
*****************/ }
FileDialog {
id: generalFileDialog function show(selectExisting, callback) {
property var callback; generalFileDialog.callback = callback;
onAccepted: { generalFileDialog.selectExisting = selectExisting;
var path = this.fileUrl.toString();
callback.call(this, path); this.open();
} }
}
function show(selectExisting, callback) {
generalFileDialog.callback = callback;
generalFileDialog.selectExisting = selectExisting; /******************
* Wallet functions
this.open(); *****************/
} function importApp(path) {
} var ext = path.split('.').pop()
if(ext == "html" || ext == "htm") {
eth.openHtml(path)
/****************** }else if(ext == "qml"){
* Wallet functions addPlugin(path, {close: true, section: "apps"})
*****************/ }
function importApp(path) { }
var ext = path.split('.').pop()
if(ext == "html" || ext == "htm") {
eth.openHtml(path) function setWalletValue(value) {
}else if(ext == "qml"){ walletValueLabel.text = value
addPlugin(path, {canClose: true, section: "apps"}) }
}
} function loadPlugin(name) {
console.log("Loading plugin" + name)
var view = mainView.addPlugin(name)
function setWalletValue(value) { }
walletValueLabel.text = value
} function setPeers(text) {
peerLabel.text = text
function loadPlugin(name) { }
console.log("Loading plugin" + name)
var view = mainView.addPlugin(name) function addPeer(peer) {
} // We could just append the whole peer object but it cries if you try to alter them
peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version})
function setPeers(text) { }
peerLabel.text = text
} function resetPeers(){
peerModel.clear()
function addPeer(peer) { }
// We could just append the whole peer object but it cries if you try to alter them
peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version}) function timeAgo(unixTs){
} var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000
return (lapsed + " seconds ago")
function resetPeers(){ }
peerModel.clear()
} function convertToPretty(unixTs){
var a = new Date(unixTs*1000);
function timeAgo(unixTs){ var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000 var year = a.getFullYear();
return (lapsed + " seconds ago") var month = months[a.getMonth()];
} var date = a.getDate();
var hour = a.getHours();
function convertToPretty(unixTs){ var min = a.getMinutes();
var a = new Date(unixTs*1000); var sec = a.getSeconds();
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ;
var year = a.getFullYear(); return time;
var month = months[a.getMonth()]; }
var date = a.getDate();
var hour = a.getHours(); /**********************
var min = a.getMinutes(); * Windows
var sec = a.getSeconds(); *********************/
var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; Window {
return time; id: peerWindow
} //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint
height: 200
/********************** width: 700
* Windows Rectangle {
*********************/ anchors.fill: parent
Window { property var peerModel: ListModel {
id: peerWindow id: peerModel
//flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint }
height: 200 TableView {
width: 700 anchors.fill: parent
Rectangle { id: peerTable
anchors.fill: parent model: peerModel
property var peerModel: ListModel { TableViewColumn{width: 100; role: "ip" ; title: "IP" }
id: peerModel TableViewColumn{width: 60; role: "port" ; title: "Port" }
} TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" }
TableView { TableViewColumn{width: 100; role: "latency"; title: "Latency" }
anchors.fill: parent TableViewColumn{width: 260; role: "version" ; title: "Version" }
id: peerTable }
model: peerModel }
TableViewColumn{width: 100; role: "ip" ; title: "IP" } }
TableViewColumn{width: 60; role: "port" ; title: "Port" }
TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" } Window {
TableViewColumn{width: 100; role: "latency"; title: "Latency" } id: aboutWin
TableViewColumn{width: 260; role: "version" ; title: "Version" } visible: false
} title: "About"
} minimumWidth: 350
} maximumWidth: 350
maximumHeight: 200
Window { minimumHeight: 200
id: aboutWin
visible: false Image {
title: "About" id: aboutIcon
minimumWidth: 350 height: 150
maximumWidth: 350 width: 150
maximumHeight: 200 fillMode: Image.PreserveAspectFit
minimumHeight: 200 smooth: true
source: "../facet.png"
Image { x: 10
id: aboutIcon y: 10
height: 150 }
width: 150
fillMode: Image.PreserveAspectFit Text {
smooth: true anchors.left: aboutIcon.right
source: "../facet.png" anchors.leftMargin: 10
x: 10 anchors.top: parent.top
y: 10 anchors.topMargin: 40
} font.pointSize: 12
text: "<h2>Mist - Amalthea</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Viktor Trón<br>"
Text { }
anchors.left: aboutIcon.right }
anchors.leftMargin: 10
font.pointSize: 12 Window {
text: "<h2>Ethereal - Aitne</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>Viktor Trón<br>" id: txImportDialog
} minimumWidth: 270
} maximumWidth: 270
maximumHeight: 50
Window { minimumHeight: 50
id: txImportDialog TextField {
minimumWidth: 270 id: txImportField
maximumWidth: 270 width: 170
maximumHeight: 50 anchors.verticalCenter: parent.verticalCenter
minimumHeight: 50 anchors.left: parent.left
TextField { anchors.leftMargin: 10
id: txImportField onAccepted: {
width: 170 }
anchors.verticalCenter: parent.verticalCenter }
anchors.left: parent.left Button {
anchors.leftMargin: 10 anchors.left: txImportField.right
onAccepted: { anchors.verticalCenter: parent.verticalCenter
} anchors.leftMargin: 5
} text: "Import"
Button { onClicked: {
anchors.left: txImportField.right eth.importTx(txImportField.text)
anchors.verticalCenter: parent.verticalCenter txImportField.visible = false
anchors.leftMargin: 5 }
text: "Import" }
onClicked: { Component.onCompleted: {
eth.importTx(txImportField.text) addrField.focus = true
txImportField.visible = false }
} }
}
Component.onCompleted: { Window {
addrField.focus = true id: addPeerWin
} visible: false
} minimumWidth: 300
maximumWidth: 300
Window { maximumHeight: 50
id: addPeerWin minimumHeight: 50
visible: false title: "Connect to peer"
minimumWidth: 300
maximumWidth: 300 ComboBox {
maximumHeight: 50 id: addrField
minimumHeight: 50 anchors.verticalCenter: parent.verticalCenter
title: "Add peer" anchors.left: parent.left
anchors.right: addPeerButton.left
/* anchors.leftMargin: 10
TextField { anchors.rightMargin: 10
id: addrField onAccepted: {
anchors.verticalCenter: parent.verticalCenter eth.connectToPeer(addrField.currentText)
anchors.left: parent.left addPeerWin.visible = false
anchors.right: addPeerButton.left }
anchors.leftMargin: 10
anchors.rightMargin: 10 editable: true
placeholderText: "address:port" model: ListModel { id: pastPeers }
text: "54.76.56.74:30303"
onAccepted: { Component.onCompleted: {
eth.connectToPeer(addrField.text) var ips = eth.pastPeers()
addPeerWin.visible = false for(var i = 0; i < ips.length; i++) {
} pastPeers.append({text: ips.get(i)})
} }
*/
ComboBox { pastPeers.insert(0, {text: "54.76.56.74:30303"})
id: addrField }
anchors.verticalCenter: parent.verticalCenter }
anchors.left: parent.left
anchors.right: addPeerButton.left Button {
anchors.leftMargin: 10 id: addPeerButton
anchors.rightMargin: 10 anchors.right: parent.right
onAccepted: { anchors.verticalCenter: parent.verticalCenter
eth.connectToPeer(addrField.currentText) anchors.rightMargin: 10
addPeerWin.visible = false text: "Add"
} onClicked: {
eth.connectToPeer(addrField.currentText)
editable: true addPeerWin.visible = false
model: ListModel { id: pastPeers } }
}
Component.onCompleted: { Component.onCompleted: {
var ips = eth.pastPeers() addrField.focus = true
for(var i = 0; i < ips.length; i++) { }
pastPeers.append({text: ips.get(i)}) }
}
pastPeers.insert(0, {text: "54.76.56.74: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
}
}
} }
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