aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gui.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-22 00:29:59 +0800
committerobscuren <geffobscura@gmail.com>2014-02-22 00:29:59 +0800
commit3e8b27c9dc78ffeeefae987e67730fae17707df4 (patch)
treeccc51eac0f5772d3500b6555325ec97c55a7f0b0 /ui/gui.go
parent95a48cea18eccd4ea2cb298027dbd01bd21f43e8 (diff)
downloadgo-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar.gz
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar.bz2
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar.lz
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar.xz
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.tar.zst
go-tangerine-3e8b27c9dc78ffeeefae987e67730fae17707df4.zip
WIP library, sample app
Diffstat (limited to 'ui/gui.go')
-rw-r--r--ui/gui.go28
1 files changed, 25 insertions, 3 deletions
diff --git a/ui/gui.go b/ui/gui.go
index e223fe262..8f063843c 100644
--- a/ui/gui.go
+++ b/ui/gui.go
@@ -17,10 +17,15 @@ type Gui struct {
engine *qml.Engine
component *qml.Common
eth *eth.Ethereum
+
+ // The Ethereum library
+ lib *EthLib
}
func New(ethereum *eth.Ethereum) *Gui {
- return &Gui{eth: ethereum}
+ lib := &EthLib{blockManager: ethereum.BlockManager, blockChain: ethereum.BlockManager.BlockChain(), txPool: ethereum.TxPool}
+
+ return &Gui{eth: ethereum, lib: lib}
}
type Block struct {
@@ -48,10 +53,10 @@ func (ui *Gui) Start() {
}
ui.win = component.CreateWindow(nil)
- root := ui.win.Root()
context := ui.engine.Context()
- context.SetVar("tester", &Tester{root: root})
+ context.SetVar("eth", ui.lib)
+ context.SetVar("ui", &UiLib{engine: ui.engine})
ui.eth.BlockManager.SecondaryBlockProcessor = ui
@@ -82,6 +87,23 @@ func (ui *Gui) updatePeers() {
}
}
+type UiLib struct {
+ engine *qml.Engine
+}
+
+func (ui *UiLib) Open(path string) {
+ component, err := ui.engine.LoadFile(path[7:])
+ if err != nil {
+ ethutil.Config.Log.Debugln(err)
+ }
+ win := component.CreateWindow(nil)
+
+ go func() {
+ win.Show()
+ win.Wait()
+ }()
+}
+
type Tester struct {
root qml.Object
}