From 4ed94d3d512da28407118723e05e29f4058497e0 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 7 Oct 2014 11:18:34 +0200 Subject: [PATCH] removed old windows & added websockets to mist --- ethereum/main.go | 2 +- mist/assets/qml/main.qml | 17 +++++----- mist/assets/qml/views/chain.qml | 31 ++++++++---------- mist/assets/qml/views/history.qml | 1 - mist/assets/qml/views/info.qml | 3 +- mist/assets/qml/views/javascript.qml | 45 --------------------------- mist/assets/qml/views/pending_tx.qml | 1 - mist/assets/qml/views/transaction.qml | 1 - mist/flags.go | 44 ++++++++++++++------------ mist/main.go | 6 +++- 10 files changed, 51 insertions(+), 100 deletions(-) delete mode 100644 mist/assets/qml/views/javascript.qml diff --git a/ethereum/main.go b/ethereum/main.go index 0f0df20bbd..3729b840b8 100644 --- a/ethereum/main.go +++ b/ethereum/main.go @@ -13,7 +13,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.6.7" + Version = "0.6.8" ) var logger = ethlog.NewLogger("CLI") diff --git a/mist/assets/qml/main.qml b/mist/assets/qml/main.qml index 3d9204ce87..689427228c 100644 --- a/mist/assets/qml/main.qml +++ b/mist/assets/qml/main.qml @@ -51,9 +51,8 @@ ApplicationWindow { addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/chain.qml", {noAdd: true, close: false, section: "legacy"}); - addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/pending_tx.qml", {noAdd: true, close: false, section: "legacy"}); - addPlugin("./views/javascript.qml", {noAdd: true, close: false, section: "legacy"}); + addPlugin("./views/info.qml", {noAdd: true, close: false, section: "legacy"}); addPlugin("./views/jeffcoin/jeffcoin.qml", {noAdd: true, close: false, section: "apps"}) @@ -363,12 +362,7 @@ ApplicationWindow { view.visible = false view.anchors.fill = mainView - if( !view.hasOwnProperty("iconSource") ) { - console.log("Could not load plugin. Property 'iconSourc' not found on view."); - return; - } - - var menuItem = menu.createMenuItem(view.iconSource, view, options); + var menuItem = menu.createMenuItem(view, options); if( view.hasOwnProperty("menuItem") ) { view.menuItem = menuItem; } @@ -525,7 +519,7 @@ ApplicationWindow { } } - function createMenuItem(icon, view, options) { + function createMenuItem(view, options) { if(options === undefined) { options = {}; } @@ -547,7 +541,10 @@ ApplicationWindow { comp.view = view comp.title = view.title - comp.icon = view.iconSource + + if(view.hasOwnProperty("iconSource")) { + comp.icon = view.iconSource; + } comp.closable = options.close; return comp diff --git a/mist/assets/qml/views/chain.qml b/mist/assets/qml/views/chain.qml index 130ff8bb97..454fafef65 100644 --- a/mist/assets/qml/views/chain.qml +++ b/mist/assets/qml/views/chain.qml @@ -8,8 +8,7 @@ import Ethereum 1.0 Rectangle { id: root - property var title: "Network" - property var iconSource: "../net.png" + property var title: "Block chain" property var menuItem objectName: "chainView" @@ -102,22 +101,18 @@ Rectangle { initial = false } - /* - var txs = JSON.parse(block.transactions); - if(txs != null){ - amount = txs.length - } - */ - var txs = block.transactions; var amount = block.transactions.length; + var txs = []; + for(var i = 0; i < block.transactions.length; i++) { + var tx = JSON.parse(block.transactions.getAsJson(i)); + txs.push(tx); + } if(initial){ blockModel.append({size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } else { blockModel.insert(0, {size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)}) } - - //root.secondary.text = "#" + block.number; } Window { @@ -240,16 +235,16 @@ Rectangle { property var singleBlock: ListModel { id: singleBlock } - function setDetails(block){ - singleBlock.set(0,block) + function setDetails(bl){ + singleBlock.set(0, bl) popup.height = 300 transactionModel.clear() - if(block.txs !== undefined){ - for(var i = 0; i < block.txs.length; i++) { - transactionModel.insert(0, block.txs.get(i)) + if(bl.txs !== undefined){ + for(var i = 0; i < bl.txs.count; i++) { + transactionModel.insert(0, bl.txs.get(i)) } - if(block.txs.length > 0 && block.txs.get(0).data){ - popup.showContractData(block.txs.get(0)) + if(bl.txs.count > 0 && bl.txs.get(0).data){ + popup.showContractData(bl.txs.get(0)) } } txView.forceActiveFocus() diff --git a/mist/assets/qml/views/history.qml b/mist/assets/qml/views/history.qml index 9eee883e3e..c72f8f3aee 100644 --- a/mist/assets/qml/views/history.qml +++ b/mist/assets/qml/views/history.qml @@ -7,7 +7,6 @@ import QtQuick.Controls.Styles 1.1 import Ethereum 1.0 Rectangle { - property var iconSource: "../tx.png" property var title: "Transactions" property var menuItem diff --git a/mist/assets/qml/views/info.qml b/mist/assets/qml/views/info.qml index 158e2c9609..3ff551b058 100644 --- a/mist/assets/qml/views/info.qml +++ b/mist/assets/qml/views/info.qml @@ -7,8 +7,7 @@ import QtQuick.Controls.Styles 1.1 import Ethereum 1.0 Rectangle { - property var title: "Information" - property var iconSource: "../heart.png" + property var title: "Debug Info" property var menuItem objectName: "infoView" diff --git a/mist/assets/qml/views/javascript.qml b/mist/assets/qml/views/javascript.qml deleted file mode 100644 index ea05c41485..0000000000 --- a/mist/assets/qml/views/javascript.qml +++ /dev/null @@ -1,45 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.0; -import QtQuick.Layouts 1.0; -import QtQuick.Dialogs 1.0; -import QtQuick.Window 2.1; -import QtQuick.Controls.Styles 1.1 -import Ethereum 1.0 - -Rectangle { - property var title: "JavaScript" - property var iconSource: "../tx.png" - property var menuItem - - objectName: "javascriptView" - visible: false - anchors.fill: parent - - TextField { - id: input - anchors { - left: parent.left - right: parent.right - bottom: parent.bottom - } - height: 20 - - Keys.onReturnPressed: { - var res = eth.evalJavascriptString(this.text); - this.text = ""; - - output.append(res) - } - } - - TextArea { - id: output - text: "> JSRE Ready..." - anchors { - top: parent.top - left: parent.left - right: parent.right - bottom: input.top - } - } -} diff --git a/mist/assets/qml/views/pending_tx.qml b/mist/assets/qml/views/pending_tx.qml index abfa257907..4442a69dbf 100644 --- a/mist/assets/qml/views/pending_tx.qml +++ b/mist/assets/qml/views/pending_tx.qml @@ -8,7 +8,6 @@ import Ethereum 1.0 Rectangle { property var title: "Pending Transactions" - property var iconSource: "../tx.png" property var menuItem objectName: "pendingTxView" diff --git a/mist/assets/qml/views/transaction.qml b/mist/assets/qml/views/transaction.qml index 7d689733fa..744a4da65d 100644 --- a/mist/assets/qml/views/transaction.qml +++ b/mist/assets/qml/views/transaction.qml @@ -7,7 +7,6 @@ import QtQuick.Controls.Styles 1.1 import Ethereum 1.0 Rectangle { - property var iconSource: "../new.png" property var title: "New transaction" property var menuItem diff --git a/mist/flags.go b/mist/flags.go index d2e7d3fb08..a56d689c04 100644 --- a/mist/flags.go +++ b/mist/flags.go @@ -13,26 +13,29 @@ import ( "github.com/ethereum/eth-go/ethlog" ) -var Identifier string -var KeyRing string -var KeyStore string -var StartRpc bool -var RpcPort int -var UseUPnP bool -var OutboundPort string -var ShowGenesis bool -var AddPeer string -var MaxPeer int -var GenAddr bool -var UseSeed bool -var SecretFile string -var ExportDir string -var NonInteractive bool -var Datadir string -var LogFile string -var ConfigFile string -var DebugFile string -var LogLevel int +var ( + Identifier string + KeyRing string + KeyStore string + StartRpc bool + StartWebSockets bool + RpcPort int + UseUPnP bool + OutboundPort string + ShowGenesis bool + AddPeer string + MaxPeer int + GenAddr bool + UseSeed bool + SecretFile string + ExportDir string + NonInteractive bool + Datadir string + LogFile string + ConfigFile string + DebugFile string + LogLevel int +) // flags specific to gui client var AssetPath string @@ -83,6 +86,7 @@ func Init() { flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") + flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&UseSeed, "seed", true, "seed peers") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") diff --git a/mist/main.go b/mist/main.go index 6e45543527..a860f7527c 100644 --- a/mist/main.go +++ b/mist/main.go @@ -12,7 +12,7 @@ import ( const ( ClientIdentifier = "Mist" - Version = "0.6.7" + Version = "0.6.8" ) var ethereum *eth.Ethereum @@ -80,6 +80,10 @@ func main() { utils.HandleInterrupt() + if StartWebSockets { + utils.StartWebSockets(ethereum) + } + // we need to run the interrupt callbacks in case gui is closed // this skips if we got here by actual interrupt stopping the GUI if !interrupted {