From f6aabb7a90903a681eca44976301620756124137 Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 23 Jun 2014 16:25:57 +0200 Subject: Implements QML Apps. Implements #47 You are welcome Stephan. --- ethereal/ui/qml_app.go | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ethereal/ui/qml_app.go (limited to 'ethereal/ui/qml_app.go') diff --git a/ethereal/ui/qml_app.go b/ethereal/ui/qml_app.go new file mode 100644 index 000000000..d47751616 --- /dev/null +++ b/ethereal/ui/qml_app.go @@ -0,0 +1,59 @@ +package ethui + +import ( + "github.com/ethereum/eth-go/ethchain" + "github.com/ethereum/eth-go/ethpub" + "github.com/ethereum/eth-go/ethutil" + "github.com/go-qml/qml" +) + +type QmlApplication struct { + win *qml.Window + engine *qml.Engine + lib *UiLib + path string +} + +func NewQmlApplication(path string, lib *UiLib) *QmlApplication { + engine := qml.NewEngine() + return &QmlApplication{engine: engine, path: path, lib: lib} +} + +func (app *QmlApplication) Create() error { + component, err := app.engine.LoadFile(app.path) + if err != nil { + ethutil.Config.Log.Debugln(err) + } + app.win = component.CreateWindow(nil) + + return nil +} + +func (app *QmlApplication) Destroy() { + app.engine.Destroy() +} + +func (app *QmlApplication) NewWatcher(quitChan chan bool) { +} + +// Events +func (app *QmlApplication) NewBlock(block *ethchain.Block) { + pblock := ðpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())} + app.win.Call("onNewBlockCb", pblock) +} + +func (app *QmlApplication) ObjectChanged(stateObject *ethchain.StateObject) { + app.win.Call("onObjectChangeCb", ethpub.NewPStateObject(stateObject)) +} + +func (app *QmlApplication) StorageChanged(storageObject *ethchain.StorageState) { + app.win.Call("onStorageChangeCb", ethpub.NewPStorageState(storageObject)) +} + +// Getters +func (app *QmlApplication) Engine() *qml.Engine { + return app.engine +} +func (app *QmlApplication) Window() *qml.Window { + return app.win +} -- cgit v1.2.3 From 9a06efd0809c370451c5e85ce4688104cd5df461 Mon Sep 17 00:00:00 2001 From: zelig Date: Wed, 25 Jun 2014 18:28:38 +0100 Subject: new logger API for upstream merge --- ethereal/ui/qml_app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereal/ui/qml_app.go') diff --git a/ethereal/ui/qml_app.go b/ethereal/ui/qml_app.go index d47751616..39ab7f922 100644 --- a/ethereal/ui/qml_app.go +++ b/ethereal/ui/qml_app.go @@ -22,7 +22,7 @@ func NewQmlApplication(path string, lib *UiLib) *QmlApplication { func (app *QmlApplication) Create() error { component, err := app.engine.LoadFile(app.path) if err != nil { - ethutil.Config.Log.Debugln(err) + logger.Warnln(err) } app.win = component.CreateWindow(nil) -- cgit v1.2.3 From 098f7f23ce62d3f0c60d30d325576de93795cc4b Mon Sep 17 00:00:00 2001 From: zelig Date: Sun, 29 Jun 2014 20:39:45 +0100 Subject: changed name for ethutil hex functions; and access to keyring via keyManager --- ethereal/ui/qml_app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ethereal/ui/qml_app.go') diff --git a/ethereal/ui/qml_app.go b/ethereal/ui/qml_app.go index 39ab7f922..d23fdd110 100644 --- a/ethereal/ui/qml_app.go +++ b/ethereal/ui/qml_app.go @@ -38,7 +38,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) { // Events func (app *QmlApplication) NewBlock(block *ethchain.Block) { - pblock := ðpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())} + pblock := ðpub.PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} app.win.Call("onNewBlockCb", pblock) } -- cgit v1.2.3