Add axis tracking options for smooth follow
This commit is contained in:
parent
994dd4e648
commit
6711cc1913
|
|
@ -125,6 +125,9 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu
|
|||
connect(ui.kcfg_MirrorPhysicalDisplays, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save);
|
||||
connect(ui.kcfg_RemoveVirtualDisplaysOnDisable, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::save);
|
||||
connect(ui.EnableMultitap, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateMultitapEnabled);
|
||||
connect(ui.SmoothFollowTrackYaw, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateSmoothFollowTrackYaw);
|
||||
connect(ui.SmoothFollowTrackPitch, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateSmoothFollowTrackPitch);
|
||||
connect(ui.SmoothFollowTrackRoll, &QCheckBox::toggled, this, &BreezyDesktopEffectConfig::updateSmoothFollowTrackRoll);
|
||||
|
||||
if (auto label = widget()->findChild<QLabel*>("labelAppNameVersion")) {
|
||||
label->setText(QStringLiteral("Breezy Desktop - v%1").arg(QLatin1String(BREEZY_DESKTOP_VERSION_STR)));
|
||||
|
|
@ -473,6 +476,16 @@ void BreezyDesktopEffectConfig::pollDriverState()
|
|||
bool multitap = multitapEnabled(configJsonOpt);
|
||||
if (ui.EnableMultitap->isChecked() != multitap) ui.EnableMultitap->setChecked(multitap);
|
||||
|
||||
const bool trackYaw = smoothFollowTrackYawEnabled(configJsonOpt);
|
||||
if (ui.SmoothFollowTrackYaw->isChecked() != trackYaw)
|
||||
ui.SmoothFollowTrackYaw->setChecked(trackYaw);
|
||||
const bool trackPitch = smoothFollowTrackPitchEnabled(configJsonOpt);
|
||||
if (ui.SmoothFollowTrackPitch->isChecked() != trackPitch)
|
||||
ui.SmoothFollowTrackPitch->setChecked(trackPitch);
|
||||
const bool trackRoll = smoothFollowTrackRollEnabled(configJsonOpt);
|
||||
if (ui.SmoothFollowTrackRoll->isChecked() != trackRoll)
|
||||
ui.SmoothFollowTrackRoll->setChecked(trackRoll);
|
||||
|
||||
refreshLicenseUi(stateJson);
|
||||
|
||||
m_driverStateInitialized = true;
|
||||
|
|
@ -519,6 +532,60 @@ void BreezyDesktopEffectConfig::updateSmoothFollowEnabled()
|
|||
XRDriverIPC::instance().writeControlFlags(flags);
|
||||
}
|
||||
|
||||
bool BreezyDesktopEffectConfig::smoothFollowTrackYawEnabled(std::optional<QJsonObject> configJsonOpt)
|
||||
{
|
||||
if (!configJsonOpt) return true; // fallback if config missing entirely
|
||||
return configJsonOpt->value(QStringLiteral("smooth_follow_track_yaw")).toBool();
|
||||
}
|
||||
|
||||
bool BreezyDesktopEffectConfig::smoothFollowTrackPitchEnabled(std::optional<QJsonObject> configJsonOpt)
|
||||
{
|
||||
if (!configJsonOpt) return true; // fallback if config missing entirely
|
||||
return configJsonOpt->value(QStringLiteral("smooth_follow_track_pitch")).toBool();
|
||||
}
|
||||
|
||||
bool BreezyDesktopEffectConfig::smoothFollowTrackRollEnabled(std::optional<QJsonObject> configJsonOpt)
|
||||
{
|
||||
if (!configJsonOpt) return false; // fallback if config missing entirely
|
||||
return configJsonOpt->value(QStringLiteral("smooth_follow_track_roll")).toBool();
|
||||
}
|
||||
|
||||
void BreezyDesktopEffectConfig::updateSmoothFollowTrackYaw()
|
||||
{
|
||||
auto configJsonOpt = XRDriverIPC::instance().retrieveConfig();
|
||||
const bool current = smoothFollowTrackYawEnabled(configJsonOpt);
|
||||
const bool desired = ui.SmoothFollowTrackYaw->isChecked();
|
||||
if (current == desired) return;
|
||||
|
||||
QJsonObject newConfig = configJsonOpt ? configJsonOpt.value() : QJsonObject();
|
||||
newConfig.insert(QStringLiteral("smooth_follow_track_yaw"), desired);
|
||||
XRDriverIPC::instance().writeConfig(newConfig);
|
||||
}
|
||||
|
||||
void BreezyDesktopEffectConfig::updateSmoothFollowTrackPitch()
|
||||
{
|
||||
auto configJsonOpt = XRDriverIPC::instance().retrieveConfig();
|
||||
const bool current = smoothFollowTrackPitchEnabled(configJsonOpt);
|
||||
const bool desired = ui.SmoothFollowTrackPitch->isChecked();
|
||||
if (current == desired) return;
|
||||
|
||||
QJsonObject newConfig = configJsonOpt ? configJsonOpt.value() : QJsonObject();
|
||||
newConfig.insert(QStringLiteral("smooth_follow_track_pitch"), desired);
|
||||
XRDriverIPC::instance().writeConfig(newConfig);
|
||||
}
|
||||
|
||||
void BreezyDesktopEffectConfig::updateSmoothFollowTrackRoll()
|
||||
{
|
||||
auto configJsonOpt = XRDriverIPC::instance().retrieveConfig();
|
||||
const bool current = smoothFollowTrackRollEnabled(configJsonOpt);
|
||||
const bool desired = ui.SmoothFollowTrackRoll->isChecked();
|
||||
if (current == desired) return;
|
||||
|
||||
QJsonObject newConfig = configJsonOpt ? configJsonOpt.value() : QJsonObject();
|
||||
newConfig.insert(QStringLiteral("smooth_follow_track_roll"), desired);
|
||||
XRDriverIPC::instance().writeConfig(newConfig);
|
||||
}
|
||||
|
||||
void BreezyDesktopEffectConfig::showStatus(QLabel *label, bool success, const QString &message) {
|
||||
if (!label) return;
|
||||
QPalette pal = label->palette();
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ private:
|
|||
void updateDriverEnabled();
|
||||
void updateMultitapEnabled();
|
||||
void updateSmoothFollowEnabled();
|
||||
void updateSmoothFollowTrackYaw();
|
||||
void updateSmoothFollowTrackPitch();
|
||||
void updateSmoothFollowTrackRoll();
|
||||
void updateUiFromConfig();
|
||||
void updateUiFromDefaultConfig();
|
||||
void updateConfigFromUi();
|
||||
|
|
@ -38,6 +41,9 @@ private:
|
|||
bool driverEnabled(std::optional<QJsonObject> configJsonOpt);
|
||||
bool multitapEnabled(std::optional<QJsonObject> configJsonOpt);
|
||||
bool smoothFollowEnabled(std::optional<QJsonObject> stateJsonOpt);
|
||||
bool smoothFollowTrackYawEnabled(std::optional<QJsonObject> configJsonOpt);
|
||||
bool smoothFollowTrackPitchEnabled(std::optional<QJsonObject> configJsonOpt);
|
||||
bool smoothFollowTrackRollEnabled(std::optional<QJsonObject> configJsonOpt);
|
||||
void pollDriverState();
|
||||
void refreshLicenseUi(const QJsonObject &rootObj);
|
||||
void checkEffectLoaded();
|
||||
|
|
|
|||
|
|
@ -325,13 +325,60 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSmoothFollowTracking">
|
||||
<property name="text">
|
||||
<string>Smooth follow tracking:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="widgetSmoothFollowTracking">
|
||||
<layout class="QHBoxLayout" name="layoutSmoothFollowTracking">
|
||||
<property name="leftMargin"><number>0</number></property>
|
||||
<property name="topMargin"><number>0</number></property>
|
||||
<property name="rightMargin"><number>0</number></property>
|
||||
<property name="bottomMargin"><number>0</number></property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="SmoothFollowTrackYaw">
|
||||
<property name="text">
|
||||
<string>Yaw</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="SmoothFollowTrackPitch">
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="SmoothFollowTrackRoll">
|
||||
<property name="text">
|
||||
<string>Roll</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelDisplayHorizontalOffset">
|
||||
<property name="text">
|
||||
<string>Display Horizontal Offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayHorizontalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
|
|
@ -353,14 +400,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelDisplayVerticalOffset">
|
||||
<property name="text">
|
||||
<string>Display Vertical Offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayVerticalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
|
|
@ -382,14 +429,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelLookAheadOverride">
|
||||
<property name="text">
|
||||
<string>Movement look-ahead (ms):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_LookAheadOverride">
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
|
|
@ -408,7 +455,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_RemoveVirtualDisplaysOnDisable">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
|
|
@ -422,7 +469,7 @@
|
|||
<property name="checked"><bool>true</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_MirrorPhysicalDisplays">
|
||||
<property name="text">
|
||||
<string>Mirror physical displays (may impact performance)</string>
|
||||
|
|
@ -430,7 +477,7 @@
|
|||
<property name="checked"><bool>false</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="EnableMultitap">
|
||||
<property name="text">
|
||||
<string>Enable multi-tap detection</string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue