mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-14 09:06:51 +02:00
Merge pull request #5012 from ctrlaltdavid/20555
DO NOT MERGE - QA for #20555 - Re-style QML Address Bar
This commit is contained in:
commit
12bcbbf338
15 changed files with 528 additions and 123 deletions
50
interface/resources/images/address-bar-error-close.svg
Normal file
50
interface/resources/images/address-bar-error-close.svg
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="pomodoro"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="100"
|
||||
height="100"
|
||||
viewBox="-7.125 -7.328 100 100"
|
||||
enable-background="new -7.125 -7.328 100 91.57"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="address-bar-error-close.svg"><metadata
|
||||
id="metadata4143"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs4141" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1840"
|
||||
inkscape:window-height="1057"
|
||||
id="namedview4139"
|
||||
showgrid="false"
|
||||
inkscape:zoom="4.8487496"
|
||||
inkscape:cx="50"
|
||||
inkscape:cy="37.53545"
|
||||
inkscape:window-x="72"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="pomodoro" /><path
|
||||
d="m 42.8705,-2.3280001 c -24.8688,0 -44.9955,20.1618001 -44.9955,45.0045001 0,24.8733 20.1267,44.9955 44.9955,44.9955 24.8427,0 45.0045,-20.1222 45.0045,-44.9955 0,-24.8427 -20.1618,-45.0045001 -45.0045,-45.0045001 z M 67.1066,57.126 57.329,66.9036 42.6293,52.221 27.9422,66.9036 18.1511,57.126 32.8247,42.4443 18.1511,27.7482 27.9422,17.9796 42.6284,32.6487 57.3281,17.9796 67.1057,27.7482 52.424,42.4434 67.1066,57.126 Z"
|
||||
id="path4137"
|
||||
inkscape:connector-curvature="0" /><path
|
||||
style="fill:#787878;fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
d="M 38.400102,87.62655 C 28.705316,86.39839 21.084707,83.18102 13.982682,77.31765 5.5185024,70.329714 -0.09877759,60.244376 -1.7904936,48.998291 -2.1921426,46.328239 -2.2434696,39.677941 -1.8825126,37.07572 0.23131941,21.836625 9.4778634,8.9272213 23.005945,2.3281243 c 9.805646,-4.783264 20.444414,-5.902737 30.964952,-3.25830896 7.357662,1.849413 14.403738,5.75570696 19.976698,11.07495366 7.36697,7.031569 12.03213,16.084669 13.58981,26.37208 0.45133,2.980701 0.44981,9.518147 -0.003,12.481442 -0.72914,4.772737 -2.08456,9.199896 -4.04575,13.214497 -2.40852,4.930297 -4.94684,8.502038 -8.75077,12.313422 -6.78153,6.79482 -14.822805,10.95587 -24.504932,12.68035 -1.787127,0.3183 -3.134188,0.40875 -6.708441,0.45045 -2.459762,0.0287 -4.765789,0.0149 -5.124505,-0.0304 z m -3.02899,-27.869116 7.314939,-7.311007 7.360877,7.35692 7.360872,7.356917 4.983865,-4.982378 4.98386,-4.982378 -7.359111,-7.358686 -7.359105,-7.358687 7.359105,-7.358687 7.359111,-7.358686 -4.98387,-4.982383 -4.983864,-4.982384 -7.407456,7.393329 -7.407456,7.393328 -7.360652,-7.342464 -7.36065,-7.342467 -4.922357,4.916384 -4.922356,4.916381 7.300528,7.417269 7.300528,7.417267 -7.362706,7.362244 -7.362709,7.362244 4.890918,4.889465 c 2.690008,2.689205 4.974582,4.889463 5.076835,4.889463 0.102254,0 3.477639,-3.289951 7.500854,-7.311004 z"
|
||||
id="path4145"
|
||||
inkscape:connector-curvature="0" /></svg>
|
After Width: | Height: | Size: 3.4 KiB |
3
interface/resources/images/address-bar-error-icon.svg
Normal file
3
interface/resources/images/address-bar-error-icon.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
|
||||
<path fill="#000000" d="M50.291,0.07c-18.706,0-33.871,15.165-33.871,33.87c0,0.401,0.013,0.81,0.03,1.221 c0.127,3.558,0.798,6.976,1.939,10.173c7.226,23.752,31.901,54.736,31.901,54.736s24.674-30.982,31.901-54.734 c1.143-3.197,1.812-6.617,1.939-10.175c0.02-0.411,0.031-0.819,0.031-1.221C84.162,15.235,68.998,0.07,50.291,0.07z M51.013,58.386 c-2.479,0-4.664-2.126-4.664-4.664c0-2.479,2.184-4.723,4.664-4.723s4.724,2.243,4.724,4.723 C55.736,56.26,53.551,58.386,51.013,58.386z M50.481,45.811c-1.062-6.376-2.479-12.634-3.601-19.01 c-0.236-1.357-0.295-2.302-0.295-3.66c0-2.716,1.299-5.667,4.428-5.667c3.483,0,4.428,3.011,4.428,6.021 c0,1.181-0.059,2.538-0.295,3.66c-1.181,6.199-2.302,12.457-3.483,18.655H50.481z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 954 B |
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 49 49" enable-background="new 0 0 49 49" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#333" d="M49,46c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h43c1.7,0,3,1.3,3,3V46z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g id="Your_Icon_11_">
|
||||
<g>
|
||||
<polygon fill="#E7EEEE" points="23.6,19.9 15.1,19.9 15.1,27.8 23.6,27.8 23.6,33.8 33,23.9 23.6,14 "/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 759 B |
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 49 49" enable-background="new 0 0 49 49" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<path fill="#0E7077" d="M49,46c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h43c1.7,0,3,1.3,3,3V46z"/>
|
||||
</g>
|
||||
<g>
|
||||
<g id="Your_Icon_11_">
|
||||
<g>
|
||||
<polygon fill="#E7EEEE" points="23.6,19.9 15.1,19.9 15.1,27.8 23.6,27.8 23.6,33.8 33,23.9 23.6,14 "/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 762 B |
72
interface/resources/images/address-bar.svg
Normal file
72
interface/resources/images/address-bar.svg
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="1440"
|
||||
height="200"
|
||||
data-icon="map-marker"
|
||||
data-container-transform="translate(24)"
|
||||
viewBox="0 0 1440 200"
|
||||
id="svg4136"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="address-bar.svg">
|
||||
<metadata
|
||||
id="metadata4144">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs4142" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1840"
|
||||
inkscape:window-height="1057"
|
||||
id="namedview4140"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.8671875"
|
||||
inkscape:cx="707.02439"
|
||||
inkscape:cy="52.468468"
|
||||
inkscape:window-x="72"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4136" />
|
||||
<rect
|
||||
style="fill:#ededed;fill-opacity:1;stroke:none;stroke-linejoin:round;stroke-opacity:1"
|
||||
id="rect4141"
|
||||
width="1280"
|
||||
height="140"
|
||||
x="160"
|
||||
y="30"
|
||||
rx="16.025024"
|
||||
ry="17.019567" />
|
||||
<circle
|
||||
style="fill:#b8b8b8;fill-opacity:1;stroke:none;stroke-opacity:1"
|
||||
id="path4146"
|
||||
cx="100"
|
||||
cy="100"
|
||||
r="100" />
|
||||
<path
|
||||
d="m 100,36.000005 c -22.1,0 -40,17.9 -40,39.999995 0,30 40,88 40,88 0,0 40,-58 40,-88 0,-22.099995 -17.9,-39.999995 -40,-39.999995 z m 0,22 c 9.9,0 18,8.099995 18,17.999995 0,9.9 -8.1,18 -18,18 -9.9,0 -18,-8.1 -18,-18 0,-9.9 8.1,-17.999995 18,-17.999995 z"
|
||||
id="path4138"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
|
@ -1,91 +1,145 @@
|
|||
//
|
||||
// AddressBarDialog.qml
|
||||
//
|
||||
// Created by Austin Davis on 2015/04/14
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import Hifi 1.0
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.2
|
||||
import "controls"
|
||||
import "styles"
|
||||
|
||||
Dialog {
|
||||
Item {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
title: "Go to..."
|
||||
|
||||
objectName: "AddressBarDialog"
|
||||
contentImplicitWidth: addressBarDialog.implicitWidth
|
||||
contentImplicitHeight: addressBarDialog.implicitHeight
|
||||
destroyOnCloseButton: false
|
||||
|
||||
property int animationDuration: hifi.effects.fadeInDuration
|
||||
property bool destroyOnInvisible: false
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
reset();
|
||||
}
|
||||
implicitWidth: addressBarDialog.implicitWidth
|
||||
implicitHeight: addressBarDialog.implicitHeight
|
||||
|
||||
x: parent ? parent.width / 2 - width / 2 : 0
|
||||
y: parent ? parent.height / 2 - height / 2 : 0
|
||||
property int maximumX: parent ? parent.width - width : 0
|
||||
property int maximumY: parent ? parent.height - height : 0
|
||||
|
||||
AddressBarDialog {
|
||||
id: addressBarDialog
|
||||
|
||||
implicitWidth: backgroundImage.width
|
||||
implicitHeight: backgroundImage.height
|
||||
|
||||
Image {
|
||||
id: backgroundImage
|
||||
|
||||
source: "../images/address-bar.svg"
|
||||
width: 576
|
||||
height: 80
|
||||
property int inputAreaHeight: 56 // Height of the background's input area
|
||||
property int inputAreaStep: (height - inputAreaHeight) / 2
|
||||
|
||||
TextInput {
|
||||
id: addressLine
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: parent.height + hifi.layout.spacing * 2
|
||||
rightMargin: hifi.layout.spacing * 2
|
||||
topMargin: parent.inputAreaStep + hifi.layout.spacing
|
||||
bottomMargin: parent.inputAreaStep + hifi.layout.spacing
|
||||
|
||||
}
|
||||
|
||||
font.pointSize: 15
|
||||
helperText: "Go to: place, @user, /path, network address"
|
||||
|
||||
onAccepted: {
|
||||
event.accepted = true // Generates erroneous error in program log, "ReferenceError: event is not defined".
|
||||
addressBarDialog.loadAddress(addressLine.text)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
// Drag the icon
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
x: 0
|
||||
y: 0
|
||||
drag {
|
||||
target: root
|
||||
minimumX: -parent.inputAreaStep
|
||||
minimumY: -parent.inputAreaStep
|
||||
maximumX: root.parent ? root.maximumX : 0
|
||||
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
// Drag the input rectangle
|
||||
width: parent.width - parent.height
|
||||
height: parent.inputAreaHeight
|
||||
x: parent.height
|
||||
y: parent.inputAreaStep
|
||||
drag {
|
||||
target: root
|
||||
minimumX: -parent.inputAreaStep
|
||||
minimumY: -parent.inputAreaStep
|
||||
maximumX: root.parent ? root.maximumX : 0
|
||||
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions.
|
||||
// Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property
|
||||
// that can be animated, like scale or opacity, and then when the target animation value is reached, we can modify the
|
||||
// visibility.
|
||||
enabled: false
|
||||
opacity: 0.0
|
||||
|
||||
onEnabledChanged: {
|
||||
opacity = enabled ? 1.0 : 0.0
|
||||
if (enabled) {
|
||||
addressLine.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
onParentChanged: {
|
||||
if (enabled && visible) {
|
||||
addressLine.forceActiveFocus();
|
||||
|
||||
Behavior on opacity {
|
||||
// Animate opacity.
|
||||
NumberAnimation {
|
||||
duration: animationDuration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
onOpacityChanged: {
|
||||
// Once we're transparent, disable the dialog's visibility.
|
||||
visible = (opacity != 0.0)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
reset()
|
||||
|
||||
// Some dialogs should be destroyed when they become invisible.
|
||||
if (destroyOnInvisible) {
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function reset() {
|
||||
addressLine.text = ""
|
||||
goButton.source = "../images/address-bar-submit.svg"
|
||||
}
|
||||
|
||||
AddressBarDialog {
|
||||
id: addressBarDialog
|
||||
// The client area
|
||||
x: root.clientX
|
||||
y: root.clientY
|
||||
implicitWidth: 512
|
||||
implicitHeight: border.height + hifi.layout.spacing * 4
|
||||
|
||||
|
||||
Border {
|
||||
id: border
|
||||
height: 64
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: hifi.layout.spacing * 2
|
||||
anchors.right: goButton.left
|
||||
anchors.rightMargin: hifi.layout.spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
TextInput {
|
||||
id: addressLine
|
||||
anchors.fill: parent
|
||||
helperText: "domain, location, @user, /x,y,z"
|
||||
anchors.margins: hifi.layout.spacing
|
||||
onAccepted: {
|
||||
event.accepted
|
||||
addressBarDialog.loadAddress(addressLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: goButton
|
||||
width: 32
|
||||
height: 32
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: hifi.layout.spacing * 2
|
||||
source: "../images/address-bar-submit.svg"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
parent.source = "../images/address-bar-submit-active.svg"
|
||||
addressBarDialog.loadAddress(addressLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
function toggleOrGo() {
|
||||
|
@ -95,8 +149,22 @@ Dialog {
|
|||
addressBarDialog.loadAddress(addressLine.text)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Keys.onEscapePressed: {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
switch(event.key) {
|
||||
case Qt.Key_W:
|
||||
if (event.modifiers == Qt.ControlModifier) {
|
||||
event.accepted = true
|
||||
enabled = false
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: toggleOrGo()
|
||||
Keys.onEnterPressed: toggleOrGo()
|
||||
}
|
||||
|
||||
|
|
152
interface/resources/qml/ErrorDialog.qml
Normal file
152
interface/resources/qml/ErrorDialog.qml
Normal file
|
@ -0,0 +1,152 @@
|
|||
//
|
||||
// ErrorDialog.qml
|
||||
//
|
||||
// Created by David Rowe on 30 May 2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import Hifi 1.0 as Hifi
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
import "controls"
|
||||
import "styles"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
property int animationDuration: hifi.effects.fadeInDuration
|
||||
property bool destroyOnInvisible: true
|
||||
|
||||
Component.onCompleted: {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
onParentChanged: {
|
||||
if (visible && enabled) {
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
implicitWidth: content.implicitWidth
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
x: parent ? parent.width / 2 - width / 2 : 0
|
||||
y: parent ? parent.height / 2 - height / 2 : 0
|
||||
|
||||
Hifi.ErrorDialog {
|
||||
id: content
|
||||
|
||||
implicitWidth: box.width
|
||||
implicitHeight: icon.height + hifi.layout.spacing * 2
|
||||
|
||||
Border {
|
||||
id: box
|
||||
|
||||
width: 512
|
||||
color: "#ebebeb"
|
||||
radius: 2
|
||||
border.width: 1
|
||||
border.color: "#000000"
|
||||
|
||||
Image {
|
||||
id: icon
|
||||
|
||||
source: "../images/address-bar-error-icon.svg"
|
||||
width: 40
|
||||
height: 40
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: hifi.layout.spacing
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: messageText
|
||||
|
||||
font.pointSize: 10
|
||||
font.weight: Font.Bold
|
||||
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
text: content.text
|
||||
}
|
||||
|
||||
Image {
|
||||
source: "../images/address-bar-error-close.svg"
|
||||
width: 20
|
||||
height: 20
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: hifi.layout.spacing * 2
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
content.accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions.
|
||||
// Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property
|
||||
// that can be animated, like scale or opacity, and then when the target animation value is reached, we can modify the
|
||||
// visibility.
|
||||
enabled: false
|
||||
opacity: 0.0
|
||||
|
||||
onEnabledChanged: {
|
||||
opacity = enabled ? 1.0 : 0.0
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
// Animate opacity.
|
||||
NumberAnimation {
|
||||
duration: animationDuration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
onOpacityChanged: {
|
||||
// Once we're transparent, disable the dialog's visibility.
|
||||
visible = (opacity != 0.0)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
// Some dialogs should be destroyed when they become invisible.
|
||||
if (destroyOnInvisible) {
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
if (event.modifiers === Qt.ControlModifier)
|
||||
switch (event.key) {
|
||||
case Qt.Key_W:
|
||||
event.accepted = true
|
||||
content.accept()
|
||||
break
|
||||
} else switch (event.key) {
|
||||
case Qt.Key_Escape:
|
||||
case Qt.Key_Back:
|
||||
case Qt.Key_Enter:
|
||||
case Qt.Key_Return:
|
||||
event.accepted = true
|
||||
content.accept()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ DialogBase {
|
|||
* Support for animating the dialog in and out.
|
||||
*/
|
||||
enabled: false
|
||||
scale: 0.0
|
||||
opacity: 1.0
|
||||
|
||||
// The offscreen UI will enable an object, rather than manipulating it's
|
||||
// visibility, so that we can do animations in both directions. Because
|
||||
|
@ -40,20 +40,20 @@ DialogBase {
|
|||
// opacity, and then when the target animation value is reached, we can
|
||||
// modify the visibility
|
||||
onEnabledChanged: {
|
||||
scale = enabled ? 1.0 : 0.0
|
||||
opacity = enabled ? 1.0 : 0.0
|
||||
}
|
||||
|
||||
// The actual animator
|
||||
Behavior on scale {
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: root.animationDuration
|
||||
easing.type: Easing.InOutBounce
|
||||
duration: animationDuration
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
// Once we're scaled to 0, disable the dialog's visibility
|
||||
onScaleChanged: {
|
||||
visible = (scale != 0.0);
|
||||
// Once we're transparent, disable the dialog's visibility
|
||||
onOpacityChanged: {
|
||||
visible = (opacity != 0.0);
|
||||
}
|
||||
|
||||
// Some dialogs should be destroyed when they become invisible,
|
||||
|
|
|
@ -56,6 +56,6 @@ Item {
|
|||
|
||||
QtObject {
|
||||
id: effects
|
||||
readonly property int fadeInDuration: 400
|
||||
readonly property int fadeInDuration: 300
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,40 +55,41 @@
|
|||
#include <QMessageBox>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include <AddressManager.h>
|
||||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <AmbientOcclusionEffect.h>
|
||||
#include <AudioInjector.h>
|
||||
#include <DeferredLightingEffect.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <EntityScriptingInterface.h>
|
||||
#include <ErrorDialog.h>
|
||||
#include <GlowEffect.h>
|
||||
#include <HFActionEvent.h>
|
||||
#include <HFBackEvent.h>
|
||||
#include <VrMenu.h>
|
||||
#include <InfoView.h>
|
||||
#include <LogHandler.h>
|
||||
#include <MainWindow.h>
|
||||
#include <MessageDialog.h>
|
||||
#include <ModelEntityItem.h>
|
||||
#include <NetworkAccessManager.h>
|
||||
#include <NetworkingConstants.h>
|
||||
#include <ObjectMotionState.h>
|
||||
#include <OctalCode.h>
|
||||
#include <OctreeSceneStats.h>
|
||||
#include <ObjectMotionState.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <PathUtils.h>
|
||||
#include <PerfStat.h>
|
||||
#include <PhysicsEngine.h>
|
||||
#include <ProgramObject.h>
|
||||
#include <ResourceCache.h>
|
||||
#include <SceneScriptingInterface.h>
|
||||
#include <ScriptCache.h>
|
||||
#include <SettingHandle.h>
|
||||
#include <SoundCache.h>
|
||||
#include <TextRenderer.h>
|
||||
#include <UserActivityLogger.h>
|
||||
#include <UUID.h>
|
||||
#include <MessageDialog.h>
|
||||
#include <InfoView.h>
|
||||
#include <SceneScriptingInterface.h>
|
||||
#include <VrMenu.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "AudioClient.h"
|
||||
|
@ -799,6 +800,7 @@ void Application::initializeGL() {
|
|||
|
||||
void Application::initializeUi() {
|
||||
AddressBarDialog::registerType();
|
||||
ErrorDialog::registerType();
|
||||
LoginDialog::registerType();
|
||||
MessageDialog::registerType();
|
||||
VrMenu::registerType();
|
||||
|
|
|
@ -36,12 +36,10 @@ void AddressBarDialog::loadAddress(const QString& address) {
|
|||
}
|
||||
|
||||
void AddressBarDialog::displayAddressOfflineMessage() {
|
||||
OffscreenUi::information("Address offline",
|
||||
"That user or place is currently offline.");
|
||||
OffscreenUi::error("That user or place is currently offline");
|
||||
}
|
||||
|
||||
void AddressBarDialog::displayAddressNotFoundMessage() {
|
||||
OffscreenUi::information("Address not found",
|
||||
"There is no address information for that user or place.");
|
||||
OffscreenUi::error("There is no address information for that user or place");
|
||||
}
|
||||
|
||||
|
|
38
libraries/ui/src/ErrorDialog.cpp
Normal file
38
libraries/ui/src/ErrorDialog.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// ErrorDialog.cpp
|
||||
//
|
||||
// Created by David Rowe on 30 May 2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "ErrorDialog.h"
|
||||
|
||||
HIFI_QML_DEF(ErrorDialog)
|
||||
|
||||
ErrorDialog::ErrorDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
||||
}
|
||||
|
||||
ErrorDialog::~ErrorDialog() {
|
||||
}
|
||||
|
||||
QString ErrorDialog::text() const {
|
||||
return _text;
|
||||
}
|
||||
|
||||
void ErrorDialog::setVisible(bool v) {
|
||||
OffscreenQmlDialog::setVisible(v);
|
||||
}
|
||||
|
||||
void ErrorDialog::setText(const QString& arg) {
|
||||
if (arg != _text) {
|
||||
_text = arg;
|
||||
emit textChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorDialog::accept() {
|
||||
OffscreenQmlDialog::accept();
|
||||
}
|
46
libraries/ui/src/ErrorDialog.h
Normal file
46
libraries/ui/src/ErrorDialog.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// ErrorDialog.h
|
||||
//
|
||||
// Created by David Rowe on 30 May 2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef hifi_ErrorDialog_h
|
||||
#define hifi_ErrorDialog_h
|
||||
|
||||
#include "OffscreenQmlDialog.h"
|
||||
|
||||
class ErrorDialog : public OffscreenQmlDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
HIFI_QML_DECL
|
||||
|
||||
private:
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||
|
||||
public:
|
||||
ErrorDialog(QQuickItem* parent = 0);
|
||||
virtual ~ErrorDialog();
|
||||
|
||||
QString text() const;
|
||||
|
||||
public slots:
|
||||
virtual void setVisible(bool v);
|
||||
void setText(const QString& arg);
|
||||
|
||||
signals:
|
||||
void textChanged();
|
||||
|
||||
protected slots:
|
||||
virtual void accept();
|
||||
|
||||
private:
|
||||
QString _text;
|
||||
};
|
||||
|
||||
#endif // hifi_ErrorDialog_h
|
|
@ -13,6 +13,7 @@
|
|||
#include <QOpenGLDebugLogger>
|
||||
#include <QGLWidget>
|
||||
#include <QtQml>
|
||||
#include "ErrorDialog.h"
|
||||
#include "MessageDialog.h"
|
||||
|
||||
|
||||
|
@ -130,6 +131,15 @@ void OffscreenUi::critical(const QString& title, const QString& text,
|
|||
static_cast<QMessageBox::Icon>(MessageDialog::Critical), buttons);
|
||||
}
|
||||
|
||||
void OffscreenUi::error(const QString& text) {
|
||||
ErrorDialog* pDialog{ nullptr };
|
||||
ErrorDialog::show([&](QQmlContext* ctx, QObject* item) {
|
||||
pDialog = item->findChild<ErrorDialog*>();
|
||||
pDialog->setText(text);
|
||||
});
|
||||
pDialog->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
OffscreenUi::ButtonCallback OffscreenUi::NO_OP_CALLBACK = [](QMessageBox::StandardButton) {};
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ public:
|
|||
static void critical(const QString& title, const QString& text,
|
||||
ButtonCallback callback = NO_OP_CALLBACK,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
|
||||
|
||||
static void error(const QString& text); // Interim dialog in new style
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue