mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Merge pull request #8799 from ctrlaltdavid/21070
HMD keyboard polishing
This commit is contained in:
commit
aec76cd542
22 changed files with 380 additions and 781 deletions
|
@ -11,6 +11,7 @@
|
|||
var POLL_FREQUENCY = 500; // ms
|
||||
var MAX_WARNINGS = 3;
|
||||
var numWarnings = 0;
|
||||
var isWindowFocused = true;
|
||||
var isKeyboardRaised = false;
|
||||
var isNumericKeyboard = false;
|
||||
var KEYBOARD_HEIGHT = 200;
|
||||
|
@ -38,15 +39,15 @@
|
|||
var keyboardRaised = shouldRaiseKeyboard();
|
||||
var numericKeyboard = shouldSetNumeric();
|
||||
|
||||
if (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard) {
|
||||
if (isWindowFocused && (keyboardRaised !== isKeyboardRaised || numericKeyboard !== isNumericKeyboard)) {
|
||||
|
||||
if (typeof EventBridge !== "undefined") {
|
||||
if (typeof EventBridge !== "undefined" && EventBridge !== null) {
|
||||
EventBridge.emitWebEvent(
|
||||
keyboardRaised ? ("_RAISE_KEYBOARD" + (numericKeyboard ? "_NUMERIC" : "")) : "_LOWER_KEYBOARD"
|
||||
);
|
||||
} else {
|
||||
if (numWarnings < MAX_WARNINGS) {
|
||||
console.log("WARNING: no global EventBridge object found");
|
||||
console.log("WARNING: No global EventBridge object found");
|
||||
numWarnings++;
|
||||
}
|
||||
}
|
||||
|
@ -65,4 +66,14 @@
|
|||
isNumericKeyboard = numericKeyboard;
|
||||
}
|
||||
}, POLL_FREQUENCY);
|
||||
|
||||
window.addEventListener("focus", function () {
|
||||
isWindowFocused = true;
|
||||
});
|
||||
|
||||
window.addEventListener("blur", function () {
|
||||
isWindowFocused = false;
|
||||
isKeyboardRaised = false;
|
||||
isNumericKeyboard = false;
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -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();
|
||||
|
@ -62,7 +65,6 @@ Window {
|
|||
clearAddressLineTimer.start();
|
||||
}
|
||||
property var allStories: [];
|
||||
property int keyboardHeight: 200;
|
||||
property int cardWidth: 200;
|
||||
property int cardHeight: 152;
|
||||
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
||||
|
@ -71,10 +73,13 @@ Window {
|
|||
AddressBarDialog {
|
||||
id: addressBarDialog
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
implicitWidth: backgroundImage.width
|
||||
implicitHeight: backgroundImage.height + keyboardHeight + cardHeight - 25; // fudge to make header reasonable
|
||||
implicitHeight: backgroundImage.height + (keyboardEnabled ? keyboard.raisedHeight + 2 * hifi.layout.spacing : 0)
|
||||
+ cardHeight - 36 // Fudge to reduce bottom margin.
|
||||
|
||||
// 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;
|
||||
|
@ -93,7 +98,7 @@ Window {
|
|||
spacing: hifi.layout.spacing;
|
||||
clip: true;
|
||||
anchors {
|
||||
bottom: backgroundImage.top;
|
||||
top: parent.top
|
||||
horizontalCenter: backgroundImage.horizontalCenter
|
||||
}
|
||||
model: suggestions;
|
||||
|
@ -134,9 +139,9 @@ Window {
|
|||
width: 576 * root.scale
|
||||
height: 80 * root.scale
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter;
|
||||
verticalCenterOffset: -15; // fudge to keep header reasonable and keep us under Card
|
||||
top: scroll.bottom
|
||||
}
|
||||
|
||||
property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area
|
||||
property int inputAreaStep: (height - inputAreaHeight) / 2
|
||||
|
||||
|
@ -279,33 +284,15 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
// virtual keyboard, letters
|
||||
HifiControls.Keyboard {
|
||||
id: keyboard1
|
||||
y: parent.height
|
||||
height: keyboardHeight
|
||||
visible: !parent.punctuationMode
|
||||
enabled: !parent.punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.top: backgroundImage.bottom
|
||||
anchors.bottomMargin: 0
|
||||
}
|
||||
|
||||
HifiControls.KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
y: parent.height
|
||||
height: keyboardHeight
|
||||
visible: parent.punctuationMode
|
||||
enabled: parent.punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.top: backgroundImage.bottom
|
||||
anchors.bottomMargin: 0
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled // Ignore keyboardRaised; keep keyboard raised if enabled (i.e., in HMD).
|
||||
numeric: parent.punctuationMode
|
||||
anchors {
|
||||
top: backgroundImage.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,6 @@ ScrollingWindow {
|
|||
addressBar.text = webview.url
|
||||
}
|
||||
|
||||
onParentChanged: {
|
||||
if (visible) {
|
||||
addressBar.forceActiveFocus();
|
||||
addressBar.selectAll()
|
||||
}
|
||||
}
|
||||
|
||||
function showPermissionsBar(){
|
||||
permissionsContainer.visible=true;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ ModalWindow {
|
|||
property string title: ""
|
||||
property int titleWidth: 0
|
||||
|
||||
keyboardOverride: true // Disable ModalWindow's keyboard.
|
||||
|
||||
LoginDialog {
|
||||
id: loginDialog
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ Item {
|
|||
loginDialog.login(usernameField.text, passwordField.text)
|
||||
}
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
|
@ -46,7 +47,7 @@ Item {
|
|||
|
||||
root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
||||
root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||
+ (linkAccountBody.keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,28 +138,13 @@ Item {
|
|||
|
||||
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
||||
Keyboard {
|
||||
y: parent.keyboardRaised ? parent.height : 0
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && !parent.punctuationMode
|
||||
raised: keyboardEnabled && keyboardRaised
|
||||
numeric: punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: buttons.top
|
||||
bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardPunctuation {
|
||||
y: parent.keyboardRaised ? parent.height : 0
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: buttons.top
|
||||
bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,9 +181,10 @@ Item {
|
|||
Component.onCompleted: {
|
||||
root.title = qsTr("Sign Into High Fidelity")
|
||||
root.iconText = "<"
|
||||
keyboardEnabled = HMD.active;
|
||||
d.resize();
|
||||
|
||||
usernameField.forceActiveFocus()
|
||||
usernameField.forceActiveFocus();
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
|
|
@ -42,6 +42,10 @@ ScrollingWindow {
|
|||
}
|
||||
}
|
||||
|
||||
onShownChanged: {
|
||||
keyboardEnabled = HMD.active;
|
||||
}
|
||||
|
||||
Settings {
|
||||
category: "ToolWindow.Position"
|
||||
property alias x: toolWindow.x
|
||||
|
|
|
@ -25,8 +25,6 @@ WebEngineView {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
|
||||
Timer {
|
||||
id: urlReplacementTimer
|
||||
|
|
|
@ -1,10 +1,28 @@
|
|||
//
|
||||
// FileDialog.qml
|
||||
//
|
||||
// Created by Anthony Thibault on 31 Oct 2016
|
||||
// Copyright 2016 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 QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: keyboardBase
|
||||
height: 200
|
||||
property alias shiftKey: key27
|
||||
|
||||
property bool raised: false
|
||||
property bool numeric: false
|
||||
|
||||
readonly property int raisedHeight: 200
|
||||
|
||||
height: enabled && raised ? raisedHeight : 0
|
||||
visible: enabled && raised
|
||||
|
||||
property bool shiftMode: false
|
||||
property bool numericShiftMode: false
|
||||
|
||||
function resetShiftMode(mode) {
|
||||
shiftMode = mode;
|
||||
|
@ -37,8 +55,8 @@ Item {
|
|||
|
||||
function forEachKey(func) {
|
||||
var i, j;
|
||||
for (i = 0; i < column1.children.length; i++) {
|
||||
var row = column1.children[i];
|
||||
for (i = 0; i < columnAlpha.children.length; i++) {
|
||||
var row = columnAlpha.children[i];
|
||||
for (j = 0; j < row.children.length; j++) {
|
||||
var key = row.children[j];
|
||||
func(key);
|
||||
|
@ -48,10 +66,12 @@ Item {
|
|||
|
||||
onShiftModeChanged: {
|
||||
forEachKey(function (key) {
|
||||
if (shiftMode) {
|
||||
key.glyph = keyboardBase.toUpper(key.glyph);
|
||||
} else {
|
||||
key.glyph = keyboardBase.toLower(key.glyph);
|
||||
if (/[a-z]/i.test(key.glyph)) {
|
||||
if (shiftMode) {
|
||||
key.glyph = keyboardBase.toUpper(key.glyph);
|
||||
} else {
|
||||
key.glyph = keyboardBase.toLower(key.glyph);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -97,265 +117,177 @@ Item {
|
|||
anchors.bottomMargin: 0
|
||||
|
||||
Column {
|
||||
id: column1
|
||||
id: columnAlpha
|
||||
width: 480
|
||||
height: 200
|
||||
visible: !numeric
|
||||
|
||||
Row {
|
||||
id: row1
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key1
|
||||
width: 44
|
||||
glyph: "q"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key2
|
||||
width: 44
|
||||
glyph: "w"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key3
|
||||
width: 44
|
||||
glyph: "e"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key4
|
||||
width: 43
|
||||
glyph: "r"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key5
|
||||
width: 43
|
||||
glyph: "t"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key6
|
||||
width: 44
|
||||
glyph: "y"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key7
|
||||
width: 44
|
||||
glyph: "u"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key8
|
||||
width: 43
|
||||
glyph: "i"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key9
|
||||
width: 42
|
||||
glyph: "o"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key10
|
||||
width: 44
|
||||
glyph: "p"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key28
|
||||
width: 45
|
||||
glyph: "←"
|
||||
}
|
||||
Key { width: 43; glyph: "q"; }
|
||||
Key { width: 43; glyph: "w"; }
|
||||
Key { width: 43; glyph: "e"; }
|
||||
Key { width: 43; glyph: "r"; }
|
||||
Key { width: 43; glyph: "t"; }
|
||||
Key { width: 43; glyph: "y"; }
|
||||
Key { width: 43; glyph: "u"; }
|
||||
Key { width: 43; glyph: "i"; }
|
||||
Key { width: 43; glyph: "o"; }
|
||||
Key { width: 43; glyph: "p"; }
|
||||
Key { width: 43; glyph: "←"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row2
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 18
|
||||
anchors.leftMargin: 20
|
||||
|
||||
Key {
|
||||
id: key11
|
||||
width: 43
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key12
|
||||
width: 43
|
||||
glyph: "s"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key13
|
||||
width: 43
|
||||
glyph: "d"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key14
|
||||
width: 43
|
||||
glyph: "f"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key15
|
||||
width: 43
|
||||
glyph: "g"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key16
|
||||
width: 43
|
||||
glyph: "h"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key17
|
||||
width: 43
|
||||
glyph: "j"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key18
|
||||
width: 43
|
||||
glyph: "k"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key19
|
||||
width: 43
|
||||
glyph: "l"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key32
|
||||
width: 75
|
||||
glyph: "⏎"
|
||||
}
|
||||
Key { width: 43; glyph: "a"; }
|
||||
Key { width: 43; glyph: "s"; }
|
||||
Key { width: 43; glyph: "d"; }
|
||||
Key { width: 43; glyph: "f"; }
|
||||
Key { width: 43; glyph: "g"; }
|
||||
Key { width: 43; glyph: "h"; }
|
||||
Key { width: 43; glyph: "j"; }
|
||||
Key { width: 43; glyph: "k"; }
|
||||
Key { width: 43; glyph: "l"; }
|
||||
Key { width: 70; glyph: "⏎"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row3
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key27
|
||||
width: 46
|
||||
id: shiftKey
|
||||
width: 43
|
||||
glyph: "⇪"
|
||||
toggle: true
|
||||
onToggledChanged: {
|
||||
shiftMode = toggled;
|
||||
}
|
||||
onToggledChanged: shiftMode = toggled
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key20
|
||||
width: 43
|
||||
glyph: "z"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key21
|
||||
width: 43
|
||||
glyph: "x"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key22
|
||||
width: 43
|
||||
glyph: "c"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key23
|
||||
width: 43
|
||||
glyph: "v"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key24
|
||||
width: 43
|
||||
glyph: "b"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key25
|
||||
width: 43
|
||||
glyph: "n"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key26
|
||||
width: 44
|
||||
glyph: "m"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key31
|
||||
width: 43
|
||||
glyph: "_"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key33
|
||||
width: 43
|
||||
glyph: "?"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key36
|
||||
width: 46
|
||||
glyph: "/"
|
||||
}
|
||||
|
||||
Key { width: 43; glyph: "z"; }
|
||||
Key { width: 43; glyph: "x"; }
|
||||
Key { width: 43; glyph: "c"; }
|
||||
Key { width: 43; glyph: "v"; }
|
||||
Key { width: 43; glyph: "b"; }
|
||||
Key { width: 43; glyph: "n"; }
|
||||
Key { width: 43; glyph: "m"; }
|
||||
Key { width: 43; glyph: "_"; }
|
||||
Key { width: 43; glyph: "/"; }
|
||||
Key { width: 43; glyph: "?"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row4
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 19
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key30
|
||||
width: 89
|
||||
glyph: "&123"
|
||||
mouseArea.onClicked: {
|
||||
keyboardBase.parent.punctuationMode = true;
|
||||
}
|
||||
width: 70
|
||||
glyph: "123"
|
||||
mouseArea.onClicked: keyboardBase.parent.punctuationMode = true
|
||||
}
|
||||
Key { width: 231; glyph: " "; }
|
||||
Key { width: 43; glyph: ","; }
|
||||
Key { width: 43; glyph: "."; }
|
||||
Key { width: 43; glyph: "\u276C"; }
|
||||
Key { width: 43; glyph: "\u276D"; }
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: columnNumeric
|
||||
width: 480
|
||||
height: 200
|
||||
visible: numeric
|
||||
|
||||
Row {
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key { width: 43; glyph: "1"; }
|
||||
Key { width: 43; glyph: "2"; }
|
||||
Key { width: 43; glyph: "3"; }
|
||||
Key { width: 43; glyph: "4"; }
|
||||
Key { width: 43; glyph: "5"; }
|
||||
Key { width: 43; glyph: "6"; }
|
||||
Key { width: 43; glyph: "7"; }
|
||||
Key { width: 43; glyph: "8"; }
|
||||
Key { width: 43; glyph: "9"; }
|
||||
Key { width: 43; glyph: "0"; }
|
||||
Key { width: 43; glyph: "←"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key { width: 43; glyph: "!"; }
|
||||
Key { width: 43; glyph: "@"; }
|
||||
Key { width: 43; glyph: "#"; }
|
||||
Key { width: 43; glyph: "$"; }
|
||||
Key { width: 43; glyph: "%"; }
|
||||
Key { width: 43; glyph: "^"; }
|
||||
Key { width: 43; glyph: "&"; }
|
||||
Key { width: 43; glyph: "*"; }
|
||||
Key { width: 43; glyph: "("; }
|
||||
Key { width: 43; glyph: ")"; }
|
||||
Key { width: 43; glyph: "⏎"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key29
|
||||
width: 285
|
||||
glyph: " "
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key34
|
||||
id: numericShiftKey
|
||||
width: 43
|
||||
glyph: "⇦"
|
||||
glyph: "\u21E8"
|
||||
toggle: true
|
||||
onToggledChanged: numericShiftMode = toggled
|
||||
}
|
||||
Key { width: 43; glyph: numericShiftMode ? "`" : "+"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "~" : "-"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "\u00A3" : "="; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "\u20AC" : ";"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "\u00A5" : ":"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "<" : "'"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? ">" : "\""; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "[" : "{"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "]" : "}"; }
|
||||
Key { width: 43; glyph: numericShiftMode ? "\\" : "|"; }
|
||||
}
|
||||
|
||||
Row {
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key35
|
||||
x: 343
|
||||
width: 43
|
||||
glyph: "⇨"
|
||||
width: 70
|
||||
glyph: "abc"
|
||||
mouseArea.onClicked: keyboardBase.parent.punctuationMode = false
|
||||
}
|
||||
|
||||
Key { width: 231; glyph: " "; }
|
||||
Key { width: 43; glyph: ","; }
|
||||
Key { width: 43; glyph: "."; }
|
||||
Key { width: 43; glyph: "\u276C"; }
|
||||
Key { width: 43; glyph: "\u276D"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,5 +318,4 @@ Item {
|
|||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,324 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: keyboardBase
|
||||
height: 200
|
||||
Rectangle {
|
||||
id: leftRect
|
||||
y: 0
|
||||
height: 200
|
||||
color: "#252525"
|
||||
anchors.right: keyboardRect.left
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: keyboardRect
|
||||
x: 206
|
||||
y: 0
|
||||
width: 480
|
||||
height: 200
|
||||
color: "#252525"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
|
||||
Column {
|
||||
id: column1
|
||||
width: 480
|
||||
height: 200
|
||||
|
||||
Row {
|
||||
id: row1
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
|
||||
Key {
|
||||
id: key1
|
||||
width: 43
|
||||
glyph: "1"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key2
|
||||
width: 43
|
||||
glyph: "2"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key3
|
||||
width: 43
|
||||
glyph: "3"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key4
|
||||
width: 43
|
||||
glyph: "4"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key5
|
||||
width: 43
|
||||
glyph: "5"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key6
|
||||
width: 43
|
||||
glyph: "6"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key7
|
||||
width: 43
|
||||
glyph: "7"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key8
|
||||
width: 43
|
||||
glyph: "8"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key9
|
||||
width: 43
|
||||
glyph: "9"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key10
|
||||
width: 43
|
||||
glyph: "0"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key28
|
||||
width: 50
|
||||
glyph: "←"
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row2
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
|
||||
Key {
|
||||
id: key11
|
||||
width: 43
|
||||
glyph: "!"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key12
|
||||
width: 43
|
||||
glyph: "@"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key13
|
||||
width: 43
|
||||
glyph: "#"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key14
|
||||
width: 43
|
||||
glyph: "$"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key15
|
||||
width: 43
|
||||
glyph: "%"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key16
|
||||
width: 43
|
||||
glyph: "^"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key17
|
||||
width: 43
|
||||
glyph: "&"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key18
|
||||
width: 43
|
||||
glyph: "*"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key19
|
||||
width: 43
|
||||
glyph: "("
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key32
|
||||
width: 43
|
||||
glyph: ")"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key37
|
||||
width: 50
|
||||
glyph: "⏎"
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row3
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
|
||||
Key {
|
||||
id: key27
|
||||
width: 43
|
||||
glyph: "="
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key20
|
||||
width: 43
|
||||
glyph: "+"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key21
|
||||
width: 43
|
||||
glyph: "-"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key22
|
||||
width: 43
|
||||
glyph: ","
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key23
|
||||
width: 43
|
||||
glyph: "."
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key24
|
||||
width: 43
|
||||
glyph: ";"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key25
|
||||
width: 43
|
||||
glyph: ":"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key26
|
||||
width: 43
|
||||
glyph: "'"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key31
|
||||
width: 43
|
||||
glyph: "\""
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key33
|
||||
width: 43
|
||||
glyph: "<"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key36
|
||||
width: 43
|
||||
glyph: ">"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
id: row4
|
||||
width: 480
|
||||
height: 50
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 19
|
||||
|
||||
Key {
|
||||
id: key30
|
||||
width: 65
|
||||
glyph: "abc"
|
||||
mouseArea.onClicked: {
|
||||
keyboardBase.parent.punctuationMode = false
|
||||
}
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key29
|
||||
width: 285
|
||||
glyph: " "
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key34
|
||||
width: 43
|
||||
glyph: "⇦"
|
||||
}
|
||||
|
||||
Key {
|
||||
id: key35
|
||||
x: 343
|
||||
width: 43
|
||||
glyph: "⇨"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rightRect
|
||||
y: 280
|
||||
height: 200
|
||||
color: "#252525"
|
||||
border.width: 0
|
||||
anchors.left: keyboardRect.right
|
||||
anchors.leftMargin: 0
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rectangle1
|
||||
color: "#ffffff"
|
||||
anchors.bottom: keyboardRect.top
|
||||
anchors.bottomMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
}
|
||||
|
||||
}
|
|
@ -199,6 +199,11 @@ TreeView {
|
|||
unfocusHelper.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
onReadOnlyChanged: {
|
||||
// Have to explicily set keyboardRaised because automatic setting fails because readOnly is true at the time.
|
||||
keyboardRaised = activeFocus;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,9 @@ import "."
|
|||
|
||||
BaseWebView {
|
||||
onNewViewRequested: {
|
||||
var component = Qt.createComponent("../Browser.qml");
|
||||
var newWindow = component.createObject(desktop);
|
||||
request.openIn(newWindow.webView)
|
||||
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
|
||||
var browser = OffscreenUi.load("Browser.qml");
|
||||
request.openIn(browser.webView);
|
||||
browser.webView.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,18 @@ import "../controls-uit" as HiFiControls
|
|||
Item {
|
||||
property alias url: root.url
|
||||
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||
property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
// FIXME - Keyboard HMD only: Make Interface either set keyboardRaised property directly in OffscreenQmlSurface
|
||||
// or provide HMDinfo object to QML in RenderableWebEntityItem and do the following.
|
||||
/*
|
||||
onKeyboardRaisedChanged: {
|
||||
keyboardEnabled = HMDinfo.active;
|
||||
}
|
||||
*/
|
||||
|
||||
QtObject {
|
||||
id: eventBridgeWrapper
|
||||
WebChannel.id: "eventBridgeWrapper"
|
||||
|
@ -20,7 +29,7 @@ Item {
|
|||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardRaised ? parent.height - keyboard1.height : parent.height
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||
|
||||
// creates a global EventBridge object.
|
||||
WebEngineScript {
|
||||
|
@ -82,7 +91,7 @@ Item {
|
|||
onLoadingChanged: {
|
||||
keyboardRaised = false;
|
||||
punctuationMode = false;
|
||||
keyboard1.resetShiftMode(false);
|
||||
keyboard.resetShiftMode(false);
|
||||
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
|
@ -105,32 +114,15 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
// virtual keyboard, letters
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard1
|
||||
y: keyboardRaised ? parent.height : 0
|
||||
height: keyboardRaised ? 200 : 0
|
||||
visible: keyboardRaised && !punctuationMode
|
||||
enabled: keyboardRaised && !punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
numeric: parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
y: keyboardRaised ? parent.height : 0
|
||||
height: keyboardRaised ? 200 : 0
|
||||
visible: keyboardRaised && punctuationMode
|
||||
enabled: keyboardRaised && punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ? (200 + 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) ?
|
||||
|
@ -153,38 +154,15 @@ ModalWindow {
|
|||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Keyboard {
|
||||
id: keyboard
|
||||
|
||||
height: keyboardRaised ? 200 : 0
|
||||
|
||||
raised: keyboardEnabled && keyboardRaised
|
||||
numeric: punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottomMargin: keyboardRaised ? hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
|
||||
Keyboard {
|
||||
id: keyboard1
|
||||
visible: keyboardRaised && !punctuationMode
|
||||
enabled: keyboardRaised && !punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
visible: keyboardRaised && punctuationMode
|
||||
enabled: keyboardRaised && punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
bottomMargin: raised ? hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +317,7 @@ ModalWindow {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
keyboardEnabled = HMD.active;
|
||||
updateIcon();
|
||||
updateCheckbox();
|
||||
d.resize();
|
||||
|
|
|
@ -27,7 +27,7 @@ ModalWindow {
|
|||
id: root
|
||||
resizable: true
|
||||
implicitWidth: 480
|
||||
implicitHeight: 360 + (fileDialogItem.keyboardRaised ? 200 + 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
|
||||
|
||||
|
@ -626,7 +629,7 @@ ModalWindow {
|
|||
left: parent.left
|
||||
right: selectionType.visible ? selectionType.left: parent.right
|
||||
rightMargin: selectionType.visible ? hifi.dimensions.contentSpacing.x : 0
|
||||
bottom: keyboard1.top
|
||||
bottom: keyboard.top
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||
}
|
||||
readOnly: !root.saveDialog
|
||||
|
@ -648,25 +651,15 @@ ModalWindow {
|
|||
}
|
||||
|
||||
Keyboard {
|
||||
id: keyboard1
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: visible
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: buttonRow.top
|
||||
anchors.bottomMargin: visible ? hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
|
||||
KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: visible
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: buttonRow.top
|
||||
anchors.bottomMargin: visible ? hifi.dimensions.contentSpacing.y : 0
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
numeric: parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: buttonRow.top
|
||||
bottomMargin: visible ? hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
|
|
|
@ -22,6 +22,7 @@ ModalWindow {
|
|||
implicitWidth: 640
|
||||
implicitHeight: 320
|
||||
visible: true
|
||||
keyboardOverride: true // Disable ModalWindow's keyboard.
|
||||
|
||||
signal selected(var result);
|
||||
signal canceled();
|
||||
|
@ -45,6 +46,12 @@ ModalWindow {
|
|||
property int titleWidth: 0
|
||||
onTitleWidthChanged: d.resize();
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
onKeyboardRaisedChanged: d.resize();
|
||||
|
||||
function updateIcon() {
|
||||
if (!root) {
|
||||
return;
|
||||
|
@ -59,11 +66,6 @@ ModalWindow {
|
|||
height: pane.height
|
||||
anchors.margins: 0
|
||||
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
onKeyboardRaisedChanged: d.resize();
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
readonly property int minWidth: 480
|
||||
|
@ -74,15 +76,15 @@ ModalWindow {
|
|||
function resize() {
|
||||
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)) + (modalWindowItem.keyboardRaised ? (200 + 2 * 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) ? d.maxHeight : targetHeight)) + ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: keyboard1.top;
|
||||
bottom: keyboard.top;
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
margins: 0
|
||||
|
@ -116,33 +118,16 @@ ModalWindow {
|
|||
}
|
||||
}
|
||||
|
||||
// virtual keyboard, letters
|
||||
Keyboard {
|
||||
id: keyboard1
|
||||
y: parent.keyboardRaised ? parent.height : 0
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && !parent.punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: buttons.top
|
||||
anchors.bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
|
||||
KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
y: parent.keyboardRaised ? parent.height : 0
|
||||
height: parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: parent.keyboardRaised && parent.punctuationMode
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: buttons.top
|
||||
anchors.bottomMargin: parent.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
id: keyboard
|
||||
raised: keyboardEnabled && keyboardRaised
|
||||
numeric: punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: buttons.top
|
||||
bottomMargin: raised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
|
@ -203,6 +188,7 @@ ModalWindow {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
keyboardEnabled = HMD.active;
|
||||
updateIcon();
|
||||
d.resize();
|
||||
textResult.forceActiveFocus();
|
||||
|
|
|
@ -10,23 +10,84 @@
|
|||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import QtWebEngine 1.1
|
||||
import QtWebChannel 1.0
|
||||
import QtWebEngine 1.2
|
||||
|
||||
import "../../windows" as Windows
|
||||
import "../../controls-uit" as Controls
|
||||
import "../../windows"
|
||||
import "../../controls-uit"
|
||||
import "../../styles-uit"
|
||||
|
||||
Windows.Window {
|
||||
Window {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
width: 900; height: 700
|
||||
resizable: true
|
||||
modality: Qt.ApplicationModal
|
||||
|
||||
Controls.WebView {
|
||||
id: webview
|
||||
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
|
||||
focus: true
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: true
|
||||
property bool punctuationMode: false
|
||||
|
||||
BaseWebView {
|
||||
id: webview
|
||||
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
|
||||
focus: true
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: keyboard.top
|
||||
}
|
||||
|
||||
property alias eventBridgeWrapper: eventBridgeWrapper
|
||||
|
||||
QtObject {
|
||||
id: eventBridgeWrapper
|
||||
WebChannel.id: "eventBridgeWrapper"
|
||||
property var eventBridge;
|
||||
}
|
||||
|
||||
webChannel.registeredObjects: [eventBridgeWrapper]
|
||||
|
||||
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
||||
WebEngineScript {
|
||||
id: createGlobalEventBridge
|
||||
sourceCode: eventBridgeJavaScriptToInject
|
||||
injectionPoint: WebEngineScript.DocumentCreation
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
// Detect when may want to raise and lower keyboard.
|
||||
WebEngineScript {
|
||||
id: raiseAndLowerKeyboard
|
||||
injectionPoint: WebEngineScript.Deferred
|
||||
sourceUrl: resourceDirectoryUrl + "html/raiseAndLowerKeyboard.js"
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
|
||||
|
||||
}
|
||||
|
||||
Keyboard {
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
numeric: parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
keyboardEnabled = HMD.active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,11 +74,6 @@ Preference {
|
|||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
|
||||
Component {
|
||||
id: avatarBrowserBuilder;
|
||||
AvatarBrowser { }
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button
|
||||
text: "Browse"
|
||||
|
@ -87,12 +82,12 @@ Preference {
|
|||
verticalCenter: dataTextField.verticalCenter
|
||||
}
|
||||
onClicked: {
|
||||
root.browser = avatarBrowserBuilder.createObject(desktop);
|
||||
// Load dialog via OffscreenUi so that JavaScript EventBridge is available.
|
||||
root.browser = OffscreenUi.load("dialogs/preferences/AvatarBrowser.qml");
|
||||
root.browser.windowDestroyed.connect(function(){
|
||||
root.browser = null;
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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,7 @@ Window {
|
|||
// Optional non-scrolling footer.
|
||||
id: footerPane
|
||||
|
||||
property alias keyboardEnabled: window.keyboardEnabled
|
||||
property alias keyboardOverride: window.keyboardOverride
|
||||
property alias keyboardRaised: window.keyboardRaised
|
||||
property alias punctuationMode: window.punctuationMode
|
||||
|
||||
|
@ -141,9 +142,9 @@ Window {
|
|||
bottom: parent.bottom
|
||||
}
|
||||
width: parent.contentWidth
|
||||
height: footerContentHeight + (keyboardEnabled && keyboardRaised ? 200 : 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.
|
||||
|
@ -181,22 +182,10 @@ Window {
|
|||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard1
|
||||
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||
enabled: parent.keyboardEnabled && parent.keyboardRaised && !parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.KeyboardPunctuation {
|
||||
id: keyboard2
|
||||
height: parent.keyboardEnabled && parent.keyboardRaised ? 200 : 0
|
||||
visible: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||
enabled: parent.keyboardEnabled && parent.keyboardRaised && parent.punctuationMode
|
||||
id: keyboard
|
||||
enabled: !keyboardOverride
|
||||
raised: keyboardEnabled && keyboardRaised
|
||||
numeric: punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
|
@ -207,9 +196,9 @@ Window {
|
|||
}
|
||||
|
||||
onKeyboardRaisedChanged: {
|
||||
if (keyboardEnabled && keyboardRaised) {
|
||||
if (!keyboardOverride && keyboardEnabled && keyboardRaised) {
|
||||
var delta = activator.mouseY
|
||||
- (activator.height + activator.y - 200 - footerContentHeight - hifi.dimensions.controlLineHeight);
|
||||
- (activator.height + activator.y - keyboard.raisedHeight - footerContentHeight - hifi.dimensions.controlLineHeight);
|
||||
|
||||
if (delta > 0) {
|
||||
pane.scrollBy(delta);
|
||||
|
@ -220,4 +209,10 @@ Window {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (typeof HMD !== "undefined") {
|
||||
keyboardEnabled = HMD.active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ bool RenderableWebEntityItem::buildWebSurface(EntityTreeRenderer* renderer) {
|
|||
_webSurface->resume();
|
||||
_webSurface->getRootItem()->setProperty("url", _sourceUrl);
|
||||
_webSurface->getRootContext()->setContextProperty("desktop", QVariant());
|
||||
// FIXME - Keyboard HMD only: Possibly add "HMDinfo" object to context for WebView.qml.
|
||||
|
||||
// forward web events to EntityScriptingInterface
|
||||
auto entities = DependencyManager::get<EntityScriptingInterface>();
|
||||
|
|
|
@ -309,6 +309,7 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
|
|||
}
|
||||
|
||||
// FIXME
|
||||
_glData = ::getGLContextData(); // Initialize JSON structure so that it can be filled in later and then used in QML.
|
||||
_qmlEngine->rootContext()->setContextProperty("GL", _glData);
|
||||
_qmlEngine->rootContext()->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
|
||||
_qmlComponent = new QQmlComponent(_qmlEngine);
|
||||
|
@ -726,13 +727,13 @@ void OffscreenQmlSurface::setFocusText(bool newFocusText) {
|
|||
}
|
||||
|
||||
// UTF-8 encoded symbols
|
||||
static const uint8_t UPWARDS_WHITE_ARROW_FROM_BAR[] = { 0xE2, 0x87, 0xAA, 0x00 }; // shift
|
||||
static const uint8_t LEFT_ARROW[] = { 0xE2, 0x86, 0x90, 0x00 }; // backspace
|
||||
static const uint8_t LEFTWARD_WHITE_ARROW[] = { 0xE2, 0x87, 0xA6, 0x00 }; // left arrow
|
||||
static const uint8_t RIGHTWARD_WHITE_ARROW[] = { 0xE2, 0x87, 0xA8, 0x00 }; // right arrow
|
||||
static const uint8_t ASTERISIM[] = { 0xE2, 0x81, 0x82, 0x00 }; // symbols
|
||||
static const uint8_t RETURN_SYMBOL[] = { 0xE2, 0x8F, 0x8E, 0x00 }; // return
|
||||
static const char PUNCTUATION_STRING[] = "&123";
|
||||
static const uint8_t SHIFT_ARROW[] = { 0xE2, 0x87, 0xAA, 0x00 };
|
||||
static const uint8_t NUMERIC_SHIFT_ARROW[] = { 0xE2, 0x87, 0xA8, 0x00 };
|
||||
static const uint8_t BACKSPACE_SYMBOL[] = { 0xE2, 0x86, 0x90, 0x00 };
|
||||
static const uint8_t LEFT_ARROW[] = { 0xE2, 0x9D, 0xAC, 0x00 };
|
||||
static const uint8_t RIGHT_ARROW[] = { 0xE2, 0x9D, 0xAD, 0x00 };
|
||||
static const uint8_t RETURN_SYMBOL[] = { 0xE2, 0x8F, 0x8E, 0x00 };
|
||||
static const char PUNCTUATION_STRING[] = "123";
|
||||
static const char ALPHABET_STRING[] = "abc";
|
||||
|
||||
static bool equals(const QByteArray& byteArray, const uint8_t* ptr) {
|
||||
|
@ -752,19 +753,19 @@ void OffscreenQmlSurface::synthesizeKeyPress(QString key) {
|
|||
|
||||
int scanCode = (int)utf8Key[0];
|
||||
QString keyString = key;
|
||||
if (equals(utf8Key, UPWARDS_WHITE_ARROW_FROM_BAR) || equals(utf8Key, ASTERISIM) ||
|
||||
if (equals(utf8Key, SHIFT_ARROW) || equals(utf8Key, NUMERIC_SHIFT_ARROW) ||
|
||||
equals(utf8Key, (uint8_t*)PUNCTUATION_STRING) || equals(utf8Key, (uint8_t*)ALPHABET_STRING)) {
|
||||
return; // ignore
|
||||
} else if (equals(utf8Key, LEFT_ARROW)) {
|
||||
} else if (equals(utf8Key, BACKSPACE_SYMBOL)) {
|
||||
scanCode = Qt::Key_Backspace;
|
||||
keyString = "\x08";
|
||||
} else if (equals(utf8Key, RETURN_SYMBOL)) {
|
||||
scanCode = Qt::Key_Return;
|
||||
keyString = "\x0d";
|
||||
} else if (equals(utf8Key, LEFTWARD_WHITE_ARROW)) {
|
||||
} else if (equals(utf8Key, LEFT_ARROW)) {
|
||||
scanCode = Qt::Key_Left;
|
||||
keyString = "";
|
||||
} else if (equals(utf8Key, RIGHTWARD_WHITE_ARROW)) {
|
||||
} else if (equals(utf8Key, RIGHT_ARROW)) {
|
||||
scanCode = Qt::Key_Right;
|
||||
keyString = "";
|
||||
}
|
||||
|
@ -787,6 +788,7 @@ void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool n
|
|||
numeric = numeric || QString(item->metaObject()->className()).left(7) == "SpinBox";
|
||||
|
||||
if (item->property("keyboardRaised").isValid()) {
|
||||
// FIXME - HMD only: Possibly set value of "keyboardEnabled" per isHMDMode() for use in WebView.qml.
|
||||
if (item->property("punctuationMode").isValid()) {
|
||||
item->setProperty("punctuationMode", QVariant(numeric));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue