browser bar with two states

This commit is contained in:
Alexandre Van de Sande 2015-02-05 17:21:37 -02:00
parent 5f051551aa
commit 1032d133fb

View file

@ -56,7 +56,6 @@ Rectangle {
//uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>"); //uriNav.text = uri.text.replace(/(^https?\:\/\/(?:www\.)?)([a-zA-Z0-9_\-]*\.\w{2,3})(.*)/, "$1$2<span style='color:#CCC'>$3</span>");
uriNav.text = uri; uriNav.text = uri;
appDomain.text = "some.thing"
} else { } else {
// Prevent inf loop. // Prevent inf loop.
@ -104,8 +103,6 @@ Rectangle {
} }
} }
Rectangle { Rectangle {
id: appInfoPane id: appInfoPane
height: 28 height: 28
@ -120,15 +117,7 @@ Rectangle {
uriNav.visible = true uriNav.visible = true
appTitle.visible = false appTitle.visible = false
appDomain.visible = false appDomain.visible = false
} }
/*onExited: {
uriNav.visible = false
appTitle.visible = true
appDomain.visible = true
}*/
} }
anchors { anchors {
@ -140,7 +129,7 @@ Rectangle {
Text { Text {
id: appTitle id: appTitle
text: webview.title text: "LOADING"
font.bold: true font.bold: true
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
@ -158,7 +147,7 @@ Rectangle {
Text { Text {
id: appDomain id: appDomain
text: webview.url text: "loading domain"
font.bold: false font.bold: false
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@ -170,7 +159,7 @@ Rectangle {
bottom: parent.bottom bottom: parent.bottom
leftMargin: 10 leftMargin: 10
} }
color: "#928484" color: "#C0AFAF"
} }
@ -195,11 +184,9 @@ Rectangle {
text: webview.url; text: webview.url;
y: parent.height / 2 - this.height / 2 y: parent.height / 2 - this.height / 2
z: 20 z: 20
activeFocusOnPress: true
Keys.onReturnPressed: { Keys.onReturnPressed: {
webview.url = this.text; webview.url = this.text;
uriNav.visible = false
appTitle.visible = true
appDomain.visible = true
} }
} }
@ -297,6 +284,17 @@ Rectangle {
}); });
webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("bignumber.min.js"));
webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.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];
uriNav.visible = false
appDomain.visible = true
appDomain.text = domain //webview.url.replace("a", "z")
appTitle.visible = true
appTitle.text = webview.title
} }
} }
onJavaScriptConsoleMessage: { onJavaScriptConsoleMessage: {