From 0e2f6691bfbbcc666c409be6b8657bd6ca475ddd Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Tue, 17 Feb 2015 17:37:26 +0100 Subject: Cut, Copy, Undo and Redo working in webview --- cmd/mist/assets/ext/mist.js | 9 +++++++-- cmd/mist/assets/qml/views/browser.qml | 10 ++++++---- cmd/mist/assets/qml/views/catalog.qml | 19 +++++++------------ 3 files changed, 20 insertions(+), 18 deletions(-) (limited to 'cmd') diff --git a/cmd/mist/assets/ext/mist.js b/cmd/mist/assets/ext/mist.js index 8734f8dc7..8589c8fc5 100644 --- a/cmd/mist/assets/ext/mist.js +++ b/cmd/mist/assets/ext/mist.js @@ -27,9 +27,14 @@ document.onkeydown = function(evt) { } else if (evt.ctrlKey && evt.keyCode == 88) { window.document.execCommand("cut"); console.log("Ctrl-X"); - } if (evt.ctrlKey && evt.keyCode == 86) { + } else if (evt.ctrlKey && evt.keyCode == 86) { + window.document.execCommand("paste"); console.log("Ctrl-V"); - } if (evt.ctrlKey && evt.keyCode == 90) { + } else if (evt.ctrlKey && evt.keyCode == 90) { + window.document.execCommand("undo"); + console.log("Ctrl-Z"); + } else if (evt.ctrlKey && evt.shiftKey && evt.keyCode == 90) { + window.document.execCommand("redo"); console.log("Ctrl-Z"); } }; \ No newline at end of file diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 54f5d755e..edecc8696 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -3,7 +3,7 @@ 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 QtWebEngine.experimental 1.0 import QtQuick.Window 2.0; Rectangle { @@ -340,7 +340,7 @@ Rectangle { WebEngineView { objectName: "webView" id: webview - //experimental.settings.javascriptCanAccessClipboard: true + experimental.settings.javascriptCanAccessClipboard: true //experimental.settings.localContentCanAccessRemoteUrls: true anchors { left: parent.left @@ -399,7 +399,8 @@ Rectangle { onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - webview.runJavaScript("document.title", function(pageTitle) { + + webview.runJavaScript("document.title", function(pageTitle) { menuItem.title = pageTitle; }); @@ -441,7 +442,8 @@ Rectangle { webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - + webview.runJavaScript(eth.readFile("mist.js")); + var cleanTitle = webview.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 497d69ed1..29e133074 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -3,7 +3,7 @@ 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 QtWebEngine.experimental 1.0 import QtQuick.Window 2.0; @@ -21,8 +21,6 @@ Rectangle { property alias windowTitle: webview.title property alias webView: webview - - property var cleanPath: false property var open: function(url) { if(!window.cleanPath) { @@ -66,9 +64,6 @@ Rectangle { } } - Component.onCompleted: { - } - Item { objectName: "root" id: root @@ -85,7 +80,7 @@ Rectangle { property var domain: "ethereum-dapp-catalog.meteor.com" url: protocol + domain - //experimental.settings.javascriptCanAccessClipboard: true + experimental.settings.javascriptCanAccessClipboard: true onJavaScriptConsoleMessage: { @@ -112,11 +107,11 @@ Rectangle { } } - // onLoadingChanged: { - // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - // webview.runJavaScript(eth.readFile("mist.js")); - // } - // } + onLoadingChanged: { + if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + webview.runJavaScript(eth.readFile("mist.js")); + } + } } -- cgit v1.2.3 From acd93c29711f18787ec3392751f57ffe08b5df28 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Wed, 18 Feb 2015 10:25:40 +0100 Subject: Removed console logs from mist.js also fixed an issue where it would force reloads unnecessarily --- cmd/mist/assets/ext/mist.js | 7 ++----- cmd/mist/assets/qml/main.qml | 8 ++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd') diff --git a/cmd/mist/assets/ext/mist.js b/cmd/mist/assets/ext/mist.js index 8589c8fc5..2fc38cdfa 100644 --- a/cmd/mist/assets/ext/mist.js +++ b/cmd/mist/assets/ext/mist.js @@ -20,21 +20,18 @@ console.log("loaded?"); document.onkeydown = function(evt) { + // This functions keeps track of keyboard inputs in order to allow copy, paste and other features + evt = evt || window.event; if (evt.ctrlKey && evt.keyCode == 67) { window.document.execCommand("copy"); - console.log("Ctrl-C"); } else if (evt.ctrlKey && evt.keyCode == 88) { window.document.execCommand("cut"); - console.log("Ctrl-X"); } else if (evt.ctrlKey && evt.keyCode == 86) { window.document.execCommand("paste"); - console.log("Ctrl-V"); } else if (evt.ctrlKey && evt.keyCode == 90) { window.document.execCommand("undo"); - console.log("Ctrl-Z"); } else if (evt.ctrlKey && evt.shiftKey && evt.keyCode == 90) { window.document.execCommand("redo"); - console.log("Ctrl-Z"); } }; \ No newline at end of file diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 9a6bf5273..78a6dd846 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -132,7 +132,11 @@ ApplicationWindow { var existingDomain = matches && matches[1]; if (requestedDomain == existingDomain) { domainAlreadyOpen = true; - mainSplit.views[i].view.url = url; + + if (mainSplit.views[i].view.url != url){ + mainSplit.views[i].view.url = url; + } + activeView(mainSplit.views[i].view, mainSplit.views[i].menuItem); } } @@ -888,7 +892,7 @@ ApplicationWindow { function addPeer(peer) { peerModel.append(peer) } function setPeerCounters(text) { - peerCounterLabel.text = text + //peerCounterLabel.text = text } function timeAgo(unixTs){ -- cgit v1.2.3 From 07bdba687f4971641c4dadc526c634dfbe4177d8 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Wed, 18 Feb 2015 10:52:36 +0100 Subject: Re-add LogFormat to Config --- cmd/ethereum/main.go | 1 + 1 file changed, 1 insertion(+) (limited to 'cmd') diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 0dba462be..d4a57ee48 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -67,6 +67,7 @@ func main() { DataDir: Datadir, LogFile: LogFile, LogLevel: LogLevel, + LogFormat: LogFormat, MaxPeers: MaxPeer, Port: OutboundPort, NAT: NAT, -- cgit v1.2.3 From 5aff8bfb5918e53ba2590b25e6c17e1875870f6a Mon Sep 17 00:00:00 2001 From: Maran Date: Thu, 19 Feb 2015 10:38:36 +0100 Subject: Implement command line argument to set the amount of agents created by the miner Defaults to the amount of cores available on the CPU --- cmd/mist/flags.go | 3 +++ cmd/mist/main.go | 27 ++++++++++++++------------- cmd/utils/cmd.go | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'cmd') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index eb280f71b..d9487de9e 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -63,6 +63,7 @@ var ( DebugFile string LogLevel int VmType int + MinerThreads int ) // flags specific to gui client @@ -137,6 +138,8 @@ func Init() { flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") + flag.IntVar(&MinerThreads, "minerthreads", runtime.NumCPU(), "number of miner threads") + flag.Parse() var err error diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 14f561e99..d41aa34bf 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -52,19 +52,20 @@ func run() error { config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: p2p.MakeName(ClientIdentifier, Version), - KeyStore: KeyStore, - DataDir: Datadir, - LogFile: LogFile, - LogLevel: LogLevel, - MaxPeers: MaxPeer, - Port: OutboundPort, - NAT: NAT, - Shh: true, - BootNodes: BootNodes, - NodeKey: NodeKey, - KeyRing: KeyRing, - Dial: true, + Name: p2p.MakeName(ClientIdentifier, Version), + KeyStore: KeyStore, + DataDir: Datadir, + LogFile: LogFile, + LogLevel: LogLevel, + MaxPeers: MaxPeer, + Port: OutboundPort, + NAT: NAT, + Shh: true, + BootNodes: BootNodes, + NodeKey: NodeKey, + KeyRing: KeyRing, + Dial: true, + MinerThreads: MinerThreads, }) if err != nil { mainlogger.Fatalln(err) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index ecb847fc3..d252f3ab2 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -225,7 +225,7 @@ func StartMining(ethereum *eth.Ethereum) bool { go func() { clilogger.Infoln("Start mining") if gminer == nil { - gminer = miner.New(addr, ethereum) + gminer = miner.New(addr, ethereum, 4) } gminer.Start() }() -- cgit v1.2.3 From 1ec6190e866eeefd91ea82b31da9f94753685a4a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 19 Feb 2015 16:39:20 +0100 Subject: cmd/mist: show peer names in peers window --- cmd/mist/assets/qml/main.qml | 3 ++- cmd/mist/gui.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index f9bfd9b8d..31d240b5f 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -927,7 +927,8 @@ ApplicationWindow { model: peerModel TableViewColumn{width: 180; role: "addr" ; title: "Remote Address" } TableViewColumn{width: 280; role: "nodeID" ; title: "Node ID" } - TableViewColumn{width: 180; role: "caps" ; title: "Capabilities" } + TableViewColumn{width: 100; role: "name" ; title: "Name" } + TableViewColumn{width: 40; role: "caps" ; title: "Capabilities" } } } } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c9419473c..efab18064 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -466,7 +466,7 @@ NumGC: %d )) } -type qmlpeer struct{ Addr, NodeID, Caps string } +type qmlpeer struct{ Addr, NodeID, Name, Caps string } type peersByID []*qmlpeer @@ -481,6 +481,7 @@ func (gui *Gui) setPeerInfo() { qpeers[i] = &qmlpeer{ NodeID: p.ID().String(), Addr: p.RemoteAddr().String(), + Name: p.Name(), Caps: fmt.Sprint(p.Caps()), } } -- cgit v1.2.3