fixed errors in Browser.qml and UpdateDialog.qml

This commit is contained in:
SamGondelman 2016-07-07 14:06:57 -07:00
parent 7724065298
commit 99fc472d77
4 changed files with 21 additions and 42 deletions

View file

@ -3,12 +3,14 @@ import QtQuick.Controls 1.2
import QtWebEngine 1.1 import QtWebEngine 1.1
import "controls-uit" import "controls-uit"
import "styles" as HifiStyles
import "styles-uit" import "styles-uit"
import "windows" import "windows"
ScrollingWindow { ScrollingWindow {
id: root id: root
HifiConstants { id: hifi } HifiConstants { id: hifi }
HifiStyles.HifiConstants { id: hifistyles }
title: "Browser" title: "Browser"
resizable: true resizable: true
destroyOnHidden: true destroyOnHidden: true
@ -46,7 +48,7 @@ ScrollingWindow {
id: back; id: back;
enabled: webview.canGoBack; enabled: webview.canGoBack;
text: hifi.glyphs.backward text: hifi.glyphs.backward
color: enabled ? hifi.colors.text : hifi.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goBack() } MouseArea { anchors.fill: parent; onClicked: webview.goBack() }
} }
@ -55,7 +57,7 @@ ScrollingWindow {
id: forward; id: forward;
enabled: webview.canGoForward; enabled: webview.canGoForward;
text: hifi.glyphs.forward text: hifi.glyphs.forward
color: enabled ? hifi.colors.text : hifi.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goForward() } MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
} }
@ -64,7 +66,7 @@ ScrollingWindow {
id: reload; id: reload;
enabled: webview.canGoForward; enabled: webview.canGoForward;
text: webview.loading ? hifi.glyphs.close : hifi.glyphs.reload text: webview.loading ? hifi.glyphs.close : hifi.glyphs.reload
color: enabled ? hifi.colors.text : hifi.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: webview.goForward() } MouseArea { anchors.fill: parent; onClicked: webview.goForward() }
} }
@ -105,7 +107,7 @@ ScrollingWindow {
focus: true focus: true
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
placeholderText: "Enter URL" placeholderText: "Enter URL"
Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i") Component.onCompleted: ScriptDiscoveryService.scriptsModelFilter.filterRegExp = new RegExp("^.*$", "i")
Keys.onPressed: { Keys.onPressed: {
switch(event.key) { switch(event.key) {
case Qt.Key_Enter: case Qt.Key_Enter:

View file

@ -3,13 +3,16 @@ 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-uit" import "controls-uit"
import "styles" as HifiStyles
import "styles-uit" import "styles-uit"
import "windows" import "windows"
ScrollingWindow { ScrollingWindow {
id: root id: root
HifiConstants { id: hifi } HifiConstants { id: hifi }
HifiStyles.HifiConstants { id: hifistyles }
objectName: "UpdateDialog" objectName: "UpdateDialog"
width: updateDialog.implicitWidth width: updateDialog.implicitWidth
height: updateDialog.implicitHeight height: updateDialog.implicitHeight
@ -40,22 +43,6 @@ ScrollingWindow {
width: updateDialog.contentWidth + updateDialog.borderWidth * 2 width: updateDialog.contentWidth + updateDialog.borderWidth * 2
height: mainContent.height + updateDialog.borderWidth * 2 - updateDialog.closeMargin / 2 height: mainContent.height + updateDialog.borderWidth * 2 - updateDialog.closeMargin / 2
MouseArea {
width: parent.width
height: parent.height
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
drag {
target: root
minimumX: 0
minimumY: 0
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY : 0
}
}
} }
Image { Image {
@ -89,7 +76,7 @@ ScrollingWindow {
text: "Update Available" text: "Update Available"
font { font {
family: updateDialog.fontFamily family: updateDialog.fontFamily
pixelSize: hifi.fonts.pixelSize * 1.5 pixelSize: hifistyles.fonts.pixelSize * 1.5
weight: Font.DemiBold weight: Font.DemiBold
} }
color: "#303030" color: "#303030"
@ -100,10 +87,10 @@ ScrollingWindow {
text: updateDialog.updateAvailableDetails text: updateDialog.updateAvailableDetails
font { font {
family: updateDialog.fontFamily family: updateDialog.fontFamily
pixelSize: hifi.fonts.pixelSize * 0.6 pixelSize: hifistyles.fonts.pixelSize * 0.6
letterSpacing: -0.5 letterSpacing: -0.5
} }
color: hifi.colors.text color: hifistyles.colors.text
anchors { anchors {
top: updateAvailable.bottom top: updateAvailable.bottom
} }
@ -130,12 +117,12 @@ ScrollingWindow {
Text { Text {
id: releaseNotes id: releaseNotes
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width - updateDialog.closeMargin width: parent.parent.width - updateDialog.closeMargin
text: updateDialog.releaseNotes text: updateDialog.releaseNotes
color: hifi.colors.text color: hifistyles.colors.text
font { font {
family: updateDialog.fontFamily family: updateDialog.fontFamily
pixelSize: hifi.fonts.pixelSize * 0.65 pixelSize: hifistyles.fonts.pixelSize * 0.65
} }
} }
} }
@ -157,7 +144,7 @@ ScrollingWindow {
color: "#0c9ab4" // Same as logo color: "#0c9ab4" // Same as logo
font { font {
family: updateDialog.fontFamily family: updateDialog.fontFamily
pixelSize: hifi.fonts.pixelSize * 1.2 pixelSize: hifistyles.fonts.pixelSize * 1.2
weight: Font.DemiBold weight: Font.DemiBold
} }
anchors { anchors {
@ -169,7 +156,7 @@ ScrollingWindow {
MouseArea { MouseArea {
id: cancelButtonAction id: cancelButtonAction
anchors.fill: parent anchors.fill: parent
onClicked: updateDialog.closeDialog() onClicked: root.shown = false
cursorShape: "PointingHandCursor" cursorShape: "PointingHandCursor"
} }
} }
@ -185,7 +172,7 @@ ScrollingWindow {
color: "#0c9ab4" // Same as logo color: "#0c9ab4" // Same as logo
font { font {
family: updateDialog.fontFamily family: updateDialog.fontFamily
pixelSize: hifi.fonts.pixelSize * 1.2 pixelSize: hifistyles.fonts.pixelSize * 1.2
weight: Font.DemiBold weight: Font.DemiBold
} }
anchors { anchors {

View file

@ -48,14 +48,6 @@ const QString& UpdateDialog::releaseNotes() const {
return _releaseNotes; return _releaseNotes;
} }
void UpdateDialog::closeDialog() {
hide();
}
void UpdateDialog::hide() {
((QQuickItem*)parent())->setVisible(false);
}
void UpdateDialog::triggerUpgrade() { void UpdateDialog::triggerUpgrade() {
auto applicationUpdater = DependencyManager::get<AutoUpdater>(); auto applicationUpdater = DependencyManager::get<AutoUpdater>();
applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey()); applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey());

View file

@ -21,22 +21,20 @@ class UpdateDialog : public OffscreenQmlDialog {
Q_OBJECT Q_OBJECT
HIFI_QML_DECL HIFI_QML_DECL
Q_PROPERTY(QString updateAvailableDetails READ updateAvailableDetails) Q_PROPERTY(QString updateAvailableDetails READ updateAvailableDetails CONSTANT)
Q_PROPERTY(QString releaseNotes READ releaseNotes) Q_PROPERTY(QString releaseNotes READ releaseNotes CONSTANT)
public: public:
UpdateDialog(QQuickItem* parent = nullptr); UpdateDialog(QQuickItem* parent = nullptr);
const QString& updateAvailableDetails() const; const QString& updateAvailableDetails() const;
const QString& releaseNotes() const; const QString& releaseNotes() const;
private: private:
QString _updateAvailableDetails; QString _updateAvailableDetails;
QString _releaseNotes; QString _releaseNotes;
protected: protected:
void hide();
Q_INVOKABLE void triggerUpgrade(); Q_INVOKABLE void triggerUpgrade();
Q_INVOKABLE void closeDialog();
}; };