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.leftMargin: 10
anchors.topMargin: 30
anchors.verticalCenter: sourceGlyph.horizontalCenter
}
Row {
@ -96,21 +95,6 @@ Rectangle {
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.leftMargin: 10
anchors.topMargin: 30
anchors.verticalCenter: sliderGlyph.horizontalCenter
}
Loader {
@ -160,15 +143,35 @@ Rectangle {
anchors.topMargin: 10
anchors.bottom: inputConfiguration.bottom
source: InputConfiguration.configurationLayout(box.currentText);
onLoaded: {
if (loader.item.hasOwnProperty("pluginName")) {
loader.item.pluginName = box.currentText
if (loader.item.hasOwnProperty("displayInformation")) {
loader.item.displayInformation();
}
}
}
}
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 string pluginName: ""
property var displayInformation: openVrConfiguration.displayConfiguration()
readonly property bool feetChecked: feetBox.checked
readonly property bool hipsChecked: hipBox.checked
@ -353,7 +354,6 @@ Rectangle {
size: 36
color: hifi.colors.white
anchors.horizontalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 30
@ -379,6 +379,10 @@ Rectangle {
}
}
Component.onCompleted: {
InputConfiguration.calibrationStatus.connect(calibrationStatus);
}
HifiControls.SpinBox {
id: timeToCalibrate
@ -391,34 +395,39 @@ Rectangle {
colorScheme: hifi.colorSchemes.dark
}
Component.onCompleted: {
var settings = InputConfiguration.configurationSettings(pluginName);
function calibrationStatus(status) {
console.log("getting calibration status");
}
function displayConfiguration() {
var settings = InputConfiguration.configurationSettings(pluginName);
var configurationType = settings["trackerConfiguration"];
displayTrackerConfiguration(configurationType);
var HmdHead = settings["HMDHead"];
var viveController = settings["handController"];
console.log(HmdHead);
console.log(viveController);
if (HmdHead) {
headBox.checked = true;
headPuckBox.checked = false;
} else {
headPuckBox.checked = true;
headBox.checked = false;
}
if (viveController) {
handBox.checked = true;
handPuckBox.checked = false;
} else {
handPuckBox.checked = true;
handBox.checked = false;
}
}
function displayTrackerConfiguration(type) {
console.log(type);
if (type === "Feet") {
feetBox.checked = true;
} 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 calibratePlugin(QString pluginName);
Q_INVOKABLE QJsonObject configurationSettings(QString pluginName);
void calibrated();
void calibrated(const QJsonObject& status);
signals:
void calibrationStatus(const QJsonObject& status);
};
#endif

View file

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

View file

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