From 9d2166a964d83c09481dea6ef30889f260249295 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 5 Feb 2015 08:29:41 -0800 Subject: wip --- cmd/mist/assets/examples/coin.html | 20 +++--- cmd/mist/assets/html/home.html | 142 ++++++++++++++++++------------------- 2 files changed, 81 insertions(+), 81 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index a84a828af..9d1a83171 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -93,18 +93,18 @@ function transact() { var to = document.querySelector("#address").value; if( to.length == 0 ) { - to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3"; + to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3"; } else { to = "0x"+to; } - - var value = parseInt( document.querySelector("#amount").value ); - - contract.transact({gas: "10000", gasprice: eth.gasPrice}).send( to, value ); - } - - reflesh(); - - + + var value = parseInt( document.querySelector("#amount").value ); + + contract.transact({gas: "10000", gasprice: eth.gasPrice}).send( to, value ); + } + + reflesh(); + + diff --git a/cmd/mist/assets/html/home.html b/cmd/mist/assets/html/home.html index 7116f5dde..3b27917fd 100644 --- a/cmd/mist/assets/html/home.html +++ b/cmd/mist/assets/html/home.html @@ -1,75 +1,75 @@ - -Ethereum - - - - - - -

Info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Block number
Peer count
Accounts
Gas price
Mining
Listening
Coinbase
- - - - + + Ethereum + + + + + + +

Info

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Block number
Peer count
Accounts
Gas price
Mining
Listening
Coinbase
+ + + + -- cgit v1.2.3 From 56f777b2fc77275bc636562b66a08b19afe2ec56 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 5 Feb 2015 03:16:16 +0100 Subject: cmd/ethereum, cmd/mist, core, eth, javascript, xeth: fixes for new p2p API --- cmd/mist/assets/qml/main.qml | 14 +++++++++++++- cmd/mist/assets/qml/views/info.qml | 12 ------------ cmd/mist/bindings.go | 9 --------- cmd/mist/gui.go | 25 +++++++++++-------------- cmd/mist/main.go | 6 ++---- cmd/mist/ui_lib.go | 10 ++++++++-- 6 files changed, 34 insertions(+), 42 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 357e40846..b1d3f2d19 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -844,6 +844,7 @@ ApplicationWindow { minimumHeight: 50 title: "Connect to peer" + ComboBox { id: addrField anchors.verticalCenter: parent.verticalCenter @@ -872,6 +873,17 @@ ApplicationWindow { } } + ComboBox { + id: nodeidField + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: addPeerButton.left + anchors.leftMargin: 10 + anchors.rightMargin: 10 + + editable: true + } + Button { id: addPeerButton anchors.right: parent.right @@ -879,7 +891,7 @@ ApplicationWindow { anchors.rightMargin: 10 text: "Add" onClicked: { - eth.connectToPeer(addrField.currentText) + eth.connectToPeer(addrField.currentText, nodeidField.currentText) addPeerWin.visible = false } } diff --git a/cmd/mist/assets/qml/views/info.qml b/cmd/mist/assets/qml/views/info.qml index 14ee0bce1..b2d2f521c 100644 --- a/cmd/mist/assets/qml/views/info.qml +++ b/cmd/mist/assets/qml/views/info.qml @@ -32,18 +32,6 @@ Rectangle { width: 500 } - Label { - text: "Client ID" - } - TextField { - text: gui.getCustomIdentifier() - width: 500 - placeholderText: "Anonymous" - onTextChanged: { - gui.setCustomIdentifier(text) - } - } - TextArea { objectName: "statsPane" width: parent.width diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 706c789b1..9623538a3 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -64,15 +64,6 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, d string) (string, err return gui.xeth.Transact(recipient, value, gas, gasPrice, data) } -func (gui *Gui) SetCustomIdentifier(customIdentifier string) { - gui.clientIdentity.SetCustomIdentifier(customIdentifier) - gui.config.Save("id", customIdentifier) -} - -func (gui *Gui) GetCustomIdentifier() string { - return gui.clientIdentity.GetCustomIdentifier() -} - // functions that allow Gui to implement interface guilogger.LogSystem func (gui *Gui) SetLogLevel(level logger.LogLevel) { gui.logLevel = level diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index edc799abc..dee99859c 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -41,7 +41,6 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/ui/qt/qwhisper" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" @@ -77,9 +76,8 @@ type Gui struct { xeth *xeth.XEth - Session string - clientIdentity *p2p.SimpleClientIdentity - config *ethutil.ConfigManager + Session string + config *ethutil.ConfigManager plugins map[string]plugin @@ -87,7 +85,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *p2p.SimpleClientIdentity, session string, logLevel int) *Gui { +func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, session string, logLevel int) *Gui { db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { panic(err) @@ -95,15 +93,14 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden xeth := xeth.New(ethereum) gui := &Gui{eth: ethereum, - txDb: db, - xeth: xeth, - logLevel: logger.LogLevel(logLevel), - Session: session, - open: false, - clientIdentity: clientIdentity, - config: config, - plugins: make(map[string]plugin), - serviceEvents: make(chan ServEv, 1), + txDb: db, + xeth: xeth, + logLevel: logger.LogLevel(logLevel), + Session: session, + open: false, + config: config, + plugins: make(map[string]plugin), + serviceEvents: make(chan ServEv, 1), } data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 66872a241..17ab9467a 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -52,13 +52,11 @@ func run() error { config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: ClientIdentifier, - Version: Version, + Name: p2p.MakeName(ClientIdentifier, Version), KeyStore: KeyStore, DataDir: Datadir, LogFile: LogFile, LogLevel: LogLevel, - Identifier: Identifier, MaxPeers: MaxPeer, Port: OutboundPort, NATType: PMPGateway, @@ -79,7 +77,7 @@ func run() error { utils.StartWebSockets(ethereum, WsPort) } - gui := NewWindow(ethereum, config, ethereum.ClientIdentity().(*p2p.SimpleClientIdentity), KeyRing, LogLevel) + gui := NewWindow(ethereum, config, KeyRing, LogLevel) utils.RegisterInterrupt(func(os.Signal) { gui.Stop() diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 7c5802076..2e557dba9 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -31,6 +31,7 @@ import ( "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/miner" + "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -142,8 +143,13 @@ func (ui *UiLib) Connect(button qml.Object) { } } -func (ui *UiLib) ConnectToPeer(addr string) { - if err := ui.eth.SuggestPeer(addr); err != nil { +func (ui *UiLib) ConnectToPeer(addr string, hexid string) { + id, err := discover.HexID(hexid) + if err != nil { + guilogger.Errorf("bad node ID: %v", err) + return + } + if err := ui.eth.SuggestPeer(addr, id); err != nil { guilogger.Infoln(err) } } -- cgit v1.2.3 From 2cf4fed11b01bb99e08b838f7df2b9396f42f758 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 7 Feb 2015 00:15:04 +0100 Subject: cmd/mist, eth, javascript, p2p: use Node URLs for peer suggestions --- cmd/mist/assets/qml/main.qml | 44 +++++++++----------------------------------- cmd/mist/ui_lib.go | 12 +++--------- 2 files changed, 12 insertions(+), 44 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index b1d3f2d19..45d56e795 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -205,7 +205,7 @@ ApplicationWindow { Menu { title: "Network" MenuItem { - text: "Add Peer" + text: "Connect to Node" shortcut: "Ctrl+p" onTriggered: { addPeerWin.visible = true @@ -838,60 +838,34 @@ ApplicationWindow { Window { id: addPeerWin visible: false - minimumWidth: 300 - maximumWidth: 300 + minimumWidth: 400 + maximumWidth: 400 maximumHeight: 50 minimumHeight: 50 - title: "Connect to peer" + title: "Connect to Node" - - ComboBox { + TextField { id: addrField + placeholderText: "enode://::" anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.right: addPeerButton.left anchors.leftMargin: 10 anchors.rightMargin: 10 onAccepted: { - eth.connectToPeer(addrField.currentText) + eth.connectToPeer(addrField.text) addPeerWin.visible = false } - - editable: true - model: ListModel { id: pastPeers } - - Component.onCompleted: { - pastPeers.insert(0, {text: "poc-8.ethdev.com:30303"}) - /* - var ips = eth.pastPeers() - for(var i = 0; i < ips.length; i++) { - pastPeers.append({text: ips.get(i)}) - } - - pastPeers.insert(0, {text: "poc-7.ethdev.com:30303"}) - */ - } } - ComboBox { - id: nodeidField - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.right: addPeerButton.left - anchors.leftMargin: 10 - anchors.rightMargin: 10 - - editable: true - } - Button { id: addPeerButton anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 10 - text: "Add" + text: "Connect" onClicked: { - eth.connectToPeer(addrField.currentText, nodeidField.currentText) + eth.connectToPeer(addrField.text) addPeerWin.visible = false } } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 2e557dba9..dbebd8a6f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -31,7 +31,6 @@ import ( "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -143,14 +142,9 @@ func (ui *UiLib) Connect(button qml.Object) { } } -func (ui *UiLib) ConnectToPeer(addr string, hexid string) { - id, err := discover.HexID(hexid) - if err != nil { - guilogger.Errorf("bad node ID: %v", err) - return - } - if err := ui.eth.SuggestPeer(addr, id); err != nil { - guilogger.Infoln(err) +func (ui *UiLib) ConnectToPeer(nodeURL string) { + if err := ui.eth.SuggestPeer(nodeURL); err != nil { + guilogger.Infoln("SuggestPeer error: " + err.Error()) } } -- cgit v1.2.3 From 028775a0863946c1e9ad51fe7b22faa5c59b2605 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 7 Feb 2015 00:38:36 +0100 Subject: cmd/ethereum, cmd/mist: add flag for discovery bootstrap nodes --- cmd/mist/flags.go | 4 ++-- cmd/mist/main.go | 5 +++-- cmd/mist/ui_lib.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index f042b39b0..3a7d2ac54 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -51,7 +51,7 @@ var ( AddPeer string MaxPeer int GenAddr bool - SeedNode string + BootNodes string SecretFile string ExportDir string NonInteractive bool @@ -116,7 +116,7 @@ func Init() { flag.BoolVar(&StartRpc, "rpc", true, "start rpc server") flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") - flag.StringVar(&SeedNode, "seednode", "poc-8.ethdev.com:30303", "ip:port of seed node to connect to. Set to blank for skip") + flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 17ab9467a..5bae33088 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -59,8 +59,9 @@ func run() error { LogLevel: LogLevel, MaxPeers: MaxPeer, Port: OutboundPort, - NATType: PMPGateway, + NATType: NatType, PMPGateway: PMPGateway, + BootNodes: BootNodes, KeyRing: KeyRing, Dial: true, }) @@ -82,7 +83,7 @@ func run() error { utils.RegisterInterrupt(func(os.Signal) { gui.Stop() }) - go utils.StartEthereum(ethereum, SeedNode) + go utils.StartEthereum(ethereum) fmt.Println("ETH stack took", time.Since(tstart)) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index dbebd8a6f..ba3ac3b61 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -136,7 +136,7 @@ func (ui *UiLib) Muted(content string) { func (ui *UiLib) Connect(button qml.Object) { if !ui.connected { - ui.eth.Start(SeedNode) + ui.eth.Start() ui.connected = true button.Set("enabled", false) } -- cgit v1.2.3 From a3cd2187194b79cd8b14c4ec4f1abca91a0147e0 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 10 Feb 2015 12:30:09 +0100 Subject: cmd/mist, cmd/ethereum: add CLI arguments for node key --- cmd/mist/flags.go | 34 ++++++++++++++++++++++++++++------ cmd/mist/main.go | 1 + 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 3a7d2ac54..dd72b5043 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -21,6 +21,7 @@ package main import ( + "crypto/ecdsa" "flag" "fmt" "log" @@ -31,6 +32,7 @@ import ( "runtime" "bitbucket.org/kardianos/osext" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/vm" ) @@ -44,7 +46,6 @@ var ( StartWebSockets bool RpcPort int WsPort int - UseUPnP bool NatType string OutboundPort string ShowGenesis bool @@ -52,6 +53,7 @@ var ( MaxPeer int GenAddr bool BootNodes string + NodeKey *ecdsa.PrivateKey SecretFile string ExportDir string NonInteractive bool @@ -99,6 +101,7 @@ func defaultDataDir() string { var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini") func Init() { + // TODO: move common flag processing to cmd/utils flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s [options] [filename]:\noptions precedence: default < config file < environment variables < command line\n", os.Args[0]) flag.PrintDefaults() @@ -108,30 +111,49 @@ func Init() { flag.StringVar(&Identifier, "id", "", "Custom client identifier") flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") - flag.StringVar(&OutboundPort, "port", "30303", "listening port") - flag.BoolVar(&UseUPnP, "upnp", true, "enable UPnP support") - flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8545, "port to start json-rpc server on") flag.IntVar(&WsPort, "wsport", 40404, "port to start websocket rpc server on") flag.BoolVar(&StartRpc, "rpc", true, "start rpc server") flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") - flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)") flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given") flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use") - flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(logger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") + // Network stuff + var ( + nodeKeyFile = flag.String("nodekey", "", "network private key file") + nodeKeyHex = flag.String("nodekeyhex", "", "network private key (for testing)") + ) + flag.StringVar(&OutboundPort, "port", "30303", "listening port") + flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for NAT-PMP") + flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") + flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") + flag.Parse() + var err error + switch { + case *nodeKeyFile != "" && *nodeKeyHex != "": + log.Fatal("Options -nodekey and -nodekeyhex are mutually exclusive") + case *nodeKeyFile != "": + if NodeKey, err = crypto.LoadECDSA(*nodeKeyFile); err != nil { + log.Fatalf("-nodekey: %v", err) + } + case *nodeKeyHex != "": + if NodeKey, err = crypto.HexToECDSA(*nodeKeyHex); err != nil { + log.Fatalf("-nodekeyhex: %v", err) + } + } + if VmType >= int(vm.MaxVmTy) { log.Fatal("Invalid VM type ", VmType) } diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 5bae33088..4d6bac9b7 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -62,6 +62,7 @@ func run() error { NATType: NatType, PMPGateway: PMPGateway, BootNodes: BootNodes, + NodeKey: NodeKey, KeyRing: KeyRing, Dial: true, }) -- cgit v1.2.3 From da2fae0e437f9467a943acfe0571a8a24e8e76fd Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 9 Feb 2015 16:20:34 +0100 Subject: Basic structure miner --- cmd/mist/gui.go | 2 +- cmd/mist/ui_lib.go | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index edc799abc..fdd823171 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -455,7 +455,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.GetPow().GetHashrate(), 10)+"Khash") + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.HashRate(), 10)+"/Khash") /* blockLength := gui.eth.BlockPool().BlocksProcessed diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 7c5802076..3b9e35c1b 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -209,17 +209,20 @@ func (self *UiLib) Call(params map[string]interface{}) (string, error) { } func (self *UiLib) AddLocalTransaction(to, data, gas, gasPrice, value string) int { - return self.miner.AddLocalTx(&miner.LocalTx{ - To: ethutil.Hex2Bytes(to), - Data: ethutil.Hex2Bytes(data), - Gas: gas, - GasPrice: gasPrice, - Value: value, - }) - 1 + return 0 + /* + return self.miner.AddLocalTx(&miner.LocalTx{ + To: ethutil.Hex2Bytes(to), + Data: ethutil.Hex2Bytes(data), + Gas: gas, + GasPrice: gasPrice, + Value: value, + }) - 1 + */ } func (self *UiLib) RemoveLocalTransaction(id int) { - self.miner.RemoveLocalTx(id) + //self.miner.RemoveLocalTx(id) } func (self *UiLib) SetGasPrice(price string) { -- cgit v1.2.3 From df49c609a0fd055a4f0dac89db6863ad5532228f Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 11 Feb 2015 13:26:44 +0100 Subject: updated coin --- cmd/mist/assets/examples/coin.html | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index 71b359834..546c6f13f 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -7,7 +7,7 @@ -

JevCoin

+

JevCoin

Balance @@ -58,29 +58,25 @@ }], "outputs": [] }, { - "name":"changed", + "name":"received", "type":"event", "inputs": [ - {"name":"to","type":"address","indexed":true}, {"name":"from","type":"address","indexed":true}, + {"name":"amount","type":"uint256","indexed":true}, ], }]; var address = localStorage.getItem("address"); // deploy if not exist if (address == null) { - var code = "0x60056013565b610132806100356000396000f35b620f4240600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b61003361012d565b60006000f35b610047600435602435610062565b60006000f35b61005860043561010b565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054106100855761008a565b610107565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555081600160a060020a031633600160a060020a03167f1863989b4bb7c5c3941722099764574df7a459f9f9c6b6cdca35ddc9731792b860006000a35b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"; - address = web3.eth.transact({ - data: code, - gasPrice: "1000000000000000", - gas: "10000", - }); + var code = "0x60056013565b61012b806100346000396000f35b6103e8600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b610033610126565b60006000f35b610047600435602435610062565b60006000f35b610058600435610104565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054101561008657610100565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555033600160a060020a0316600052806020527ff11e547d796cc64acdf758e7cee90439494fd886a19159454aa61e473fdbafef60406000a15b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"; + address = web3.eth.transact({data: code}); localStorage.setItem("address", address); } - document.querySelector("#address").innerHTML = address.toUpperCase(); + document.querySelector("#contract_addr").innerHTML = address.toUpperCase(); var contract = web3.eth.contract(address, desc); - contract.changed({from: eth.accounts[0]}).changed(function() { + contract.received({from: eth.coinbase}).changed(function() { refresh(); }); eth.watch('chain').changed(function() { @@ -102,7 +98,6 @@ function transact() { var to = document.querySelector("#address").value; - if( to.length == 0 ) { to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3"; } else { -- cgit v1.2.3 From 6221b282d40c18c5c79c459e3b6218cd565a20b1 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Wed, 11 Feb 2015 19:16:35 +0100 Subject: Catalog Page Behaviour --- cmd/mist/assets/qml/main.qml | 54 +++++++++---- cmd/mist/assets/qml/views/browser.qml | 19 +++-- cmd/mist/assets/qml/views/catalog.qml | 142 +++++++++++----------------------- 3 files changed, 96 insertions(+), 119 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index e169f54ec..d03ef43d9 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -39,7 +39,7 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { - addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); + var catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); @@ -49,9 +49,9 @@ ApplicationWindow { addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); - mainSplit.setView(wallet.view, wallet.menuItem); + mainSplit.setView(catalog.view, catalog.menuItem); - newBrowserTab("http://ethereum-dapp-whisper-client.meteor.com/chat/amsteam"); + //newBrowserTab("http://ethereum-dapp-catalog.meteor.com"); // Command setup gui.sendCommand(0) @@ -114,10 +114,33 @@ ApplicationWindow { } function newBrowserTab(url) { - var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true}); - window.view.url = url; - window.menuItem.title = "Mist"; - activeView(window.view, window.menuItem); + + var urlMatches = url.toString().match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); + var requestedDomain = urlMatches && urlMatches[1]; + + var domainAlreadyOpen = false; + + console.log("requested: " + requestedDomain ) + + for(var i = 0; i < mainSplit.views.length; i++) { + if (mainSplit.views[i].view.url) { + var matches = mainSplit.views[i].view.url.toString().match(/^[a-z]*\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i); + var existingDomain = matches && matches[1]; + console.log("exists: " + existingDomain); + if (requestedDomain == existingDomain) { + domainAlreadyOpen = true; + mainSplit.views[i].view.url = url; + activeView(mainSplit.views[i].view, mainSplit.views[i].menuItem); + } + } + } + + if (!domainAlreadyOpen) { + var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true}); + window.view.url = url; + window.menuItem.title = "Mist"; + activeView(window.view, window.menuItem); + } } @@ -332,8 +355,9 @@ ApplicationWindow { id: mainSplit anchors.fill: parent - resizing: false + //resizing: false // this is NOT where we remove that damning resizing handle.. handleDelegate: Item { + //This handle is a way to remove the line between the split views Rectangle { anchors.fill: parent } @@ -497,7 +521,7 @@ ApplicationWindow { anchors.fill: parent border.width: 0 radius: 5 - color: "#FFFFFFFF" + color: "#FAFAFA" } Rectangle { anchors { @@ -506,7 +530,7 @@ ApplicationWindow { right: r.right } width: 10 - color: "#FFFFFFFF" + color: "#FAFAFA" border.width:0 Rectangle { @@ -517,7 +541,7 @@ ApplicationWindow { top: parent.top } height: 1 - color: "#FFFFFF" + color: "#FAFAFA" } Rectangle { @@ -528,7 +552,7 @@ ApplicationWindow { bottom: parent.bottom } height: 1 - color: "#FFFFFF" + color: "#FAFAFA" } } } @@ -800,7 +824,7 @@ ApplicationWindow { anchors.top: parent.top color: "#00000000" - Rectangle { + /*Rectangle { id: urlPane height: 40 color: "#00000000" @@ -847,7 +871,7 @@ ApplicationWindow { z: -1 height: 1 color: "#CCCCCC" - } + }*/ Rectangle { id: mainView @@ -855,7 +879,7 @@ ApplicationWindow { anchors.right: parent.right anchors.left: parent.left anchors.bottom: parent.bottom - anchors.top: divider.bottom + anchors.top: parent.top function createView(component) { var view = component.createObject(mainView) diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index db89c6837..04b2229ec 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -345,14 +345,21 @@ Rectangle { if (topBarStyle=="transparent") { // Adjust for a transparent sidebar Dapp - navBarBackground.visible = false; - back.visible = false; - appInfoPane.anchors.leftMargin = -16; - appInfoPaneShadow.anchors.leftMargin = -16; - webview.anchors.topMargin = -74; + navBarBackground.visible = false; + back.visible = false; + appInfoPane.anchors.leftMargin = -16; + appInfoPaneShadow.anchors.leftMargin = -16; + webview.anchors.topMargin = -74; webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')") - }; + } else { + navBarBackground.visible = true; + back.visible = true; + appInfoPane.anchors.leftMargin = 0; + appInfoPaneShadow.anchors.leftMargin = 0; + webview.anchors.topMargin = 0; + + }; }); diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 7f42c25dc..a7832e9fa 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -12,7 +12,7 @@ Rectangle { anchors.fill: parent color: "#00000000" - property var title: "" + property var title: "Catalog" property var iconSource: "" property var menuItem property var hideUrl: true @@ -75,111 +75,57 @@ Rectangle { anchors.fill: parent state: "inspectorShown" - RowLayout { - id: navBar - height: 184 - z: 20 - - anchors { - left: parent.left - right: parent.right - } - - Rectangle { - id: appInfoPane - height: 28 - color: "#efefef" - radius: 6 - z:25 - - MouseArea { - anchors.fill: parent - z: 10 - hoverEnabled: true - onEntered: { - uriNav.visible = true - appTitle.visible = false - appDomain.visible = false - } - } - - anchors { - left: parent.left - right: parent.right - leftMargin: 10 - rightMargin: 10 - top: parent.verticalCenter - topMargin: 23 - } - - TextField { - id: uriNav - anchors { - left: parent.left - right: parent.right - leftMargin: 16 - top: parent.verticalCenter - topMargin: -10 - } - - horizontalAlignment: Text.AlignHCenter - - style: TextFieldStyle { - textColor: "#928484" - background: Rectangle { - border.width: 0 - color: "transparent" - } - } - text: "Type the address of a new Dapp"; - y: parent.height / 2 - this.height / 2 - z: 30 - activeFocusOnPress: true - Keys.onReturnPressed: { - newBrowserTab(this.text); - this.text = "Type the address of a new Dapp"; - } - - } - } - - Rectangle { - id: appInfoPaneShadow - width: 10 - height: 30 - color: "#BDB6B6" - radius: 6 - z: 15 - - anchors { - left: parent.left - right: parent.right - leftMargin:10 - rightMargin:10 - top: parent.verticalCenter - topMargin: 23 - } - - - } - - } - - WebEngineView { objectName: "webView" id: webview anchors.fill: parent - onLoadingChanged: { - if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - webview.runJavaScript(eth.readFile("bignumber.min.js")); - webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - } - } + property var protocol: "http://" + //property var domain: "localhost:3000" + property var domain: "ethereum-dapp-catalog.meteor.com" + url: protocol + domain + + //navigationRequest: WebEngineView.IgnoreRequest + // onLoadingChanged: { + // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + // webview.runJavaScript(eth.readFile("bignumber.min.js")); + // webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); + // } + // } + + //onNavigationRequested: { + // detect URL scheme prefix, most likely an external link + //var schemaRE = /^\w+:/; + //if (schemaRE.test(request.url)) { + // request.action = WebView.AcceptRequest; + //} else { + //request.action = WebView.IgnoreRequest; + // delegate request.url here + //} + //} + onJavaScriptConsoleMessage: { console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message)); } + + onNavigationRequested: { + var cleanTitle = request.url.toString() + var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); + var requestedDomain = matches && matches[1]; + + console.debug ("NavigationRequested: " + request.url + " navigationType=" + request.navigationType) + + if(request.navigationType==0){ + + if (requestedDomain === this.domain){ + request.action = WebEngineView.AcceptRequest; + } else { + request.action = WebEngineView.IgnoreRequest; + newBrowserTab(request.url); + } + + } + } } -- cgit v1.2.3 From 3f6baa45a7fb1ae5fd7966d2763a2a776a65eb96 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 11 Feb 2015 23:46:45 +0100 Subject: Documented methods & removed old manifest --- cmd/mist/assets/examples/coin.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 cmd/mist/assets/examples/coin.js (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.js b/cmd/mist/assets/examples/coin.js new file mode 100644 index 000000000..ada9d196c --- /dev/null +++ b/cmd/mist/assets/examples/coin.js @@ -0,0 +1 @@ +var contract = web3.eth.contractFromAbi([{"constant":false,"inputs":[{"name":"_h","type":"hash256"}],"name":"confirm","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_data","type":"bytes"}],"name":"execute","outputs":[{"name":"_r","type":"hash256"}],"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"}],"name":"kill","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"}],"name":"changeOwner","outputs":[],"type":"function"},{"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"CashIn","type":"event"},{"inputs":[{"indexed":true,"name":"out","type":"string32"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"to","type":"address"}],"name":"SingleTransact","type":"event"},{"inputs":[{"indexed":true,"name":"out","type":"string32"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"operation","type":"hash256"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"to","type":"address"}],"name":"MultiTransact","type":"event"}]); -- cgit v1.2.3 From 31fdc645ed9c6bfa63deb8a688888b6cacfd821e Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 12 Feb 2015 15:03:53 +0100 Subject: cmd + t switches to new dapp window --- cmd/mist/assets/qml/main.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index d03ef43d9..2b56b7236 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -17,6 +17,7 @@ ApplicationWindow { // Use this to make the window frameless. But then you'll need to do move and resize by hand property var ethx : Eth.ethx + property var catalog; width: 1200 height: 820 @@ -39,7 +40,7 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { - var catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); + catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); @@ -169,7 +170,7 @@ ApplicationWindow { text: "New tab" shortcut: "Ctrl+t" onTriggered: { - newBrowserTab("http://etherian.io"); + activeView(catalog.view, catalog.menuItem); } } -- cgit v1.2.3 From 38faf2c51a1e4a86cda5dfa1b4f7fdae4fd7f58d Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 12 Feb 2015 17:06:15 +0100 Subject: removed messages --- cmd/mist/ext_app.go | 26 -------------------------- cmd/mist/html_container.go | 14 -------------- cmd/mist/qml_container.go | 6 ------ 3 files changed, 46 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 20ec52e60..4831884e5 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -24,7 +24,6 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/ui/qt" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" @@ -39,7 +38,6 @@ type AppContainer interface { NewBlock(*types.Block) NewWatcher(chan bool) - Messages(state.Messages, string) Post(string, int) } @@ -79,10 +77,6 @@ func (app *ExtApplication) run() { return } - // Subscribe to events - mux := app.lib.eth.EventMux() - app.events = mux.Subscribe(core.NewBlockEvent{}, state.Messages(nil)) - // Call the main loop go app.mainLoop() @@ -126,23 +120,3 @@ func (app *ExtApplication) mainLoop() { func (self *ExtApplication) Watch(filterOptions map[string]interface{}, identifier string) { self.filters[identifier] = qt.NewFilterFromMap(filterOptions, self.eth) } - -func (self *ExtApplication) GetMessages(object map[string]interface{}) string { - /* TODO remove me - filter := qt.NewFilterFromMap(object, self.eth) - - messages := filter.Find() - var msgs []javascript.JSMessage - for _, m := range messages { - msgs = append(msgs, javascript.NewJSMessage(m)) - } - - b, err := json.Marshal(msgs) - if err != nil { - return "{\"error\":" + err.Error() + "}" - } - - return string(b) - */ - return "" -} diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 0909a6abd..e4ea57b9b 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -31,7 +31,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" "github.com/howeyc/fsnotify" "github.com/obscuren/qml" @@ -144,19 +143,6 @@ func (app *HtmlApplication) NewBlock(block *types.Block) { app.webView.Call("onNewBlockCb", b) } -func (self *HtmlApplication) Messages(messages state.Messages, id string) { - /* TODO remove me - var msgs []javascript.JSMessage - for _, m := range messages { - msgs = append(msgs, javascript.NewJSMessage(m)) - } - - b, _ := json.Marshal(msgs) - - self.webView.Call("onWatchedCb", string(b), id) - */ -} - func (app *HtmlApplication) Destroy() { app.engine.Destroy() } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 9d76d8fe4..16a055bc0 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -22,12 +22,10 @@ package main import ( - "fmt" "runtime" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -74,10 +72,6 @@ func (app *QmlApplication) NewBlock(block *types.Block) { app.win.Call("onNewBlockCb", pblock) } -func (self *QmlApplication) Messages(msgs state.Messages, id string) { - fmt.Println("IMPLEMENT QML APPLICATION MESSAGES METHOD") -} - // Getters func (app *QmlApplication) Engine() *qml.Engine { return app.engine -- cgit v1.2.3 From d0a2e655c9599f462bb20bd49bc69b8e1e330a21 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 11 Feb 2015 17:19:31 +0100 Subject: cmd/ethereum, cmd/mist, eth, p2p: use package p2p/nat This deletes the old NAT implementation. --- cmd/mist/flags.go | 10 ++++++---- cmd/mist/main.go | 25 ++++++++++++------------- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index dd72b5043..eb280f71b 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -34,6 +34,7 @@ import ( "bitbucket.org/kardianos/osext" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/vm" ) @@ -41,12 +42,10 @@ var ( Identifier string KeyRing string KeyStore string - PMPGateway string StartRpc bool StartWebSockets bool RpcPort int WsPort int - NatType string OutboundPort string ShowGenesis bool AddPeer string @@ -54,6 +53,7 @@ var ( GenAddr bool BootNodes string NodeKey *ecdsa.PrivateKey + NAT nat.Interface SecretFile string ExportDir string NonInteractive bool @@ -117,7 +117,6 @@ func Init() { flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") - flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)") flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given") flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") @@ -132,15 +131,18 @@ func Init() { var ( nodeKeyFile = flag.String("nodekey", "", "network private key file") nodeKeyHex = flag.String("nodekeyhex", "", "network private key (for testing)") + natstr = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:)") ) flag.StringVar(&OutboundPort, "port", "30303", "listening port") - flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for NAT-PMP") flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers") flag.Parse() var err error + if NAT, err = nat.Parse(*natstr); err != nil { + log.Fatalf("-nat: %v", err) + } switch { case *nodeKeyFile != "" && *nodeKeyHex != "": log.Fatal("Options -nodekey and -nodekeyhex are mutually exclusive") diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 4d6bac9b7..52b5e4e94 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -52,19 +52,18 @@ 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, - NATType: NatType, - PMPGateway: PMPGateway, - 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, + BootNodes: BootNodes, + NodeKey: NodeKey, + KeyRing: KeyRing, + Dial: true, }) if err != nil { mainlogger.Fatalln(err) -- cgit v1.2.3 From bde3ff16ad98cb4ab0befc899f7f0584d21ff9a4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 16:02:37 +0100 Subject: merge --- cmd/mist/assets/examples/coin.html | 6 + cmd/mist/assets/qml/main.qml | 869 +------------------------------------ 2 files changed, 7 insertions(+), 868 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index 546c6f13f..99e0c7643 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -79,6 +79,12 @@ contract.received({from: eth.coinbase}).changed(function() { refresh(); }); + + var ev = contract.SingleTransact({}) + ev.watch(function(log) { + someElement.innerHTML += "tnaheousnthaoeu"; + }); + eth.watch('chain').changed(function() { refresh(); }); diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 8f9a2d3cc..2b56b7236 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -11,7 +11,6 @@ import "../ext/http.js" as Http ApplicationWindow { -<<<<<<< HEAD id: root //flags: Qt.FramelessWindowHint @@ -1102,870 +1101,4 @@ ApplicationWindow { addrField.focus = true } } - } -======= - id: root - - property var ethx : Eth.ethx - - width: 1200 - height: 820 - minimumWidth: 300 - - title: "Mist" - - 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}); - addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); - - 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"}); - addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"}); - addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); - - mainSplit.setView(wallet.view, wallet.menuItem); - - newBrowserTab(eth.assetPath("html/home.html")); - - // Command setup - gui.sendCommand(0) - } - - function activeView(view, menuItem) { - mainSplit.setView(view, menuItem) - if (view.hideUrl) { - urlPane.visible = false; - mainView.anchors.top = rootView.top - } else { - urlPane.visible = true; - mainView.anchors.top = divider.bottom - } - } - - 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) { - console.log(e) - } - } - - function newBrowserTab(url) { - var window = addPlugin("./views/browser.qml", {noAdd: true, close: true, section: "apps", active: true}); - window.view.url = url; - window.menuItem.title = "Mist"; - activeView(window.view, window.menuItem); - } - - menuBar: MenuBar { - Menu { - title: "File" - MenuItem { - text: "Import App" - shortcut: "Ctrl+o" - onTriggered: { - generalFileDialog.show(true, importApp) - } - } - - MenuItem { - text: "Add plugin" - onTriggered: { - generalFileDialog.show(true, function(path) { - addPlugin(path, {close: true, section: "apps"}) - }) - } - } - - MenuItem { - text: "New tab" - shortcut: "Ctrl+t" - onTriggered: { - newBrowserTab("about:blank"); - } - } - - 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 {} - } - - Menu { - title: "Network" - MenuItem { - text: "Connect to Node" - 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 - Label { - //y: 6 - 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 { - visible: false - id: downloadIndicator - value: 0 - objectName: "downloadIndicator" - y: -4 - x: statusBar.width / 2 - this.width / 2 - width: 160 - } - - Label { - visible: false - 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: 10 - text: "0 / 0" - } - } - } - - - property var blockModel: ListModel { - id: blockModel - } - - SplitView { - property var views: []; - - id: mainSplit - anchors.fill: parent - resizing: false - - function setView(view, menu) { - for(var i = 0; i < views.length; i++) { - views[i].view.visible = false - views[i].menuItem.setSelection(false) - } - view.visible = true - menu.setSelection(true) - } - - function addComponent(view, options) { - view.visible = false - view.anchors.fill = mainView - - var menuItem = menu.createMenuItem(view, options); - if( view.hasOwnProperty("menuItem") ) { - view.menuItem = menuItem; - } - - if( view.hasOwnProperty("onReady") ) { - view.onReady.call(view) - } - - if( options.active ) { - setView(view, menuItem) - } - - - return {view: view, menuItem: menuItem} - } - - /********************* - * Main menu. - ********************/ - Rectangle { - id: menu - Layout.minimumWidth: 210 - Layout.maximumWidth: 210 - anchors.top: parent.top - color: "#ececec" - - Component { - id: menuItemTemplate - Rectangle { - id: menuItem - property var view; - property var path; - property var closable; - - property alias title: label.text - property alias icon: icon.source - property alias secondaryTitle: secondary.text - function setSelection(on) { - sel.visible = on - } - - width: 206 - height: 28 - color: "#00000000" - - anchors { - left: parent.left - leftMargin: 4 - } - - Rectangle { - id: sel - visible: false - anchors.fill: parent - color: "#00000000" - Rectangle { - id: r - anchors.fill: parent - border.color: "#CCCCCC" - border.width: 1 - radius: 5 - color: "#FFFFFFFF" - } - Rectangle { - anchors { - top: r.top - bottom: r.bottom - right: r.right - } - width: 10 - color: "#FFFFFFFF" - - Rectangle { - anchors { - left: parent.left - right: parent.right - top: parent.top - } - height: 1 - color: "#CCCCCC" - } - - Rectangle { - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 1 - color: "#CCCCCC" - } - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - activeView(view, menuItem); - } - } - - Image { - id: icon - height: 20 - width: 20 - anchors { - left: parent.left - verticalCenter: parent.verticalCenter - leftMargin: 3 - } - MouseArea { - anchors.fill: parent - onClicked: { - menuItem.closeApp() - } - } - } - - Text { - id: label - anchors { - left: icon.right - verticalCenter: parent.verticalCenter - leftMargin: 3 - } - - color: "#0D0A01" - font.pixelSize: 12 - } - - Text { - id: secondary - anchors { - right: parent.right - rightMargin: 8 - verticalCenter: parent.verticalCenter - } - color: "#AEADBE" - font.pixelSize: 12 - } - - - function closeApp() { - if(!this.closable) { return; } - - if(this.view.hasOwnProperty("onDestroy")) { - this.view.onDestroy.call(this.view) - } - - this.view.destroy() - this.destroy() - for (var i = 0; i < mainSplit.views.length; i++) { - var view = mainSplit.views[i]; - if (view.menuItem === this) { - mainSplit.views.splice(i, 1); - break; - } - } - gui.removePlugin(this.path) - activeView(mainSplit.views[0].view, mainSplit.views[0].menuItem); - } - } - } - - function createMenuItem(view, options) { - if(options === undefined) { - options = {}; - } - - 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 - - if(view.hasOwnProperty("iconSource")) { - comp.icon = view.iconSource; - } - comp.closable = options.close; - - return comp - } - - ColumnLayout { - id: menuColumn - y: 10 - width: parent.width - anchors.left: parent.left - anchors.right: parent.right - spacing: 3 - - Text { - text: "ETHEREUM" - font.bold: true - anchors { - left: parent.left - leftMargin: 5 - } - color: "#888888" - } - - ColumnLayout { - id: menuDefault - spacing: 3 - anchors { - left: parent.left - right: parent.right - } - } - - - Text { - text: "NET" - font.bold: true - anchors { - left: parent.left - leftMargin: 5 - } - color: "#888888" - } - - ColumnLayout { - id: menuApps - spacing: 3 - anchors { - left: parent.left - right: parent.right - } - } - - Text { - text: "DEBUG" - font.bold: true - anchors { - left: parent.left - leftMargin: 5 - } - color: "#888888" - } - - ColumnLayout { - id: menuLegacy - spacing: 3 - anchors { - left: parent.left - right: parent.right - } - } - } - } - - /********************* - * Main view - ********************/ - Rectangle { - id: rootView - anchors.right: parent.right - anchors.left: menu.right - anchors.bottom: parent.bottom - anchors.top: parent.top - color: "#00000000" - - Rectangle { - id: urlPane - height: 40 - color: "#00000000" - anchors { - left: parent.left - right: parent.right - leftMargin: 5 - rightMargin: 5 - top: parent.top - topMargin: 5 - } - TextField { - id: url - objectName: "url" - placeholderText: "DApp URL" - anchors { - left: parent.left - right: parent.right - top: parent.top - topMargin: 5 - rightMargin: 5 - leftMargin: 5 - } - - Keys.onReturnPressed: { - if(/^https?/.test(this.text)) { - newBrowserTab(this.text); - } else { - addPlugin(this.text, {close: true, section: "apps"}) - } - } - } - - } - - // Border - Rectangle { - id: divider - anchors { - left: parent.left - right: parent.right - top: urlPane.bottom - } - z: -1 - height: 1 - color: "#CCCCCC" - } - - Rectangle { - id: mainView - color: "#00000000" - anchors.right: parent.right - anchors.left: parent.left - 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(); - callback.call(this, path); - } - - function show(selectExisting, callback) { - generalFileDialog.callback = callback; - generalFileDialog.selectExisting = selectExisting; - - this.open(); - } - } - - - /****************** - * Wallet functions - *****************/ - function importApp(path) { - var ext = path.split('.').pop() - if(ext == "html" || ext == "htm") { - eth.openHtml(path) - }else if(ext == "qml"){ - addPlugin(path, {close: true, section: "apps"}) - } - } - - - function setWalletValue(value) { - walletValueLabel.text = value - } - - function loadPlugin(name) { - console.log("Loading plugin" + name) - var view = mainView.addPlugin(name) - } - - 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 - peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version, caps: peer.caps}) - } - - function resetPeers(){ - peerModel.clear() - } - - function timeAgo(unixTs){ - var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000 - return (lapsed + " seconds ago") - } - - function convertToPretty(unixTs){ - var a = new Date(unixTs*1000); - var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; - var year = a.getFullYear(); - var month = months[a.getMonth()]; - var date = a.getDate(); - var hour = a.getHours(); - var min = a.getMinutes(); - var sec = a.getSeconds(); - var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ; - return time; - } - - /********************** - * Windows - *********************/ - Window { - id: peerWindow - //flags: Qt.CustomizeWindowHint | Qt.Tool | Qt.WindowCloseButtonHint - height: 200 - width: 700 - Rectangle { - anchors.fill: parent - property var peerModel: ListModel { - id: peerModel - } - TableView { - anchors.fill: parent - id: peerTable - model: peerModel - TableViewColumn{width: 200; role: "ip" ; title: "IP" } - TableViewColumn{width: 260; role: "version" ; title: "Version" } - TableViewColumn{width: 180; role: "caps" ; title: "Capabilities" } - } - } - } - - Window { - id: aboutWin - visible: false - title: "About" - minimumWidth: 350 - maximumWidth: 350 - maximumHeight: 280 - minimumHeight: 280 - - Image { - id: aboutIcon - height: 150 - width: 150 - fillMode: Image.PreserveAspectFit - smooth: true - source: "../facet.png" - x: 10 - y: 30 - } - - Text { - anchors.left: aboutIcon.right - anchors.leftMargin: 10 - anchors.top: parent.top - anchors.topMargin: 30 - font.pointSize: 12 - text: "

Mist (0.7.10)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy

UX

Alex van de Sande
" - } - } - - Window { - id: txImportDialog - minimumWidth: 270 - maximumWidth: 270 - maximumHeight: 50 - minimumHeight: 50 - TextField { - id: txImportField - width: 170 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 10 - onAccepted: { - } - } - Button { - anchors.left: txImportField.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 5 - text: "Import" - onClicked: { - eth.importTx(txImportField.text) - txImportField.visible = false - } - } - Component.onCompleted: { - addrField.focus = true - } - } - - Window { - id: addPeerWin - visible: false - minimumWidth: 400 - maximumWidth: 400 - maximumHeight: 50 - minimumHeight: 50 - title: "Connect to Node" - - TextField { - id: addrField - placeholderText: "enode://::" - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.right: addPeerButton.left - anchors.leftMargin: 10 - anchors.rightMargin: 10 - onAccepted: { - eth.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - - Button { - id: addPeerButton - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: 10 - text: "Connect" - onClicked: { - eth.connectToPeer(addrField.text) - addPeerWin.visible = false - } - } - Component.onCompleted: { - addrField.focus = true - } - } - } ->>>>>>> 32a9c0ca809508c1648b8f44f3e09725af7a80d3 + } \ No newline at end of file -- cgit v1.2.3 From 8a0f23915e4feb9aabe21bd075416bc0f32bbc43 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 17:23:09 +0100 Subject: Fixed a few issues in the miner and updated hash rate title * Sometimes old nonces were set by "old" agents * Added the hash rate to the miner --- cmd/mist/assets/qml/main.qml | 4 +++- cmd/mist/assets/qml/views/miner.qml | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 2b56b7236..dce279518 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -289,6 +289,7 @@ ApplicationWindow { styleColor: "#797979" } + /* Label { //y: 6 objectName: "miningLabel" @@ -307,6 +308,7 @@ ApplicationWindow { anchors.right: peerGroup.left anchors.rightMargin: 5 } + */ ProgressBar { visible: false @@ -1101,4 +1103,4 @@ ApplicationWindow { addrField.focus = true } } - } \ No newline at end of file + } diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index 193ce37be..0938644b9 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -14,6 +14,30 @@ Rectangle { color: "#00000000" + Label { + visible: false + id: lastBlockLabel + objectName: "lastBlockLabel" + text: "---" + font.pixelSize: 10 + anchors.right: peerGroup.left + anchors.rightMargin: 5 + onTextChanged: { + //menuItem.secondaryTitle = text + } + } + + Label { + objectName: "miningLabel" + visible: false + font.pixelSize: 10 + anchors.right: lastBlockLabel.left + anchors.rightMargin: 5 + onTextChanged: { + menuItem.secondaryTitle = text + } + } + ColumnLayout { spacing: 10 anchors.fill: parent -- cgit v1.2.3 From 218f437b0c2a80aa189e703520b5e1a5b9841b0f Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 17:30:37 +0100 Subject: Updated window --- cmd/mist/assets/qml/main.qml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index dce279518..1d6b15ac1 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -1054,38 +1054,24 @@ ApplicationWindow { Window { id: addPeerWin visible: false - minimumWidth: 300 - maximumWidth: 300 + minimumWidth: 400 + maximumWidth: 400 maximumHeight: 50 minimumHeight: 50 title: "Connect to peer" - ComboBox { + TextField { id: addrField anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.right: addPeerButton.left anchors.leftMargin: 10 anchors.rightMargin: 10 + placeholderText: "enode://::" onAccepted: { - eth.connectToPeer(addrField.currentText) + eth.connectToPeer(addrField.text) addPeerWin.visible = false } - - editable: true - model: ListModel { id: pastPeers } - - Component.onCompleted: { - pastPeers.insert(0, {text: "poc-8.ethdev.com:30303"}) - /* - var ips = eth.pastPeers() - for(var i = 0; i < ips.length; i++) { - pastPeers.append({text: ips.get(i)}) - } - - pastPeers.insert(0, {text: "poc-7.ethdev.com:30303"}) - */ - } } Button { @@ -1093,7 +1079,7 @@ ApplicationWindow { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 10 - text: "Add" + text: "Connect" onClicked: { eth.connectToPeer(addrField.currentText) addPeerWin.visible = false -- cgit v1.2.3 From 790de35e7ff5235c83e081faf00aff35640cdcc6 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 17:57:46 +0100 Subject: Fixed issue in peer window * Fixed issues where new peer window could cause a crash when entering an empty string --- cmd/mist/assets/qml/main.qml | 20 ++++++++++++-------- cmd/mist/main.go | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 1d6b15ac1..ecc121407 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -61,11 +61,11 @@ ApplicationWindow { function activeView(view, menuItem) { mainSplit.setView(view, menuItem) if (view.hideUrl) { - urlPane.visible = false; - mainView.anchors.top = rootView.top + //urlPane.visible = false; + //mainView.anchors.top = rootView.top } else { - urlPane.visible = true; - mainView.anchors.top = divider.bottom + //urlPane.visible = true; + //mainView.anchors.top = divider.bottom } } @@ -1069,8 +1069,10 @@ ApplicationWindow { anchors.rightMargin: 10 placeholderText: "enode://::" onAccepted: { - eth.connectToPeer(addrField.text) - addPeerWin.visible = false + if(addrField.text.length != 0) { + eth.connectToPeer(addrField.text) + addPeerWin.visible = false + } } } @@ -1081,8 +1083,10 @@ ApplicationWindow { anchors.rightMargin: 10 text: "Connect" onClicked: { - eth.connectToPeer(addrField.currentText) - addPeerWin.visible = false + if(addrField.text.length != 0) { + eth.connectToPeer(addrField.text) + addPeerWin.visible = false + } } } Component.onCompleted: { diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 52b5e4e94..32222fbef 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -36,7 +36,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.8.2" + Version = "0.8.3" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 0f3c25b26589f5667b618d6a91b73392d02ccd1e Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 18:03:16 +0100 Subject: Propagate blocks --- cmd/mist/gui.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 6d179eea1..484cda5ff 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -412,9 +412,7 @@ func (gui *Gui) update() { switch ev := ev.(type) { case core.NewBlockEvent: gui.processBlock(ev.Block, false) - if bytes.Compare(ev.Block.Coinbase(), gui.address()) == 0 { - gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) - } + gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) case core.TxPreEvent: tx := ev.Tx -- cgit v1.2.3 From ce239333d529898edd8333637fd75c565e80a9ff Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 18:15:23 +0100 Subject: Update balance label when mining --- cmd/mist/assets/qml/views/wallet.qml | 11 +++++++++++ cmd/mist/gui.go | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 545098284..838fa8749 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -15,6 +15,17 @@ Rectangle { objectName: "walletView" anchors.fill: parent + Label { + objectName: "balanceLabel" + visible: false + font.pixelSize: 10 + anchors.right: lastBlockLabel.left + anchors.rightMargin: 5 + onTextChanged: { + menuItem.secondaryTitle = text + } + } + function onReady() { setBalance() } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 484cda5ff..c4ce1d463 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -412,7 +412,9 @@ func (gui *Gui) update() { switch ev := ev.(type) { case core.NewBlockEvent: gui.processBlock(ev.Block, false) - gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) + //gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) + balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address())) + gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance)) case core.TxPreEvent: tx := ev.Tx -- cgit v1.2.3 From 6a7b0ef904def27c535cba6f85d686bc4dbab281 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 18:17:17 +0100 Subject: Updated coin.js abi --- cmd/mist/assets/examples/coin.js | 113 ++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 56 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.js b/cmd/mist/assets/examples/coin.js index d69af5dcb..77daac846 100644 --- a/cmd/mist/assets/examples/coin.js +++ b/cmd/mist/assets/examples/coin.js @@ -1,64 +1,65 @@ -var contract = web3.eth.contractFromAbi([ +var walletABI = [ { - "constant":false, - "inputs":[ - {"name":"_h","type":"hash256"} - ], - "name":"confirm", - "outputs":[], - "type":"function" + "name":"confirm", + "type":"function", + "constant":false, + "inputs":[ + {"name":"_h","type":"hash256"} + ], + "outputs":[] },{ - "constant":false, - "inputs":[ - {"name":_to,"type":"address"}, - {"name":"_value","type":"uint256"}, - {"name":"_data","type":"bytes"} - ], - "name":"execute", - "outputs":[ - {"name":"_r","type":"hash256"} - ], - "type":"function" + "name":"execute", + "constant":false, + "type":"function", + "inputs":[ + {"name":"_to","type":"address"}, + {"name":"_value","type":"uint256"}, + {"name":"_data","type":"bytes"} + ], + "outputs":[ + {"name":"_r","type":"hash256"} + ] },{ - "constant":false, - "inputs":[ - {"name":"_to","type":"address"} - ],"name":"kill", - "outputs":[], - "type":"function" + "name":"kill", + "type":"function", + "constant":false, + "inputs":[ + {"name":"_to","type":"address"} + ], + "outputs":[] },{ - "constant":false, - "inputs":[ - {"name":"_from","type":"address"}, - {"name":"_to","type":"address"} - ], - "name":"changeOwner", - "outputs":[], - "type":"function" + "name":"changeOwner", + "type":"function", + "constant":false, + "inputs":[ + {"name":"_from","type":"address"}, + {"name":"_to","type":"address"} + ], + "outputs":[] },{ - "inputs":[ - {"indexed":false,"name":"value","type":"uint256"} - ], - "name":"CashIn", - "type":"event" + "name":"CashIn", + "type":"event", + "inputs":[ + {"indexed":false,"name":"value","type":"uint256"} + ] },{ - "inputs":[ - {"indexed":true,"name":"out","type":"string32"}, - {"indexed":false,"name":"owner","type":"address"}, - {"indexed":false,"name":"value","type":"uint256"}, - {"indexed":false,"name":"to","type":"address"} - ], - "name":"SingleTransact", - "type":"event" + "name":"SingleTransact", + "type":"event", + "inputs":[ + {"indexed":true,"name":"out","type":"string32"}, + {"indexed":false,"name":"owner","type":"address"}, + {"indexed":false,"name":"value","type":"uint256"}, + {"indexed":false,"name":"to","type":"address"} + ] },{ - "inputs":[ - {"indexed":true,"name":"out","type":"string32"}, - {"indexed":false,"name":"owner","type":"address"}, - {"indexed":false,"name":"operation","type":"hash256"}, - {"indexed":false,"name":"value","type":"uint256"}, - {"indexed":false,"name":"to","type":"address"} - ], - "name":"MultiTransact", - "type":"event" + "name":"MultiTransact", + "type":"event", + "inputs":[ + {"indexed":true,"name":"out","type":"string32"}, + {"indexed":false,"name":"owner","type":"address"}, + {"indexed":false,"name":"operation","type":"hash256"}, + {"indexed":false,"name":"value","type":"uint256"}, + {"indexed":false,"name":"to","type":"address"} + ] } -]); +]; -- cgit v1.2.3 From 7aef0fed29ec9e0b7f65f12f242c75b39b652d47 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Fri, 13 Feb 2015 18:32:15 +0100 Subject: changed url bar behaviour. Failed attempt at icon --- cmd/mist/assets/qml/main.qml | 14 +++-- cmd/mist/assets/qml/views/browser.qml | 110 +++++++++++++++++++--------------- cmd/mist/assets/qml/views/catalog.qml | 28 +++------ 3 files changed, 77 insertions(+), 75 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index d03ef43d9..c9505806c 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -59,13 +59,13 @@ ApplicationWindow { function activeView(view, menuItem) { mainSplit.setView(view, menuItem) - if (view.hideUrl) { + /*if (view.hideUrl) { urlPane.visible = false; mainView.anchors.top = rootView.top } else { urlPane.visible = true; mainView.anchors.top = divider.bottom - } + }*/ } function addViews(view, path, options) { @@ -120,13 +120,10 @@ ApplicationWindow { var domainAlreadyOpen = false; - console.log("requested: " + requestedDomain ) - for(var i = 0; i < mainSplit.views.length; i++) { if (mainSplit.views[i].view.url) { var matches = mainSplit.views[i].view.url.toString().match(/^[a-z]*\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i); var existingDomain = matches && matches[1]; - console.log("exists: " + existingDomain); if (requestedDomain == existingDomain) { domainAlreadyOpen = true; mainSplit.views[i].view.url = url; @@ -567,7 +564,9 @@ ApplicationWindow { if (parent.closable == true) { closeIcon.visible = sel.visible } - + /*if(view.hasOwnProperty("iconSource")) { + icon.source = view.iconSource; + }*/ } onExited: { closeIcon.visible = false @@ -600,10 +599,13 @@ ApplicationWindow { id: label font.family: sourceSansPro.name font.weight: Font.DemiBold + elide: Text.ElideRight anchors { left: icon.right + right: parent.right verticalCenter: parent.verticalCenter leftMargin: 6 + rightMargin: 8 // verticalCenterOffset: -10 } x:250 diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 04b2229ec..ff3ff0f7f 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -64,23 +64,15 @@ Rectangle { } function showFullUrlBar(on){ - if (on) { - //appTitle.visible = false - //appDomain.visible = false - - //uriNav.visible = true - clickAnywhereOnApp.visible = true - - navBar.state = "fullUrlVisible" - } else { - //appTitle.visible = true - //appDomain.visible = true - //uriNav.visible = false - clickAnywhereOnApp.visible = false - - navBar.state = "titleVisible" - - } + if (uriNav.focus == false ) { + if (on == false) { + clickAnywhereOnApp.visible = false + navBar.state = "titleVisible" + } else { + clickAnywhereOnApp.visible = true + navBar.state = "fullUrlVisible" + } + } } @@ -90,24 +82,40 @@ Rectangle { Item { objectName: "root" id: root - anchors.fill: parent + anchors { + fill: parent + } + state: "inspectorShown" MouseArea { id: clickAnywhereOnApp z:15 - //hoverEnabled: true - anchors.fill: parent - /*hoverEnabled: true*/ + // Using a secondary screen to catch on mouse exits for the area, because + // there are many hover actions conflicting + + anchors { + top: parent.top + topMargin: 50 + right: parent.right + bottom: parent.bottom + left: parent.left + } + hoverEnabled: true - onClicked: { + onEntered: { showFullUrlBar(false); } - /*Rectangle { - anchors.fill: parent - color: "#88888888" - }*/ + onClicked: { + uriNav.focus = false + showFullUrlBar(false); + } + + // Rectangle { + // anchors.fill: parent + // color: "#88888888" + // } } RowLayout { @@ -126,7 +134,7 @@ Rectangle { webview.goBack() } - anchors{ + anchors { left: parent.left leftMargin: 6 } @@ -146,15 +154,17 @@ Rectangle { color: "#FFFFFF" radius: 6 - MouseArea { anchors.fill: parent z: 10 hoverEnabled: true onEntered: { - showFullUrlBar(true); - } + showFullUrlBar(true); + } + /*onExited: { + showFullUrlBar(false); + }*/ } @@ -171,14 +181,15 @@ Rectangle { font.bold: true font.capitalization: Font.AllUppercase horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + anchors { left: parent.left right: parent.horizontalCenter top: parent.top bottom: parent.bottom - rightMargin: 10 + leftMargin: 32 } color: "#928484" } @@ -189,13 +200,15 @@ Rectangle { font.bold: false horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter + elide: Text.ElideLeft anchors { left: parent.horizontalCenter right: parent.right top: parent.top bottom: parent.bottom - leftMargin: 10 + leftMargin: 32 + } color: "#C0AFAF" } @@ -212,7 +225,7 @@ Rectangle { } horizontalAlignment: Text.AlignHCenter - + style: TextFieldStyle { textColor: "#928484" background: Rectangle { @@ -227,11 +240,6 @@ Rectangle { Keys.onReturnPressed: { webview.url = this.text; } - /* onFocusedChanged: { - if (focused) { - //uriNav.selectAll(); - } - }*/ } z:2 @@ -332,18 +340,19 @@ Rectangle { bottom: parent.bottom top: navBar.bottom } - z: 10 - - onLoadingChanged: { + + z: 10 + + onLoadingChanged: { + + // this checks if your app has special header tags if (loadRequest.status == WebEngineView.LoadSucceededStatus) { webview.runJavaScript("document.title", function(pageTitle) { menuItem.title = pageTitle; }); - //var topBarStyle webView.runJavaScript("document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")", function(topBarStyle){ if (topBarStyle=="transparent") { - // Adjust for a transparent sidebar Dapp navBarBackground.visible = false; back.visible = false; @@ -362,8 +371,13 @@ Rectangle { }; }); - - + // webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){ + // if(sideIcon){ + // window.iconSource = "http://localhost:3000/whisper-icon@2x.png" //webview.url + sideIcon + // console.log(iconSource) + // }; + // }); + webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); @@ -371,7 +385,7 @@ Rectangle { var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; - appDomain.text = domain //webview.url.replace("a", "z") + appDomain.text = domain appTitle.text = webview.title showFullUrlBar(false); diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index a7832e9fa..18a835ad2 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -85,35 +85,21 @@ Rectangle { property var domain: "ethereum-dapp-catalog.meteor.com" url: protocol + domain - //navigationRequest: WebEngineView.IgnoreRequest - // onLoadingChanged: { - // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - // webview.runJavaScript(eth.readFile("bignumber.min.js")); - // webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - // } - // } - - //onNavigationRequested: { - // detect URL scheme prefix, most likely an external link - //var schemaRE = /^\w+:/; - //if (schemaRE.test(request.url)) { - // request.action = WebView.AcceptRequest; - //} else { - //request.action = WebView.IgnoreRequest; - // delegate request.url here - //} - //} + + onJavaScriptConsoleMessage: { console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message)); } - onNavigationRequested: { + onNavigationRequested: { + // this checks if the domain of the requested link is the same as the catalog's + // If it is, it opens on the same window, if it's not it opens a new tab + var cleanTitle = request.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var requestedDomain = matches && matches[1]; - console.debug ("NavigationRequested: " + request.url + " navigationType=" + request.navigationType) if(request.navigationType==0){ @@ -137,7 +123,7 @@ Rectangle { anchors { left: root.left right: root.right - top: sizeGrip.bottom + top: root.top bottom: root.bottom } -- cgit v1.2.3 From 384305f4aa8daef684efc76a374e1d6686c9c83f Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 13 Feb 2015 18:33:08 +0100 Subject: Fixed QML errors --- cmd/mist/assets/qml/views/catalog.qml | 1 - cmd/mist/assets/qml/views/miner.qml | 3 --- cmd/mist/assets/qml/views/wallet.qml | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index a7832e9fa..884493eef 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -137,7 +137,6 @@ Rectangle { anchors { left: root.left right: root.right - top: sizeGrip.bottom bottom: root.bottom } diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index 0938644b9..6a199a925 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -19,9 +19,6 @@ Rectangle { id: lastBlockLabel objectName: "lastBlockLabel" text: "---" - font.pixelSize: 10 - anchors.right: peerGroup.left - anchors.rightMargin: 5 onTextChanged: { //menuItem.secondaryTitle = text } diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 838fa8749..d1d38bb72 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -18,10 +18,8 @@ Rectangle { Label { objectName: "balanceLabel" visible: false - font.pixelSize: 10 - anchors.right: lastBlockLabel.left - anchors.rightMargin: 5 onTextChanged: { + balance.text = text menuItem.secondaryTitle = text } } -- cgit v1.2.3 From 8464e43eaf7d4841f90c8345d6d0afdf3f90ad49 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 13 Feb 2015 23:55:50 +0100 Subject: cmd/mist: fix peer window --- cmd/mist/assets/qml/main.qml | 23 ++++++++--------------- cmd/mist/gui.go | 34 +++++++++++++++++++++++++++++----- cmd/mist/ui_lib.go | 5 ----- 3 files changed, 37 insertions(+), 25 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index ecc121407..fd3e3020a 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -341,7 +341,7 @@ ApplicationWindow { } Label { - id: peerLabel + id: peerCounterLabel font.pixelSize: 10 text: "0 / 0" } @@ -926,7 +926,6 @@ ApplicationWindow { } } - function setWalletValue(value) { walletValueLabel.text = value } @@ -936,17 +935,11 @@ ApplicationWindow { var view = mainView.addPlugin(name) } - 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 - peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version, caps: peer.caps}) - } + function clearPeers() { peerModel.clear() } + function addPeer(peer) { peerModel.append(peer) } - function resetPeers(){ - peerModel.clear() + function setPeerCounters(text) { + peerCounterLabel.text = text } function timeAgo(unixTs){ @@ -984,9 +977,9 @@ ApplicationWindow { anchors.fill: parent id: peerTable model: peerModel - TableViewColumn{width: 200; role: "ip" ; title: "IP" } - TableViewColumn{width: 260; role: "version" ; title: "Version" } - TableViewColumn{width: 180; role: "caps" ; title: "Capabilities" } + TableViewColumn{width: 180; role: "addr" ; title: "Remote Address" } + TableViewColumn{width: 280; role: "nodeID" ; title: "Node ID" } + TableViewColumn{width: 180; role: "caps" ; title: "Capabilities" } } } } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c4ce1d463..208b553d2 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -31,6 +31,7 @@ import ( "os" "path" "runtime" + "sort" "strconv" "time" @@ -449,6 +450,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() + case <-generalUpdateTicker.C: statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number().String() lastBlockLabel.Set("text", statusText) @@ -499,12 +501,34 @@ NumGC: %d )) } +type qmlpeer struct{ Addr, NodeID, Caps string } + +type peersByID []*qmlpeer + +func (s peersByID) Len() int { return len(s) } +func (s peersByID) Less(i, j int) bool { return s[i].NodeID < s[j].NodeID } +func (s peersByID) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + 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.xeth.Peers() { - //gui.win.Root().Call("addPeer", peer) - //} + peers := gui.eth.Peers() + qpeers := make(peersByID, len(peers)) + for i, p := range peers { + qpeers[i] = &qmlpeer{ + NodeID: p.ID().String(), + Addr: p.RemoteAddr().String(), + Caps: fmt.Sprint(p.Caps()), + } + } + // we need to sort the peers because they jump around randomly + // otherwise. order returned by eth.Peers is random because they + // are taken from a map. + sort.Sort(qpeers) + + gui.win.Root().Call("setPeerCounters", fmt.Sprintf("%d / %d", len(peers), gui.eth.MaxPeers())) + gui.win.Root().Call("clearPeers") + for _, p := range qpeers { + gui.win.Root().Call("addPeer", p) + } } func (gui *Gui) privateKey() string { diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index ab48386f4..368fb002b 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -73,11 +73,6 @@ func (self *UiLib) Notef(args []interface{}) { guilogger.Infoln(args...) } -func (self *UiLib) PastPeers() *ethutil.List { - return ethutil.NewList([]string{}) - //return ethutil.NewList(eth.PastPeers()) -} - func (self *UiLib) ImportTx(rlpTx string) { tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) err := self.eth.TxPool().Add(tx) -- cgit v1.2.3 From 84f7c966f725ef0f5c62b4427857d112c0d1e828 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 14 Feb 2015 00:25:47 +0100 Subject: Moved ECIES to repo & added secondary title for webview * ECIES moved from obscuren to ethereum * Added html META[name=badge] to reflect menuItem.secondaryTitle --- cmd/mist/assets/examples/info.html | 4 ++-- cmd/mist/assets/qml/views/browser.qml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/info.html b/cmd/mist/assets/examples/info.html index daad8c706..d8816b19f 100644 --- a/cmd/mist/assets/examples/info.html +++ b/cmd/mist/assets/examples/info.html @@ -1,8 +1,8 @@ - + @@ -60,7 +60,7 @@ var web3 = require('web3'); var eth = web3.eth; - web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8080')); + web3.setProvider(new web3.providers.HttpSyncProvider('http://localhost:8545')); document.querySelector("#number").innerHTML = eth.number; document.querySelector("#coinbase").innerHTML = eth.coinbase diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 04b2229ec..3cbabf0b6 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -333,6 +333,17 @@ Rectangle { top: navBar.bottom } z: 10 + + Timer { + interval: 500; running: true; repeat: true + onTriggered: { + webview.runJavaScript("document.querySelector('meta[name=badge]').getAttribute('content')", function(badge) { + if (badge) { + menuItem.secondaryTitle = badge; + } + }); + } + } onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadSucceededStatus) { @@ -340,6 +351,7 @@ Rectangle { menuItem.title = pageTitle; }); + //var topBarStyle webView.runJavaScript("document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")", function(topBarStyle){ if (topBarStyle=="transparent") { -- cgit v1.2.3 From befb4bc1c102a62eaad9b4980e54cd4067078c2a Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 14 Feb 2015 17:13:21 +0100 Subject: Fixed a few errors in the browser special meta tags objects --- cmd/mist/assets/qml/views/browser.qml | 58 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 3cbabf0b6..ac160e2b1 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -334,16 +334,16 @@ Rectangle { } z: 10 - Timer { - interval: 500; running: true; repeat: true - onTriggered: { - webview.runJavaScript("document.querySelector('meta[name=badge]').getAttribute('content')", function(badge) { - if (badge) { - menuItem.secondaryTitle = badge; - } - }); - } - } + Timer { + interval: 500; running: true; repeat: true + onTriggered: { + webview.runJavaScript("try{document.querySelector('meta[name=badge]').getAttribute('content')}catch(e){}", function(badge) { + if (badge) { + menuItem.secondaryTitle = badge; + } + }); + } + } onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadSucceededStatus) { @@ -351,31 +351,27 @@ Rectangle { menuItem.title = pageTitle; }); + webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ + if (!topBarStyle) return; - //var topBarStyle - webView.runJavaScript("document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")", function(topBarStyle){ if (topBarStyle=="transparent") { - // Adjust for a transparent sidebar Dapp - navBarBackground.visible = false; - back.visible = false; - appInfoPane.anchors.leftMargin = -16; - appInfoPaneShadow.anchors.leftMargin = -16; - webview.anchors.topMargin = -74; + navBarBackground.visible = false; + back.visible = false; + appInfoPane.anchors.leftMargin = -16; + appInfoPaneShadow.anchors.leftMargin = -16; + webview.anchors.topMargin = -74; webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')") } else { - navBarBackground.visible = true; - back.visible = true; - appInfoPane.anchors.leftMargin = 0; - appInfoPaneShadow.anchors.leftMargin = 0; - webview.anchors.topMargin = 0; - - }; + navBarBackground.visible = true; + back.visible = true; + appInfoPane.anchors.leftMargin = 0; + appInfoPaneShadow.anchors.leftMargin = 0; + webview.anchors.topMargin = 0; + }; }); - - webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); @@ -383,10 +379,12 @@ Rectangle { var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; - appDomain.text = domain //webview.url.replace("a", "z") - appTitle.text = webview.title + if (domain) + appDomain.text = domain //webview.url.replace("a", "z") + if (webview.title) + appTitle.text = webview.title - showFullUrlBar(false); + showFullUrlBar(false); } } onJavaScriptConsoleMessage: { -- cgit v1.2.3 From c29b01ce75c1feacf13e57b906ce0613168cd895 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 14 Feb 2015 17:18:28 +0100 Subject: Reset URL bar --- cmd/mist/assets/qml/views/browser.qml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index ac160e2b1..2685f902b 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -352,7 +352,15 @@ Rectangle { }); webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ - if (!topBarStyle) return; + if (!topBarStyle) { + showFullUrlBar(true); + navBarBackground.visible = true; + back.visible = true; + appInfoPane.anchors.leftMargin = 0; + appInfoPaneShadow.anchors.leftMargin = 0; + webview.anchors.topMargin = 0; + return; + } if (topBarStyle=="transparent") { // Adjust for a transparent sidebar Dapp -- cgit v1.2.3 From 12fc590b34fba3391799fbdfd66ef029f7a551f4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 15 Feb 2015 01:58:15 +0100 Subject: removed some old menu items --- cmd/mist/assets/qml/main.qml | 29 ----------------------------- cmd/mist/assets/qml/views/browser.qml | 3 --- 2 files changed, 32 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index fd3e3020a..e1e6a028f 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -149,23 +149,6 @@ ApplicationWindow { menuBar: MenuBar { Menu { title: "File" - MenuItem { - text: "Import App" - shortcut: "Ctrl+o" - onTriggered: { - generalFileDialog.show(true, importApp) - } - } - - MenuItem { - text: "Add plugin" - onTriggered: { - generalFileDialog.show(true, function(path) { - addPlugin(path, {close: true, section: "apps"}) - }) - } - } - MenuItem { text: "New tab" shortcut: "Ctrl+t" @@ -262,18 +245,6 @@ ApplicationWindow { } } } - - Menu { - title: "GLOBAL SHORTCUTS" - visible: false - MenuItem { - visible: false - shortcut: "Ctrl+l" - onTriggered: { - url.focus = true - } - } - } } statusBar: StatusBar { diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 2685f902b..4d72b9741 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -380,9 +380,6 @@ Rectangle { }; }); - webview.runJavaScript(eth.readFile("bignumber.min.js")); - webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - var cleanTitle = webview.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var domain = matches && matches[1]; -- cgit v1.2.3 From 2c3a014f03390628d329167109f90a30e3c4e4c3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 15 Feb 2015 16:16:27 +0100 Subject: Resolved some bugs in the miner * TODO nonce error sometimes persists * Fixed mining on wrong blocks * Fixed state error & receipt fail --- cmd/mist/assets/qml/views/transaction.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/transaction.qml b/cmd/mist/assets/qml/views/transaction.qml index 62c762956..6637346b5 100644 --- a/cmd/mist/assets/qml/views/transaction.qml +++ b/cmd/mist/assets/qml/views/transaction.qml @@ -177,7 +177,7 @@ Rectangle { mainContractColumn.state = "ERROR" } else { txResult.text = "Your transaction has been submitted:\n" - txOutput.text = res[0].address + txOutput.text = res.toString() mainContractColumn.state = "DONE" console.log(res) -- cgit v1.2.3 From 05f28088499fdc0105bb17cee9345a3483aa24f2 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Mon, 16 Feb 2015 11:17:31 +0100 Subject: Add http when not present on browser --- cmd/mist/assets/qml/views/browser.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index ff3ff0f7f..a6f4e3d92 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -238,7 +238,12 @@ Rectangle { z: 20 activeFocusOnPress: true Keys.onReturnPressed: { - webview.url = this.text; + // if there's no http, add it. + var url = this.text, + matches = url.match(/^([a-z]*\:\/\/)?([^\/.]+)(:?\/)(.*|$)/i), + requestedProtocol = (matches && matches[1] != "undefined")? "" : "http://"; + + webview.url = requestedProtocol + url; } } -- cgit v1.2.3 From 164de5e22be39ba2bdc58f84f72572252634e7e1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 16 Feb 2015 13:20:16 +0100 Subject: Changed default denominators --- cmd/mist/assets/qml/views/browser.qml | 4 +++- cmd/mist/assets/qml/views/transaction.qml | 2 +- cmd/mist/assets/qml/views/wallet.qml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 4d72b9741..631ef5a16 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 { @@ -326,6 +326,8 @@ Rectangle { WebEngineView { objectName: "webView" id: webview + experimental.settings.javascriptCanAccessClipboard: true + experimental.settings.localContentCanAccessRemoteUrls: true anchors { left: parent.left right: parent.right diff --git a/cmd/mist/assets/qml/views/transaction.qml b/cmd/mist/assets/qml/views/transaction.qml index 6637346b5..df798a9c0 100644 --- a/cmd/mist/assets/qml/views/transaction.qml +++ b/cmd/mist/assets/qml/views/transaction.qml @@ -103,7 +103,7 @@ Rectangle { ComboBox { id: valueDenom - currentIndex: 6 + currentIndex: 5 model: denomModel } } diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index d1d38bb72..59dbae848 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -104,7 +104,7 @@ Rectangle { ComboBox { id: valueDenom - currentIndex: 6 + currentIndex: 5 model: denomModel } -- cgit v1.2.3 From 1878630b591b039fadb6f88e15340d04f4af3ed1 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Mon, 16 Feb 2015 14:34:47 +0100 Subject: Solved Issue #318 and added states to back button --- cmd/mist/assets/backButtonDisabled.png | Bin 0 -> 634 bytes cmd/mist/assets/backButtonDisabled@2x.png | Bin 0 -> 1458 bytes cmd/mist/assets/backButtonHover.png | Bin 0 -> 657 bytes cmd/mist/assets/backButtonHover@2x.png | Bin 0 -> 1517 bytes cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/assets/qml/views/browser.qml | 39 +++++++++++++++--------------- 6 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 cmd/mist/assets/backButtonDisabled.png create mode 100644 cmd/mist/assets/backButtonDisabled@2x.png create mode 100644 cmd/mist/assets/backButtonHover.png create mode 100644 cmd/mist/assets/backButtonHover@2x.png (limited to 'cmd/mist') diff --git a/cmd/mist/assets/backButtonDisabled.png b/cmd/mist/assets/backButtonDisabled.png new file mode 100644 index 000000000..428747870 Binary files /dev/null and b/cmd/mist/assets/backButtonDisabled.png differ diff --git a/cmd/mist/assets/backButtonDisabled@2x.png b/cmd/mist/assets/backButtonDisabled@2x.png new file mode 100644 index 000000000..0eaa6daa5 Binary files /dev/null and b/cmd/mist/assets/backButtonDisabled@2x.png differ diff --git a/cmd/mist/assets/backButtonHover.png b/cmd/mist/assets/backButtonHover.png new file mode 100644 index 000000000..8c5226f5a Binary files /dev/null and b/cmd/mist/assets/backButtonHover.png differ diff --git a/cmd/mist/assets/backButtonHover@2x.png b/cmd/mist/assets/backButtonHover@2x.png new file mode 100644 index 000000000..406601ebc Binary files /dev/null and b/cmd/mist/assets/backButtonHover@2x.png differ diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index c9505806c..1272f8761 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -485,7 +485,7 @@ ApplicationWindow { label.visible = !on buttonLabel.visible = on } - + width: 192 height: 55 color: "#00000000" diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index a6f4e3d92..3a35c2a65 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -129,9 +129,9 @@ Rectangle { Button { id: back - - onClicked: { - webview.goBack() + z: 30 + onClicked: { + webview.goBack() } anchors { @@ -140,21 +140,23 @@ Rectangle { } style: ButtonStyle { - background: Image { - source: "../../backButton.png" - width: 20 - height: 30 - } + background: Image { + source: (webview.canGoBack) ? + (control.hovered ? "../../backButtonHover.png" : "../../backButton.png") : + "../../backButtonDisabled.png" + width: 20 + height: 30 + } } } Rectangle { - id: appInfoPane - height: 28 - color: "#FFFFFF" - radius: 6 - - MouseArea { + id: appInfoPane + height: 28 + color: "#FFFFFF" + radius: 6 + z:2 + MouseArea { anchors.fill: parent z: 10 hoverEnabled: true @@ -247,7 +249,7 @@ Rectangle { } } - z:2 + } Rectangle { @@ -256,6 +258,7 @@ Rectangle { height: 30 color: "#BDB6B6" radius: 6 + z:1 anchors { left: back.right @@ -264,19 +267,17 @@ Rectangle { rightMargin:10 top: parent.top topMargin: 23 - } - - z:1 + } } Rectangle { id: navBarBackground anchors.fill: parent + z:-1 gradient: Gradient { GradientStop { position: 0.0; color: "#F6F1F2" } GradientStop { position: 1.0; color: "#DED5D5" } } - z:-1 } states: [ -- cgit v1.2.3 From 666ef482392340ba111fa3347160468266ff3cb5 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Mon, 16 Feb 2015 20:55:14 +0100 Subject: SideIcons work. Copy paste still doesn't. --- cmd/mist/assets/ext/mist.js | 35 +++++++++++++++++++++++++++++++++++ cmd/mist/assets/qml/views/browser.qml | 23 +++++++++++------------ cmd/mist/assets/qml/views/catalog.qml | 10 +++++++++- 3 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 cmd/mist/assets/ext/mist.js (limited to 'cmd/mist') diff --git a/cmd/mist/assets/ext/mist.js b/cmd/mist/assets/ext/mist.js new file mode 100644 index 000000000..8734f8dc7 --- /dev/null +++ b/cmd/mist/assets/ext/mist.js @@ -0,0 +1,35 @@ +// Copyright (c) 2015, ETHDEV. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + +// this function is included locally, but you can also include separately via a header definition + +console.log("loaded?"); + +document.onkeydown = function(evt) { + 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"); + } if (evt.ctrlKey && evt.keyCode == 86) { + console.log("Ctrl-V"); + } if (evt.ctrlKey && evt.keyCode == 90) { + 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 6ded02fcb..9bee12cc6 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,8 +340,8 @@ Rectangle { WebEngineView { objectName: "webView" id: webview - experimental.settings.javascriptCanAccessClipboard: true - experimental.settings.localContentCanAccessRemoteUrls: true + //experimental.settings.javascriptCanAccessClipboard: true + //experimental.settings.localContentCanAccessRemoteUrls: true anchors { left: parent.left right: parent.right @@ -367,7 +367,12 @@ Rectangle { menuItem.title = pageTitle; }); - + webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){ + if(sideIcon){ + menuItem.icon = "http://localhost:3000/whisper-icon@2x.png" + }; + }); + webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ if (!topBarStyle) { showFullUrlBar(true); @@ -397,15 +402,9 @@ Rectangle { }; }); - // webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){ - // if(sideIcon){ - // window.iconSource = "http://localhost:3000/whisper-icon@2x.png" //webview.url + sideIcon - // console.log(iconSource) - // }; - // }); - + webview.runJavaScript(eth.readFile("bignumber.min.js")); - webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); + webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); var cleanTitle = webview.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 18a835ad2..497d69ed1 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -85,7 +85,7 @@ Rectangle { property var domain: "ethereum-dapp-catalog.meteor.com" url: protocol + domain - + //experimental.settings.javascriptCanAccessClipboard: true onJavaScriptConsoleMessage: { @@ -112,10 +112,18 @@ Rectangle { } } + // onLoadingChanged: { + // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { + // webview.runJavaScript(eth.readFile("mist.js")); + // } + // } } + + + WebEngineView { id: inspector visible: false -- cgit v1.2.3 From c4b8c115294ea34d3e820c9e39bdda80af8026ff Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Tue, 17 Feb 2015 00:52:40 +0100 Subject: side icons --- cmd/mist/assets/browser.png | Bin 5329 -> 756 bytes cmd/mist/assets/browser@2x.png | Bin 0 -> 1603 bytes cmd/mist/assets/qml/main.qml | 67 ++++++++++++++++++++++++++++------ cmd/mist/assets/qml/views/browser.qml | 55 ++++++++++++++++++++++++---- 4 files changed, 103 insertions(+), 19 deletions(-) create mode 100644 cmd/mist/assets/browser@2x.png (limited to 'cmd/mist') diff --git a/cmd/mist/assets/browser.png b/cmd/mist/assets/browser.png index 7b3b0870c..074c9ae3c 100644 Binary files a/cmd/mist/assets/browser.png and b/cmd/mist/assets/browser.png differ diff --git a/cmd/mist/assets/browser@2x.png b/cmd/mist/assets/browser@2x.png new file mode 100644 index 000000000..8ca417608 Binary files /dev/null and b/cmd/mist/assets/browser@2x.png differ diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 03c8e4518..09a25b431 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -40,10 +40,14 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { - catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin"}); - var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); + catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin", active: true}); + var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum"}); - addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); + var walletWeb = addPlugin("./views/browser.qml", {noAdd: true, close: false, section: "ethereum", active: false}); + 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/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"}); @@ -443,10 +447,14 @@ ApplicationWindow { property var view; property var path; property var closable; + property var badgeContent; property alias title: label.text property alias icon: icon.source property alias secondaryTitle: secondary.text + property alias badgeNumber: badgeNumberLabel.text + property alias badgeIcon: badgeIconLabel.text + function setSelection(on) { sel.visible = on @@ -539,9 +547,6 @@ ApplicationWindow { if (parent.closable == true) { closeIcon.visible = sel.visible } - /*if(view.hasOwnProperty("iconSource")) { - icon.source = view.iconSource; - }*/ } onExited: { closeIcon.visible = false @@ -550,8 +555,8 @@ ApplicationWindow { Image { id: icon - height: 24 - width: 24 + height: 28 + width: 28 anchors { left: parent.left verticalCenter: parent.verticalCenter @@ -581,7 +586,7 @@ ApplicationWindow { verticalCenter: parent.verticalCenter leftMargin: 6 rightMargin: 8 - // verticalCenterOffset: -10 + verticalCenterOffset: (secondaryTitle == "") ? 0 : -10; } x:250 color: "#665F5F" @@ -607,7 +612,7 @@ ApplicationWindow { visible: false width: 10 height: 10 - color: "#FFFFFF" + color: "#FAFAFA" anchors { fill: icon } @@ -626,9 +631,49 @@ ApplicationWindow { centerIn: parent } color: "#665F5F" - font.pixelSize: 18 + font.pixelSize: 20 text: "\ue082" } + } + + Rectangle { + id: badge + visible: (badgeContent == "icon" || badgeContent == "number" )? true : false + width: 32 + color: "#05000000" + anchors { + right: parent.right; + top: parent.top; + bottom: parent.bottom; + rightMargin: 4; + } + + Text { + id: badgeIconLabel + visible: (badgeContent == "icon") ? true : false; + font.family: simpleLineIcons.name + anchors { + centerIn: parent + } + horizontalAlignment: Text.AlignCenter + color: "#AAA0A0" + font.pixelSize: 20 + text: badgeIcon + } + + Text { + id: badgeNumberLabel + visible: (badgeContent == "number") ? true : false; + anchors { + centerIn: parent + } + horizontalAlignment: Text.AlignCenter + font.family: sourceSansPro.name + font.weight: Font.Light + color: "#AAA0A0" + font.pixelSize: 18 + text: badgeNumber + } } diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 9bee12cc6..16290578a 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -351,13 +351,50 @@ Rectangle { z: 10 Timer { - interval: 500; running: true; repeat: true + interval: 2000; running: true; repeat: true onTriggered: { - webview.runJavaScript("try{document.querySelector('meta[name=badge]').getAttribute('content')}catch(e){}", function(badge) { - if (badge) { - menuItem.secondaryTitle = badge; - } - }); + webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-info]').getAttribute('content')}catch(e){}", function(extraInfo) { + if (extraInfo) { + menuItem.secondaryTitle = extraInfo; + } + }); + webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-badge]').getAttribute('content')}catch(e){}", function(badge) { + if (badge) { + if (Number(badge)>0 && Number(badge)<999) { + menuItem.badgeNumber = Number(badge); + menuItem.badgeContent = "number" + } else if (badge == "warning") { + menuItem.badgeIcon = "\ue00e" + menuItem.badgeContent = "icon" + + } else if (badge == "ghost") { + menuItem.badgeIcon = "\ue01a" + menuItem.badgeContent = "icon" + + } else if (badge == "question") { + menuItem.badgeIcon = "\ue05d" + menuItem.badgeContent = "icon" + + } else if (badge == "info") { + menuItem.badgeIcon = "\ue08b" + menuItem.badgeContent = "icon" + + } else if (badge == "check") { + menuItem.badgeIcon = "\ue080" + menuItem.badgeContent = "icon" + + } else if (badge == "gear") { + menuItem.badgeIcon = "\ue09a" + menuItem.badgeContent = "icon" + + } + + + console.log(menuItem.badgeContent); + } else { + menuItem.badgeContent = "" + } + }); } } @@ -367,10 +404,12 @@ Rectangle { menuItem.title = pageTitle; }); - webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){ + webView.runJavaScript("try{document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")}catch(e){}", function(sideIcon){ if(sideIcon){ - menuItem.icon = "http://localhost:3000/whisper-icon@2x.png" + menuItem.icon = webview.url + sideIcon; + console.log("icon: " + webview.url + sideIcon ); }; + console.log("no icon!" ); }); webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ -- cgit v1.2.3 From a22711a7b569fd9d29fe03591ef2c39d793877b1 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Tue, 17 Feb 2015 11:22:52 +0100 Subject: badge support --- cmd/mist/assets/qml/main.qml | 11 +++++++---- cmd/mist/assets/qml/views/browser.qml | 7 ++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 09a25b431..07e6d36da 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -580,6 +580,9 @@ ApplicationWindow { font.family: sourceSansPro.name font.weight: Font.DemiBold elide: Text.ElideRight + x:250 + color: "#665F5F" + font.pixelSize: 14 anchors { left: icon.right right: parent.right @@ -588,12 +591,12 @@ ApplicationWindow { rightMargin: 8 verticalCenterOffset: (secondaryTitle == "") ? 0 : -10; } - x:250 - color: "#665F5F" - font.pixelSize: 14 - } + + + } + Text { id: secondary font.family: sourceSansPro.name diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 16290578a..54f5d755e 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -387,10 +387,9 @@ Rectangle { menuItem.badgeIcon = "\ue09a" menuItem.badgeContent = "icon" + } else { + menuItem.badgeContent = "" } - - - console.log(menuItem.badgeContent); } else { menuItem.badgeContent = "" } @@ -407,9 +406,7 @@ Rectangle { webView.runJavaScript("try{document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")}catch(e){}", function(sideIcon){ if(sideIcon){ menuItem.icon = webview.url + sideIcon; - console.log("icon: " + webview.url + sideIcon ); }; - console.log("no icon!" ); }); webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ -- cgit v1.2.3 From 0de1d1dd588266961740b598da4e01e5efdf2d1f Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Tue, 17 Feb 2015 11:23:28 +0100 Subject: removed status bar code --- cmd/mist/assets/qml/main.qml | 73 -------------------------------------------- 1 file changed, 73 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 07e6d36da..0a8776345 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -249,79 +249,6 @@ ApplicationWindow { } } - statusBar: StatusBar { - //height: 32 - visible: false - - id: statusBar - Label { - //y: 6 - 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 { - id: lastBlockLabel - objectName: "lastBlockLabel" - visible: true - text: "---" - font.pixelSize: 10 - anchors.right: peerGroup.left - anchors.rightMargin: 5 - } - */ - - ProgressBar { - visible: false - id: downloadIndicator - value: 0 - objectName: "downloadIndicator" - y: -4 - x: statusBar.width / 2 - this.width / 2 - width: 160 - } - - Label { - visible: false - 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: peerCounterLabel - font.pixelSize: 10 - text: "0 / 0" - } - } - } - - property var blockModel: ListModel { id: blockModel } -- cgit v1.2.3 From fbd5e4d5afeaff6c250a3a953b18476cdb4b86ae Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Tue, 17 Feb 2015 11:52:22 +0100 Subject: Updated icons --- cmd/mist/assets/miner.png | Bin 2100 -> 0 bytes cmd/mist/assets/mining-icon.png | Bin 0 -> 1029 bytes cmd/mist/assets/mining-icon@2x.png | Bin 0 -> 2312 bytes cmd/mist/assets/qml/main.qml | 4 ++-- cmd/mist/assets/qml/views/miner.qml | 2 +- cmd/mist/assets/qml/views/wallet.qml | 1 - 6 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 cmd/mist/assets/miner.png create mode 100644 cmd/mist/assets/mining-icon.png create mode 100644 cmd/mist/assets/mining-icon@2x.png (limited to 'cmd/mist') diff --git a/cmd/mist/assets/miner.png b/cmd/mist/assets/miner.png deleted file mode 100644 index 58e3f4dfe..000000000 Binary files a/cmd/mist/assets/miner.png and /dev/null differ diff --git a/cmd/mist/assets/mining-icon.png b/cmd/mist/assets/mining-icon.png new file mode 100644 index 000000000..db611e5c0 Binary files /dev/null and b/cmd/mist/assets/mining-icon.png differ diff --git a/cmd/mist/assets/mining-icon@2x.png b/cmd/mist/assets/mining-icon@2x.png new file mode 100644 index 000000000..16466d338 Binary files /dev/null and b/cmd/mist/assets/mining-icon@2x.png differ diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 0a8776345..9a6bf5273 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -41,12 +41,12 @@ ApplicationWindow { Component.onCompleted: { catalog = addPlugin("./views/catalog.qml", {noAdd: true, close: false, section: "begin", active: true}); - var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum"}); var walletWeb = addPlugin("./views/browser.qml", {noAdd: true, close: false, section: "ethereum", active: false}); walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/"; walletWeb.menuItem.title = "Wallet"; - + + addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"}); diff --git a/cmd/mist/assets/qml/views/miner.qml b/cmd/mist/assets/qml/views/miner.qml index 6a199a925..e239c7d7b 100644 --- a/cmd/mist/assets/qml/views/miner.qml +++ b/cmd/mist/assets/qml/views/miner.qml @@ -9,7 +9,7 @@ import Ethereum 1.0 Rectangle { id: root property var title: "Miner" - property var iconSource: "../miner.png" + property var iconSource: "../mining-icon.png" property var menuItem color: "#00000000" diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 59dbae848..2369390c3 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -9,7 +9,6 @@ import Ethereum 1.0 Rectangle { id: root property var title: "Wallet" - property var iconSource: "../facet.png" property var menuItem objectName: "walletView" -- cgit v1.2.3 From 8135752a32837748e6d4a986912131736b1a0aa0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 12:24:51 +0100 Subject: "centralised" mining to backend. Closes #323 --- cmd/mist/ext_app.go | 2 +- cmd/mist/gui.go | 5 +---- cmd/mist/ui_lib.go | 14 +++++--------- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 4831884e5..7ac51db0b 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -43,7 +43,7 @@ type AppContainer interface { type ExtApplication struct { *xeth.XEth - eth core.EthManager + eth core.Backend events event.Subscription watcherQuitChan chan bool diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 208b553d2..9ce6ba650 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -41,7 +41,6 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/ui/qt/qwhisper" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" @@ -81,8 +80,6 @@ type Gui struct { config *ethutil.ConfigManager plugins map[string]plugin - - miner *miner.Miner } // Create GUI, but doesn't start it @@ -454,7 +451,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", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash") /* blockLength := gui.eth.BlockPool().BlocksProcessed diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 368fb002b..1a4d21012 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -30,7 +30,6 @@ import ( "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" - "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -56,13 +55,10 @@ type UiLib struct { filterCallbacks map[int][]int filterManager *filter.FilterManager - - miner *miner.Miner } func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { lib := &UiLib{XEth: xeth.New(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int)} //, filters: make(map[int]*xeth.JSFilter)} - lib.miner = miner.New(eth.KeyManager().Address(), eth) lib.filterManager = filter.NewFilterManager(eth.EventMux()) go lib.filterManager.Start() @@ -221,20 +217,20 @@ func (self *UiLib) RemoveLocalTransaction(id int) { } func (self *UiLib) SetGasPrice(price string) { - self.miner.MinAcceptedGasPrice = ethutil.Big(price) + self.Miner().MinAcceptedGasPrice = ethutil.Big(price) } func (self *UiLib) SetExtra(extra string) { - self.miner.Extra = extra + self.Miner().Extra = extra } func (self *UiLib) ToggleMining() bool { - if !self.miner.Mining() { - self.miner.Start() + if !self.Miner().Mining() { + self.Miner().Start() return true } else { - self.miner.Stop() + self.Miner().Stop() return false } -- cgit v1.2.3 From 567428fb3489d639cd7fdcd50e4362be52745ec4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 16:12:55 +0100 Subject: Filter and mutex locks added --- cmd/mist/assets/examples/coin.html | 5 ----- cmd/mist/gui.go | 2 -- 2 files changed, 7 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index ca7a9c0dd..cb9d471de 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -80,11 +80,6 @@ refresh(); }); - var ev = contract.SingleTransact({}) - ev.watch(function(log) { - someElement.innerHTML += "tnaheousnthaoeu"; - }); - eth.watch('chain').changed(function() { refresh(); }); diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 9ce6ba650..886a5811b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -394,7 +394,6 @@ func (gui *Gui) update() { miningLabel := gui.getObjectByName("miningLabel") events := gui.eth.EventMux().Subscribe( - //eth.PeerListEvent{}, core.NewBlockEvent{}, core.TxPreEvent{}, core.TxPostEvent{}, @@ -410,7 +409,6 @@ func (gui *Gui) update() { switch ev := ev.(type) { case core.NewBlockEvent: gui.processBlock(ev.Block, false) - //gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address())) gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance)) -- cgit v1.2.3 From 9a2be227a6486dd514d64981fb964e86e0bb0467 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 16:18:29 +0100 Subject: commented peer count out --- cmd/mist/assets/qml/main.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 9a6bf5273..e194c9f09 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -888,7 +888,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 13c00afc68652d517f91313bb8c3eeb206d23f22 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 16:54:52 +0100 Subject: Implement register and watchTx --- cmd/mist/assets/ext/ethereum.js/dist/ethereum.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js index d0e9d3cb7..83b598b3f 100644 --- a/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js +++ b/cmd/mist/assets/ext/ethereum.js/dist/ethereum.js @@ -1417,6 +1417,8 @@ var ethMethods = function () { var methods = [ { name: 'balanceAt', call: 'eth_balanceAt' }, + { name: 'register', call: 'eth_register' }, + { name: 'unregister', call: 'eth_unregister' }, { name: 'stateAt', call: 'eth_stateAt' }, { name: 'storageAt', call: 'eth_storageAt' }, { name: 'countAt', call: 'eth_countAt'}, -- cgit v1.2.3 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/mist') 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 7fc9b5b3f9ca0111cc4bc1b2a6b4bb2eccd3e048 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 22:20:47 +0100 Subject: Changed to ChainEvent and fixed a nil pointer in transact --- cmd/mist/assets/examples/info.html | 4 ++++ cmd/mist/gui.go | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/info.html b/cmd/mist/assets/examples/info.html index d8816b19f..2a405c280 100644 --- a/cmd/mist/assets/examples/info.html +++ b/cmd/mist/assets/examples/info.html @@ -71,6 +71,10 @@ document.querySelector("#gas_price").innerHTML = eth.gasPrice; document.querySelector("#mining").innerHTML = eth.mining; document.querySelector("#listening").innerHTML = eth.listening; + eth.watch('chain').changed(function() { + document.querySelector("#number").innerHTML = eth.number; + }); + diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 886a5811b..c12538f4a 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -394,7 +394,6 @@ func (gui *Gui) update() { miningLabel := gui.getObjectByName("miningLabel") events := gui.eth.EventMux().Subscribe( - core.NewBlockEvent{}, core.TxPreEvent{}, core.TxPostEvent{}, ) @@ -407,11 +406,6 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { - case core.NewBlockEvent: - gui.processBlock(ev.Block, false) - balance := ethutil.CurrencyToString(gui.eth.ChainManager().State().GetBalance(gui.address())) - gui.getObjectByName("balanceLabel").Set("text", fmt.Sprintf("%v", balance)) - case core.TxPreEvent: tx := ev.Tx -- cgit v1.2.3 From c1474e1877641cb80ed0c935a3bd5b3d5c2fe3ac Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 23:10:37 +0100 Subject: Removed mined transactions from pending view. Closes #321 --- cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/assets/qml/views/pending_tx.qml | 9 +++++++++ cmd/mist/gui.go | 28 ++-------------------------- 3 files changed, 12 insertions(+), 27 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index e194c9f09..3089fc46f 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -876,7 +876,7 @@ ApplicationWindow { } function setWalletValue(value) { - walletValueLabel.text = value + //walletValueLabel.text = value } function loadPlugin(name) { diff --git a/cmd/mist/assets/qml/views/pending_tx.qml b/cmd/mist/assets/qml/views/pending_tx.qml index 4442a69db..3dcedeff2 100644 --- a/cmd/mist/assets/qml/views/pending_tx.qml +++ b/cmd/mist/assets/qml/views/pending_tx.qml @@ -41,4 +41,13 @@ Rectangle { pendingTxModel.insert(0, {hash: tx.hash, to: tx.address, from: tx.sender, value: tx.value, contract: isContract}) } + + function removeTx(tx) { + for (var i = 0; i < pendingTxModel.count; i++) { + if (tx.hash === pendingTxModel.get(i).hash) { + pendingTxModel.remove(i); + break; + } + } + } } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c12538f4a..c9419473c 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -407,34 +407,10 @@ func (gui *Gui) update() { } switch ev := ev.(type) { case core.TxPreEvent: - tx := ev.Tx - - tstate := gui.eth.ChainManager().TransState() - cstate := gui.eth.ChainManager().State() - - taccount := tstate.GetAccount(gui.address()) - caccount := cstate.GetAccount(gui.address()) - unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance()) - - gui.setWalletValue(taccount.Balance(), unconfirmedFunds) - gui.insertTransaction("pre", tx) + gui.insertTransaction("pre", ev.Tx) case core.TxPostEvent: - tx := ev.Tx - object := state.GetAccount(gui.address()) - - if bytes.Compare(tx.From(), gui.address()) == 0 { - object.SubAmount(tx.Value()) - - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.To(), gui.address()) == 0 { - object.AddAmount(tx.Value()) - - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } - - gui.setWalletValue(object.Balance(), nil) - state.UpdateStateObject(object) + gui.getObjectByName("pendingTxView").Call("removeTx", xeth.NewTx(ev.Tx)) } case <-peerUpdateTicker.C: -- cgit v1.2.3 From 60318c96d03bcaaf731802b1080a3d87cb482124 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 17 Feb 2015 23:22:42 +0100 Subject: removed old wallet --- cmd/mist/assets/qml/main.qml | 1 - 1 file changed, 1 deletion(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 3089fc46f..f9bfd9b8d 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -46,7 +46,6 @@ ApplicationWindow { walletWeb.view.url = "http://ethereum-dapp-wallet.meteor.com/"; walletWeb.menuItem.title = "Wallet"; - addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: false}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/whisper.qml", {noAdd: true, close: false, section: "legacy"}); -- 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/mist') 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 05b1ec008b771d9856e83a6269a5267eb18e1f51 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 18 Feb 2015 11:42:01 +0100 Subject: Disabled ability to disable whisper. Closes #334 --- cmd/mist/main.go | 1 + 1 file changed, 1 insertion(+) (limited to 'cmd/mist') diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 32222fbef..14f561e99 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -60,6 +60,7 @@ func run() error { MaxPeers: MaxPeer, Port: OutboundPort, NAT: NAT, + Shh: true, BootNodes: BootNodes, NodeKey: NodeKey, KeyRing: KeyRing, -- 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 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'cmd/mist') 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) -- cgit v1.2.3 From 0057bb4ef6d55b5d580a4e0421526a477ef93de9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 19 Feb 2015 11:51:38 +0100 Subject: WIP QT Clipboard --- cmd/mist/assets/qml/main.qml | 1 + cmd/mist/gui.go | 1 + 2 files changed, 2 insertions(+) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index f9bfd9b8d..5f7f05d83 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -246,6 +246,7 @@ ApplicationWindow { } } } + } property var blockModel: ListModel { diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c9419473c..1e3efd269 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -131,6 +131,7 @@ func (gui *Gui) Start(assetPath string) { context.SetVar("gui", gui) context.SetVar("eth", gui.uiLib) context.SetVar("shh", gui.whisper) + //clipboard.SetQMLClipboard(context) win, err := gui.showWallet(context) if err != nil { -- 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/mist') 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 From fa4cbad315609e41d88c59ecbce7c6c6169fc57a Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 19 Feb 2015 22:33:22 +0100 Subject: Optimisations and fixed a couple of DDOS issues in the miner --- cmd/mist/assets/examples/bomb.html | 22 ++++++++++++++++++++++ cmd/mist/gui.go | 20 +++----------------- 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 cmd/mist/assets/examples/bomb.html (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/bomb.html b/cmd/mist/assets/examples/bomb.html new file mode 100644 index 000000000..62540f9bb --- /dev/null +++ b/cmd/mist/assets/examples/bomb.html @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 1e3efd269..afddeb8f6 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -387,14 +387,11 @@ func (gui *Gui) update() { generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) - state := gui.eth.ChainManager().TransState() - - gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) - lastBlockLabel := gui.getObjectByName("lastBlockLabel") miningLabel := gui.getObjectByName("miningLabel") events := gui.eth.EventMux().Subscribe( + core.ChainEvent{}, core.TxPreEvent{}, core.TxPostEvent{}, ) @@ -407,6 +404,8 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { + case core.ChainEvent: + gui.processBlock(ev.Block, false) case core.TxPreEvent: gui.insertTransaction("pre", ev.Tx) @@ -422,19 +421,6 @@ func (gui *Gui) update() { lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.Miner().HashRate(), 10)+"/Khash") - /* - blockLength := gui.eth.BlockPool().BlocksProcessed - chainLength := gui.eth.BlockPool().ChainLength - - var ( - pct float64 = 1.0 / float64(chainLength) * float64(blockLength) - dlWidget = gui.win.Root().ObjectByName("downloadIndicator") - dlLabel = gui.win.Root().ObjectByName("downloadLabel") - ) - dlWidget.Set("value", pct) - dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) - */ - case <-statsUpdateTicker.C: gui.setStatsPane() } -- cgit v1.2.3 From ea9a549bbdc8377bca73f1417f2dc4a18396a382 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 20 Feb 2015 14:19:34 +0100 Subject: Removed exported fields from state object and added proper set/getters --- cmd/mist/ui_lib.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 1a4d21012..4fa6e8e55 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -146,8 +146,8 @@ func (ui *UiLib) AssetPath(p string) string { func (self *UiLib) StartDbWithContractAndData(contractHash, data string) { dbWindow := NewDebuggerWindow(self) object := self.eth.ChainManager().State().GetStateObject(ethutil.Hex2Bytes(contractHash)) - if len(object.Code) > 0 { - dbWindow.SetCode(ethutil.Bytes2Hex(object.Code)) + if len(object.Code()) > 0 { + dbWindow.SetCode(ethutil.Bytes2Hex(object.Code())) } dbWindow.SetData(data) -- cgit v1.2.3 From cc43ab9a810125239636143a91609389b19b49c7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 20 Feb 2015 18:05:46 +0100 Subject: Minor updates for release --- cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 937670bd2..c421d696c 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -964,7 +964,7 @@ ApplicationWindow { anchors.top: parent.top anchors.topMargin: 30 font.pointSize: 12 - text: "

Mist (0.7.10)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy

UX

Alex van de Sande
" + text: "

Mist (0.9.0)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy
Gustav Simonsson

UX/UI

Alex van de Sande
Fabian Vogelsteller" } } diff --git a/cmd/mist/main.go b/cmd/mist/main.go index d41aa34bf..c7152347d 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -36,7 +36,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.8.3" + Version = "0.9.0" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 92337baa5a51f4d4ec39cb5004bdcc4b07d321e0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 21 Feb 2015 00:42:57 +0100 Subject: reverted back to proper version number --- cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index c421d696c..ca37dbf3c 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -964,7 +964,7 @@ ApplicationWindow { anchors.top: parent.top anchors.topMargin: 30 font.pointSize: 12 - text: "

Mist (0.9.0)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy
Gustav Simonsson

UX/UI

Alex van de Sande
Fabian Vogelsteller" + text: "

Mist (0.8.4)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy
Gustav Simonsson

UX/UI

Alex van de Sande
Fabian Vogelsteller" } } diff --git a/cmd/mist/main.go b/cmd/mist/main.go index c7152347d..45eddeb28 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -36,7 +36,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.9.0" + Version = "0.8.4" ) var ethereum *eth.Ethereum -- cgit v1.2.3 From 483d96a89d68023360d211ab329400f4b960fe48 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 22 Feb 2015 13:12:01 +0100 Subject: Added eth_logs & fixed issue with manual log filtering * Implemented `eth_logs` * Fixed issue with `filter.Find()` where logs were appended to an incorrect, non-returned slice resulting in no logs found --- cmd/mist/assets/examples/coin.html | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html index cb9d471de..18a6811d7 100644 --- a/cmd/mist/assets/examples/coin.html +++ b/cmd/mist/assets/examples/coin.html @@ -14,8 +14,9 @@
- Amount: + Address: + Amount:
@@ -58,7 +59,7 @@ }], "outputs": [] }, { - "name":"received", + "name":"Changed", "type":"event", "inputs": [ {"name":"from","type":"address","indexed":true}, @@ -69,18 +70,14 @@ var address = localStorage.getItem("address"); // deploy if not exist if (address == null) { - var code = "0x60056013565b61012b806100346000396000f35b6103e8600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a681461002b578063d0679d3414610039578063e3d670d71461004d57005b610033610126565b60006000f35b610047600435602435610062565b60006000f35b610058600435610104565b8060005260206000f35b80600033600160a060020a0316600052602052604060002054101561008657610100565b80600033600160a060020a0316600052602052604060002090815403908190555080600083600160a060020a0316600052602052604060002090815401908190555033600160a060020a0316600052806020527ff11e547d796cc64acdf758e7cee90439494fd886a19159454aa61e473fdbafef60406000a15b5050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"; + var code = "0x60056013565b61014f8061003a6000396000f35b620f42406000600033600160a060020a0316815260200190815260200160002081905550560060e060020a600035048063d0679d3414610020578063e3d670d71461003457005b61002e600435602435610049565b60006000f35b61003f600435610129565b8060005260206000f35b806000600033600160a060020a03168152602001908152602001600020541061007157610076565b610125565b806000600033600160a060020a03168152602001908152602001600020908154039081905550806000600084600160a060020a031681526020019081526020016000209081540190819055508033600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a38082600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660006000a35b5050565b60006000600083600160a060020a0316815260200190815260200160002054905091905056"; address = web3.eth.transact({data: code}); localStorage.setItem("address", address); } - document.querySelector("#contract_addr").innerHTML = address.toUpperCase(); + document.querySelector("#contract_addr").innerHTML = address; var contract = web3.eth.contract(address, desc); - contract.received({from: eth.coinbase}).changed(function() { - refresh(); - }); - - eth.watch('chain').changed(function() { + contract.Changed({from: eth.coinbase}).changed(function() { refresh(); }); @@ -93,7 +90,7 @@ var storage = eth.storageAt(address); table.innerHTML = ""; for( var item in storage ) { - table.innerHTML += ""+item.toUpperCase()+""+web3.toDecimal(storage[item])+""; + table.innerHTML += ""+item+""+web3.toDecimal(storage[item])+""; } } @@ -106,6 +103,7 @@ } var value = parseInt( document.querySelector("#amount").value ); + console.log("transact: ", to, " => ", value) contract.send( to, value ); } @@ -121,7 +119,7 @@ contract JevCoin { balances[msg.sender] = 1000000; } - event changed(address indexed from, address indexed to); + event Changed(address indexed from, uint indexed amount); function send(address to, uint value) { if( balances[msg.sender] < value ) return; @@ -129,7 +127,8 @@ contract JevCoin { balances[msg.sender] -= value; balances[to] += value; - changed(msg.sender, to); + Changed(msg.sender, value); + Changed(to, value); } function balance(address who) constant returns(uint t) -- cgit v1.2.3 From 321dce1f47135f673730cb86fdf1faf03dc6cbd4 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 22 Feb 2015 13:26:10 +0100 Subject: Bump --- cmd/mist/assets/qml/main.qml | 2 +- cmd/mist/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist') diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index ca37dbf3c..e80bd87e0 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -964,7 +964,7 @@ ApplicationWindow { anchors.top: parent.top anchors.topMargin: 30 font.pointSize: 12 - text: "

Mist (0.8.4)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy
Gustav Simonsson

UX/UI

Alex van de Sande
Fabian Vogelsteller" + text: "

Mist (0.8.5)


Development

Jeffrey Wilcke
Viktor Trón
Felix Lange
Taylor Gerring
Daniel Nagy
Gustav Simonsson

UX/UI

Alex van de Sande
Fabian Vogelsteller" } } diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 45eddeb28..ad6eb5bec 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -36,7 +36,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.8.4" + Version = "0.8.5" ) var ethereum *eth.Ethereum -- cgit v1.2.3