diff options
Diffstat (limited to 'cmd/mist/assets')
-rw-r--r-- | cmd/mist/assets/backButtonDisabled.png | bin | 0 -> 634 bytes | |||
-rw-r--r-- | cmd/mist/assets/backButtonDisabled@2x.png | bin | 0 -> 1458 bytes | |||
-rw-r--r-- | cmd/mist/assets/backButtonHover.png | bin | 0 -> 657 bytes | |||
-rw-r--r-- | cmd/mist/assets/backButtonHover@2x.png | bin | 0 -> 1517 bytes | |||
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 25 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/browser.qml | 146 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/catalog.qml | 27 |
7 files changed, 107 insertions, 91 deletions
diff --git a/cmd/mist/assets/backButtonDisabled.png b/cmd/mist/assets/backButtonDisabled.png Binary files differnew file mode 100644 index 000000000..428747870 --- /dev/null +++ b/cmd/mist/assets/backButtonDisabled.png diff --git a/cmd/mist/assets/backButtonDisabled@2x.png b/cmd/mist/assets/backButtonDisabled@2x.png Binary files differnew file mode 100644 index 000000000..0eaa6daa5 --- /dev/null +++ b/cmd/mist/assets/backButtonDisabled@2x.png diff --git a/cmd/mist/assets/backButtonHover.png b/cmd/mist/assets/backButtonHover.png Binary files differnew file mode 100644 index 000000000..8c5226f5a --- /dev/null +++ b/cmd/mist/assets/backButtonHover.png diff --git a/cmd/mist/assets/backButtonHover@2x.png b/cmd/mist/assets/backButtonHover@2x.png Binary files differnew file mode 100644 index 000000000..406601ebc --- /dev/null +++ b/cmd/mist/assets/backButtonHover@2x.png diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index e1e6a028f..03c8e4518 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -60,13 +60,14 @@ ApplicationWindow { function activeView(view, menuItem) { mainSplit.setView(view, menuItem) - if (view.hideUrl) { - //urlPane.visible = false; - //mainView.anchors.top = rootView.top + /*if (view.hideUrl) { + urlPane.visible = false; + mainView.anchors.top = rootView.top } else { - //urlPane.visible = true; - //mainView.anchors.top = divider.bottom - } + urlPane.visible = true; + mainView.anchors.top = divider.bottom + }*/ + } function addViews(view, path, options) { @@ -121,13 +122,10 @@ ApplicationWindow { var domainAlreadyOpen = false; - console.log("requested: " + requestedDomain ) - for(var i = 0; i < mainSplit.views.length; i++) { if (mainSplit.views[i].view.url) { var matches = mainSplit.views[i].view.url.toString().match(/^[a-z]*\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i); var existingDomain = matches && matches[1]; - console.log("exists: " + existingDomain); if (requestedDomain == existingDomain) { domainAlreadyOpen = true; mainSplit.views[i].view.url = url; @@ -462,7 +460,7 @@ ApplicationWindow { label.visible = !on buttonLabel.visible = on } - + width: 192 height: 55 color: "#00000000" @@ -541,7 +539,9 @@ ApplicationWindow { if (parent.closable == true) { closeIcon.visible = sel.visible } - + /*if(view.hasOwnProperty("iconSource")) { + icon.source = view.iconSource; + }*/ } onExited: { closeIcon.visible = false @@ -574,10 +574,13 @@ ApplicationWindow { id: label font.family: sourceSansPro.name font.weight: Font.DemiBold + elide: Text.ElideRight anchors { left: icon.right + right: parent.right verticalCenter: parent.verticalCenter leftMargin: 6 + rightMargin: 8 // verticalCenterOffset: -10 } x:250 diff --git a/cmd/mist/assets/qml/views/browser.qml b/cmd/mist/assets/qml/views/browser.qml index 631ef5a16..6ded02fcb 100644 --- a/cmd/mist/assets/qml/views/browser.qml +++ b/cmd/mist/assets/qml/views/browser.qml @@ -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: [ @@ -353,6 +367,7 @@ Rectangle { menuItem.title = pageTitle; }); + webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){ if (!topBarStyle) { showFullUrlBar(true); @@ -382,10 +397,21 @@ Rectangle { }; }); + // webView.runJavaScript("document.querySelector(\"link[rel='icon']\").getAttribute(\"href\")", function(sideIcon){ + // if(sideIcon){ + // window.iconSource = "http://localhost:3000/whisper-icon@2x.png" //webview.url + sideIcon + // console.log(iconSource) + // }; + // }); + + 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) diff --git a/cmd/mist/assets/qml/views/catalog.qml b/cmd/mist/assets/qml/views/catalog.qml index 884493eef..18a835ad2 100644 --- a/cmd/mist/assets/qml/views/catalog.qml +++ b/cmd/mist/assets/qml/views/catalog.qml @@ -85,35 +85,21 @@ Rectangle { property var domain: "ethereum-dapp-catalog.meteor.com" url: protocol + domain - //navigationRequest: WebEngineView.IgnoreRequest - // onLoadingChanged: { - // if (loadRequest.status == WebEngineView.LoadSucceededStatus) { - // webview.runJavaScript(eth.readFile("bignumber.min.js")); - // webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); - // } - // } - - //onNavigationRequested: { - // detect URL scheme prefix, most likely an external link - //var schemaRE = /^\w+:/; - //if (schemaRE.test(request.url)) { - // request.action = WebView.AcceptRequest; - //} else { - //request.action = WebView.IgnoreRequest; - // delegate request.url here - //} - //} + + onJavaScriptConsoleMessage: { console.log(sourceID + ":" + lineNumber + ":" + JSON.stringify(message)); } - onNavigationRequested: { + onNavigationRequested: { + // this checks if the domain of the requested link is the same as the catalog's + // If it is, it opens on the same window, if it's not it opens a new tab + var cleanTitle = request.url.toString() var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var requestedDomain = matches && matches[1]; - console.debug ("NavigationRequested: " + request.url + " navigationType=" + request.navigationType) if(request.navigationType==0){ @@ -137,6 +123,7 @@ Rectangle { anchors { left: root.left right: root.right + top: root.top bottom: root.bottom } |