Address bar polish and visibility handler fix

This commit is contained in:
Brad Davis 2016-01-24 15:23:37 -08:00
parent 79e6aaf17f
commit 7eac917de5
8 changed files with 36 additions and 36 deletions

View file

@ -19,7 +19,9 @@ Window {
HifiConstants { id: hifi }
anchors.centerIn: parent
objectName: "AddressBarDialog"
frame: HiddenFrame {}
visible: false
destroyOnInvisible: false
resizable: false
scale: 1.25 // Make this dialog a little larger than normal
@ -34,7 +36,6 @@ Window {
Image {
id: backgroundImage
source: "../images/address-bar.svg"
width: 576 * root.scale
height: 80 * root.scale
@ -55,12 +56,12 @@ Window {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
onClicked: {
addressBarDialog.loadBack()
}
}
}
Image {
id: forwardArrow
source: addressBarDialog.forwardEnabled ? "../images/right-arrow.svg" : "../images/right-arrow-disabled.svg"
@ -84,7 +85,7 @@ Window {
// FIXME replace with TextField
TextInput {
id: addressLine
focus: true
anchors {
fill: parent
leftMargin: parent.height + parent.height + hifi.layout.spacing * 5
@ -106,19 +107,19 @@ Window {
addressLine.text = ""
}
}
function toggleOrGo() {
if (addressLine.text != "") {
if (addressLine.text !== "") {
addressBarDialog.loadAddress(addressLine.text)
}
root.close();
root.visible = false;
}
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
root.close()
root.visible = false
event.accepted = true
break
case Qt.Key_Enter:

View file

@ -282,7 +282,7 @@ Window {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
root.close();
root.visible = false;
event.accepted = true;
break;

View file

@ -146,7 +146,7 @@ ModalWindow {
currentRow = -1;
} else {
root.selectedFile(file);
root.close();
root.visible = false;
}
}
}
@ -182,14 +182,14 @@ ModalWindow {
KeyNavigation.left: openButton
KeyNavigation.right: fileTableView.contentItem
Keys.onReturnPressed: { canceled(); root.enabled = false }
onClicked: { canceled(); close() }
onClicked: { canceled(); root.visible = false; }
}
Button {
id: openButton
text: root.selectDirectory ? "Choose" : "Open"
enabled: currentSelection.text ? true : false
onClicked: { selectedFile(d.currentSelectionUrl); close(); }
Keys.onReturnPressed: { selectedFile(d.currentSelectionUrl); close(); }
onClicked: { selectedFile(d.currentSelectionUrl); root.visible = false; }
Keys.onReturnPressed: { selectedFile(d.currentSelectionUrl); root.visible = false; }
KeyNavigation.up: selectionType
KeyNavigation.left: selectionType

View file

@ -50,7 +50,7 @@ Frame {
id: closeClickArea
anchors.fill: parent
hoverEnabled: true
onClicked: frame.close();
onClicked: window.visible = false;
}
}
}

View file

@ -9,9 +9,6 @@ FocusScope {
id: root
HifiConstants { id: hifi }
// Should hiding the window destroy it or just hide it?
property bool destroyOnInvisible: false
Component.onCompleted: {
fadeTargetProperty = visible ? 1.0 : 0.0
}
@ -36,10 +33,6 @@ FocusScope {
fadeTargetProperty = target ? 1.0 : 0.0;
return;
}
if (!visible && destroyOnInvisible) {
destroy();
}
}
// The actual animator

View file

@ -28,14 +28,6 @@ Item {
y: -height
}
function close() {
window.close();
}
function raise() {
window.raise();
}
function deltaSize(dx, dy) {
var newSize = Qt.vector2d(window.width + dx, window.height + dy);
newSize = Utils.clampVector(newSize, window.minSize, window.maxSize);

View file

@ -0,0 +1,10 @@
import QtQuick 2.5
import "."
Frame {
id: frame
Item { anchors.fill: parent }
}

View file

@ -33,6 +33,8 @@ Fadable {
property bool alwaysOnTop: false
// Should hitting the close button hide or destroy the window?
property bool destroyOnCloseButton: true
// Should hiding the window destroy it or just hide it?
property bool destroyOnInvisible: false
// FIXME support for pinned / unpinned pending full design
// property bool pinnable: false
// property bool pinned: false
@ -117,13 +119,15 @@ Fadable {
// don't do anything but manipulate the targetVisible flag and let the other
// mechanisms decide if the window should be destroyed after the close
// animation completes
function close() {
console.log("Closing " + window)
if (destroyOnCloseButton) {
destroyOnInvisible = true
}
visible = false;
}
// FIXME using this close function messes up the visibility signals received by the
// type and it's derived types
// function close() {
// console.log("Closing " + window)
// if (destroyOnCloseButton) {
// destroyOnInvisible = true
// }
// visible = false;
// }
function framedRect() {
if (!frame || !frame.decoration) {