diff --git a/interface/resources/icons/circle.svg b/interface/resources/icons/circle.svg new file mode 100644 index 0000000000..b544955858 --- /dev/null +++ b/interface/resources/icons/circle.svg @@ -0,0 +1,63 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/interface/resources/icons/edit-icon.svg b/interface/resources/icons/edit-icon.svg new file mode 100644 index 0000000000..a4322c5a3c --- /dev/null +++ b/interface/resources/icons/edit-icon.svg @@ -0,0 +1,68 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml new file mode 100644 index 0000000000..59bcb511e9 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -0,0 +1,76 @@ +import QtQuick 2.0 +import "../../styles-uit/" + +Item { + id: item1 + width: 480 + height: 720 + + Rectangle { + id: bg + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.top: parent.top + anchors.topMargin: 0 + gradient: Gradient { + GradientStop { + position: 0 + color: "#7c7c7c" + } + + GradientStop { + position: 1 + color: "#000000" + } + } + + Flow { + id: flow + spacing: 12 + anchors.right: parent.right + anchors.rightMargin: 17 + anchors.left: parent.left + anchors.leftMargin: 17 + anchors.bottom: parent.bottom + anchors.bottomMargin: 8 + anchors.top: parent.top + anchors.topMargin: 123 + } + + Image { + id: muteIcon + x: 205 + width: 70 + height: 70 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 28 + fillMode: Image.Stretch + source: "../../../icons/circle.svg" + + RalewaySemiBold { + id: muteText + x: 15 + y: 27 + color: "#ffffff" + text: qsTr("MUTE") + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 14 + } + } + + Component.onCompleted: { + console.log("AJT: Tablet.onCompleted!"); + // AJT: test flow by adding buttons + var component = Qt.createComponent("TabletButton.qml"); + for (var i = 0; i < 10; i++) { + component.createObject(flow); + } + } + } +} + diff --git a/interface/resources/qml/hifi/tablet/TabletButton.qml b/interface/resources/qml/hifi/tablet/TabletButton.qml new file mode 100644 index 0000000000..a1d17cf423 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/TabletButton.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 +import "../../styles-uit/" + +Rectangle { + id: tabletButton + width: 140 + height: 140 + color: "#1794c3" + + Image { + id: icon + x: 40 + y: 30 + width: 60 + height: 60 + source: "../../../icons/edit-icon.svg" + } + + RalewaySemiBold { + id: text + x: 50 + y: 96 + color: "#ffffff" + text: qsTr("EDIT") + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 18 + } +} diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index 5290f3df19..b17a2ecc38 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -116,6 +116,16 @@ bool RenderableWebEntityItem::buildWebSurface(QSharedPointer // member variables, since they would implicitly refer to a this that // is no longer valid _webSurface->create(currentContext); + +#define AJT_TABLET_HACK + +#ifdef AJT_TABLET_HACK + _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "qml/hifi/tablet/")); + _webSurface->load("Tablet.qml", [&](QQmlContext* context, QObject* obj) { + ; + }); + _webSurface->resume(); +#else _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/controls/")); _webSurface->load("WebView.qml", [&](QQmlContext* context, QObject* obj) { context->setContextProperty("eventBridgeJavaScriptToInject", QVariant(javaScriptToInject)); @@ -123,6 +133,7 @@ bool RenderableWebEntityItem::buildWebSurface(QSharedPointer _webSurface->resume(); _webSurface->getRootItem()->setProperty("url", _sourceUrl); _webSurface->getRootContext()->setContextProperty("desktop", QVariant()); +#endif // FIXME - Keyboard HMD only: Possibly add "HMDinfo" object to context for WebView.qml. // forward web events to EntityScriptingInterface diff --git a/libraries/gl/src/gl/OffscreenQmlSurface.cpp b/libraries/gl/src/gl/OffscreenQmlSurface.cpp index cde779d101..26d799fffe 100644 --- a/libraries/gl/src/gl/OffscreenQmlSurface.cpp +++ b/libraries/gl/src/gl/OffscreenQmlSurface.cpp @@ -743,8 +743,12 @@ void OffscreenQmlSurface::resume() { _paused = false; _render = true; - getRootItem()->setProperty("eventBridge", QVariant::fromValue(this)); - getRootContext()->setContextProperty("webEntity", this); + if (getRootItem()) { + getRootItem()->setProperty("eventBridge", QVariant::fromValue(this)); + } + if (getRootContext()) { + getRootContext()->setContextProperty("webEntity", this); + } } bool OffscreenQmlSurface::isPaused() const {