mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
making final changes
This commit is contained in:
parent
1b13cd6d45
commit
bbe675ab72
5 changed files with 124 additions and 69 deletions
|
@ -89,24 +89,24 @@ Rectangle {
|
|||
editable: true
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
model: inputPlugins()
|
||||
label: ""
|
||||
|
||||
label: ""
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
changeSource();
|
||||
changeSource();
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: checkBox
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
text: "show all input plugins"
|
||||
HifiControls.CheckBox {
|
||||
id: checkBox
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
text: "show all input plugins"
|
||||
|
||||
onClicked: {
|
||||
console.log("clicked");
|
||||
inputPlugins();
|
||||
changeSource();
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
console.log("clicked");
|
||||
inputPlugins();
|
||||
changeSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,13 +166,13 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function inputPlugins() {
|
||||
if (checkBox.checked) {
|
||||
if (checkBox.checked) {
|
||||
return InputConfiguration.inputPlugins();
|
||||
} else {
|
||||
return InputConfiguration.activeInputPlugins();
|
||||
}
|
||||
} else {
|
||||
return InputConfiguration.activeInputPlugins();
|
||||
}
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
@ -180,14 +180,14 @@ Rectangle {
|
|||
}
|
||||
|
||||
function changeSource() {
|
||||
loader.source = "";
|
||||
var source = InputConfiguration.configurationLayout(box.currentText);
|
||||
loader.source = source;
|
||||
if (source === "") {
|
||||
box.label = "(not configurable)";
|
||||
} else {
|
||||
box.label = "";
|
||||
}
|
||||
loader.source = "";
|
||||
var source = InputConfiguration.configurationLayout(box.currentText);
|
||||
loader.source = source;
|
||||
if (source === "") {
|
||||
box.label = "(not configurable)";
|
||||
} else {
|
||||
box.label = "";
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
|
|
@ -84,13 +84,13 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Vive HMD"
|
||||
color: hifi.colors.lightGrayText
|
||||
}
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: headPuckBox
|
||||
width: 15
|
||||
|
@ -116,10 +116,10 @@ Rectangle {
|
|||
|
||||
RalewayBold {
|
||||
id: hands
|
||||
|
||||
|
||||
text: "Hands:"
|
||||
size: 12
|
||||
|
||||
|
||||
color: "white"
|
||||
|
||||
anchors.top: headConfig.bottom
|
||||
|
@ -135,7 +135,7 @@ Rectangle {
|
|||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 20
|
||||
spacing: 10
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: handBox
|
||||
width: 15
|
||||
|
@ -151,13 +151,13 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Controllers"
|
||||
color: hifi.colors.lightGrayText
|
||||
}
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: handPuckBox
|
||||
width: 12
|
||||
|
@ -173,7 +173,7 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Trackers"
|
||||
|
@ -183,10 +183,10 @@ Rectangle {
|
|||
|
||||
RalewayBold {
|
||||
id: additional
|
||||
|
||||
|
||||
text: "Additional Trackers"
|
||||
size: 12
|
||||
|
||||
|
||||
color: hifi.colors.white
|
||||
|
||||
anchors.top: handConfig.bottom
|
||||
|
@ -202,7 +202,7 @@ Rectangle {
|
|||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 20
|
||||
spacing: 10
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: feetBox
|
||||
width: 15
|
||||
|
@ -216,7 +216,7 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Feet"
|
||||
|
@ -231,7 +231,7 @@ Rectangle {
|
|||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 20
|
||||
spacing: 10
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: hipBox
|
||||
width: 15
|
||||
|
@ -249,7 +249,7 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Hips"
|
||||
|
@ -271,7 +271,7 @@ Rectangle {
|
|||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 20
|
||||
spacing: 10
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: chestBox
|
||||
width: 15
|
||||
|
@ -286,7 +286,7 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Chest"
|
||||
|
@ -308,7 +308,7 @@ Rectangle {
|
|||
anchors.left: openVrConfiguration.left
|
||||
anchors.leftMargin: leftMargin + 20
|
||||
spacing: 10
|
||||
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: shoulderBox
|
||||
width: 15
|
||||
|
@ -323,7 +323,7 @@ Rectangle {
|
|||
composeConfigurationSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RalewayBold {
|
||||
size: 12
|
||||
text: "Shoulders"
|
||||
|
@ -336,7 +336,7 @@ Rectangle {
|
|||
color: hifi.colors.lightGray
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Separator {
|
||||
id: bottomSeperator
|
||||
width: parent.width
|
||||
|
@ -367,9 +367,9 @@ Rectangle {
|
|||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 30
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
RalewayRegular {
|
||||
id: calibrate
|
||||
text: "CALIBRATE"
|
||||
|
@ -413,6 +413,7 @@ Rectangle {
|
|||
info.showCountDown = false;
|
||||
info.calibrationFailed = false
|
||||
info.calibrationSucceed = false;
|
||||
info.calibrationSucceed = false;
|
||||
info.showCalibrationStatus = false;
|
||||
info.visible = false;
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ Rectangle {
|
|||
numberAnimation.duration = calibrationTimer.interval;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NumberAnimation {
|
||||
id: numberAnimation
|
||||
target: openVrConfiguration
|
||||
|
@ -455,6 +456,9 @@ Rectangle {
|
|||
} else if (!status["calibrated"]) {
|
||||
var uncalibrated = status["success"];
|
||||
if (uncalibrated) {
|
||||
info.visible = true;
|
||||
info.showCalibrationStatus = true;
|
||||
info.uncalibrationSucceed = true;
|
||||
} else {
|
||||
info.visible = true;
|
||||
info.showCalibrationStatus = true;
|
||||
|
@ -496,10 +500,10 @@ Rectangle {
|
|||
var configurationType = settings["trackerConfiguration"];
|
||||
displayTrackerConfiguration(configurationType);
|
||||
|
||||
|
||||
|
||||
var HmdHead = settings["HMDHead"];
|
||||
var viveController = settings["handController"];
|
||||
|
||||
|
||||
if (HmdHead) {
|
||||
headBox.checked = true;
|
||||
headPuckBox.checked = false;
|
||||
|
@ -524,7 +528,8 @@ Rectangle {
|
|||
property bool showCalibrationStatus: false
|
||||
property bool calibrationFailed: false
|
||||
property bool calibrationSucceed: false
|
||||
|
||||
property bool uncalibrationSucceed: false
|
||||
|
||||
visible: false
|
||||
color: hifi.colors.baseGray
|
||||
anchors.top: openVrConfiguration.top
|
||||
|
@ -538,12 +543,12 @@ Rectangle {
|
|||
anchors.centerIn: parent
|
||||
RalewayBold {
|
||||
id: countDownText
|
||||
|
||||
|
||||
text: openVrConfiguration.countDown
|
||||
size: 92
|
||||
|
||||
|
||||
color: hifi.colors.blueHighlight
|
||||
|
||||
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
@ -576,11 +581,24 @@ Rectangle {
|
|||
color: hifi.colors.redAccent
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: uncalibrateInfo
|
||||
visible: info.uncalibrationSucceed
|
||||
anchors.centerIn: parent
|
||||
RalewayBold {
|
||||
id: uncalibrateText
|
||||
text: "Uncalibration Successful"
|
||||
size: 42
|
||||
color: hifi.colors.greenHighlight
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function displayTrackerConfiguration(type) {
|
||||
if (type === "Feet") {
|
||||
feetBox.checked = true;
|
||||
|
@ -631,8 +649,8 @@ Rectangle {
|
|||
} else if (handPuck) {
|
||||
overrideHandController = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var settingsObject = {
|
||||
"trackerConfiguration": trackerConfiguration,
|
||||
"overrideHead": overrideHead,
|
||||
|
@ -640,6 +658,6 @@ Rectangle {
|
|||
}
|
||||
|
||||
InputConfiguration.setConfigurationSettings(settingsObject, pluginName);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
|
||||
#include "InputConfiguration.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include "DisplayPlugin.h"
|
||||
#include "InputPlugin.h"
|
||||
#include "PluginManager.h"
|
||||
|
@ -16,6 +19,13 @@ InputConfiguration::InputConfiguration() {
|
|||
}
|
||||
|
||||
QStringList InputConfiguration::inputPlugins() {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QStringList result;
|
||||
QMetaObject::invokeMethod(this, "inputPlugins", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QStringList, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList inputPlugins;
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
inputPlugins << QString(plugin->getName());
|
||||
|
@ -25,6 +35,13 @@ QStringList InputConfiguration::inputPlugins() {
|
|||
|
||||
|
||||
QStringList InputConfiguration::activeInputPlugins() {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QStringList result;
|
||||
QMetaObject::invokeMethod(this, "activeInputPlugins", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QStringList, result));
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList activePlugins;
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
if (plugin->configurable()) {
|
||||
|
@ -35,8 +52,15 @@ QStringList InputConfiguration::activeInputPlugins() {
|
|||
}
|
||||
|
||||
QString InputConfiguration::configurationLayout(QString pluginName) {
|
||||
QString sourcePath;
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QString result;
|
||||
QMetaObject::invokeMethod(this, "configurationLayout", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QString, result),
|
||||
Q_ARG(QString, pluginName));
|
||||
return result;
|
||||
}
|
||||
|
||||
QString sourcePath;
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
if (plugin->getName() == pluginName) {
|
||||
return plugin->configurationLayout();
|
||||
|
@ -46,6 +70,13 @@ QString InputConfiguration::configurationLayout(QString pluginName) {
|
|||
}
|
||||
|
||||
void InputConfiguration::setConfigurationSettings(QJsonObject configurationSettings, QString pluginName) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setConfigurationSettings", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(QJsonObject, configurationSettings),
|
||||
Q_ARG(QString, pluginName));
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
if (plugin->getName() == pluginName) {
|
||||
plugin->setConfigurationSettings(configurationSettings);
|
||||
|
@ -54,6 +85,14 @@ void InputConfiguration::setConfigurationSettings(QJsonObject configurationSetti
|
|||
}
|
||||
|
||||
QJsonObject InputConfiguration::configurationSettings(QString pluginName) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QJsonObject result;
|
||||
QMetaObject::invokeMethod(this, "configurationSettings", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QJsonObject, result),
|
||||
Q_ARG(QString, pluginName));
|
||||
return result;
|
||||
}
|
||||
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
if (plugin->getName() == pluginName) {
|
||||
return plugin->configurationSettings();
|
||||
|
@ -63,14 +102,14 @@ QJsonObject InputConfiguration::configurationSettings(QString pluginName) {
|
|||
}
|
||||
|
||||
void InputConfiguration::calibratePlugin(QString pluginName) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "calibratePlugin", Qt::BlockingQueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto plugin : PluginManager::getInstance()->getInputPlugins()) {
|
||||
if (plugin->getName() == pluginName) {
|
||||
qDebug() << "calibrating plauin " << pluginName;
|
||||
plugin->calibrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InputConfiguration::calibrated(const QJsonObject& status) {
|
||||
emit calibrationStatus(status);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
Q_INVOKABLE void setConfigurationSettings(QJsonObject configurationSettings, QString pluginName);
|
||||
Q_INVOKABLE void calibratePlugin(QString pluginName);
|
||||
Q_INVOKABLE QJsonObject configurationSettings(QString pluginName);
|
||||
void calibrated(const QJsonObject& status);
|
||||
|
||||
signals:
|
||||
void calibrationStatus(const QJsonObject& status);
|
||||
|
|
|
@ -314,7 +314,6 @@ void ViveControllerManager::InputDevice::calibrateFromUI(const controller::Input
|
|||
|
||||
void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJsonObject configurationSettings) {
|
||||
Locker locker(_lock);
|
||||
|
||||
if (!configurationSettings.empty()) {
|
||||
auto iter = configurationSettings.begin();
|
||||
auto end = configurationSettings.end();
|
||||
|
@ -372,7 +371,7 @@ void ViveControllerManager::InputDevice::emitCalibrationStatus(const bool succes
|
|||
status["puckCount"] = (int)_validTrackedObjects.size();
|
||||
}
|
||||
|
||||
inputConfiguration->calibrated(status);
|
||||
emit inputConfiguration->calibrationStatus(status); //inputConfiguration->calibrated(status);
|
||||
}
|
||||
|
||||
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
|
|
Loading…
Reference in a new issue