diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-19 13:39:50 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-19 13:39:50 +0200 |
commit | a8ffbb76f3e3bbca547fccf5135323e06cae9d2a (patch) | |
tree | cd77a5302cb4ead5995a2a86d5b5b6324ebf43ff /ftnoir_protocol_ft | |
parent | 0f0d663c6263a59e2cb14f555a00b39b19c134e7 (diff) |
update modules to refactored API
Diffstat (limited to 'ftnoir_protocol_ft')
-rw-r--r-- | ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 15 | ||||
-rw-r--r-- | ftnoir_protocol_ft/ftnoir_protocol_ft.h | 40 |
2 files changed, 24 insertions, 31 deletions
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index ae23be3c..c0a186ff 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -28,13 +28,12 @@ #include "ftnoir_csv/csv.h" FTNoIR_Protocol::FTNoIR_Protocol() : - shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)) + pMemData((FTHeap*) shm.ptr()), + shm(FREETRACK_HEAP, FREETRACK_MUTEX, sizeof(FTHeap)), + viewsStart(nullptr), + viewsStop(nullptr), + intGameID(0) { - pMemData = (FTHeap*) shm.ptr(); - ProgramName = ""; - intGameID = 0; - viewsStart = 0; - viewsStop = 0; } FTNoIR_Protocol::~FTNoIR_Protocol() @@ -48,7 +47,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() dummyTrackIR.waitForFinished(50); } -void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { +void FTNoIR_Protocol::pose(const double* headpose) { float yaw = getRadsFromDegrees(headpose[Yaw]); float pitch = getRadsFromDegrees(headpose[Pitch]); float roll = getRadsFromDegrees(headpose[Roll]); @@ -128,7 +127,7 @@ void FTNoIR_Protocol::start_dummy() { dummyTrackIR.start(); } -bool FTNoIR_Protocol::checkServerInstallationOK() +bool FTNoIR_Protocol::correct() { QSettings settings("Freetrack", "FreetrackClient"); // Registry settings (in HK_USER) QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 5a9e5cdd..51079f20 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -60,42 +60,38 @@ class FTNoIR_Protocol : public IProtocol public: FTNoIR_Protocol(); ~FTNoIR_Protocol() override; - bool checkServerInstallationOK( ); - void sendHeadposeToGame( const double *headpose ); - QString getGameName() { + bool correct( ); + void pose( const double *headpose ); + QString game_name() override { QMutexLocker foo(&game_name_mutex); return connected_game; } private: - importTIRViewsStart viewsStart; - importTIRViewsStop viewsStop; - + settings s; FTHeap *pMemData; - QString game_name; PortableLockedShm shm; - QString ProgramName; QLibrary FTIRViewsLib; QProcess dummyTrackIR; - static inline double getRadsFromDegrees ( double degrees ) - { - return degrees * 0.017453; - } + importTIRViewsStart viewsStart; + importTIRViewsStop viewsStop; + int intGameID; - void start_tirviews(); - void start_dummy(); QString connected_game; QMutex game_name_mutex; - settings s; + + static inline double getRadsFromDegrees(double degrees) { return degrees * 0.017453; } + void start_tirviews(); + void start_dummy(); }; -class FTControls: public QWidget, public IProtocolDialog +class FTControls: public IProtocolDialog { Q_OBJECT public: - explicit FTControls(); - void registerProtocol(IProtocol *) {} - void unRegisterProtocol() {} + FTControls(); + void register_protocol(IProtocol *) {} + void unregister_protocol() {} private: Ui::UICFTControls ui; settings s; @@ -108,8 +104,6 @@ private slots: class FTNoIR_ProtocolDll : public Metadata { public: - void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack 2.0"); } - void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("FreeTrack 2.0"); } - void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Enhanced FreeTrack protocol"); } - void getIcon(QIcon *icon) { *icon = QIcon(":/images/freetrack.png"); } + QString name() { return QString("freetrack 2.0 Enhanced"); } + QIcon icon() { return QIcon(":/images/freetrack.png"); } }; |