From 70ba344f1bc5107f737af5a4de0120ded42c91fc Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 7 Jun 2017 00:25:08 +0100 Subject: [PATCH] finished openvr ui --- .../qml/hifi/tablet/InputConfiguration.qml | 78 +++++++++++----- .../qml/hifi/tablet/OpenVrConfiguration.qml | 90 +++++++++++++++---- .../qml/styles-uit/HifiConstants.qml | 1 + .../src/plugins/InputConfiguration.cpp | 8 ++ .../plugins/src/plugins/InputConfiguration.h | 1 + libraries/plugins/src/plugins/InputPlugin.h | 2 + 6 files changed, 138 insertions(+), 42 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/InputConfiguration.qml b/interface/resources/qml/hifi/tablet/InputConfiguration.qml index 56f0e0fe14..9393906b06 100644 --- a/interface/resources/qml/hifi/tablet/InputConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/InputConfiguration.qml @@ -29,7 +29,7 @@ Rectangle { x: -hifi.dimensions.contentMargin.x } - RalewayBold { + RalewayRegular { id: header text: "Controller Settings" size: 22 @@ -49,25 +49,38 @@ Rectangle { anchors.topMargin: 10 } - RalewayBold { - id: configuration - text: "SELECT DEVICE" - size: 18 - color: hifi.colors.lightGray - + HiFiGlyphs { + id: sourceGlyph + text: hifi.glyphs.source + size: 36 + color: hifi.colors.blueHighlight anchors.top: headerSeparator.bottom anchors.left: inputConfiguration.left - anchors.leftMargin: 20 + anchors.leftMargin: 40 anchors.topMargin: 20 } + RalewayRegular { + id: configuration + text: "SELECT DEVICE" + size: 15 + color: hifi.colors.lightGrayText + + + anchors.top: headerSeparator.bottom + anchors.left: sourceGlyph.right + anchors.leftMargin: 10 + anchors.topMargin: 30 + anchors.verticalCenter: sourceGlyph.horizontalCenter + } + Row { id: configRow z: 999 - anchors.top: configuration.bottom + anchors.top: sourceGlyph.bottom anchors.topMargin: 20 - anchors.left: configuration.left + anchors.left: sourceGlyph.left anchors.leftMargin: 40 spacing: 10 HifiControls.ComboBox { @@ -98,38 +111,57 @@ Rectangle { Separator { - id: configurationSeperator + id: configurationSeparator z: 0 width: inputConfiguration.width anchors.top: configRow.bottom anchors.topMargin: 10 } - Row { - z: 0 - id: configurationHeader - anchors.top: configurationSeperator.bottom - anchors.topMargin: 20 + + HiFiGlyphs { + id: sliderGlyph + text: hifi.glyphs.sliders + size: 36 + color: hifi.colors.blueHighlight + + anchors.top: configurationSeparator.bottom anchors.left: inputConfiguration.left anchors.leftMargin: 40 - spacing: 10 - RalewayBold { - text: "CONFIGURATION" - size: 18 - color: hifi.colors.lightGray - } + anchors.topMargin: 20 + } + + RalewayRegular { + id: configurationHeader + text: "CONFIGURATION" + size: 15 + color: hifi.colors.lightGrayText + + + anchors.top: configurationSeparator.bottom + anchors.left: sliderGlyph.right + anchors.leftMargin: 10 + anchors.topMargin: 30 + anchors.verticalCenter: sliderGlyph.horizontalCenter } Loader { id: loader asynchronous: false - width: configurationHeader.width + width: inputConfiguration.width anchors.left: inputConfiguration.left anchors.right: inputConfiguration.right anchors.top: configurationHeader.bottom anchors.topMargin: 10 anchors.bottom: inputConfiguration.bottom + + + onLoaded: { + if (loader.item.hasOwnProeprty("pluginName")) { + loader.item.pluginName = box.currentText + } + } } function inputPlugins() { diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index c20f01ad6e..434ee12f28 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -7,6 +7,7 @@ // import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtGraphicalEffects 1.0 import "../../styles-uit" import "../../controls" @@ -20,7 +21,8 @@ Rectangle { height: parent.height anchors.fill: parent - property int leftMargin: 55 + property int leftMargin: 75 + property string pluginName: "" HifiConstants { id: hifi } @@ -30,7 +32,7 @@ Rectangle { id: head text: "Head:" - size: 15 + size: 12 color: "white" @@ -54,7 +56,7 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Vive HMD" color: hifi.colors.lightGrayText } @@ -67,7 +69,7 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Tracker" color: hifi.colors.lightGrayText } @@ -77,7 +79,7 @@ Rectangle { id: hands text: "Hands:" - size: 15 + size: 12 color: "white" @@ -103,20 +105,20 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Controllers" color: hifi.colors.lightGrayText } HifiControls.CheckBox { id: handPuckBox - width: 15 + width: 12 height: 15 boxRadius: 7 } RalewayBold { - size: 15 + size: 12 text: "Trackers" color: hifi.colors.lightGrayText } @@ -126,7 +128,7 @@ Rectangle { id: additional text: "Additional Trackers" - size: 15 + size: 12 color: hifi.colors.white @@ -152,7 +154,7 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Feet" color: hifi.colors.lightGrayText } @@ -174,12 +176,12 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Hips" color: hifi.colors.lightGrayText } - RalewayBold { + RalewayRegular { size: 12 text: "requires feet" color: hifi.colors.lightGray @@ -203,12 +205,12 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Chest" color: hifi.colors.lightGrayText } - RalewayBold { + RalewayRegular { size: 12 text: "requires hips" color: hifi.colors.lightGray @@ -216,7 +218,7 @@ Rectangle { } - Row { + Row { id: shoulderConfig anchors.top: chestConfig.bottom anchors.topMargin: 15 @@ -232,22 +234,72 @@ Rectangle { } RalewayBold { - size: 15 + size: 12 text: "Shoulders" color: hifi.colors.lightGrayText } - RalewayBold { + RalewayRegular { size: 12 text: "requires hips" color: hifi.colors.lightGray } - } - + } + Separator { id: bottomSeperator width: parent.width anchors.top: shoulderConfig.bottom anchors.topMargin: 10 } + + + Rectangle { + id: calibrationButton + width: 200 + height: 35 + radius: 6 + + color: hifi.colors.blueHighlight + + anchors.top: bottomSeperator.bottom + anchors.topMargin: 10 + anchors.left: parent.left + anchors.leftMargin: leftMargin + + + HiFiGlyphs { + id: calibrationGlyph + text: hifi.glyphs.sliders + size: 36 + color: hifi.colors.white + + anchors.horizontalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 30 + + } + + RalewayRegular { + id: calibrate + text: "CALIBRATE" + size: 17 + color: hifi.colors.white + + anchors.left: calibrationGlyph.right + anchors.top: parent.top + anchors.topMargin: 8 + } + + MouseArea { + anchors.fill: parent + + onClicked: { + InputCalibration.calibratePlugin(pluginName); + } + } + } + + + } diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index 7b6efbd573..12bbb09fba 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -333,5 +333,6 @@ Item { readonly property string vol_x_2: "\ue015" readonly property string vol_x_3: "\ue016" readonly property string vol_x_4: "\ue017" + readonly property string source: "\ue01c" } } diff --git a/libraries/plugins/src/plugins/InputConfiguration.cpp b/libraries/plugins/src/plugins/InputConfiguration.cpp index 14472a5ec7..051bb3281c 100644 --- a/libraries/plugins/src/plugins/InputConfiguration.cpp +++ b/libraries/plugins/src/plugins/InputConfiguration.cpp @@ -48,3 +48,11 @@ QString InputConfiguration::configurationLayout(QString pluginName) { void InputConfiguration::configurationSettings(QJsonObject configurationSettings, QString pluginName) { qDebug() << configurationSettings["Test"]; } + +void InputConfiguration::calibratePlugin(QString pluginName) { + for (auto plugin : PluginManager::getInstance()->getInputPlugins()) { + if (plugin->getName() == pluginName) { + //calibrtate plugin + } + } +} diff --git a/libraries/plugins/src/plugins/InputConfiguration.h b/libraries/plugins/src/plugins/InputConfiguration.h index 2a0093d5b2..a560c02e5a 100644 --- a/libraries/plugins/src/plugins/InputConfiguration.h +++ b/libraries/plugins/src/plugins/InputConfiguration.h @@ -26,6 +26,7 @@ public: Q_INVOKABLE QStringList activeInputPlugins(); Q_INVOKABLE QString configurationLayout(QString pluginName); Q_INVOKABLE void configurationSettings(QJsonObject configurationSettings, QString pluginName); + Q_INVOKABLE void calibratePlugin(QString pluginName); }; #endif diff --git a/libraries/plugins/src/plugins/InputPlugin.h b/libraries/plugins/src/plugins/InputPlugin.h index 94c7595eb9..1850dcbc18 100644 --- a/libraries/plugins/src/plugins/InputPlugin.h +++ b/libraries/plugins/src/plugins/InputPlugin.h @@ -28,4 +28,6 @@ public: virtual bool isHandController() const = 0; virtual void configurationSettings(const QJsonObject configurationSettings) { } virtual QString configurationLayout() { return QString(); } + virtual void calibrate() {} + virtual bool configurable() { return false; } };