|
|
|
@ -63,6 +63,15 @@ func LoadExtension(path string) (uintptr, error) { |
|
|
|
|
return ptr.Interface().(uintptr), nil |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
/* |
|
|
|
|
vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") |
|
|
|
|
fmt.Printf("Fetched vec with addr: %#x\n", vec) |
|
|
|
|
if errr != nil { |
|
|
|
|
fmt.Println(errr) |
|
|
|
|
} else { |
|
|
|
|
context.SetVar("vec", (unsafe.Pointer)(vec)) |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
var guilogger = logger.NewLogger("GUI") |
|
|
|
|
|
|
|
|
@ -112,9 +121,10 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (gui *Gui) Start(assetPath string) { |
|
|
|
|
|
|
|
|
|
defer gui.txDb.Close() |
|
|
|
|
|
|
|
|
|
guilogger.Infoln("Starting GUI") |
|
|
|
|
|
|
|
|
|
// Register ethereum functions
|
|
|
|
|
qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ |
|
|
|
|
Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, |
|
|
|
@ -132,16 +142,6 @@ func (gui *Gui) Start(assetPath string) { |
|
|
|
|
context.SetVar("gui", gui) |
|
|
|
|
context.SetVar("eth", gui.uiLib) |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") |
|
|
|
|
fmt.Printf("Fetched vec with addr: %#x\n", vec) |
|
|
|
|
if errr != nil { |
|
|
|
|
fmt.Println(errr) |
|
|
|
|
} else { |
|
|
|
|
context.SetVar("vec", (unsafe.Pointer)(vec)) |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// Load the main QML interface
|
|
|
|
|
data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) |
|
|
|
|
|
|
|
|
@ -160,7 +160,6 @@ func (gui *Gui) Start(assetPath string) { |
|
|
|
|
panic(err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
guilogger.Infoln("Starting GUI") |
|
|
|
|
gui.open = true |
|
|
|
|
win.Show() |
|
|
|
|
|
|
|
|
@ -245,7 +244,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { |
|
|
|
|
return gui.eth.KeyManager().KeyPair().AsStrings() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (gui *Gui) setInitialChainManager() { |
|
|
|
|
func (gui *Gui) setInitialChain(ancientBlocks bool) { |
|
|
|
|
sBlk := gui.eth.ChainManager().LastBlockHash |
|
|
|
|
blk := gui.eth.ChainManager().GetBlock(sBlk) |
|
|
|
|
for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { |
|
|
|
@ -255,10 +254,6 @@ func (gui *Gui) setInitialChainManager() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type address struct { |
|
|
|
|
Name, Address string |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (gui *Gui) loadAddressBook() { |
|
|
|
|
view := gui.getObjectByName("infoView") |
|
|
|
|
nameReg := gui.pipe.World().Config().Get("NameReg") |
|
|
|
@ -385,11 +380,11 @@ func (self *Gui) getObjectByName(objectName string) qml.Object { |
|
|
|
|
func (gui *Gui) update() { |
|
|
|
|
// We have to wait for qml to be done loading all the windows.
|
|
|
|
|
for !gui.qmlDone { |
|
|
|
|
time.Sleep(500 * time.Millisecond) |
|
|
|
|
time.Sleep(300 * time.Millisecond) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
go func() { |
|
|
|
|
go gui.setInitialChainManager() |
|
|
|
|
go gui.setInitialChain(false) |
|
|
|
|
gui.loadAddressBook() |
|
|
|
|
gui.loadMergedMiningOptions() |
|
|
|
|
gui.setPeerInfo() |
|
|
|
@ -493,14 +488,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") |
|
|
|
|
/* |
|
|
|
|
if gui.miner != nil { |
|
|
|
|
pow := gui.miner.GetPow() |
|
|
|
|
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
blockLength := gui.eth.BlockPool().BlocksProcessed |
|
|
|
|
chainLength := gui.eth.BlockPool().ChainLength |
|
|
|
@ -510,7 +498,6 @@ func (gui *Gui) update() { |
|
|
|
|
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)) |
|
|
|
|
|
|
|
|
@ -549,7 +536,6 @@ NumGC: %d |
|
|
|
|
|
|
|
|
|
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.pipe.Peers() { |
|
|
|
|
gui.win.Root().Call("addPeer", peer) |
|
|
|
|