aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/assets/qml
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mist/assets/qml')
-rw-r--r--cmd/mist/assets/qml/browser.qml473
-rw-r--r--cmd/mist/assets/qml/main.qml63
-rw-r--r--cmd/mist/assets/qml/views/whisper.qml1
3 files changed, 264 insertions, 273 deletions
diff --git a/cmd/mist/assets/qml/browser.qml b/cmd/mist/assets/qml/browser.qml
index a89c3c97d..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"
+ 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);
@@ -139,315 +139,310 @@ Rectangle {
}
}
- // Border
- Rectangle {
- id: divider
- anchors {
- left: parent.left
- right: parent.right
- top: navBar.bottom
- }
- z: -1
- height: 1
- color: "#CCCCCC"
- }
+ // Border
+ Rectangle {
+ id: divider
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: navBar.bottom
+ }
+ z: -1
+ height: 1
+ color: "#CCCCCC"
+ }
- WebView {
- objectName: "webView"
- id: webview
+ ScrollView {
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
top: divider.bottom
}
+ WebView {
+ objectName: "webView"
+ 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))
- }
-
+ function sendMessage(data) {
+ webview.experimental.postMessage(JSON.stringify(data))
+ }
- experimental.preferences.javascriptEnabled: true
- experimental.preferences.webGLEnabled: true
- experimental.itemSelector: MouseArea {
- // To avoid conflicting with ListView.model when inside Initiator context.
- property QtObject selectorModel: model
- anchors.fill: parent
- onClicked: selectorModel.reject()
-
- Menu {
- visible: true
- id: itemSelector
-
- Instantiator {
- model: selectorModel.items
- delegate: MenuItem {
- text: model.text
- onTriggered: {
- selectorModel.accept(index)
+ experimental.preferences.javascriptEnabled: true
+ experimental.preferences.webAudioEnabled: true
+ experimental.preferences.pluginsEnabled: true
+ experimental.preferences.navigatorQtObjectEnabled: true
+ experimental.preferences.developerExtrasEnabled: true
+ experimental.preferences.webGLEnabled: true
+ experimental.preferences.notificationsEnabled: true
+ experimental.preferences.localStorageEnabled: true
+ experimental.userAgent:"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Mist/0.1 Safari/537.36"
+
+ experimental.itemSelector: MouseArea {
+ // To avoid conflicting with ListView.model when inside Initiator context.
+ property QtObject selectorModel: model
+ anchors.fill: parent
+ onClicked: selectorModel.reject()
+
+ Menu {
+ visible: true
+ id: itemSelector
+
+ Instantiator {
+ model: selectorModel.items
+ delegate: MenuItem {
+ text: model.text
+ onTriggered: {
+ selectorModel.accept(index)
+ }
}
+ onObjectAdded: itemSelector.insertItem(index, object)
+ onObjectRemoved: itemSelector.removeItem(object)
}
- onObjectAdded: itemSelector.insertItem(index, object)
- onObjectRemoved: itemSelector.removeItem(object)
}
- }
- Component.onCompleted: {
- itemSelector.popup()
+ Component.onCompleted: {
+ itemSelector.popup()
+ }
}
- }
- experimental.preferences.webAudioEnabled: true
- experimental.preferences.navigatorQtObjectEnabled: true
- experimental.preferences.developerExtrasEnabled: true
- 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
- var data = JSON.parse(message.data)
+ 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)
+ var data = JSON.parse(message.data)
- try {
- switch(data.call) {
- case "eth_compile":
- postData(data._id, eth.compile(data.args[0]))
- break
+ try {
+ switch(data.call) {
+ case "eth_compile":
+ postData(data._id, eth.compile(data.args[0]))
+ break
- case "eth_coinbase":
- postData(data._id, eth.coinBase())
+ case "eth_coinbase":
+ postData(data._id, eth.coinBase())
- case "eth_account":
- postData(data._id, eth.key().address);
+ case "eth_account":
+ postData(data._id, eth.key().address);
- case "eth_istening":
- postData(data._id, eth.isListening())
+ case "eth_istening":
+ postData(data._id, eth.isListening())
- break
+ break
- case "eth_mining":
- postData(data._id, eth.isMining())
+ case "eth_mining":
+ postData(data._id, eth.isMining())
- break
+ break
- case "eth_peerCount":
- postData(data._id, eth.peerCount())
+ case "eth_peerCount":
+ postData(data._id, eth.peerCount())
- break
+ break
- case "eth_countAt":
- require(1)
- postData(data._id, eth.txCountAt(data.args[0]))
+ case "eth_countAt":
+ require(1)
+ postData(data._id, eth.txCountAt(data.args[0]))
- break
+ break
- case "eth_codeAt":
- require(1)
- var code = eth.codeAt(data.args[0])
- postData(data._id, code);
+ case "eth_codeAt":
+ require(1)
+ var code = eth.codeAt(data.args[0])
+ postData(data._id, code);
- break
+ break
- case "eth_blockByNumber":
- require(1)
- var block = eth.blockByNumber(data.args[0])
- postData(data._id, block)
- break
+ case "eth_blockByNumber":
+ require(1)
+ var block = eth.blockByNumber(data.args[0])
+ postData(data._id, block)
+ break
- case "eth_blockByHash":
- require(1)
- var block = eth.blockByHash(data.args[0])
- postData(data._id, block)
- break
+ case "eth_blockByHash":
+ require(1)
+ var block = eth.blockByHash(data.args[0])
+ postData(data._id, block)
+ break
- require(2)
- var block = eth.blockByHash(data.args[0])
- postData(data._id, block.transactions[data.args[1]])
- break
+ require(2)
+ var block = eth.blockByHash(data.args[0])
+ postData(data._id, block.transactions[data.args[1]])
+ break
- case "eth_transactionByHash":
- case "eth_transactionByNumber":
- require(2)
+ case "eth_transactionByHash":
+ case "eth_transactionByNumber":
+ require(2)
- var block;
- if (data.call === "transactionByHash")
- block = eth.blockByHash(data.args[0])
- else
- block = eth.blockByNumber(data.args[0])
+ var block;
+ if (data.call === "transactionByHash")
+ block = eth.blockByHash(data.args[0])
+ else
+ block = eth.blockByNumber(data.args[0])
- var tx = block.transactions.get(data.args[1])
+ var tx = block.transactions.get(data.args[1])
- postData(data._id, tx)
- break
+ postData(data._id, tx)
+ break
- case "eth_uncleByHash":
- case "eth_uncleByNumber":
- require(2)
+ case "eth_uncleByHash":
+ case "eth_uncleByNumber":
+ require(2)
- var block;
- if (data.call === "uncleByHash")
- block = eth.blockByHash(data.args[0])
- else
- block = eth.blockByNumber(data.args[0])
+ var block;
+ if (data.call === "uncleByHash")
+ block = eth.blockByHash(data.args[0])
+ else
+ block = eth.blockByNumber(data.args[0])
- var uncle = block.uncles.get(data.args[1])
+ var uncle = block.uncles.get(data.args[1])
- postData(data._id, uncle)
+ postData(data._id, uncle)
- break
+ break
- case "transact":
- require(5)
+ case "transact":
+ require(5)
- var tx = eth.transact(data.args)
- postData(data._id, tx)
+ var tx = eth.transact(data.args)
+ postData(data._id, tx)
- break
+ break
- case "eth_stateAt":
- require(2);
+ case "eth_stateAt":
+ require(2);
- var storage = eth.storageAt(data.args[0], data.args[1]);
- postData(data._id, storage)
+ var storage = eth.storageAt(data.args[0], data.args[1]);
+ postData(data._id, storage)
- break
+ break
- case "eth_call":
- require(1);
- var ret = eth.call(data.args)
- postData(data._id, ret)
- break
+ case "eth_call":
+ require(1);
+ var ret = eth.call(data.args)
+ postData(data._id, ret)
+ break
- case "eth_balanceAt":
- require(1);
+ case "eth_balanceAt":
+ require(1);
- postData(data._id, eth.balanceAt(data.args[0]));
- break
+ postData(data._id, eth.balanceAt(data.args[0]));
+ break
- case "eth_watch":
- require(2)
- eth.watch(data.args[0], data.args[1])
+ case "eth_watch":
+ require(2)
+ eth.watch(data.args[0], data.args[1])
- case "eth_disconnect":
- require(1)
- postData(data._id, null)
- break;
+ case "eth_disconnect":
+ require(1)
+ postData(data._id, null)
+ break;
- case "eth_newFilterString":
- require(1)
- var id = eth.newFilterString(data.args[0])
- postData(data._id, id);
- break;
+ case "eth_newFilterString":
+ require(1)
+ 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])
+ case "eth_newFilter":
+ require(1)
+ var id = eth.newFilter(data.args[0], window)
- postData(data._id, id);
- break;
+ postData(data._id, id);
+ break;
- case "eth_filterLogs":
- require(1);
+ case "eth_filterLogs":
+ require(1);
- var messages = eth.messages(data.args[0]);
- var m = JSON.parse(JSON.parse(JSON.stringify(messages)))
- postData(data._id, m);
+ var messages = eth.messages(data.args[0]);
+ var m = JSON.parse(JSON.parse(JSON.stringify(messages)))
+ postData(data._id, m);
- break;
+ break;
- case "eth_deleteFilter":
- require(1);
- eth.uninstallFilter(data.args[0])
- break;
+ case "eth_deleteFilter":
+ require(1);
+ eth.uninstallFilter(data.args[0])
+ break;
- case "shh_newFilter":
- require(1);
- var id = shh.watch(data.args[0], window);
- postData(data._id, id);
- break;
+ case "shh_newFilter":
+ require(1);
+ var id = shh.watch(data.args[0], window);
+ postData(data._id, id);
+ break;
- case "shh_newIdentity":
- var id = shh.newIdentity()
- postData(data._id, id)
+ case "shh_newIdentity":
+ var id = shh.newIdentity()
+ postData(data._id, id)
- break
+ break
- case "shh_post":
- require(1);
+ case "shh_post":
+ require(1);
- var params = data.args[0];
- var fields = ["payload", "to", "from"];
- for(var i = 0; i < fields.length; i++) {
- params[fields[i]] = params[fields[i]] || "";
- }
- if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
- params.topics = params.topics || [];
- params.priority = params.priority || 1000;
- params.ttl = params.ttl || 100;
+ var params = data.args[0];
+ var fields = ["payload", "to", "from"];
+ for(var i = 0; i < fields.length; i++) {
+ params[fields[i]] = params[fields[i]] || "";
+ }
+ if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
+ params.topics = params.topics || [];
+ params.priority = params.priority || 1000;
+ params.ttl = params.ttl || 100;
- shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl);
+ shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl);
- break;
+ break;
- case "shh_getMessages":
- require(1);
+ case "shh_getMessages":
+ require(1);
- var m = shh.messages(data.args[0]);
- var messages = JSON.parse(JSON.parse(JSON.stringify(m)));
- postData(data._id, messages);
+ var m = shh.messages(data.args[0]);
+ var messages = JSON.parse(JSON.parse(JSON.stringify(m)));
+ postData(data._id, messages);
- break;
+ break;
- case "ssh_newGroup":
- postData(data._id, "");
- break;
- }
- } catch(e) {
- console.log(data.call + ": " + e)
+ case "ssh_newGroup":
+ postData(data._id, "");
+ break;
+ }
+ } catch(e) {
+ console.log(data.call + ": " + e)
- postData(data._id, null);
+ postData(data._id, null);
+ }
}
- }
-
-
- 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);
+ 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);
+ }
+ }
+ function postData(seed, data) {
+ webview.experimental.postMessage(JSON.stringify({data: data, _id: seed}))
+ }
+ 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)
+ }
+ function onObjectChangeCb(stateObject) {
+ postEvent("object:"+stateObject.address(), stateObject)
+ }
+ function onStorageChangeCb(storageObject) {
+ var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":");
+ postEvent(ev, [storageObject.address, storageObject.value])
}
- }
- function postData(seed, data) {
- webview.experimental.postMessage(JSON.stringify({data: data, _id: seed}))
- }
- 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)
- }
- function onObjectChangeCb(stateObject) {
- postEvent("object:"+stateObject.address(), stateObject)
- }
- function onStorageChangeCb(storageObject) {
- var ev = ["storage", storageObject.stateAddress, storageObject.address].join(":");
- postEvent(ev, [storageObject.address, storageObject.value])
}
}
-
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)
}