Changed naming on exposed QML variables

pull/115/head
obscuren 10 years ago
parent 2e2f23a0ae
commit 59d9746849
  1. 4
      ethereal/assets/qml/views/chain.qml
  2. 10
      ethereal/assets/qml/views/info.qml
  3. 2
      ethereal/assets/qml/views/transaction.qml
  4. 8
      ethereal/assets/qml/wallet.qml
  5. 25
      ethereal/gui.go
  6. 15
      ethereal/ui_lib.go

@ -145,9 +145,9 @@ Rectangle {
text: "Debug contract"
onClicked: {
if(tx.createsContract){
ui.startDbWithCode(tx.rawData)
eth.startDbWithCode(tx.rawData)
}else {
ui.startDbWithContractAndData(tx.address, tx.rawData)
eth.startDbWithContractAndData(tx.address, tx.rawData)
}
}
}

@ -35,11 +35,11 @@ Rectangle {
text: "Client ID"
}
TextField {
text: eth.getCustomIdentifier()
text: gui.getCustomIdentifier()
width: 500
placeholderText: "Anonymous"
onTextChanged: {
eth.setCustomIdentifier(text)
gui.setCustomIdentifier(text)
}
}
}
@ -75,7 +75,7 @@ Rectangle {
MouseArea{
anchors.fill: parent
onClicked: {
eth.registerName(nameToReg.text)
gui.registerName(nameToReg.text)
nameToReg.text = ""
}
}
@ -107,7 +107,7 @@ Rectangle {
Slider {
id: logLevelSlider
value: eth.getLogLevelInt()
value: gui.getLogLevelInt()
anchors {
right: parent.right
top: parent.top
@ -124,7 +124,7 @@ Rectangle {
stepSize: 1
onValueChanged: {
eth.setLogLevel(value)
gui.setLogLevel(value)
}
}
}

@ -174,7 +174,7 @@ Rectangle {
onClicked: {
var value = txValue.text + denomModel.get(valueDenom.currentIndex).zeros;
var gasPrice = txGasPrice.text + denomModel.get(gasDenom.currentIndex).zeros;
var res = eth.create(txFuelRecipient.text, value, txGas.text, gasPrice, codeView.text)
var res = gui.create(txFuelRecipient.text, value, txGas.text, gasPrice, codeView.text)
if(res[1]) {
txResult.text = "Your contract <b>could not</b> be sent over the network:\n<b>"
txResult.text += res[1].error()

@ -26,7 +26,7 @@ ApplicationWindow {
var pendingTxView = addPlugin("./views/pending_tx.qml")
// Call the ready handler
eth.done()
gui.done()
}
function addPlugin(path, options) {
@ -111,7 +111,7 @@ ApplicationWindow {
text: "Run JS file"
onTriggered: {
generalFileDialog.callback = function(path) {
eth.evalJavascriptFile(path)
lib.evalJavascriptFile(path)
}
generalFileDialog.open()
}
@ -155,7 +155,7 @@ ApplicationWindow {
id: miningButton
text: "Start Mining"
onClicked: {
eth.toggleMining()
gui.toggleMining()
}
}
@ -456,7 +456,7 @@ ApplicationWindow {
anchors.leftMargin: 5
text: "Import"
onClicked: {
eth.importTx(txImportField.text)
lib.importTx(txImportField.text)
txImportField.visible = false
}
}

@ -18,7 +18,6 @@ import (
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
)
@ -49,8 +48,6 @@ type Gui struct {
config *ethutil.ConfigManager
miner *ethminer.Miner
jsEngine *javascript.JSRE
}
// Create GUI, but doesn't start it
@ -62,7 +59,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
pub := ethpub.NewPEthereum(ethereum)
return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, jsEngine: javascript.NewJSRE(ethereum)}
return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config}
}
func (gui *Gui) Start(assetPath string) {
@ -81,12 +78,12 @@ func (gui *Gui) Start(assetPath string) {
// Create a new QML engine
gui.engine = qml.NewEngine()
context := gui.engine.Context()
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
// Expose the eth library and the ui library to QML
context.SetVar("eth", gui)
context.SetVar("gui", gui)
context.SetVar("pub", gui.pub)
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
context.SetVar("ui", gui.uiLib)
context.SetVar("eth", gui.uiLib)
// Load the main QML interface
data, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
@ -126,7 +123,7 @@ func (gui *Gui) Stop() {
gui.win.Hide()
}
gui.jsEngine.Stop()
gui.uiLib.jsEngine.Stop()
logger.Infoln("Stopped")
}
@ -477,18 +474,6 @@ func (gui *Gui) Create(recipient, value, gas, gasPrice, data string) (*ethpub.PR
return gui.pub.Transact(gui.privateKey(), recipient, value, gas, gasPrice, data)
}
func (self *Gui) ImportTx(rlpTx string) {
tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
self.eth.TxPool().QueueTransaction(tx)
}
func (self *Gui) SearchChange(blockHash, address, storageAddress string) {
}
func (self *Gui) EvalJavascriptFile(path string) {
self.jsEngine.LoadExtFile(path[7:])
}
func (gui *Gui) SetCustomIdentifier(customIdentifier string) {
gui.clientIdentity.SetCustomIdentifier(customIdentifier)
gui.config.Save("id", customIdentifier)

@ -4,7 +4,9 @@ import (
"path"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/go-qml/qml"
)
@ -23,10 +25,21 @@ type UiLib struct {
win *qml.Window
Db *Debugger
DbWindow *DebuggerWindow
jsEngine *javascript.JSRE
}
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
return &UiLib{engine: engine, eth: eth, assetPath: assetPath}
return &UiLib{engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth)}
}
func (self *UiLib) ImportTx(rlpTx string) {
tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
self.eth.TxPool().QueueTransaction(tx)
}
func (self *UiLib) EvalJavascriptFile(path string) {
self.jsEngine.LoadExtFile(path[7:])
}
func (ui *UiLib) OpenQml(path string) {

Loading…
Cancel
Save