Fix browser and update dialogs

This commit is contained in:
Brad Davis 2016-06-02 19:54:25 -07:00
parent e9b359feb1
commit 4e49f3f942
3 changed files with 52 additions and 30 deletions

View file

@ -2,8 +2,8 @@ import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtWebEngine 1.1 import QtWebEngine 1.1
import "controls" import "controls-uit"
import "styles" import "styles-uit"
import "windows" import "windows"
Window { Window {
@ -15,7 +15,9 @@ Window {
width: 800 width: 800
height: 600 height: 600
property alias webView: webview property alias webView: webview
x: 100
y: 100
Component.onCompleted: { Component.onCompleted: {
shown = true shown = true
addressBar.text = webview.url addressBar.text = webview.url
@ -30,15 +32,9 @@ Window {
Item { Item {
id:item id:item
anchors.fill: parent width: pane.contentWidth
Rectangle { implicitHeight: pane.scrollHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: webview.top
color: "white"
}
Row { Row {
id: buttons id: buttons
spacing: 4 spacing: 4
@ -46,25 +42,37 @@ Window {
anchors.topMargin: 8 anchors.topMargin: 8
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 8 anchors.leftMargin: 8
FontAwesome { HiFiGlyphs {
id: back; text: "\uf0a8"; size: 48; enabled: webview.canGoBack; id: back;
enabled: webview.canGoBack;
text: hifi.glyphs.backward
color: enabled ? hifi.colors.text : hifi.colors.disabledText color: enabled ? hifi.colors.text : hifi.colors.disabledText
size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goBack() } MouseArea { anchors.fill: parent; onClicked: webview.goBack() }
} }
FontAwesome {
id: forward; text: "\uf0a9"; size: 48; enabled: webview.canGoForward; HiFiGlyphs {
id: forward;
enabled: webview.canGoForward;
text: hifi.glyphs.forward
color: enabled ? hifi.colors.text : hifi.colors.disabledText color: enabled ? hifi.colors.text : hifi.colors.disabledText
MouseArea { anchors.fill: parent; onClicked: webview.goBack() } size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
} }
FontAwesome {
id: reload; size: 48; text: webview.loading ? "\uf057" : "\uf021" HiFiGlyphs {
MouseArea { anchors.fill: parent; onClicked: webview.loading ? webview.stop() : webview.reload() } id: reload;
enabled: webview.canGoForward;
text: webview.loading ? hifi.glyphs.close : hifi.glyphs.reload
color: enabled ? hifi.colors.text : hifi.colors.disabledText
size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
} }
} }
Border { Item {
id: border
height: 48 height: 48
radius: 8
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 8 anchors.topMargin: 8
anchors.right: parent.right anchors.right: parent.right
@ -86,15 +94,18 @@ Window {
onSourceChanged: console.log("Icon url: " + source) onSourceChanged: console.log("Icon url: " + source)
} }
} }
TextInput { TextField {
id: addressBar id: addressBar
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 8 anchors.rightMargin: 8
anchors.left: barIcon.right anchors.left: barIcon.right
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
focus: true
colorScheme: hifi.colorSchemes.dark
placeholderText: "Enter URL"
Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i")
Keys.onPressed: { Keys.onPressed: {
switch(event.key) { switch(event.key) {
case Qt.Key_Enter: case Qt.Key_Enter:
@ -110,7 +121,7 @@ Window {
} }
} }
WebView { WebEngineView {
id: webview id: webview
url: "http://highfidelity.com" url: "http://highfidelity.com"
anchors.top: buttons.bottom anchors.top: buttons.bottom
@ -119,7 +130,7 @@ Window {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
onLoadingChanged: { onLoadingChanged: {
if (loadRequest.status == WebEngineView.LoadSucceededStatus) { if (loadRequest.status === WebEngineView.LoadSucceededStatus) {
addressBar.text = loadRequest.url addressBar.text = loadRequest.url
} }
} }
@ -127,7 +138,7 @@ Window {
console.log("New icon: " + icon) console.log("New icon: " + icon)
} }
profile: desktop.browserProfile //profile: desktop.browserProfile
} }

View file

@ -3,8 +3,8 @@ import QtQuick 2.3
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import "controls" import "controls-uit"
import "styles" import "styles-uit"
import "windows" import "windows"
Window { Window {

View file

@ -105,6 +105,16 @@ ApplicationWindow {
} }
*/ */
// Browser
Button {
text: "Open Browser"
onClicked: builder.createObject(desktop);
property var builder: Component {
Browser {}
}
}
// file dialog // file dialog
Button { Button {
@ -358,6 +368,7 @@ ApplicationWindow {
} }
Action { Action {
id: openBrowserAction
text: "Open Browser" text: "Open Browser"
shortcut: "Ctrl+Shift+X" shortcut: "Ctrl+Shift+X"
onTriggered: { onTriggered: {