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

View file

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