Add placeholder "FIXME"s for making Web entity keyboard HMD-only

This commit is contained in:
David Rowe 2016-10-13 09:35:39 +13:00
parent 49709b42d7
commit e269a84d0e
3 changed files with 13 additions and 2 deletions

View file

@ -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 - keyboard.height : parent.height
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
// creates a global EventBridge object.
WebEngineScript {
@ -107,7 +116,7 @@ Item {
HiFiControls.Keyboard {
id: keyboard
raised: parent.keyboardRaised
raised: parent.keyboardEnabled && parent.keyboardRaised
numeric: parent.punctuationMode
anchors {
left: parent.left

View file

@ -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>();

View file

@ -787,6 +787,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));
}