Merge branch 'alexvandesande-ui' into develop

This commit is contained in:
obscuren 2015-03-05 17:37:09 +01:00
commit 201b09f99a
27 changed files with 544 additions and 36 deletions

View File

@ -17,7 +17,6 @@
// this function is included locally, but you can also include separately via a header definition
console.log("loaded?");
document.onkeydown = function(evt) {
// This functions keeps track of keyboard inputs in order to allow copy, paste and other features

View File

@ -46,7 +46,14 @@ ApplicationWindow {
walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/";
walletWeb.menuItem.title = "Wallet";
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false});
addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "legacy", active: false});
addPlugin("./views/network.qml", {noAdd: true, close: false, section: "ethereum", active: false});
/* var whisperTab = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "ethereum", active: false});
whisperTab.view.url = "http://ethereum-dapp-whisper-client.meteor.com/";
whisperTab.menuItem.title = "Whisper Chat";
*/
addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"});
addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"});
@ -530,6 +537,8 @@ ApplicationWindow {
Text {
id: secondary
//only shows secondary title if there's no badge
visible: (badgeContent == "icon" || badgeContent == "number" )? false : true
font.family: sourceSansPro.name
font.weight: Font.Light
anchors {
@ -691,18 +700,23 @@ ApplicationWindow {
}
Rectangle {
height: 55
height: 19
color: "transparent"
Text {
text: "ETHEREUM"
font.family: sourceSansPro.name
font.weight: Font.DemiBold
anchors {
left: parent.left
top: parent.verticalCenter
leftMargin: 16
}
color: "#AAA0A0"
font.weight: Font.Regular
// anchors.top: 20
// anchors.left: 16
anchors {
leftMargin: 12
topMargin: 4
fill: parent
}
// anchors.leftMargin: 16
// anchors.topMargin: 16
// anchors.verticalCenterOffset: 50
color: "#AAA0A0"
}
}
@ -717,17 +731,16 @@ ApplicationWindow {
}
Rectangle {
height: 55
color: "transparent"
height: 19
color: "#00ff00"
visible: (menuApps.children.length > 0)
Text {
text: "APPS"
font.family: sourceSansPro.name
font.weight: Font.DemiBold
anchors {
left: parent.left
top: parent.verticalCenter
leftMargin: 16
}
font.weight: Font.Regular
anchors.fill: parent
anchors.leftMargin: 16
color: "#AAA0A0"
}
}
@ -735,6 +748,8 @@ ApplicationWindow {
ColumnLayout {
id: menuApps
spacing: 3
anchors {
left: parent.left
right: parent.right
@ -744,6 +759,7 @@ ApplicationWindow {
Rectangle {
height: 55
color: "transparent"
visible: true
Text {
text: "DEBUG"
font.family: sourceSansPro.name
@ -760,6 +776,7 @@ ApplicationWindow {
ColumnLayout {
id: menuLegacy
visible: true
spacing: 3
anchors {
left: parent.left

View File

@ -19,20 +19,9 @@ Rectangle {
id: lastBlockLabel
objectName: "lastBlockLabel"
text: "---"
onTextChanged: {
//menuItem.secondaryTitle = text
}
}
Label {
objectName: "miningLabel"
visible: false
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
onTextChanged: {
menuItem.secondaryTitle = text
}
onTextChanged: {
//menuItem.secondaryTitle = text
}
}
ColumnLayout {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,43 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -0,0 +1,30 @@
<html>
<meta charset="utf-8">
<title>Network</title>
<!-- <base href="/"> -->
<meta name="description" content="">
<meta name="keywords" content="dapp, ethereum">
<!-- <link rel="icon" href="/favicon.ico" type="image/x-icon"> -->
<!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- <link rel="apple-touch-icon" href="/apple-touch-icon-precomposed.png"> -->
<!-- <link rel="apple-touch-startup-image" href="/startup.png"> -->
<link rel="stylesheet" type="text/css" class="__meteor-css__" href="529f30ee0ee386c5143b4ccb62073179ca8253c3.css?meteor_css_resource=true">
<body>
<script type="text/javascript">__meteor_runtime_config__ = {"meteorRelease":"METEOR@1.0.3.1","ROOT_URL":"http://localhost:3000/","ROOT_URL_PATH_PREFIX":"","appId":"e350zy16p3kznipbx5o","autoupdateVersion":"df83a37bd2952ddbb9ba6c5f2a59e9caba02642b","autoupdateVersionRefreshable":"81118ed5fac9ef5f8d55835426179e1e058da42b","autoupdateVersionCordova":"none"};</script>
<script type="text/javascript" src="205f39107b64acf34cb35d7edb57f47893187a12.js"></script>
</body>
</html>

View File

@ -0,0 +1,92 @@
body {
background-color: #000;
font: 16px solid 'Helvetica Neue', sans-serif;
}
.inject-loading-container {
position: relative;
padding-top: 20%;
/*left: 50%;*/
margin: 0 auto;
/*max-width: 600px;*/
/*margin-left: -300px;*/
text-align: center;
}
.inject-loading-container h1 {
text-align: center;
font-weight: 300;
font-size: 2em;
}
img.loading-circle {
width: 24px;
height: 24px;
animation: rotate 1s linear infinite;
-moz-animation: rotate 1s linear infinite;
-webkit-animation: rotate 1s linear infinite;
-ms-animation: rotate 1s linear infinite;
transform-origin:50% 49.5%;
-ms-transform-origin:50% 49.5%; /* IE 9 */
-moz-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */
-webkit-transform-origin:50% 49.5%; /* Chrome, Safari, Opera */
}
/* Keyframes */
@-webkit-keyframes rotate {
0% {
-webkit-transform: rotate(0deg);
}
50% {
opacity: 0.2;
}
100% {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes rotate {
0% {
-moz-transform: rotate(0deg);
}
50% {
opacity: 0.2;
}
100% {
-moz-transform: rotate(360deg);
}
}
@-o-keyframes rotate {
0% {
-o-transform: rotate(0deg);
}
50% {
opacity: 0.2;
}
100% {
-o-transform: rotate(360deg);
}
}
@-ms-keyframes rotate {
0% {
-ms-transform: rotate(0deg);
}
50% {
opacity: 0.2;
}
100% {
-ms-transform-origin: rotate(360deg);
}
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
50% {
opacity: 0.2;
}
100% {
transform: rotate(360deg);
}
}

View File

@ -0,0 +1,160 @@
import QtQuick 2.0
import QtQuick.Controls 1.0;
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0;
import QtWebEngine 1.0
import QtWebEngine.experimental 1.0
import QtQuick.Window 2.0;
import Ethereum 1.0
import Qt.WebSockets 1.0
//import "qwebchannel.js" as WebChannel
Rectangle {
id: window
anchors.fill: parent
color: "#00000000"
property var title: "Network"
property var iconSource: "../mining-icon.png"
property var menuItem
property var hideUrl: true
property alias url: webview.url
property alias windowTitle: webview.title
property alias webView: webview
property var cleanPath: false
property var open: function(url) {
if(!window.cleanPath) {
var uri = url;
if(!/.*\:\/\/.*/.test(uri)) {
uri = "http://" + uri;
}
var reg = /(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.eth)(.*)/
if(reg.test(uri)) {
uri.replace(reg, function(match, pre, domain, path) {
uri = pre;
var lookup = eth.lookupDomain(domain.substring(0, domain.length - 4));
var ip = [];
for(var i = 0, l = lookup.length; i < l; i++) {
ip.push(lookup.charCodeAt(i))
}
if(ip.length != 0) {
uri += lookup;
} else {
uri += domain;
}
uri += path;
});
}
window.cleanPath = true;
webview.url = uri;
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
uriNav.text = uri;
} else {
// Prevent inf loop.
window.cleanPath = false;
}
}
Label {
objectName: "miningLabel"
visible: false
font.pixelSize: 10
anchors.right: lastBlockLabel.left
anchors.rightMargin: 5
onTextChanged: {
menuItem.secondaryTitle = eth.miner().mining()? eth.miner().hashRate() + " Khash" : ""
}
}
Item {
objectName: "root"
id: root
anchors.fill: parent
state: "inspectorShown"
Timer {
interval: 1000; running: true; repeat: true
onTriggered: {
webview.runJavaScript("Miner.mining", function(miningSliderValue) {
// Check if it's mining and set it accordingly
if (miningSliderValue > 0 && !eth.miner().mining()) {
// If the
eth.setGasPrice("10000000000000");
eth.miner().start();
} else if (miningSliderValue == 0 && eth.miner().mining()) {
eth.miner().stop();
} else if (eth.miner().mining()) {
webview.runJavaScript('var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}}); Miner.hashrate = ' + eth.miner().hashRate() );
//var miningData = MiningData.findOne(); MiningData.update(miningData._id, {$inc: {totalTimeSpent: 1}});
} else if (miningSliderValue == "undefined") {
webview.runJavaScript('Miner.mining = 0' );
}
});
}
}
WebEngineView {
objectName: "webView"
id: webview
anchors.fill: parent
url: "network-health/index.html"
//url: "http://localhost:3000/"
experimental.settings.javascriptCanAccessClipboard: true
onJavaScriptConsoleMessage: {
console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message));
}
onLoadingChanged: {
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
webview.runJavaScript(eth.readFile("mist.js"));
}
}
}
WebEngineView {
id: inspector
visible: false
z:10
anchors {
left: root.left
right: root.right
top: root.top
bottom: root.bottom
}
}
states: [
State {
name: "inspectorShown"
PropertyChanges {
target: inspector
}
}
]
}
}

View File

@ -32,7 +32,6 @@ import (
"path"
"runtime"
"sort"
"strconv"
"time"
"github.com/ethereum/go-ethereum/core"
@ -388,7 +387,7 @@ func (gui *Gui) update() {
statsUpdateTicker := time.NewTicker(5 * time.Second)
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
miningLabel := gui.getObjectByName("miningLabel")
//miningLabel := gui.getObjectByName("miningLabel")
events := gui.eth.EventMux().Subscribe(
core.ChainEvent{},
@ -419,8 +418,7 @@ func (gui *Gui) update() {
case <-generalUpdateTicker.C:
statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String()
lastBlockLabel.Set("text", statusText)
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash")
//miningLabel.Set("text", strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10))
case <-statsUpdateTicker.C:
gui.setStatsPane()
}