Only raise keyboard if in HMD display mode

This commit is contained in:
David Rowe 2016-10-12 09:43:33 +13:00
parent 552f276a06
commit 31b35f0a35
9 changed files with 51 additions and 26 deletions

View file

@ -34,7 +34,10 @@ Window {
width: addressBarDialog.implicitWidth
height: addressBarDialog.implicitHeight
onShownChanged: addressBarDialog.observeShownChanged(shown);
onShownChanged: {
addressBarDialog.keyboardEnabled = HMD.active;
addressBarDialog.observeShownChanged(shown);
}
Component.onCompleted: {
root.parentChanged.connect(center);
center();
@ -70,11 +73,12 @@ Window {
AddressBarDialog {
id: addressBarDialog
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
implicitWidth: backgroundImage.width
implicitHeight: backgroundImage.height + (keyboardRaised ? keyboard.raisedHeight : 0)
implicitHeight: backgroundImage.height + ((keyboardEnabled && keyboardRaised) ? keyboard.raisedHeight : 0)
// The buttons have their button state changed on hover, so we have to manually fix them up here
onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0;
@ -277,7 +281,7 @@ Window {
HifiControls.Keyboard {
id: keyboard
raised: parent.keyboardRaised
raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode
anchors {
left: parent.left
@ -285,7 +289,6 @@ Window {
bottom: parent.bottom
}
}
}
function getRequest(url, cb) { // cb(error, responseOfCorrectContentType) of url. General for 'get' text/html/json, but without redirects.

View file

@ -42,6 +42,10 @@ ScrollingWindow {
}
}
onShownChanged: {
keyboardEnabled = HMD.active;
}
Settings {
category: "ToolWindow.Position"
property alias x: toolWindow.x

View file

@ -22,7 +22,7 @@ ModalWindow {
implicitWidth: 640;
implicitHeight: 320;
visible: true;
keyboardEnabled: false // Disable ModalWindow's keyboard.
keyboardOverride: true // Disable ModalWindow's keyboard.
signal selected(var result);
signal canceled();
@ -51,6 +51,7 @@ ModalWindow {
}
}
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
onKeyboardRaisedChanged: d.resize();
@ -116,7 +117,7 @@ ModalWindow {
var targetHeight = (textField.visible ? textField.controlHeight + hifi.dimensions.contentSpacing.y : 0) +
(extraInputs.visible ? extraInputs.height + hifi.dimensions.contentSpacing.y : 0) +
(buttons.height + 3 * hifi.dimensions.contentSpacing.y) +
(root.keyboardRaised ? (keyboard.raisedHeight + hifi.dimensions.contentSpacing.y) : 0);
((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + hifi.dimensions.contentSpacing.y) : 0);
root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth);
root.height = (targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ?
@ -155,13 +156,13 @@ ModalWindow {
Keyboard {
id: keyboard
raised: keyboardRaised
raised: keyboardEnabled && keyboardRaised
numeric: punctuationMode
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: keyboardRaised ? hifi.dimensions.contentSpacing.y : 0
bottomMargin: raised ? hifi.dimensions.contentSpacing.y : 0
}
}
}
@ -312,6 +313,7 @@ ModalWindow {
}
Component.onCompleted: {
keyboardEnabled = HMD.active;
updateIcon();
d.resize();
textField.forceActiveFocus();

View file

@ -27,7 +27,7 @@ ModalWindow {
id: root
resizable: true
implicitWidth: 480
implicitHeight: 360 + (fileDialogItem.keyboardRaised ? keyboard.raisedHeight + hifi.dimensions.contentSpacing.y : 0)
implicitHeight: 360 + (fileDialogItem.keyboardEnabled && fileDialogItem.keyboardRaised ? keyboard.raisedHeight + hifi.dimensions.contentSpacing.y : 0)
minSize: Qt.vector2d(360, 240)
draggable: true
@ -70,7 +70,9 @@ ModalWindow {
signal canceled();
Component.onCompleted: {
console.log("Helper " + helper + " drives " + drives)
console.log("Helper " + helper + " drives " + drives);
fileDialogItem.keyboardEnabled = HMD.active;
// HACK: The following lines force the model to initialize properly such that the go-up button
// works properly from the initial screen.
@ -106,6 +108,7 @@ ModalWindow {
height: pane.height
anchors.margins: 0
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
@ -649,7 +652,7 @@ ModalWindow {
Keyboard {
id: keyboard
raised: parent.keyboardRaised
raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode
anchors {
left: parent.left

View file

@ -22,7 +22,7 @@ ModalWindow {
implicitWidth: 640
implicitHeight: 320
visible: true
keyboardEnabled: false // Disable ModalWindow's keyboard.
keyboardOverride: true // Disable ModalWindow's keyboard.
signal selected(var result);
signal canceled();
@ -46,6 +46,7 @@ ModalWindow {
property int titleWidth: 0
onTitleWidthChanged: d.resize();
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
@ -76,7 +77,7 @@ ModalWindow {
var targetWidth = Math.max(titleWidth, pane.width)
var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height
root.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth);
root.height = ((targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + (root.keyboardRaised ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0)
root.height = ((targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0)
}
}
@ -119,13 +120,13 @@ ModalWindow {
Keyboard {
id: keyboard
raised: keyboardRaised
raised: keyboardEnabled && keyboardRaised
numeric: punctuationMode
anchors {
left: parent.left
right: parent.right
bottom: buttons.top
bottomMargin: root.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
bottomMargin: raised ? 2 * hifi.dimensions.contentSpacing.y : 0
}
}
@ -187,6 +188,7 @@ ModalWindow {
}
Component.onCompleted: {
keyboardEnabled = HMD.active;
updateIcon();
d.resize();
textResult.forceActiveFocus();

View file

@ -29,6 +29,7 @@ Window {
Item {
anchors.fill: parent
property bool keyboardEnabled: false
property bool keyboardRaised: true
property bool punctuationMode: false
@ -76,7 +77,7 @@ Window {
Keyboard {
id: keyboard
raised: parent.keyboardRaised
raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode
anchors {
left: parent.left
@ -84,5 +85,9 @@ Window {
bottom: parent.bottom
}
}
Component.onCompleted: {
keyboardEnabled = HMD.active;
}
}
}

View file

@ -45,7 +45,7 @@ ScrollingWindow {
Rectangle {
width: parent.width
height: root.height - (keyboardRaised ? 200 : 0)
height: root.height - (keyboardEnabled && keyboardRaised ? 200 : 0)
radius: 4
color: hifi.colors.baseGray
@ -210,7 +210,7 @@ ScrollingWindow {
}
onKeyboardRaisedChanged: {
if (keyboardRaised) {
if (keyboardEnabled && keyboardRaised) {
// Scroll to item with focus if necessary.
var footerHeight = newAttachmentButton.height + buttonRow.height + 3 * hifi.dimensions.contentSpacing.y;
var delta = activator.mouseY

View file

@ -30,7 +30,7 @@ ScrollingWindow {
Rectangle {
width: parent.width
height: root.height - (keyboardRaised ? 200 : 0)
height: root.height - (keyboardEnabled && keyboardRaised ? 200 : 0)
radius: 4
color: hifi.colors.baseGray

View file

@ -34,7 +34,8 @@ Window {
property var footer: Item { } // Optional static footer at the bottom of the dialog.
readonly property var footerContentHeight: footer.height > 0 ? (footer.height + 2 * hifi.dimensions.contentSpacing.y + 3) : 0
property bool keyboardEnabled: true // Set false if derived control implements its own keyboard.
property bool keyboardOverride: false // Set true in derived control if it implements its own keyboard.
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
@ -132,7 +133,8 @@ Window {
// Optional non-scrolling footer.
id: footerPane
property alias keyboardEnabled: window.keyboardEnabled
// @@@@@@@ TODO: Are these aliases actually needed?
property alias keyboardOverride: window.keyboardOverride
property alias keyboardRaised: window.keyboardRaised
property alias punctuationMode: window.punctuationMode
@ -141,9 +143,9 @@ Window {
bottom: parent.bottom
}
width: parent.contentWidth
height: footerContentHeight + (keyboardEnabled && keyboardRaised ? keyboard.height : 0)
height: footerContentHeight + (keyboard.enabled && keyboard.raised ? keyboard.height : 0)
color: hifi.colors.baseGray
visible: footer.height > 0 || keyboardEnabled && keyboardRaised
visible: footer.height > 0 || keyboard.enabled && keyboard.raised
Item {
// Horizontal rule.
@ -182,8 +184,8 @@ Window {
HiFiControls.Keyboard {
id: keyboard
enabled: keyboardEnabled
raised: keyboardRaised
enabled: !keyboardOverride
raised: keyboardEnabled && keyboardRaised
numeric: punctuationMode
anchors {
left: parent.left
@ -195,7 +197,7 @@ Window {
}
onKeyboardRaisedChanged: {
if (keyboardEnabled && keyboardRaised) {
if (keyboard.enabled && keyboard.raised) {
var delta = activator.mouseY
- (activator.height + activator.y - keyboard.raisedHeight - footerContentHeight - hifi.dimensions.controlLineHeight);
@ -208,4 +210,8 @@ Window {
}
}
}
Component.onCompleted: {
keyboardEnabled = HMD.active;
}
}