From 01863ebff06d620c9d3a8cf9195d72caeb11dc19 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Wed, 17 Sep 2014 15:58:44 +0200
Subject: [PATCH] Rename and changed peer window

---
 Mist/assets/qml/wallet.qml       | 43 +++++++++++++++++++++++++++-----
 Mist/flags.go                    |  6 ++---
 Mist/gui.go                      |  8 ++++--
 Mist/main.go                     |  4 +--
 Mist/ui_lib.go                   |  4 +++
 javascript/javascript_runtime.go |  2 +-
 utils/cmd.go                     |  4 +--
 7 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/Mist/assets/qml/wallet.qml b/Mist/assets/qml/wallet.qml
index 4867c6833..fc3e7a383 100644
--- a/Mist/assets/qml/wallet.qml
+++ b/Mist/assets/qml/wallet.qml
@@ -19,7 +19,7 @@ ApplicationWindow {
 	height: 600
 	minimumHeight: 300
 
-	title: "Ether Browser"
+	title: "Mist"
 
 	// This signal is used by the filter API. The filter API connects using this signal handler from
 	// the different QML files and plugins.
@@ -853,16 +853,20 @@ ApplicationWindow {
 	     Window {
 		     id: addPeerWin
 		     visible: false
-		     minimumWidth: 230
-		     maximumWidth: 230
+		     minimumWidth: 300
+		     maximumWidth: 300
 		     maximumHeight: 50
 		     minimumHeight: 50
+		     title: "Add peer"
 
+		     /*
 		     TextField {
 			     id: addrField
 			     anchors.verticalCenter: parent.verticalCenter
 			     anchors.left: parent.left
+			     anchors.right: addPeerButton.left
 			     anchors.leftMargin: 10
+			     anchors.rightMargin: 10
 			     placeholderText: "address:port"
 			     text: "54.76.56.74:30303"
 			     onAccepted: {
@@ -870,13 +874,40 @@ ApplicationWindow {
 				     addPeerWin.visible = false
 			     }
 		     }
+		     */
+		    ComboBox {
+			     id: addrField
+			     anchors.verticalCenter: parent.verticalCenter
+			     anchors.left: parent.left
+			     anchors.right: addPeerButton.left
+			     anchors.leftMargin: 10
+			     anchors.rightMargin: 10
+			     onAccepted: {
+				     eth.connectToPeer(addrField.currentText)
+				     addPeerWin.visible = false
+			     }
+
+			     editable: true
+			     model: ListModel { id: pastPeers }
+
+			     Component.onCompleted: {
+				     var ips = eth.pastPeers()
+				     for(var i = 0; i < ips.length; i++) {
+					     pastPeers.append({text: ips.get(i)})
+				     }
+
+				     pastPeers.insert(0, {text: "54.76.56.74:30303"})
+			     }
+		    }
+
 		     Button {
-			     anchors.left: addrField.right
+			     id: addPeerButton
+			     anchors.right: parent.right
 			     anchors.verticalCenter: parent.verticalCenter
-			     anchors.leftMargin: 5
+			     anchors.rightMargin: 10
 			     text: "Add"
 			     onClicked: {
-				     eth.connectToPeer(addrField.text)
+				     eth.connectToPeer(addrField.currentText)
 				     addPeerWin.visible = false
 			     }
 		     }
diff --git a/Mist/flags.go b/Mist/flags.go
index 382f093aa..388280b8c 100644
--- a/Mist/flags.go
+++ b/Mist/flags.go
@@ -44,7 +44,7 @@ func defaultAssetPath() string {
 	// assume a debug build and use the source directory as
 	// asset directory.
 	pwd, _ := os.Getwd()
-	if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "ethereal") {
+	if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "Mist") {
 		assetPath = path.Join(pwd, "assets")
 	} else {
 		switch runtime.GOOS {
@@ -53,7 +53,7 @@ func defaultAssetPath() string {
 			exedir, _ := osext.ExecutableFolder()
 			assetPath = filepath.Join(exedir, "../Resources")
 		case "linux":
-			assetPath = "/usr/share/ethereal"
+			assetPath = "/usr/share/mist"
 		case "windows":
 			assetPath = "./assets"
 		default:
@@ -64,7 +64,7 @@ func defaultAssetPath() string {
 }
 func defaultDataDir() string {
 	usr, _ := user.Current()
-	return path.Join(usr.HomeDir, ".ethereal")
+	return path.Join(usr.HomeDir, ".mist")
 }
 
 var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini")
diff --git a/Mist/gui.go b/Mist/gui.go
index 208157d69..538719703 100644
--- a/Mist/gui.go
+++ b/Mist/gui.go
@@ -491,7 +491,9 @@ func (gui *Gui) setStatsPane() {
 	runtime.ReadMemStats(&memStats)
 
 	statsPane := gui.getObjectByName("statsPane")
-	statsPane.Set("text", fmt.Sprintf(`###### Ethereal 0.6.4 (%s) #######
+	statsPane.Set("text", fmt.Sprintf(`###### Mist 0.6.4 (%s) #######
+
+eth %d (p2p = %d)
 
 CPU:        # %d
 Goroutines: # %d
@@ -502,7 +504,9 @@ Heap Alloc: %d
 
 CGNext:     %x
 NumGC:      %d
-`, runtime.Version(), runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(),
+`, runtime.Version(),
+		eth.ProtocolVersion, eth.P2PVersion,
+		runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(),
 		memStats.Alloc, memStats.HeapAlloc,
 		memStats.NextGC, memStats.NumGC,
 	))
diff --git a/Mist/main.go b/Mist/main.go
index dff0abbb7..6e4554352 100644
--- a/Mist/main.go
+++ b/Mist/main.go
@@ -11,8 +11,8 @@ import (
 )
 
 const (
-	ClientIdentifier = "Ethereal"
-	Version          = "0.6.6"
+	ClientIdentifier = "Mist"
+	Version          = "0.6.7"
 )
 
 var ethereum *eth.Ethereum
diff --git a/Mist/ui_lib.go b/Mist/ui_lib.go
index 4e1f7f45c..1434e28d0 100644
--- a/Mist/ui_lib.go
+++ b/Mist/ui_lib.go
@@ -72,6 +72,10 @@ func (self *UiLib) LookupDomain(domain string) string {
 	}
 }
 
+func (self *UiLib) PastPeers() *ethutil.List {
+	return ethutil.NewList(eth.PastPeers())
+}
+
 func (self *UiLib) ImportTx(rlpTx string) {
 	tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
 	self.eth.TxPool().QueueTransaction(tx)
diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go
index c794c32a8..94301b859 100644
--- a/javascript/javascript_runtime.go
+++ b/javascript/javascript_runtime.go
@@ -42,7 +42,7 @@ func (jsre *JSRE) LoadExtFile(path string) {
 }
 
 func (jsre *JSRE) LoadIntFile(file string) {
-	assetPath := path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "ethereal", "assets", "ext")
+	assetPath := path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "Mist", "assets", "ext")
 	jsre.LoadExtFile(path.Join(assetPath, file))
 }
 
diff --git a/utils/cmd.go b/utils/cmd.go
index 83f3ec0b6..da3cac444 100644
--- a/utils/cmd.go
+++ b/utils/cmd.go
@@ -189,7 +189,7 @@ func DefaultAssetPath() string {
 	// assume a debug build and use the source directory as
 	// asset directory.
 	pwd, _ := os.Getwd()
-	if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "ethereal") {
+	if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "Mist") {
 		assetPath = path.Join(pwd, "assets")
 	} else {
 		switch runtime.GOOS {
@@ -198,7 +198,7 @@ func DefaultAssetPath() string {
 			exedir, _ := osext.ExecutableFolder()
 			assetPath = filepath.Join(exedir, "../Resources")
 		case "linux":
-			assetPath = "/usr/share/ethereal"
+			assetPath = "/usr/share/mist"
 		case "windows":
 			assetPath = "./assets"
 		default:
-- 
GitLab