aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/mist/assets/qml/views/browser.qml
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mist/assets/qml/views/browser.qml')
-rw-r--r--cmd/mist/assets/qml/views/browser.qml199
1 files changed, 130 insertions, 69 deletions
diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml
index 631ef5a16..54f5d755e 100644
--- a/cmd/mist/assets/qml/views/browser.qml
+++ b/cmd/mist/assets/qml/views/browser.qml
@@ -3,7 +3,7 @@ import QtQuick.Controls 1.0;
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0;
import QtWebEngine 1.0
-import QtWebEngine.experimental 1.0
+//import QtWebEngine.experimental 1.0
import QtQuick.Window 2.0;
Rectangle {
@@ -64,23 +64,15 @@ Rectangle {
}
function showFullUrlBar(on){
- if (on) {
- //appTitle.visible = false
- //appDomain.visible = false
-
- //uriNav.visible = true
- clickAnywhereOnApp.visible = true
-
- navBar.state = "fullUrlVisible"
- } else {
- //appTitle.visible = true
- //appDomain.visible = true
- //uriNav.visible = false
- clickAnywhereOnApp.visible = false
-
- navBar.state = "titleVisible"
-
- }
+ if (uriNav.focus == false ) {
+ if (on == false) {
+ clickAnywhereOnApp.visible = false
+ navBar.state = "titleVisible"
+ } else {
+ clickAnywhereOnApp.visible = true
+ navBar.state = "fullUrlVisible"
+ }
+ }
}
@@ -90,24 +82,40 @@ Rectangle {
Item {
objectName: "root"
id: root
- anchors.fill: parent
+ anchors {
+ fill: parent
+ }
+
state: "inspectorShown"
MouseArea {
id: clickAnywhereOnApp
z:15
- //hoverEnabled: true
- anchors.fill: parent
- /*hoverEnabled: true*/
+ // Using a secondary screen to catch on mouse exits for the area, because
+ // there are many hover actions conflicting
+
+ anchors {
+ top: parent.top
+ topMargin: 50
+ right: parent.right
+ bottom: parent.bottom
+ left: parent.left
+ }
+ hoverEnabled: true
- onClicked: {
+ onEntered: {
showFullUrlBar(false);
}
- /*Rectangle {
- anchors.fill: parent
- color: "#88888888"
- }*/
+ onClicked: {
+ uriNav.focus = false
+ showFullUrlBar(false);
+ }
+
+ // Rectangle {
+ // anchors.fill: parent
+ // color: "#88888888"
+ // }
}
RowLayout {
@@ -121,40 +129,44 @@ Rectangle {
Button {
id: back
-
- onClicked: {
- webview.goBack()
+ z: 30
+ onClicked: {
+ webview.goBack()
}
- anchors{
+ anchors {
left: parent.left
leftMargin: 6
}
style: ButtonStyle {
- background: Image {
- source: "../../backButton.png"
- width: 20
- height: 30
- }
+ background: Image {
+ source: (webview.canGoBack) ?
+ (control.hovered ? "../../backButtonHover.png" : "../../backButton.png") :
+ "../../backButtonDisabled.png"
+ width: 20
+ height: 30
+ }
}
}
Rectangle {
- id: appInfoPane
- height: 28
- color: "#FFFFFF"
- radius: 6
-
-
- MouseArea {
+ id: appInfoPane
+ height: 28
+ color: "#FFFFFF"
+ radius: 6
+ z:2
+ MouseArea {
anchors.fill: parent
z: 10
hoverEnabled: true
onEntered: {
- showFullUrlBar(true);
- }
+ showFullUrlBar(true);
+ }
+ /*onExited: {
+ showFullUrlBar(false);
+ }*/
}
@@ -171,14 +183,15 @@ Rectangle {
font.bold: true
font.capitalization: Font.AllUppercase
horizontalAlignment: Text.AlignRight
- verticalAlignment: Text.AlignVCenter
-
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+
anchors {
left: parent.left
right: parent.horizontalCenter
top: parent.top
bottom: parent.bottom
- rightMargin: 10
+ leftMargin: 32
}
color: "#928484"
}
@@ -189,13 +202,15 @@ Rectangle {
font.bold: false
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideLeft
anchors {
left: parent.horizontalCenter
right: parent.right
top: parent.top
bottom: parent.bottom
- leftMargin: 10
+ leftMargin: 32
+
}
color: "#C0AFAF"
}
@@ -212,7 +227,7 @@ Rectangle {
}
horizontalAlignment: Text.AlignHCenter
-
+
style: TextFieldStyle {
textColor: "#928484"
background: Rectangle {
@@ -225,16 +240,16 @@ Rectangle {
z: 20
activeFocusOnPress: true
Keys.onReturnPressed: {
- webview.url = this.text;
+ // if there's no http, add it.
+ var url = this.text,
+ matches = url.match(/^([a-z]*\:\/\/)?([^\/.]+)(:?\/)(.*|$)/i),
+ requestedProtocol = (matches && matches[1] != "undefined")? "" : "http://";
+
+ webview.url = requestedProtocol + url;
}
- /* onFocusedChanged: {
- if (focused) {
- //uriNav.selectAll();
- }
- }*/
}
- z:2
+
}
Rectangle {
@@ -243,6 +258,7 @@ Rectangle {
height: 30
color: "#BDB6B6"
radius: 6
+ z:1
anchors {
left: back.right
@@ -251,19 +267,17 @@ Rectangle {
rightMargin:10
top: parent.top
topMargin: 23
- }
-
- z:1
+ }
}
Rectangle {
id: navBarBackground
anchors.fill: parent
+ z:-1
gradient: Gradient {
GradientStop { position: 0.0; color: "#F6F1F2" }
GradientStop { position: 1.0; color: "#DED5D5" }
}
- z:-1
}
states: [
@@ -326,8 +340,8 @@ Rectangle {
WebEngineView {
objectName: "webView"
id: webview
- experimental.settings.javascriptCanAccessClipboard: true
- experimental.settings.localContentCanAccessRemoteUrls: true
+ //experimental.settings.javascriptCanAccessClipboard: true
+ //experimental.settings.localContentCanAccessRemoteUrls: true
anchors {
left: parent.left
right: parent.right
@@ -337,13 +351,49 @@ Rectangle {
z: 10
Timer {
- interval: 500; running: true; repeat: true
+ interval: 2000; running: true; repeat: true
onTriggered: {
- webview.runJavaScript("try{document.querySelector('meta[name=badge]').getAttribute('content')}catch(e){}", function(badge) {
- if (badge) {
- menuItem.secondaryTitle = badge;
- }
- });
+ webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-info]').getAttribute('content')}catch(e){}", function(extraInfo) {
+ if (extraInfo) {
+ menuItem.secondaryTitle = extraInfo;
+ }
+ });
+ webview.runJavaScript("try{document.querySelector('meta[name=ethereum-dapp-badge]').getAttribute('content')}catch(e){}", function(badge) {
+ if (badge) {
+ if (Number(badge)>0 && Number(badge)<999) {
+ menuItem.badgeNumber = Number(badge);
+ menuItem.badgeContent = "number"
+ } else if (badge == "warning") {
+ menuItem.badgeIcon = "\ue00e"
+ menuItem.badgeContent = "icon"
+
+ } else if (badge == "ghost") {
+ menuItem.badgeIcon = "\ue01a"
+ menuItem.badgeContent = "icon"
+
+ } else if (badge == "question") {
+ menuItem.badgeIcon = "\ue05d"
+ menuItem.badgeContent = "icon"
+
+ } else if (badge == "info") {
+ menuItem.badgeIcon = "\ue08b"
+ menuItem.badgeContent = "icon"
+
+ } else if (badge == "check") {
+ menuItem.badgeIcon = "\ue080"
+ menuItem.badgeContent = "icon"
+
+ } else if (badge == "gear") {
+ menuItem.badgeIcon = "\ue09a"
+ menuItem.badgeContent = "icon"
+
+ } else {
+ menuItem.badgeContent = ""
+ }
+ } else {
+ menuItem.badgeContent = ""
+ }
+ });
}
}
@@ -353,6 +403,12 @@ Rectangle {
menuItem.title = pageTitle;
});
+ webView.runJavaScript("try{document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")}catch(e){}", function(sideIcon){
+ if(sideIcon){
+ menuItem.icon = webview.url + sideIcon;
+ };
+ });
+
webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){
if (!topBarStyle) {
showFullUrlBar(true);
@@ -382,10 +438,15 @@ Rectangle {
};
});
+
+ webview.runJavaScript(eth.readFile("bignumber.min.js"));
+ webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js"));
+
var cleanTitle = webview.url.toString()
var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
var domain = matches && matches[1];
+
if (domain)
appDomain.text = domain //webview.url.replace("a", "z")
if (webview.title)