Refactor out duplicate PTT logic into a shared controller.
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "AudioTabController.h"
|
||||
#include "PttController.h"
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <openvr.h>
|
||||
#include <mutex>
|
||||
@@ -15,7 +17,7 @@ namespace advsettings {
|
||||
class OverlayController;
|
||||
|
||||
|
||||
class MoveCenterTabController : public QObject {
|
||||
class MoveCenterTabController : public PttController {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int trackingUniverse READ trackingUniverse WRITE setTrackingUniverse NOTIFY trackingUniverseChanged)
|
||||
Q_PROPERTY(float offsetX READ offsetX WRITE setOffsetX NOTIFY offsetXChanged)
|
||||
@@ -23,14 +25,8 @@ class MoveCenterTabController : public QObject {
|
||||
Q_PROPERTY(float offsetZ READ offsetZ WRITE setOffsetZ NOTIFY offsetZChanged)
|
||||
Q_PROPERTY(int rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
|
||||
Q_PROPERTY(bool adjustChaperone READ adjustChaperone WRITE setAdjustChaperone NOTIFY adjustChaperoneChanged)
|
||||
Q_PROPERTY(bool pttEnabled READ pttEnabled WRITE setPttEnabled NOTIFY pttEnabledChanged)
|
||||
Q_PROPERTY(bool pttActive READ pttActive NOTIFY pttActiveChanged)
|
||||
Q_PROPERTY(bool pttLeftControllerEnabled READ pttLeftControllerEnabled WRITE setPttLeftControllerEnabled NOTIFY pttLeftControllerEnabledChanged)
|
||||
Q_PROPERTY(bool pttRightControllerEnabled READ pttRightControllerEnabled WRITE setPttRightControllerEnabled NOTIFY pttRightControllerEnabledChanged)
|
||||
|
||||
private:
|
||||
void offsetYToggle(bool enabled);
|
||||
|
||||
OverlayController* parent;
|
||||
QQuickWindow* widget;
|
||||
|
||||
@@ -42,16 +38,12 @@ private:
|
||||
int m_rotation = 0;
|
||||
bool m_adjustChaperone = true;
|
||||
|
||||
bool m_pttEnabled = false;
|
||||
bool m_pttActive = false;
|
||||
bool m_pttShowNotification = false;
|
||||
bool m_pttLeftControllerEnabled = false;
|
||||
bool m_pttRightControllerEnabled = false;
|
||||
PttControllerConfig m_pttControllerConfigs[2];
|
||||
|
||||
unsigned settingsUpdateCounter = 0;
|
||||
|
||||
std::recursive_mutex eventLoopMutex;
|
||||
QString getSettingsName() override { return "playspaceSettings"; }
|
||||
void onPttStart() override;
|
||||
void onPttStop() override;
|
||||
void onPttDisabled() override;
|
||||
|
||||
public:
|
||||
void initStage1();
|
||||
@@ -65,19 +57,6 @@ public:
|
||||
int rotation() const;
|
||||
bool adjustChaperone() const;
|
||||
|
||||
bool pttEnabled() const;
|
||||
bool pttActive() const;
|
||||
bool pttLeftControllerEnabled() const;
|
||||
bool pttRightControllerEnabled() const;
|
||||
void reloadPttConfig();
|
||||
void savePttConfig();
|
||||
|
||||
Q_INVOKABLE QVariantList pttDigitalButtons(unsigned controller);
|
||||
Q_INVOKABLE unsigned long pttDigitalButtonMask(unsigned controller);
|
||||
Q_INVOKABLE unsigned pttTouchpadMode(unsigned controller);
|
||||
Q_INVOKABLE unsigned pttTriggerMode(unsigned controller);
|
||||
Q_INVOKABLE unsigned pttTouchpadArea(unsigned controller);
|
||||
|
||||
public slots:
|
||||
int trackingUniverse() const;
|
||||
void setTrackingUniverse(int value, bool notify = true);
|
||||
@@ -95,12 +74,6 @@ public slots:
|
||||
void modOffsetZ(float value, bool notify = true);
|
||||
void reset();
|
||||
|
||||
void setPttEnabled(bool value, bool notify = true, bool save = true);
|
||||
void setPttLeftControllerEnabled(bool value, bool notify = true, bool save = true);
|
||||
void setPttRightControllerEnabled(bool value, bool notify = true, bool save = true);
|
||||
|
||||
void setPttControllerConfig(unsigned controller, QVariantList buttons, unsigned triggerMode, unsigned padMode, unsigned padAreas);
|
||||
|
||||
signals:
|
||||
void trackingUniverseChanged(int value);
|
||||
void offsetXChanged(float value);
|
||||
@@ -108,11 +81,6 @@ signals:
|
||||
void offsetZChanged(float value);
|
||||
void rotationChanged(int value);
|
||||
void adjustChaperoneChanged(bool value);
|
||||
|
||||
void pttEnabledChanged(bool value);
|
||||
void pttActiveChanged(bool value);
|
||||
void pttLeftControllerEnabledChanged(bool value);
|
||||
void pttRightControllerEnabledChanged(bool value);
|
||||
};
|
||||
|
||||
} // namespace advsettings
|
||||
|
||||
Reference in New Issue
Block a user