confiration update status

This commit is contained in:
Dante Ruiz 2017-06-09 00:44:05 +01:00
parent c97ea84cbf
commit 73e628461e
6 changed files with 57 additions and 32 deletions

View file

@ -72,7 +72,6 @@ Rectangle {
anchors.left: sourceGlyph.right anchors.left: sourceGlyph.right
anchors.leftMargin: 10 anchors.leftMargin: 10
anchors.topMargin: 30 anchors.topMargin: 30
anchors.verticalCenter: sourceGlyph.horizontalCenter
} }
Row { Row {
@ -96,21 +95,6 @@ Rectangle {
loader.source = InputConfiguration.configurationLayout(box.currentText); loader.source = InputConfiguration.configurationLayout(box.currentText);
} }
} }
HifiControls.CheckBox {
onClicked: {
if (checked) {
box.model = InputConfiguration.activeInputPlugins();
loader.source = "";
loader.source = InputConfiguration.configurationLayout(box.currentText);
} else {
box.model = InputConfiguration.inputPlugins();
loader.source = "";
loader.source = InputConfiguration.configurationLayout(box.currentText);
}
}
}
} }
@ -146,7 +130,6 @@ Rectangle {
anchors.left: sliderGlyph.right anchors.left: sliderGlyph.right
anchors.leftMargin: 10 anchors.leftMargin: 10
anchors.topMargin: 30 anchors.topMargin: 30
anchors.verticalCenter: sliderGlyph.horizontalCenter
} }
Loader { Loader {
@ -160,15 +143,35 @@ Rectangle {
anchors.topMargin: 10 anchors.topMargin: 10
anchors.bottom: inputConfiguration.bottom anchors.bottom: inputConfiguration.bottom
source: InputConfiguration.configurationLayout(box.currentText);
onLoaded: { onLoaded: {
if (loader.item.hasOwnProperty("pluginName")) { if (loader.item.hasOwnProperty("pluginName")) {
loader.item.pluginName = box.currentText loader.item.pluginName = box.currentText
if (loader.item.hasOwnProperty("displayInformation")) {
loader.item.displayInformation();
}
} }
} }
} }
function inputPlugins() { function inputPlugins() {
return InputConfiguration.inputPlugins(); return InputConfiguration.activeInputPlugins();
}
function initialize() {
loader.source = "";
loader.source = InputConfiguration.configurationLayout(box.currentText);
}
Timer {
id: timer
repeat: false
interval: 300
onTriggered: initialize()
}
Component.onCompleted: {
timer.start();
} }
} }

View file

@ -23,6 +23,7 @@ Rectangle {
property int leftMargin: 75 property int leftMargin: 75
property string pluginName: "" property string pluginName: ""
property var displayInformation: openVrConfiguration.displayConfiguration()
readonly property bool feetChecked: feetBox.checked readonly property bool feetChecked: feetBox.checked
readonly property bool hipsChecked: hipBox.checked readonly property bool hipsChecked: hipBox.checked
@ -353,7 +354,6 @@ Rectangle {
size: 36 size: 36
color: hifi.colors.white color: hifi.colors.white
anchors.horizontalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 30 anchors.leftMargin: 30
@ -379,6 +379,10 @@ Rectangle {
} }
} }
Component.onCompleted: {
InputConfiguration.calibrationStatus.connect(calibrationStatus);
}
HifiControls.SpinBox { HifiControls.SpinBox {
id: timeToCalibrate id: timeToCalibrate
@ -391,34 +395,39 @@ Rectangle {
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
} }
Component.onCompleted: { function calibrationStatus(status) {
var settings = InputConfiguration.configurationSettings(pluginName); console.log("getting calibration status");
}
function displayConfiguration() {
var settings = InputConfiguration.configurationSettings(pluginName);
var configurationType = settings["trackerConfiguration"]; var configurationType = settings["trackerConfiguration"];
displayTrackerConfiguration(configurationType); displayTrackerConfiguration(configurationType);
var HmdHead = settings["HMDHead"]; var HmdHead = settings["HMDHead"];
var viveController = settings["handController"]; var viveController = settings["handController"];
console.log(HmdHead);
console.log(viveController);
if (HmdHead) { if (HmdHead) {
headBox.checked = true; headBox.checked = true;
headPuckBox.checked = false;
} else { } else {
headPuckBox.checked = true; headPuckBox.checked = true;
headBox.checked = false;
} }
if (viveController) { if (viveController) {
handBox.checked = true; handBox.checked = true;
handPuckBox.checked = false;
} else { } else {
handPuckBox.checked = true; handPuckBox.checked = true;
handBox.checked = false;
} }
} }
function displayTrackerConfiguration(type) { function displayTrackerConfiguration(type) {
console.log(type);
if (type === "Feet") { if (type === "Feet") {
feetBox.checked = true; feetBox.checked = true;
} else if (type === "FeetAndHips") { } else if (type === "FeetAndHips") {

View file

@ -70,5 +70,6 @@ void InputConfiguration::calibratePlugin(QString pluginName) {
} }
} }
void InputConfiguration::calibrated() { void InputConfiguration::calibrated(const QJsonObject& status) {
emit calibrationStatus(status);
} }

View file

@ -28,7 +28,10 @@ public:
Q_INVOKABLE void setConfigurationSettings(QJsonObject configurationSettings, QString pluginName); Q_INVOKABLE void setConfigurationSettings(QJsonObject configurationSettings, QString pluginName);
Q_INVOKABLE void calibratePlugin(QString pluginName); Q_INVOKABLE void calibratePlugin(QString pluginName);
Q_INVOKABLE QJsonObject configurationSettings(QString pluginName); Q_INVOKABLE QJsonObject configurationSettings(QString pluginName);
void calibrated(); void calibrated(const QJsonObject& status);
signals:
void calibrationStatus(const QJsonObject& status);
}; };
#endif #endif

View file

@ -30,7 +30,7 @@
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>
#include <controllers/UserInputMapper.h> #include <controllers/UserInputMapper.h>
#include <Plugins/InputConfiguration.h>
#include <controllers/StandardControls.h> #include <controllers/StandardControls.h>
@ -123,7 +123,6 @@ bool ViveControllerManager::isSupported() const {
void ViveControllerManager::setConfigurationSettings(const QJsonObject configurationSettings) { void ViveControllerManager::setConfigurationSettings(const QJsonObject configurationSettings) {
if (isSupported()) { if (isSupported()) {
_inputDevice->configureCalibrationSettings(configurationSettings); _inputDevice->configureCalibrationSettings(configurationSettings);
qDebug() << "sending back information";
} }
} }
@ -325,12 +324,18 @@ void ViveControllerManager::InputDevice::configureCalibrationSettings(const QJso
QJsonObject ViveControllerManager::InputDevice::configurationSettings() { QJsonObject ViveControllerManager::InputDevice::configurationSettings() {
Locker locker(_lock); Locker locker(_lock);
QJsonObject configurationSettings; QJsonObject configurationSettings;
configurationSettings["trackerConfiguration"] = configToString(_config); configurationSettings["trackerConfiguration"] = configToString(_preferedConfig);
configurationSettings["HMDHead"] = (_headConfig == HeadConfig::HMD) ? true : false; configurationSettings["HMDHead"] = (_headConfig == HeadConfig::HMD) ? true : false;
configurationSettings["handController"] = (_handConfig == HandConfig::HandController) ? true : false; configurationSettings["handController"] = (_handConfig == HandConfig::HandController) ? true : false;
return configurationSettings; return configurationSettings;
} }
void ViveControllerManager::InputDevice::emitCalibrationStatus() {
auto inputConfiguration = DependencyManager::get<InputConfiguration>();
QJsonObject status = QJsonObject();
inputConfiguration->calibrated(status);
}
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) { void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex; uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex;
printDeviceTrackingResultChange(deviceIndex); printDeviceTrackingResultChange(deviceIndex);
@ -463,6 +468,7 @@ void ViveControllerManager::InputDevice::calibrate(const controller::InputCalibr
return; return;
} }
_calibrated = true; _calibrated = true;
emitCalibrationStatus();
qDebug() << "PuckCalibration: " << configToString(_config) << " Configuration Successful"; qDebug() << "PuckCalibration: " << configToString(_config) << " Configuration Successful";
} }
@ -860,6 +866,7 @@ QString ViveControllerManager::InputDevice::configToString(Config config) {
} }
void ViveControllerManager::InputDevice::setConfigFromString(const QString& value) { void ViveControllerManager::InputDevice::setConfigFromString(const QString& value) {
qDebug() << "------------> setConfigFromString" << value;
if (value == "Auto") { if (value == "Auto") {
_preferedConfig = Config::Auto; _preferedConfig = Config::Auto;
} else if (value == "Feet") { } else if (value == "Feet") {

View file

@ -100,6 +100,8 @@ private:
int firstShoulderIndex, int secondShoulderIndex); int firstShoulderIndex, int secondShoulderIndex);
void calibrateHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration); void calibrateHead(glm::mat4& defaultToReferenceMat, const controller::InputCalibrationData& inputCalibration);
void emitCalibrationStatus();
class FilteredStick { class FilteredStick {
public: public: