diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-31 01:36:05 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-31 01:36:05 +0800 |
commit | 0bdb0a9d58be08e210eb94dc6893f6103202ae7c (patch) | |
tree | 698d0741de1bc01510bbb98fdb42baa8aef690d1 | |
parent | 65c5a20e1c04c996f96f81cd959ab986b8482b6a (diff) | |
download | dexon-0bdb0a9d58be08e210eb94dc6893f6103202ae7c.tar.gz dexon-0bdb0a9d58be08e210eb94dc6893f6103202ae7c.tar.zst dexon-0bdb0a9d58be08e210eb94dc6893f6103202ae7c.zip |
Added ini file for ethereum. fixes #66
-rw-r--r-- | ethereal/assets/qml/wallet.qml | 37 | ||||
-rw-r--r-- | ethereal/ethereum.go | 2 | ||||
-rw-r--r-- | ethereal/ui/gui.go | 9 | ||||
-rw-r--r-- | ethereum/ethereum.go | 12 |
4 files changed, 43 insertions, 17 deletions
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 458ce90e4..bbb147d89 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -221,23 +221,30 @@ ApplicationWindow { color: "#00000000" anchors.fill: parent - Label { - id: addressLabel - text: "Address" - anchors { - margins: 5 - top: parent.top - left: parent.left + Column { + spacing: 3 + anchors.fill: parent + anchors.topMargin: 5 + anchors.leftMargin: 5 + + Label { + id: addressLabel + text: "Address" } - } - TextField { - anchors { - margins: 5 - left: addressLabel.right - top: parent.top + TextField { + text: pub.getKey().address + width: 500 + } + + Label { + text: "Client ID" + } + TextField { + text: eth.clientId() + onTextChanged: { + eth.changeClientId(text) + } } - text: pub.getKey().address - width: 500 } diff --git a/ethereal/ethereum.go b/ethereal/ethereum.go index a7e43cd9a..b6e1c681b 100644 --- a/ethereal/ethereum.go +++ b/ethereal/ethereum.go @@ -50,7 +50,7 @@ func main() { } else { g.ParseAll() } - ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, Identifier) + ethutil.ReadConfig(".ethereal", ethutil.LogFile|ethutil.LogStd, g, Identifier) // Instantiated a eth stack ethereum, err := eth.New(eth.CapDefault, UseUPnP) diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index d6430d1fe..42d1c7a04 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -67,6 +67,7 @@ func (gui *Gui) Start(assetPath string) { }}) ethutil.Config.SetClientString(fmt.Sprintf("/Ethereal v%s", version)) + // Create a new QML engine gui.engine = qml.NewEngine() context := gui.engine.Context() @@ -315,3 +316,11 @@ func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PR return gui.pub.Transact(ethutil.Hex(keyPair.PrivateKey), recipient, value, gas, gasPrice, data) } + +func (gui *Gui) ChangeClientId(id string) { + ethutil.Config.SetIdentifier(id) +} + +func (gui *Gui) ClientId() string { + return ethutil.Config.Identifier +} diff --git a/ethereum/ethereum.go b/ethereum/ethereum.go index 7bb668235..ecbf04c9a 100644 --- a/ethereum/ethereum.go +++ b/ethereum/ethereum.go @@ -6,10 +6,12 @@ import ( "github.com/ethereum/eth-go/ethchain" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/go-ethereum/utils" + "github.com/rakyll/globalconf" "io/ioutil" "log" "os" "os/signal" + "path" "runtime" "strings" ) @@ -59,7 +61,15 @@ func main() { lt = ethutil.LogFile | ethutil.LogStd } - ethutil.ReadConfig(".ethereum", lt, Identifier) + g, err := globalconf.NewWithOptions(&globalconf.Options{ + Filename: path.Join(ethutil.ApplicationFolder(".ethereal"), "conf.ini"), + }) + if err != nil { + fmt.Println(err) + } else { + g.ParseAll() + } + ethutil.ReadConfig(".ethereum", lt, g, Identifier) logger := ethutil.Config.Log |