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 width: addressBarDialog.implicitWidth
height: addressBarDialog.implicitHeight height: addressBarDialog.implicitHeight
onShownChanged: addressBarDialog.observeShownChanged(shown); onShownChanged: {
addressBarDialog.keyboardEnabled = HMD.active;
addressBarDialog.observeShownChanged(shown);
}
Component.onCompleted: { Component.onCompleted: {
root.parentChanged.connect(center); root.parentChanged.connect(center);
center(); center();
@ -70,11 +73,12 @@ Window {
AddressBarDialog { AddressBarDialog {
id: addressBarDialog id: addressBarDialog
property bool keyboardEnabled: false
property bool keyboardRaised: false property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
implicitWidth: backgroundImage.width 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 // 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; onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0;
@ -277,7 +281,7 @@ Window {
HifiControls.Keyboard { HifiControls.Keyboard {
id: keyboard id: keyboard
raised: parent.keyboardRaised raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode numeric: parent.punctuationMode
anchors { anchors {
left: parent.left left: parent.left
@ -285,7 +289,6 @@ Window {
bottom: parent.bottom bottom: parent.bottom
} }
} }
} }
function getRequest(url, cb) { // cb(error, responseOfCorrectContentType) of url. General for 'get' text/html/json, but without redirects. 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 { Settings {
category: "ToolWindow.Position" category: "ToolWindow.Position"
property alias x: toolWindow.x property alias x: toolWindow.x

View file

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

View file

@ -27,7 +27,7 @@ ModalWindow {
id: root id: root
resizable: true resizable: true
implicitWidth: 480 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) minSize: Qt.vector2d(360, 240)
draggable: true draggable: true
@ -70,7 +70,9 @@ ModalWindow {
signal canceled(); signal canceled();
Component.onCompleted: { 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 // HACK: The following lines force the model to initialize properly such that the go-up button
// works properly from the initial screen. // works properly from the initial screen.
@ -106,6 +108,7 @@ ModalWindow {
height: pane.height height: pane.height
anchors.margins: 0 anchors.margins: 0
property bool keyboardEnabled: false
property bool keyboardRaised: false property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
@ -649,7 +652,7 @@ ModalWindow {
Keyboard { Keyboard {
id: keyboard id: keyboard
raised: parent.keyboardRaised raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode numeric: parent.punctuationMode
anchors { anchors {
left: parent.left left: parent.left

View file

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

View file

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

View file

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

View file

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

View file

@ -34,7 +34,8 @@ Window {
property var footer: Item { } // Optional static footer at the bottom of the dialog. 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 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 keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
@ -132,7 +133,8 @@ Window {
// Optional non-scrolling footer. // Optional non-scrolling footer.
id: footerPane 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 keyboardRaised: window.keyboardRaised
property alias punctuationMode: window.punctuationMode property alias punctuationMode: window.punctuationMode
@ -141,9 +143,9 @@ Window {
bottom: parent.bottom bottom: parent.bottom
} }
width: parent.contentWidth width: parent.contentWidth
height: footerContentHeight + (keyboardEnabled && keyboardRaised ? keyboard.height : 0) height: footerContentHeight + (keyboard.enabled && keyboard.raised ? keyboard.height : 0)
color: hifi.colors.baseGray color: hifi.colors.baseGray
visible: footer.height > 0 || keyboardEnabled && keyboardRaised visible: footer.height > 0 || keyboard.enabled && keyboard.raised
Item { Item {
// Horizontal rule. // Horizontal rule.
@ -182,8 +184,8 @@ Window {
HiFiControls.Keyboard { HiFiControls.Keyboard {
id: keyboard id: keyboard
enabled: keyboardEnabled enabled: !keyboardOverride
raised: keyboardRaised raised: keyboardEnabled && keyboardRaised
numeric: punctuationMode numeric: punctuationMode
anchors { anchors {
left: parent.left left: parent.left
@ -195,7 +197,7 @@ Window {
} }
onKeyboardRaisedChanged: { onKeyboardRaisedChanged: {
if (keyboardEnabled && keyboardRaised) { if (keyboard.enabled && keyboard.raised) {
var delta = activator.mouseY var delta = activator.mouseY
- (activator.height + activator.y - keyboard.raisedHeight - footerContentHeight - hifi.dimensions.controlLineHeight); - (activator.height + activator.y - keyboard.raisedHeight - footerContentHeight - hifi.dimensions.controlLineHeight);
@ -208,4 +210,8 @@ Window {
} }
} }
} }
Component.onCompleted: {
keyboardEnabled = HMD.active;
}
} }