mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Apply sensor location setting
This commit is contained in:
parent
5de585e320
commit
8d84e86d19
2 changed files with 12 additions and 1 deletions
|
@ -68,7 +68,7 @@ void LeapMotionPlugin::init() {
|
|||
auto setter = [this](QString value) {
|
||||
_sensorLocation = value;
|
||||
saveSettings();
|
||||
// TODO: Apply setting value.
|
||||
applySensorLocation();
|
||||
};
|
||||
auto preference = new ComboBoxPreference(LEAPMOTION_PLUGIN, "Sensor location", getter, setter);
|
||||
QStringList list = { SENSOR_ON_DESKTOP, SENSOR_ON_HMD };
|
||||
|
@ -113,6 +113,7 @@ void LeapMotionPlugin::loadSettings() {
|
|||
{
|
||||
_enabled = settings.value(SETTINGS_ENABLED_KEY, QVariant(DEFAULT_ENABLED)).toBool();
|
||||
_sensorLocation = settings.value(SETTINGS_SENSOR_LOCATION_KEY, QVariant(DEFAULT_SENSOR_LOCATION)).toString();
|
||||
applySensorLocation();
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
|
@ -120,3 +121,11 @@ void LeapMotionPlugin::loadSettings() {
|
|||
void LeapMotionPlugin::InputDevice::clearState() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void LeapMotionPlugin::applySensorLocation() {
|
||||
if (_sensorLocation == SENSOR_ON_HMD) {
|
||||
_controller.setPolicyFlags(Leap::Controller::POLICY_OPTIMIZE_HMD);
|
||||
} else {
|
||||
_controller.setPolicyFlags(Leap::Controller::POLICY_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@ protected:
|
|||
std::shared_ptr<InputDevice> _inputDevice{ std::make_shared<InputDevice>() };
|
||||
|
||||
private:
|
||||
void applySensorLocation();
|
||||
|
||||
Leap::Controller _controller;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue