diff options
Diffstat (limited to 'cmd/mist/assets')
-rw-r--r-- | cmd/mist/assets/qml/browser.qml | 32 | ||||
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 63 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/whisper.qml | 1 |
3 files changed, 37 insertions, 59 deletions
diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml index c8f291e22..7056dbbf3 100644 --- a/cmd/mist/assets/qml/browser.qml +++ b/cmd/mist/assets/qml/browser.qml @@ -9,15 +9,16 @@ import Ethereum 1.0 Rectangle { id: window - objectName: "browserView" anchors.fill: parent color: "#00000000" - property var title: "Browser" + property var title: "DApps" property var iconSource: "../browser.png" property var menuItem + property var hideUrl: true property alias url: webview.url + property alias windowTitle: webview.title property alias webView: webview property var cleanPath: false @@ -66,8 +67,7 @@ Rectangle { webview.url = "http://etherian.io" } - signal messages(var messages, int id); - onMessages: { + function messages(messages, id) { // Bit of a cheat to get proper JSON var m = JSON.parse(JSON.parse(JSON.stringify(messages))) webview.postEvent("eth_changed", id, m); @@ -164,22 +164,10 @@ Rectangle { id: webview anchors.fill: parent - function injectJs(js) { - webview.experimental.navigatorQtObjectEnabled = true; - webview.experimental.evaluateJavaScript(js) - webview.experimental.javascriptEnabled = true; - } - function sendMessage(data) { webview.experimental.postMessage(JSON.stringify(data)) } - Component.onCompleted: { - for (var i in experimental.preferences) { - console.log(i) - } - } - experimental.preferences.javascriptEnabled: true experimental.preferences.webAudioEnabled: true experimental.preferences.pluginsEnabled: true @@ -219,8 +207,7 @@ Rectangle { } experimental.userScripts: ["../ext/q.js", "../ext/ethereum.js/lib/web3.js", "../ext/ethereum.js/lib/qt.js", "../ext/setup.js"] experimental.onMessageReceived: { - console.log("[onMessageReceived]: ", message.data) - // TODO move to messaging.js + //console.log("[onMessageReceived]: ", message.data) var data = JSON.parse(message.data) try { @@ -350,13 +337,13 @@ Rectangle { case "eth_newFilterString": require(1) - var id = eth.newFilterString(data.args[0]) + var id = eth.newFilterString(data.args[0], window) postData(data._id, id); break; case "eth_newFilter": require(1) - var id = eth.newFilter(data.args[0]) + var id = eth.newFilter(data.args[0], window) postData(data._id, id); break; @@ -425,11 +412,9 @@ Rectangle { } } - function post(seed, data) { postData(data._id, data) } - function require(args, num) { if(args.length < num) { throw("required argument count of "+num+" got "+args.length); @@ -441,12 +426,10 @@ Rectangle { function postEvent(event, id, data) { webview.experimental.postMessage(JSON.stringify({data: data, _id: id, _event: event})) } - function onWatchedCb(data, id) { var messages = JSON.parse(data) postEvent("watched:"+id, messages) } - function onNewBlockCb(block) { postEvent("block:new", block) } @@ -460,7 +443,6 @@ Rectangle { } } - Rectangle { id: sizeGrip color: "gray" diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 7b207cbcc..c6b524549 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -13,7 +13,6 @@ ApplicationWindow { id: root property var ethx : Eth.ethx - property var browser width: 1200 height: 820 @@ -21,6 +20,7 @@ ApplicationWindow { title: "Mist" + /* // This signal is used by the filter API. The filter API connects using this signal handler from // the different QML files and plugins. signal messages(var messages, int id); @@ -30,6 +30,7 @@ ApplicationWindow { messages(data, receiverSeed); root.browser.view.messages(data, receiverSeed); } + */ TextField { id: copyElementHax @@ -45,8 +46,6 @@ ApplicationWindow { // Takes care of loading all default plugins Component.onCompleted: { var wallet = addPlugin("./views/wallet.qml", {noAdd: true, close: false, section: "ethereum", active: true}); - var browser = addPlugin("./browser.qml", {noAdd: true, close: false, section: "ethereum", active: true}); - root.browser = browser; addPlugin("./views/miner.qml", {noAdd: true, close: false, section: "ethereum", active: true}); addPlugin("./views/transaction.qml", {noAdd: true, close: false, section: "legacy"}); @@ -55,17 +54,17 @@ ApplicationWindow { addPlugin("./views/pending_tx.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"}) - mainSplit.setView(wallet.view, wallet.menuItem); + newBrowserTab("http://etherian.io"); + // Command setup gui.sendCommand(0) } function activeView(view, menuItem) { mainSplit.setView(view, menuItem) - if (view.objectName === "browserView") { + if (view.hideUrl) { urlPane.visible = false; mainView.anchors.top = rootView.top } else { @@ -119,6 +118,13 @@ ApplicationWindow { } } + function newBrowserTab(url) { + var window = addPlugin("./browser.qml", {noAdd: true, close: true, section: "apps", active: true}); + window.view.url = url; + window.menuItem.title = "Browser Tab"; + activeView(window.view, window.menuItem); + } + menuBar: MenuBar { Menu { title: "File" @@ -130,13 +136,6 @@ ApplicationWindow { } } - /* - MenuItem { - text: "Browser" - onTriggered: eth.openBrowser() - } - */ - MenuItem { text: "Add plugin" onTriggered: { @@ -146,6 +145,14 @@ ApplicationWindow { } } + MenuItem { + text: "New tab" + shortcut: "Ctrl+t" + onTriggered: { + newBrowserTab("http://etherian.io"); + } + } + MenuSeparator {} MenuItem { @@ -205,21 +212,6 @@ ApplicationWindow { } MenuSeparator {} - - /* - MenuItem { - id: miningSpeed - text: "Mining: Turbo" - onTriggered: { - gui.toggleTurboMining() - if(text == "Mining: Turbo") { - text = "Mining: Normal"; - } else { - text = "Mining: Turbo"; - } - } - } - */ } Menu { @@ -350,9 +342,6 @@ ApplicationWindow { views[i].menuItem.setSelection(false) } view.visible = true - - //menu.border.color = "#CCCCCC" - //menu.color = "#FFFFFFFF" menu.setSelection(true) } @@ -512,7 +501,15 @@ ApplicationWindow { this.view.destroy() this.destroy() + for (var i = 0; i < mainSplit.views.length; i++) { + var view = mainSplit.views[i]; + if (view.menuItem === this) { + mainSplit.views.splice(i, 1); + break; + } + } gui.removePlugin(this.path) + activeView(mainSplit.views[0].view, mainSplit.views[0].menuItem); } } } @@ -576,7 +573,7 @@ ApplicationWindow { Text { - text: "APPS" + text: "NET" font.bold: true anchors { left: parent.left @@ -653,7 +650,7 @@ ApplicationWindow { Keys.onReturnPressed: { if(/^https?/.test(this.text)) { - activeView(root.browser.view, root.browser.menuItem); + newBrowserTab(this.text); } else { addPlugin(this.text, {close: true, section: "apps"}) } diff --git a/cmd/mist/assets/qml/views/whisper.qml b/cmd/mist/assets/qml/views/whisper.qml index 029376c45..dc097b806 100644 --- a/cmd/mist/assets/qml/views/whisper.qml +++ b/cmd/mist/assets/qml/views/whisper.qml @@ -18,7 +18,6 @@ Rectangle { property var identity: "" Component.onCompleted: { identity = shh.newIdentity() - console.log("New identity:", identity) var t = shh.watch({}, root) } |