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" text: "Debug contract"
onClicked: { onClicked: {
if(tx.createsContract){ if(tx.createsContract){
ui.startDbWithCode(tx.rawData) eth.startDbWithCode(tx.rawData)
}else { }else {
ui.startDbWithContractAndData(tx.address, tx.rawData) eth.startDbWithContractAndData(tx.address, tx.rawData)
} }
} }
} }

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

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

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

@ -18,7 +18,6 @@ import (
"github.com/ethereum/eth-go/ethreact" "github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire" "github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/utils" "github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml" "github.com/go-qml/qml"
) )
@ -49,8 +48,6 @@ type Gui struct {
config *ethutil.ConfigManager config *ethutil.ConfigManager
miner *ethminer.Miner miner *ethminer.Miner
jsEngine *javascript.JSRE
} }
// Create GUI, but doesn't start it // Create GUI, but doesn't start it
@ -62,7 +59,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
pub := ethpub.NewPEthereum(ethereum) 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) { func (gui *Gui) Start(assetPath string) {
@ -81,12 +78,12 @@ func (gui *Gui) Start(assetPath string) {
// Create a new QML engine // Create a new QML engine
gui.engine = qml.NewEngine() gui.engine = qml.NewEngine()
context := gui.engine.Context() context := gui.engine.Context()
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath)
// Expose the eth library and the ui library to QML // Expose the eth library and the ui library to QML
context.SetVar("eth", gui) context.SetVar("gui", gui)
context.SetVar("pub", gui.pub) context.SetVar("pub", gui.pub)
gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath) context.SetVar("eth", gui.uiLib)
context.SetVar("ui", gui.uiLib)
// Load the main QML interface // Load the main QML interface
data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) data, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
@ -126,7 +123,7 @@ func (gui *Gui) Stop() {
gui.win.Hide() gui.win.Hide()
} }
gui.jsEngine.Stop() gui.uiLib.jsEngine.Stop()
logger.Infoln("Stopped") 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) 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) { func (gui *Gui) SetCustomIdentifier(customIdentifier string) {
gui.clientIdentity.SetCustomIdentifier(customIdentifier) gui.clientIdentity.SetCustomIdentifier(customIdentifier)
gui.config.Save("id", customIdentifier) gui.config.Save("id", customIdentifier)

@ -4,7 +4,9 @@ import (
"path" "path"
"github.com/ethereum/eth-go" "github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/go-qml/qml" "github.com/go-qml/qml"
) )
@ -23,10 +25,21 @@ type UiLib struct {
win *qml.Window win *qml.Window
Db *Debugger Db *Debugger
DbWindow *DebuggerWindow DbWindow *DebuggerWindow
jsEngine *javascript.JSRE
} }
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { 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) { func (ui *UiLib) OpenQml(path string) {

Loading…
Cancel
Save