From c58c0af311892929dbce4e5437c4035214552438 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Sep 2013 15:34:44 +0200 Subject: Run dos2unix on the tree. No user-facing changes. --- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 282 ++++++++++++++++---------------- 1 file changed, 141 insertions(+), 141 deletions(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index f87c7300..05860907 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -1,141 +1,141 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2010 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see . * -* * -* FTServer FTServer is the Class, that communicates headpose-data * -* to games, using the FreeTrackClient.dll. * -********************************************************************************/ -#pragma once -#ifndef INCLUDED_FTSERVER_H -#define INCLUDED_FTSERVER_H - -#include "ftnoir_protocol_base/ftnoir_protocol_base.h" -#include "ui_ftnoir_ftcontrols.h" -#include "facetracknoir/global-settings.h" -#include "fttypes.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "compat/compat.h" -//#include "math.h" - -//typedef char *(WINAPI *importProvider)(void); -typedef void (WINAPI *importTIRViewsStart)(void); -typedef void (WINAPI *importTIRViewsStop)(void); - -class FTNoIR_Protocol : public IProtocol -{ -public: - FTNoIR_Protocol(); - ~FTNoIR_Protocol(); - bool checkServerInstallationOK( ); - void sendHeadposeToGame( double *headpose, double *rawheadpose ); - QString getGameName() { - QMutexLocker foo(&game_name_mutex); - return connected_game; - } - -private: - importTIRViewsStart viewsStart; // Functions inside TIRViews.dll - importTIRViewsStop viewsStop; - - FTMemMap *pMemData; - QString game_name; - PortableLockedShm shm; - - // Private properties - QString ProgramName; - QLibrary FTIRViewsLib; - QProcess dummyTrackIR; - int intGameID; - int intUsedInterface; // Determine which interface to use (or to hide from the game) - bool useTIRViews; // Needs to be in the Settings dialog - bool useDummyExe; - float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); } - void loadSettings(); - void start_tirviews(); - void start_dummy(); - - QString connected_game; - QMutex game_name_mutex; -}; - -// Widget that has controls for FTNoIR protocol client-settings. -class FTControls: public QWidget, public IProtocolDialog -{ - Q_OBJECT -public: - - explicit FTControls(); - virtual ~FTControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); - void registerProtocol(IProtocol *protocol) { - theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol - } - void unRegisterProtocol() { - theProtocol = NULL; // Reset the pointer - } - -private: - Ui::UICFTControls ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FTNoIR_Protocol *theProtocol; - -private slots: - void selectDLL(); - void doOK(); - void doCancel(); - void settingChanged() { settingsDirty = true; } - void settingChanged(int) { settingsDirty = true; } -}; - -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* -class FTNoIR_ProtocolDll : public Metadata -{ -public: - FTNoIR_ProtocolDll(); - ~FTNoIR_ProtocolDll(); - - 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"); } -}; - - -#endif//INCLUDED_FTSERVER_H -//END +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2010 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +* * +* FTServer FTServer is the Class, that communicates headpose-data * +* to games, using the FreeTrackClient.dll. * +********************************************************************************/ +#pragma once +#ifndef INCLUDED_FTSERVER_H +#define INCLUDED_FTSERVER_H + +#include "ftnoir_protocol_base/ftnoir_protocol_base.h" +#include "ui_ftnoir_ftcontrols.h" +#include "facetracknoir/global-settings.h" +#include "fttypes.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "compat/compat.h" +//#include "math.h" + +//typedef char *(WINAPI *importProvider)(void); +typedef void (WINAPI *importTIRViewsStart)(void); +typedef void (WINAPI *importTIRViewsStop)(void); + +class FTNoIR_Protocol : public IProtocol +{ +public: + FTNoIR_Protocol(); + ~FTNoIR_Protocol(); + bool checkServerInstallationOK( ); + void sendHeadposeToGame( double *headpose, double *rawheadpose ); + QString getGameName() { + QMutexLocker foo(&game_name_mutex); + return connected_game; + } + +private: + importTIRViewsStart viewsStart; // Functions inside TIRViews.dll + importTIRViewsStop viewsStop; + + FTMemMap *pMemData; + QString game_name; + PortableLockedShm shm; + + // Private properties + QString ProgramName; + QLibrary FTIRViewsLib; + QProcess dummyTrackIR; + int intGameID; + int intUsedInterface; // Determine which interface to use (or to hide from the game) + bool useTIRViews; // Needs to be in the Settings dialog + bool useDummyExe; + float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); } + void loadSettings(); + void start_tirviews(); + void start_dummy(); + + QString connected_game; + QMutex game_name_mutex; +}; + +// Widget that has controls for FTNoIR protocol client-settings. +class FTControls: public QWidget, public IProtocolDialog +{ + Q_OBJECT +public: + + explicit FTControls(); + virtual ~FTControls(); + void showEvent ( QShowEvent * event ); + void Initialize(QWidget *parent); + void registerProtocol(IProtocol *protocol) { + theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol + } + void unRegisterProtocol() { + theProtocol = NULL; // Reset the pointer + } + +private: + Ui::UICFTControls ui; + void loadSettings(); + void save(); + + /** helper **/ + bool settingsDirty; + FTNoIR_Protocol *theProtocol; + +private slots: + void selectDLL(); + void doOK(); + void doCancel(); + void settingChanged() { settingsDirty = true; } + void settingChanged(int) { settingsDirty = true; } +}; + +//******************************************************************************************************* +// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol +//******************************************************************************************************* +class FTNoIR_ProtocolDll : public Metadata +{ +public: + FTNoIR_ProtocolDll(); + ~FTNoIR_ProtocolDll(); + + 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"); } +}; + + +#endif//INCLUDED_FTSERVER_H +//END -- cgit v1.2.3 From 4d21a6c5db8ec555ed94c5f8a85482b988fec34b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 17 Oct 2013 08:09:09 +0200 Subject: fix last woe32 breakage --- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 05860907..cd77bbe4 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -55,7 +55,7 @@ public: FTNoIR_Protocol(); ~FTNoIR_Protocol(); bool checkServerInstallationOK( ); - void sendHeadposeToGame( double *headpose, double *rawheadpose ); + void sendHeadposeToGame( const double *headpose ); QString getGameName() { QMutexLocker foo(&game_name_mutex); return connected_game; -- cgit v1.2.3 From 79697936ef3ce7f0bbd1965931cdfb4b2c4c9f5b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 19 Oct 2013 17:06:23 +0200 Subject: Fix proto/filter dtor not being called Signed-off-by: Stanislaw Halik Reported-by: mm0zct --- ftnoir_filter_accela/ftnoir_filter_accela.h | 2 +- ftnoir_filter_base/ftnoir_filter_base.h | 4 +++- ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 2 +- ftnoir_protocol_base/ftnoir_protocol_base.h | 4 +++- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 2 +- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 1 + ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 2 +- ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.h | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 2 +- ftnoir_protocol_wine/ftnoir_protocol_wine.h | 2 +- 14 files changed, 18 insertions(+), 13 deletions(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 4afe127b..f1807fd0 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -42,7 +42,7 @@ class FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - ~FTNoIR_Filter(); + virtual ~FTNoIR_Filter(); void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position, const double* last_post_filter_values); void Initialize() { first_run = true; diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index fe1ad19a..48a4a6b9 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -12,11 +12,13 @@ struct IFilter { - virtual ~IFilter() {} + virtual ~IFilter() = 0; virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position, const double *last_post_filter) = 0; virtual void Initialize() = 0; }; +inline IFilter::~IFilter() { } + struct IFilterDialog { virtual ~IFilterDialog() {} diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 656b2895..7f2f21e6 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -41,7 +41,7 @@ class FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - ~FTNoIR_Filter(); + virtual ~FTNoIR_Filter(); void Initialize() {} void FilterHeadPoseData(const double *target_camera_position, diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h index 5db49f01..e4ca1977 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base.h @@ -39,12 +39,14 @@ struct IProtocol { - virtual ~IProtocol() {} + virtual ~IProtocol() = 0; virtual bool checkServerInstallationOK() = 0; virtual void sendHeadposeToGame( const double* headpose ) = 0; virtual QString getGameName() = 0; }; +inline IProtocol::~IProtocol() { } + struct IProtocolDialog { virtual ~IProtocolDialog() {} diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 43d1b05a..9a4f304c 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -44,7 +44,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double *headpose); QString getGameName() { diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index 52b2cd98..87c6a3a4 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -59,7 +59,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); QString getGameName() { diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 27e88136..65d877a7 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -61,6 +61,7 @@ FTNoIR_Protocol::~FTNoIR_Protocol() FTIRViewsLib.unload(); } dummyTrackIR.kill(); + dummyTrackIR.waitForFinished(5); } // diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index cd77bbe4..e13d260f 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -53,7 +53,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK( ); void sendHeadposeToGame( const double *headpose ); QString getGameName() { diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 4e814ddf..9aee73ac 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -43,7 +43,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double *headpose); QString getGameName() { diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index 3c6f591c..aabd3e51 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -21,7 +21,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK() { return dev != NULL; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h index 1eb80b12..1ce72f69 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h @@ -58,7 +58,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame( const double *headpose); QString getGameName() { diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index 9ac56b30..e17cabb5 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -81,7 +81,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); QString getGameName() { diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 2fe53669..c4db29e4 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -42,7 +42,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK() { return true; } diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index 01bfc93d..d7276b8e 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -48,7 +48,7 @@ class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - ~FTNoIR_Protocol(); + virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double* headpose); -- cgit v1.2.3 From d1e0537f704ea67483ccbdf7461e636490aba0cf Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 31 Dec 2013 08:41:16 +0100 Subject: meta: get rid of Initialize(), now RAII --- FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h | 4 - ftnoir_filter_accela/ftnoir_filter_accela.h | 4 +- .../ftnoir_filter_accela_dialog.cpp | 4 - ftnoir_filter_base/ftnoir_filter_base.h | 3 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp | 4 - ftnoir_filter_ewma2/ftnoir_filter_ewma2.h | 5 +- ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp | 21 -- ftnoir_filter_kalman/ftnoir_filter_kalman.h | 9 +- ftnoir_filter_kalman/kalman.cpp | 4 +- ftnoir_protocol_base/ftnoir_protocol_base.h | 3 - ftnoir_protocol_fg/ftnoir_protocol_fg.h | 7 - ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp | 24 -- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h | 3 - .../ftnoir_protocol_fsuipc_dialog.cpp | 29 -- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 3 - ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 30 -- ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 3 - ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp | 24 -- .../ftnoir_protocol_libevdev.h | 4 - .../ftnoir_protocol_libevdev_dialog.cpp | 15 - ftnoir_protocol_sc/ftnoir_protocol_sc.h | 3 - ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp | 30 -- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 4 - .../ftnoir_protocol_vjoy_dialog.cpp | 15 - ftnoir_protocol_wine/ftnoir_protocol_wine.h | 3 - ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp | 309 +++++---------------- ftnoir_tracker_aruco/ftnoir_tracker_aruco.h | 55 ++-- ftnoir_tracker_base/ftnoir_tracker_base.h | 3 +- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 34 --- ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 7 - .../ftnoir_tracker_hat_dialog.cpp | 18 -- ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 4 +- ftnoir_tracker_ht/ftnoir_tracker_ht.cpp | 5 - ftnoir_tracker_ht/ftnoir_tracker_ht.h | 1 - ftnoir_tracker_hydra/ftnoir_tracker_hydra.h | 1 - .../ftnoir_tracker_hydra_dialog.cpp | 9 - ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 6 +- .../ftnoir_tracker_joystick_dialog.cpp | 18 -- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 2 - ftnoir_tracker_rift/ftnoir_tracker_rift.h | 1 - ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 9 - ftnoir_tracker_udp/ftnoir_tracker_udp.h | 3 - ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp | 23 -- 43 files changed, 118 insertions(+), 648 deletions(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h index 18283837..1d30e7e5 100644 --- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h +++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt_dll.h @@ -20,10 +20,6 @@ class TrackerDll : public ITrackerDll #endif { - // ITrackerDll interface -#ifndef OPENTRACK_API - void Initialize() {} -#endif void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 2b93f550..1aaa039f 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -37,7 +37,7 @@ class FTNoIR_Filter : public IFilter public: FTNoIR_Filter(); void FilterHeadPoseData(const double* target_camera_position, double *new_camera_position); - void Initialize() { + void reset() { first_run = true; } void receiveSettings() { @@ -64,7 +64,7 @@ class FilterControls: public QWidget, public IFilterDialog Q_OBJECT public: FilterControls(); - void Initialize(QWidget *); + void reset(QWidget *); void registerFilter(IFilter* filter); void unregisterFilter(); private: diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index cc759bcb..6d1ad384 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -20,10 +20,6 @@ FilterControls::FilterControls() : tie_setting(s.expt, ui.expt); } -void FilterControls::Initialize(QWidget *) { - show(); -} - void FilterControls::registerFilter(IFilter* filter) { accela_filter = (FTNoIR_Filter*) filter; diff --git a/ftnoir_filter_base/ftnoir_filter_base.h b/ftnoir_filter_base/ftnoir_filter_base.h index 800e5deb..fbb0441d 100644 --- a/ftnoir_filter_base/ftnoir_filter_base.h +++ b/ftnoir_filter_base/ftnoir_filter_base.h @@ -14,7 +14,7 @@ struct IFilter { virtual ~IFilter() = 0; virtual void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) = 0; - virtual void Initialize() = 0; + virtual void reset() = 0; }; inline IFilter::~IFilter() { } @@ -22,7 +22,6 @@ inline IFilter::~IFilter() { } struct IFilterDialog { virtual ~IFilterDialog() {} - virtual void Initialize(QWidget *parent) = 0; virtual void registerFilter(IFilter* tracker) = 0; virtual void unregisterFilter() = 0; }; diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp index 5f66be96..77596b71 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp @@ -44,10 +44,6 @@ FTNoIR_Filter::FTNoIR_Filter() loadSettings(); // Load the Settings } -FTNoIR_Filter::~FTNoIR_Filter() -{ -} - void FTNoIR_Filter::receiveSettings(double smin, double smax, double sexpt) { QMutexLocker foo(&mutex); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h index 86e4b65c..7c98b2cb 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2.h @@ -41,8 +41,7 @@ class FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - virtual ~FTNoIR_Filter(); - void Initialize() {} + void reset() {} void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position); @@ -73,9 +72,7 @@ class FilterControls: public QWidget, public IFilterDialog Q_OBJECT public: explicit FilterControls(); - virtual ~FilterControls(); void showEvent (QShowEvent *); - void Initialize(QWidget *parent); void registerFilter(IFilter* flt); void unregisterFilter(); diff --git a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp index c304eb0a..eb414340 100644 --- a/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp +++ b/ftnoir_filter_ewma2/ftnoir_filter_ewma2_dialog.cpp @@ -59,27 +59,6 @@ FilterControls::FilterControls() : loadSettings(); } -// -// Destructor for server-dialog -// -FilterControls::~FilterControls() { - qDebug() << "~FilterControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FilterControls::Initialize(QWidget *parent) { - // - // - // - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void FilterControls::registerFilter(IFilter* flt) { pFilter = (FTNoIR_Filter*) flt; diff --git a/ftnoir_filter_kalman/ftnoir_filter_kalman.h b/ftnoir_filter_kalman/ftnoir_filter_kalman.h index da6df2b1..9e0d817d 100644 --- a/ftnoir_filter_kalman/ftnoir_filter_kalman.h +++ b/ftnoir_filter_kalman/ftnoir_filter_kalman.h @@ -28,7 +28,7 @@ public: FTNoIR_Filter(); ~FTNoIR_Filter() virt_override { } - void Initialize() virt_override; + void reset() virt_override; void FilterHeadPoseData(const double *target_camera_position, double *new_camera_position) virt_override; cv::KalmanFilter kalman; @@ -68,16 +68,9 @@ public: connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); show(); } - ~FilterControls() {} void showEvent ( QShowEvent * ) virt_override { show(); } - - void Initialize(QWidget *) virt_override { - show(); - raise(); - } - bool settingsDirty; Ui::KalmanUICFilterControls ui; virtual void registerFilter(IFilter*) virt_override {} diff --git a/ftnoir_filter_kalman/kalman.cpp b/ftnoir_filter_kalman/kalman.cpp index 629cfcc8..743eb3d4 100644 --- a/ftnoir_filter_kalman/kalman.cpp +++ b/ftnoir_filter_kalman/kalman.cpp @@ -31,12 +31,12 @@ void kalman_save_settings(FilterControls&) { FTNoIR_Filter::FTNoIR_Filter() { kalman_load_settings(*this); - Initialize(); + reset(); } // the following was written by Donovan Baarda // https://sourceforge.net/p/facetracknoir/discussion/1150909/thread/418615e1/?limit=25#af75/084b -void FTNoIR_Filter::Initialize() { +void FTNoIR_Filter::reset() { const double accel_variance = 1e-3; const double noise_variance = 5e2; kalman.init(12, 6, 0, CV_64F); diff --git a/ftnoir_protocol_base/ftnoir_protocol_base.h b/ftnoir_protocol_base/ftnoir_protocol_base.h index e4ca1977..d2f85ec0 100644 --- a/ftnoir_protocol_base/ftnoir_protocol_base.h +++ b/ftnoir_protocol_base/ftnoir_protocol_base.h @@ -50,9 +50,6 @@ inline IProtocol::~IProtocol() { } struct IProtocolDialog { virtual ~IProtocolDialog() {} - virtual void Initialize(QWidget *parent) = 0; - virtual void showEvent ( QShowEvent * event ) = 0; - virtual void registerProtocol(IProtocol *protocol) = 0; virtual void unRegisterProtocol() = 0; }; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 9a4f304c..0a255d84 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -35,11 +35,8 @@ #include #include #include -#include #include "facetracknoir/global-settings.h" -#define FT_PROGRAMID "FT_ProgramID" - class FTNoIR_Protocol : public IProtocol { public: @@ -65,10 +62,6 @@ class FGControls: public QWidget, public IProtocolDialog public: explicit FGControls(); - virtual ~FGControls(); - void showEvent ( QShowEvent * event ); - - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp index 45123540..cb11ace6 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg_dialog.cpp @@ -63,25 +63,6 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FGControls::~FGControls() { - qDebug() << "~FGControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FGControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - // // OK clicked on server-dialog // @@ -90,11 +71,6 @@ void FGControls::doOK() { this->close(); } -// override show event -void FGControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - // // Cancel clicked on server-dialog // diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h index 87c6a3a4..9f5e3b6f 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.h @@ -83,9 +83,6 @@ class FSUIPCControls: public QWidget, public IProtocolDialog public: explicit FSUIPCControls(); - virtual ~FSUIPCControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp index 985915b4..b2f28ba1 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc_dialog.cpp @@ -48,41 +48,12 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FSUIPCControls::~FSUIPCControls() { - qDebug() << "~FSUIPCControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FSUIPCControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void FSUIPCControls::doOK() { save(); this->close(); } -// override show event -void FSUIPCControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} -// -// Cancel clicked on server-dialog -// void FSUIPCControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index e13d260f..56316ec4 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -93,9 +93,6 @@ class FTControls: public QWidget, public IProtocolDialog public: explicit FTControls(); - virtual ~FTControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index df13a6dc..0b29db6e 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -75,41 +75,11 @@ QWidget() } -// -// Destructor for server-dialog -// -FTControls::~FTControls() { - qDebug() << "~FTControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FTControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void FTControls::doOK() { save(); this->close(); } -// override show event -void FTControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void FTControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index 9aee73ac..acccc9e7 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -64,9 +64,6 @@ class FTNControls: public QWidget, public IProtocolDialog public: explicit FTNControls(); - virtual ~FTNControls(); - void showEvent (QShowEvent *); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp index 3b4e851c..72c30051 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn_dialog.cpp @@ -56,25 +56,6 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -FTNControls::~FTNControls() { - qDebug() << "~FTNControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void FTNControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - // // OK clicked on server-dialog // @@ -83,11 +64,6 @@ void FTNControls::doOK() { this->close(); } -// override show event -void FTNControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - // // Cancel clicked on server-dialog // diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h index aabd3e51..5df59919 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev.h @@ -41,10 +41,6 @@ class LibevdevControls: public QWidget, public IProtocolDialog public: explicit LibevdevControls(); - virtual ~LibevdevControls(); - void showEvent ( QShowEvent *) {} - - void Initialize(QWidget *); void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp index 6665a3d2..bb54c354 100644 --- a/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp +++ b/ftnoir_protocol_libevdev/ftnoir_protocol_libevdev_dialog.cpp @@ -8,21 +8,6 @@ LibevdevControls::LibevdevControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -LibevdevControls::~LibevdevControls() { -} - -// -// Initialize tracker-client-dialog -// -void LibevdevControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void LibevdevControls::doOK() { save(); this->close(); diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h index e17cabb5..7917c532 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h @@ -131,9 +131,6 @@ class SCControls: public QWidget, public IProtocolDialog public: explicit SCControls(); - virtual ~SCControls(); - void showEvent ( QShowEvent * event ); - void Initialize(QWidget *parent); void registerProtocol(IProtocol *protocol) { theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol } diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp index fb822145..eb15ca69 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc_dialog.cpp @@ -49,41 +49,11 @@ QWidget() loadSettings(); } -// -// Destructor for server-dialog -// -SCControls::~SCControls() { - qDebug() << "~SCControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void SCControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void SCControls::doOK() { save(); this->close(); } -// override show event -void SCControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void SCControls::doCancel() { // // Ask if changed Settings should be saved diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index c4db29e4..873b4e3c 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -60,10 +60,6 @@ class VJoyControls: public QWidget, public IProtocolDialog public: explicit VJoyControls(); - virtual ~VJoyControls(); - void showEvent ( QShowEvent *) {} - - void Initialize(QWidget *); void registerProtocol(IProtocol *l) {} void unRegisterProtocol() {} diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp index 0009553b..febb7b18 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp @@ -8,21 +8,6 @@ VJoyControls::VJoyControls() : QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); } -VJoyControls::~VJoyControls() { -} - -// -// Initialize tracker-client-dialog -// -void VJoyControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void VJoyControls::doOK() { save(); this->close(); diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.h b/ftnoir_protocol_wine/ftnoir_protocol_wine.h index d7276b8e..e84dbd69 100644 --- a/ftnoir_protocol_wine/ftnoir_protocol_wine.h +++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.h @@ -70,10 +70,7 @@ class FTControls: public QWidget, public IProtocolDialog { Q_OBJECT public: - FTControls(); - void showEvent ( QShowEvent * ) {show();} - void Initialize(QWidget *) {show();} void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp index 9408de02..a0a11ed2 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp @@ -99,47 +99,8 @@ static resolution_tuple resolution_choices[] = { { 0, 0 } }; -void Tracker::load_settings() +Tracker::Tracker() : stop(false), layout(nullptr), videoWidget(nullptr) { - QMutexLocker foo(&mtx); - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - iniFile.beginGroup( "aruco-Tracker" ); - fov = iniFile.value("fov", 56).toFloat(); - force_fps = iniFile.value("fps", 0).toInt(); - camera_index = iniFile.value("camera-index", -1).toInt(); - int res = iniFile.value("resolution", 0).toInt(); - if (res < 0 || res >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) - res = 0; - resolution_tuple r = resolution_choices[res]; - force_width = r.width; - force_height = r.height; - enableRX = iniFile.value("enable-rx", true).toBool(); - enableRY = iniFile.value("enable-ry", true).toBool(); - enableRZ = iniFile.value("enable-rz", true).toBool(); - enableTX = iniFile.value("enable-tx", true).toBool(); - enableTY = iniFile.value("enable-ty", true).toBool(); - enableTZ = iniFile.value("enable-tz", true).toBool(); - - for (int i = 0; i < 3; i++) - { - headpos[i] = iniFile.value(QString("headpos-%1").arg(i), 0).toDouble(); - } - headpitch = iniFile.value("pitch", 0).toDouble(); - red_only = iniFile.value("red-only", true).toBool(); - - iniFile.endGroup(); -} - -Tracker::Tracker() -{ - layout = nullptr; - stop = false; - videoWidget = NULL; - enableRX = enableRY = enableRZ = enableTX = enableTY = enableTZ = true; - load_settings(); } Tracker::~Tracker() @@ -166,7 +127,6 @@ void Tracker::StartTracker(QFrame* videoframe) delete videoframe->layout(); videoframe->setLayout(layout); videoWidget->show(); - load_settings(); start(); for (int i = 0; i < 6; i++) pose[i] = 0; @@ -177,13 +137,35 @@ void Tracker::StartTracker(QFrame* videoframe) void Tracker::run() { - camera = cv::VideoCapture(camera_index); - if (force_width) - camera.set(CV_CAP_PROP_FRAME_WIDTH, force_width); - if (force_height) - camera.set(CV_CAP_PROP_FRAME_HEIGHT, force_height); - if (force_fps) - camera.set(CV_CAP_PROP_FPS, force_fps); + int res = s.resolution; + if (res < 0 || res >= (int)(sizeof(resolution_choices) / sizeof(resolution_tuple))) + res = 0; + resolution_tuple r = resolution_choices[res]; + int fps; + switch (static_cast(s.force_fps)) + { + default: + case 0: + fps = 0; + break; + case 30: + fps = 1; + break; + case 60: + fps = 2; + break; + case 120: + fps = 3; + break; + } + camera = cv::VideoCapture(s.camera_index); + if (r.width) + { + camera.set(CV_CAP_PROP_FRAME_WIDTH, r.width); + camera.set(CV_CAP_PROP_FRAME_HEIGHT, r.height); + } + if (fps) + camera.set(CV_CAP_PROP_FPS, fps); aruco::MarkerDetector detector; detector.setDesiredSpeed(3); @@ -206,7 +188,7 @@ void Tracker::run() auto freq = cv::getTickFrequency(); auto last_time = cv::getTickCount(); - int fps = 0; + int cur_fps = 0; int last_fps = 0; cv::Point2f last_centroid; @@ -216,7 +198,7 @@ void Tracker::run() continue; auto tm = cv::getTickCount(); color_.copyTo(color); - if (red_only) + if (s.red_only) { cv::Mat channel[3]; cv::split(color, channel); @@ -227,8 +209,8 @@ void Tracker::run() const int scale = frame.cols > 480 ? 2 : 1; detector.setThresholdParams(scale > 1 ? 11 : 7, 4); - const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * fov * HT_PI / 180); - const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); + const float focal_length_w = 0.5 * grayscale.cols / tan(0.5 * s.fov * HT_PI / 180); + const float focal_length_h = 0.5 * grayscale.rows / tan(0.5 * s.fov * grayscale.rows / grayscale.cols * HT_PI / 180.0); cv::Mat intrinsics = cv::Mat::eye(3, 3, CV_32FC1); intrinsics.at (0, 0) = focal_length_w; intrinsics.at (1, 1) = focal_length_h; @@ -275,12 +257,12 @@ void Tracker::run() if ((long) (time / freq) != (long) (last_time / freq)) { - last_fps = fps; - fps = 0; + last_fps = cur_fps; + cur_fps = 0; last_time = time; } - fps++; + cur_fps++; char buf[128]; @@ -296,18 +278,18 @@ void Tracker::run() const float size = 7; cv::Mat obj_points(4,3,CV_32FC1); - obj_points.at(1,0)=-size + headpos[0]; - obj_points.at(1,1)=-size + headpos[1]; - obj_points.at(1,2)=0 + headpos[2]; - obj_points.at(2,0)=size + headpos[0]; - obj_points.at(2,1)=-size + headpos[1]; - obj_points.at(2,2)=0 + headpos[2]; - obj_points.at(3,0)=size + headpos[0]; - obj_points.at(3,1)=size + headpos[1]; - obj_points.at(3,2)=0 + headpos[2]; - obj_points.at(0,0)=-size + headpos[0]; - obj_points.at(0,1)=size + headpos[1]; - obj_points.at(0,2)=0 + headpos[2]; + obj_points.at(1,0)=-size + s.headpos_x; + obj_points.at(1,1)=-size + s.headpos_y; + obj_points.at(1,2)=0 + s.headpos_z; + obj_points.at(2,0)=size + s.headpos_x; + obj_points.at(2,1)=-size + s.headpos_y; + obj_points.at(2,2)=0 + s.headpos_z; + obj_points.at(3,0)=size + s.headpos_x; + obj_points.at(3,1)=size + s.headpos_y; + obj_points.at(3,2)=0 + s.headpos_z; + obj_points.at(0,0)=-size + s.headpos_x; + obj_points.at(0,1)=size + s.headpos_y; + obj_points.at(0,2)=0 + s.headpos_z; last_roi = cv::Rect(65535, 65535, 0, 0); @@ -341,22 +323,12 @@ void Tracker::run() cv::Rodrigues(rvec, rotation_matrix); { - const double beta = headpitch * HT_PI / 180; - double pitch[] = { - 1, 0, 0, - 0, cos(beta), -sin(beta), - 0, sin(beta), cos(beta) - }; - cv::Mat rot(3, 3, CV_64F, pitch); - cv::Mat tvec2 = rot * tvec; - rotation_matrix = rot * rotation_matrix; - cv::Vec3d euler = cv::RQDecomp3x3(rotation_matrix, junk1, junk2); QMutexLocker lck(&mtx); for (int i = 0; i < 3; i++) - pose[i] = tvec2.at(i); + pose[i] = tvec.at(i); pose[Yaw] = euler[1]; pose[Pitch] = -euler[0]; @@ -389,17 +361,17 @@ void Tracker::GetHeadPoseData(double *data) { QMutexLocker lck(&mtx); - if (enableRX) + if (s.eyaw) data[Yaw] = pose[Yaw]; - if (enableRY) + if (s.epitch) data[Pitch] = pose[Pitch]; - if (enableRZ) + if (s.eroll) data[Roll] = pose[Roll]; - if (enableTX) + if (s.ex) data[TX] = pose[TX]; - if (enableTY) + if (s.ey) data[TY] = pose[TY]; - if (enableTZ) + if (s.ez) data[TZ] = pose[TZ]; } @@ -468,178 +440,49 @@ TrackerControls::TrackerControls() tracker = nullptr; ui.setupUi(this); setAttribute(Qt::WA_NativeWindow, true); - connect(ui.cameraName, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cameraFPS, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cameraFOV, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.rx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.ry, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.rz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.tx, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.ty, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.tz, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int))); - connect(ui.cx, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.cy, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - connect(ui.cz, SIGNAL(valueChanged(double)), this, SLOT(settingChanged(double))); - //connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - //connect(ui.buttonOK, SIGNAL(clicked()), this, SLOT(doOK())); - //connect(ui.buttonSettings, SIGNAL(clicked()), this, SLOT(cameraSettings())); + tie_setting(s.camera_index, ui.cameraName); + tie_setting(s.force_fps, ui.cameraFPS); + tie_setting(s.fov, ui.cameraFOV); + tie_setting(s.eyaw, ui.rx); + tie_setting(s.epitch, ui.ry); + tie_setting(s.eroll, ui.rz); + tie_setting(s.ex, ui.tx); + tie_setting(s.ey, ui.ty); + tie_setting(s.ez, ui.tz); + tie_setting(s.headpos_x, ui.cx); + tie_setting(s.headpos_y, ui.cy); + tie_setting(s.headpos_z, ui.cz); + tie_setting(s.red_only, ui.red_only); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - loadSettings(); - settingsDirty = false; -} - -TrackerControls::~TrackerControls() -{ -} - -void TrackerControls::showEvent(QShowEvent *) -{ -} - -void TrackerControls::Initialize(QWidget*) -{ - loadSettings(); - show(); -} - -void TrackerControls::loadSettings() -{ - ui.cameraName->clear(); - QList names = get_camera_names(); - names.prepend("Any available"); - ui.cameraName->addItems(names); - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - iniFile.beginGroup( "aruco-Tracker" ); - ui.cameraName->setCurrentIndex(iniFile.value("camera-index", -1).toInt() + 1); - ui.cameraFOV->setValue(iniFile.value("fov", 56).toFloat()); - int fps; - switch (iniFile.value("fps", 0).toInt()) - { - default: - case 0: - fps = 0; - break; - case 30: - fps = 1; - break; - case 60: - fps = 2; - break; - case 120: - fps = 3; - break; - } - ui.cameraFPS->setCurrentIndex(fps); - ui.rx->setCheckState(iniFile.value("enable-rx", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.ry->setCheckState(iniFile.value("enable-ry", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.rz->setCheckState(iniFile.value("enable-rz", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.tx->setCheckState(iniFile.value("enable-tx", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.ty->setCheckState(iniFile.value("enable-ty", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.tz->setCheckState(iniFile.value("enable-tz", true).toBool() ? Qt::Checked : Qt::Unchecked); - ui.resolution->setCurrentIndex(iniFile.value("resolution", 0).toInt()); - - QDoubleSpinBox* headpos[] = { - ui.cx, - ui.cy, - ui.cz - }; - - for (int i = 0; i < 3; i++) - { - headpos[i]->setValue(iniFile.value(QString("headpos-%1").arg(i)).toDouble()); - } - - ui.pitch_deg->setValue(iniFile.value("pitch", 0).toDouble()); - ui.red_only->setChecked(iniFile.value("red-only", true).toBool()); - iniFile.endGroup(); - settingsDirty = false; -} - -void TrackerControls::save() -{ - QSettings settings("opentrack"); - QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); - - iniFile.beginGroup( "aruco-Tracker" ); - iniFile.setValue("fov", ui.cameraFOV->value()); - int fps; - switch (ui.cameraFPS->currentIndex()) - { - case 0: - default: - fps = 0; - break; - case 1: - fps = 30; - break; - case 2: - fps = 60; - break; - case 3: - fps = 120; - break; - } - iniFile.setValue("fps", fps); - iniFile.setValue("camera-index", ui.cameraName->currentIndex() - 1); - iniFile.setValue("enable-rx", ui.rx->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-ry", ui.ry->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-rz", ui.rz->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-tx", ui.tx->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-ty", ui.ty->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("enable-tz", ui.tz->checkState() != Qt::Unchecked ? true : false); - iniFile.setValue("resolution", ui.resolution->currentIndex()); - iniFile.setValue("pitch", ui.pitch_deg->value()); - - QDoubleSpinBox* headpos[] = { - ui.cx, - ui.cy, - ui.cz - }; - - for (int i = 0; i < 3; i++) - { - iniFile.setValue(QString("headpos-%1").arg(i), headpos[i]->value()); - } - iniFile.setValue("red-only", ui.red_only->isChecked()); - iniFile.endGroup(); - settingsDirty = false; - if (tracker) - tracker->load_settings(); + ui.cameraName->addItems(get_camera_names()); } void TrackerControls::doOK() { - save(); + s.b->save(); this->close(); } void TrackerControls::doCancel() { - if (settingsDirty) { + if (s.b->modifiedp()) { int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", - QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, - QMessageBox::Discard ); + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); switch (ret) { case QMessageBox::Save: - save(); + s.b->save(); this->close(); break; case QMessageBox::Discard: + s.b->revert(); this->close(); break; case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; + break; } } else { diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h index 545ad5d0..23598f4d 100644 --- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h +++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h @@ -18,6 +18,33 @@ #include #include #include +#include "facetracknoir/options.hpp" +using namespace options; + +struct settings { + pbundle b; + value fov, headpos_x, headpos_y, headpos_z; + value camera_index, force_fps, resolution; + value red_only; + value eyaw, epitch, eroll, ex, ey, ez; + settings() : + b(bundle("aruco-tracker")), + fov(b, "field-of-view", 56), + headpos_x(b, "headpos-x", 0), + headpos_y(b, "headpos-y", 0), + headpos_z(b, "headpos-z", 0), + camera_index(b, "camera-index", 0), + force_fps(b, "force-fps", 0), + resolution(b, "force-resolution", 0), + red_only(b, "red-only", false), + eyaw(b, "enable-y", true), + epitch(b, "enable-p", true), + eroll(b, "enable-r", true), + ex(b, "enable-x", true), + ey(b, "enable-y", true), + ez(b, "enable-z", true) + {} +}; class Tracker : protected QThread, public ITracker { @@ -27,22 +54,16 @@ public: virtual ~Tracker(); void StartTracker(QFrame* frame); void GetHeadPoseData(double *data); - bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ; void run(); - void load_settings(); private: QMutex mtx; - ArucoVideoWidget* videoWidget; - QHBoxLayout* layout; volatile bool stop; - float fov; - int camera_index; - int force_fps, force_width, force_height; + QHBoxLayout* layout; + ArucoVideoWidget* videoWidget; + settings s; double pose[6]; cv::Mat frame; - double headpos[3], headpitch; cv::VideoCapture camera; - volatile bool red_only; }; // Widget that has controls for FTNoIR protocol client-settings. @@ -50,32 +71,20 @@ class TrackerControls : public QWidget, public ITrackerDialog { Q_OBJECT public: - - explicit TrackerControls(); - virtual ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *); + TrackerControls(); void registerTracker(ITracker * x) { tracker = dynamic_cast(x); } void unRegisterTracker() { tracker = nullptr; } - private: Ui::Form ui; - void loadSettings(); - void save(); - bool settingsDirty; Tracker* tracker; - + settings s; private slots: void doOK(); void doCancel(); - void settingChanged() { settingsDirty = true; } - void settingChanged(int) { settingsDirty = true; } - void settingChanged(double) { settingsDirty = true; } }; #endif diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h index 16f76cf3..b8e16e9d 100644 --- a/ftnoir_tracker_base/ftnoir_tracker_base.h +++ b/ftnoir_tracker_base/ftnoir_tracker_base.h @@ -58,8 +58,7 @@ inline ITracker::~ITracker() { } struct ITrackerDialog { virtual ~ITrackerDialog() {} - virtual void Initialize(QWidget *parent) = 0; - virtual void registerTracker(ITracker *tracker) = 0; + virtual void registerTracker(ITracker *tracker) = 0; virtual void unRegisterTracker() = 0; }; diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index 3547dd6b..6fef2db0 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -403,7 +403,6 @@ void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) CptError=0; return; } -#ifdef OPENTRACK_API data[frame_cnt] = (long) HAT.Code; struct Fun { @@ -446,39 +445,6 @@ void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) if (settings.InvertZ) data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]* -1.0f; else data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]; } -#else - data->frame_number = (long) HAT.Code; - - if (bEnableYaw) { - if (bInvertYaw ) data->yaw = (double) HAT.Rot[iYawAxe] * -1.0f; - else data->yaw = (double) HAT.Rot[iYawAxe]; - } - - if (bEnablePitch) { - if (bInvertPitch)data->pitch = (double) HAT.Rot[iPitchAxe] * -1.0f; - else data->pitch = (double) HAT.Rot[iPitchAxe]; - } - - if (bEnableRoll) { - if (bInvertRoll) data->roll = (double) HAT.Rot[iRollAxe] * -1.0f; - else data->roll = (double) HAT.Rot[iRollAxe]; - } - - if (bEnableX) { - if (bInvertX) data->x = (double) HAT.Trans[iXAxe]* -1.0f; - else data->x = (double) HAT.Trans[iXAxe]; - } - - if (bEnableY) { - if (bInvertY) data->y = (double) HAT.Trans[iYAxe]* -1.0f; - else data->y = (double) HAT.Trans[iYAxe]; - } - - if (bEnableZ) { - if (bInvertZ) data->z = (double) HAT.Trans[iZAxe]* -1.0f; - else data->z = (double) HAT.Trans[iZAxe]; - } -#endif } void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index a4243c38..57ead58d 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -27,15 +27,8 @@ public: FTNoIR_Tracker(); ~FTNoIR_Tracker(); -#ifdef OPENTRACK_API virtual void StartTracker(QFrame*); virtual void GetHeadPoseData(double* data); -#else - void Initialize( QFrame *videoframe ); - virtual void StartTracker(HWND parent_window); - virtual void StopTracker(bool exit); - virtual bool GetHeadPoseData(THeadPoseData *data); -#endif void applysettings(const TrackerSettings& settings); void notifyCenter(); bool notifyZeroed(); diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index 0ef723c9..2ef75b89 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -146,24 +146,6 @@ TrackerControls::TrackerControls() : theTracker(NULL), timer(this) connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); } -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { -} - -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - - // // Center asked to ARDUINO // diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h index 82c69e0d..fe16e5e8 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h @@ -21,8 +21,6 @@ class TrackerControls: public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - virtual ~TrackerControls(); - void Initialize(QWidget *parent) virt_override; void registerTracker(ITracker *tracker) virt_override; void unRegisterTracker() virt_override; private: @@ -30,7 +28,7 @@ private: FTNoIR_Tracker *theTracker; QTime last_time; -public slots: +public slots: void WriteMsgInfo(const QByteArray &MsgInfo); protected slots: diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp index e154557e..1773b018 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp @@ -275,11 +275,6 @@ TrackerControls::TrackerControls() connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); } -void TrackerControls::Initialize(QWidget*) -{ - show(); -} - void TrackerControls::doOK() { s.b->save(); diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index f45e54f9..b3c89136 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -62,7 +62,6 @@ class TrackerControls : public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - void Initialize(QWidget *); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h index 16629c3a..8d91dfbb 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.h @@ -45,7 +45,6 @@ class TrackerControls: public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} private: diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp index e92180a3..4a2deb9f 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra_dialog.cpp @@ -18,15 +18,6 @@ QWidget() tie_setting(s.bEnableZ, ui.chkEnableZ); } -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { s.b->save(); this->close(); diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 9c856d85..67291e6f 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -62,11 +62,7 @@ class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: - explicit TrackerControls(); - ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *parent); + TrackerControls(); void registerTracker(ITracker *foo) { tracker = dynamic_cast(foo); } diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp index af3613d9..42ca8689 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick_dialog.cpp @@ -50,29 +50,11 @@ fin: loadSettings(); } -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { -} - -void TrackerControls::Initialize(QWidget *parent) { - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { save(); this->close(); } -void TrackerControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - void TrackerControls::doCancel() { if (settingsDirty) { int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index e10db0bf..b548db71 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -26,8 +26,6 @@ Rift_Tracker::~Rift_Tracker() System::Destroy(); } - - void Rift_Tracker::StartTracker(QFrame*) { System::Init(Log::ConfigureDefaultLog(LogMask_All)); diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 80bf6ffa..b1f96bf2 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -55,7 +55,6 @@ class TrackerControls: public QWidget, public ITrackerDialog public: explicit TrackerControls(); - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 5487da92..763ddd11 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -20,15 +20,6 @@ QWidget() tie_setting(s.useYawSpring, ui.yawSpring); } -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - void TrackerControls::doOK() { s.b->save(); this->close(); diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index c7e9decf..7157f064 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -49,9 +49,6 @@ public: explicit TrackerControls(); ~TrackerControls(); - void showEvent (QShowEvent *); - - void Initialize(QWidget *parent); void registerTracker(ITracker *) {} void unRegisterTracker() {} diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp index e17d5c32..707abf37 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp_dialog.cpp @@ -60,34 +60,11 @@ TrackerControls::~TrackerControls() { qDebug() << "~TrackerControls() says: started"; } -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(100, 100); - if (parent) { - this->move(parent->pos() + offsetpos); - } - show(); -} - -// -// OK clicked on server-dialog -// void TrackerControls::doOK() { save(); this->close(); } -// override show event -void TrackerControls::showEvent ( QShowEvent * ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// void TrackerControls::doCancel() { // // Ask if changed Settings should be saved -- cgit v1.2.3 From 4abd0ca3b5090018a7db05e8c2e0f478d861d978 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 31 Dec 2013 15:52:50 +0100 Subject: ft: use settings framework --- ftnoir_protocol_ft/ftnoir_protocol_ft.cpp | 102 +++--------- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 100 +++++------- ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp | 194 ++++++++--------------- ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp | 18 +-- 4 files changed, 124 insertions(+), 290 deletions(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp index 84d1d20b..5c086c10 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp @@ -24,78 +24,30 @@ * FTServer FTServer is the Class, that communicates headpose-data * * to games, using the FreeTrackClient.dll. * ********************************************************************************/ -#include #include "ftnoir_protocol_ft.h" #include "ftnoir_csv/csv.h" -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() : shm(FT_MM_DATA, FREETRACK_MUTEX, sizeof(FTMemMap)) { pMemData = (FTMemMap*) shm.mem; - useTIRViews = false; - useDummyExe = false; - intUsedInterface = 0; - - loadSettings(); - - ProgramName = ""; - intGameID = 0; - - viewsStart = 0; - viewsStop = 0; + ProgramName = ""; + intGameID = 0; + viewsStart = 0; + viewsStop = 0; } -/** destructor **/ FTNoIR_Protocol::~FTNoIR_Protocol() { - - qDebug()<< "~FTNoIR_Protocol: Destructor started."; - - // - // Stop if started - // - if (viewsStop != NULL) { - qDebug()<< "~FTNoIR_Protocol: Stopping TIRViews."; - viewsStop(); - FTIRViewsLib.unload(); - } - dummyTrackIR.terminate(); + if (viewsStop != NULL) { + viewsStop(); + FTIRViewsLib.unload(); + } + dummyTrackIR.terminate(); dummyTrackIR.kill(); dummyTrackIR.waitForFinished(50); - } -// -// Read the game-data from CSV -// - - -// -// Load the current Settings from the currently 'active' INI-file. -// -void FTNoIR_Protocol::loadSettings() { - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - iniFile.beginGroup ( "FT" ); - intUsedInterface = iniFile.value ( "UsedInterface", 0 ).toInt(); - iniFile.endGroup (); - - // - // Use the settings-section from the deprecated fake-TIR protocol, as they are most likely to be found there. - // - iniFile.beginGroup ( "FTIR" ); - useTIRViews = iniFile.value ( "useTIRViews", 0 ).toBool(); - useDummyExe = iniFile.value ( "useDummyExe", 0 ).toBool(); - iniFile.endGroup (); -} - -// -// Update Headpose in Game. -// void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { float virtPosX; float virtPosY; @@ -112,7 +64,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { float headRotX; float headRotY; float headRotZ; - headRotX = virtRotX = getRadsFromDegrees(headpose[Pitch]) * (useDummyExe ? 2.0 : 1.0); + headRotX = virtRotX = getRadsFromDegrees(headpose[Pitch]) * (s.useDummyExe ? 2.0 : 1.0); headRotY = virtRotY = getRadsFromDegrees(headpose[Yaw]); headRotZ = virtRotZ = getRadsFromDegrees(headpose[Roll]); headPosX = virtPosX = headpose[TX] * 10; @@ -149,13 +101,6 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { pMemData->data.Y3 = 0; pMemData->data.Y4 = 0; - // - // Check if the handle that was sent to the Game, was changed (on x64, this will be done by the ED-API) - // If the "Report Program Name" command arrives (which is a '1', for now), raise the event from here! - // - // - // The game-ID was changed? - // if (intGameID != pMemData->GameID) { QString gamename; @@ -167,8 +112,7 @@ void FTNoIR_Protocol::sendHeadposeToGame(const double* headpose) { } pMemData->data.DataID += 1; - - shm.unlock(); + shm.unlock(); } void FTNoIR_Protocol::start_tirviews() { @@ -212,6 +156,10 @@ bool FTNoIR_Protocol::checkServerInstallationOK() QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) QString aLocation; // Location of Client DLL + + if (!shm.success()) + return false; + qDebug() << "checkServerInstallationOK says: Starting Function"; // @@ -219,8 +167,8 @@ bool FTNoIR_Protocol::checkServerInstallationOK() // aLocation = QCoreApplication::applicationDirPath() + "/"; - qDebug() << "checkServerInstallationOK says: used interface = " << intUsedInterface; - switch (intUsedInterface) { + qDebug() << "checkServerInstallationOK says: used interface = " << s.intUsedInterface; + switch (s.intUsedInterface) { case 0: // Use both interfaces settings.setValue( "Path" , aLocation ); settingsTIR.setValue( "Path" , aLocation ); @@ -241,20 +189,17 @@ bool FTNoIR_Protocol::checkServerInstallationOK() // // TIRViews must be started first, or the NPClient DLL will never be loaded. // - if (useTIRViews) { + if (s.useTIRViews) { start_tirviews(); } // // Check if TIRViews or dummy TrackIR.exe is required for this game // - if (useDummyExe) { + if (s.useDummyExe) { start_dummy(); } - if (!shm.success()) - return false; - pMemData->data.DataID = 1; pMemData->data.CamWidth = 100; pMemData->data.CamHeight = 250; @@ -264,15 +209,6 @@ bool FTNoIR_Protocol::checkServerInstallationOK() return true; } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol object. - -// Export both decorated and undecorated names. -// GetProtocol - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocol@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0") - extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 56316ec4..8f27b071 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -25,9 +25,6 @@ * to games, using the FreeTrackClient.dll. * ********************************************************************************/ #pragma once -#ifndef INCLUDED_FTSERVER_H -#define INCLUDED_FTSERVER_H - #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ui_ftnoir_ftcontrols.h" #include "facetracknoir/global-settings.h" @@ -43,7 +40,20 @@ #include #include #include "compat/compat.h" -//#include "math.h" +#include "facetracknoir/options.h" +using namespace options; + +struct settings { + pbundle b; + value intUsedInterface; + value useTIRViews, useDummyExe; + settings() : + b(bundle("proto-freetrack")), + intUsedInterface(b, "used-interfaces", 0), + useTIRViews(b, "use-memory-hacks", false), + useDummyExe(b, "ezca-mode", false) + {} +}; //typedef char *(WINAPI *importProvider)(void); typedef void (WINAPI *importTIRViewsStart)(void); @@ -52,87 +62,59 @@ typedef void (WINAPI *importTIRViewsStop)(void); class FTNoIR_Protocol : public IProtocol { public: - FTNoIR_Protocol(); + FTNoIR_Protocol(); virtual ~FTNoIR_Protocol(); - bool checkServerInstallationOK( ); + bool checkServerInstallationOK( ); void sendHeadposeToGame( const double *headpose ); QString getGameName() { QMutexLocker foo(&game_name_mutex); return connected_game; } - private: - importTIRViewsStart viewsStart; // Functions inside TIRViews.dll - importTIRViewsStop viewsStop; + importTIRViewsStart viewsStart; // Functions inside TIRViews.dll + importTIRViewsStop viewsStop; - FTMemMap *pMemData; + FTMemMap *pMemData; QString game_name; PortableLockedShm shm; - // Private properties - QString ProgramName; - QLibrary FTIRViewsLib; - QProcess dummyTrackIR; - int intGameID; - int intUsedInterface; // Determine which interface to use (or to hide from the game) - bool useTIRViews; // Needs to be in the Settings dialog - bool useDummyExe; - float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); } - void loadSettings(); + // Private properties + QString ProgramName; + QLibrary FTIRViewsLib; + QProcess dummyTrackIR; + static inline double getRadsFromDegrees ( double degrees ) + { + return degrees * 0.017453; + } + int intGameID; void start_tirviews(); void start_dummy(); - QString connected_game; QMutex game_name_mutex; + settings s; }; -// Widget that has controls for FTNoIR protocol client-settings. class FTControls: public QWidget, public IProtocolDialog { Q_OBJECT public: - - explicit FTControls(); - void registerProtocol(IProtocol *protocol) { - theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol - } - void unRegisterProtocol() { - theProtocol = NULL; // Reset the pointer - } - + explicit FTControls(); + void registerProtocol(IProtocol *protocol) {} + void unRegisterProtocol() {} private: - Ui::UICFTControls ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - FTNoIR_Protocol *theProtocol; - + Ui::UICFTControls ui; + settings s; private slots: - void selectDLL(); - void doOK(); - void doCancel(); - void settingChanged() { settingsDirty = true; } - void settingChanged(int) { settingsDirty = true; } + void selectDLL(); + void doOK(); + void doCancel(); }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: - FTNoIR_ProtocolDll(); - ~FTNoIR_ProtocolDll(); - - 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"); } + 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"); } }; - - -#endif//INCLUDED_FTSERVER_H -//END diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp index 0b29db6e..b414561d 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp @@ -34,155 +34,87 @@ // Constructor for server-settings-dialog // FTControls::FTControls() : -QWidget() + QWidget() { - QString aFileName; // File Path and Name + QString aFileName; // File Path and Name - ui.setupUi( this ); + ui.setupUi( this ); - // Connect Qt signals to member-functions + // Connect Qt signals to member-functions connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL())); - connect(ui.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(settingChanged())); - connect(ui.chkStartDummy, SIGNAL(stateChanged(int)), this, SLOT(settingChanged())); - connect(ui.cbxSelectInterface, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int ))); - - ui.cbxSelectInterface->addItem("Enable both"); - ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR"); - ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack"); - - theProtocol = NULL; - - // Load the settings from the current .INI-file - loadSettings(); - - - aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll"; - if ( !QFile::exists( aFileName ) ) { - ui.chkTIRViews->setChecked( false ); - ui.chkTIRViews->setEnabled ( false ); - - // - // Best do this save() last, or it will continually reset the settings... :-( - // - save(); - } - else { - ui.chkTIRViews->setEnabled ( true ); - } - - + connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL())); + + tie_setting(s.intUsedInterface, ui.cbxSelectInterface); + tie_setting(s.useDummyExe, ui.chkStartDummy); + tie_setting(s.useTIRViews, ui.chkTIRViews); + + ui.cbxSelectInterface->addItem("Enable both"); + ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR"); + ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack"); + + aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll"; + if ( !QFile::exists( aFileName ) ) { + ui.chkTIRViews->setChecked( false ); + ui.chkTIRViews->setEnabled ( false ); + } + else { + ui.chkTIRViews->setEnabled ( true ); + } } void FTControls::doOK() { - save(); - this->close(); + s.b->save(); + this->close(); } void FTControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void FTControls::loadSettings() { - qDebug() << "loadSettings says: Starting "; - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - qDebug() << "loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "FT" ); - ui.cbxSelectInterface->setCurrentIndex( iniFile.value ( "UsedInterface", 0 ).toInt() ); - iniFile.endGroup (); - - iniFile.beginGroup ( "FTIR" ); - ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool()); - ui.chkStartDummy->setChecked (iniFile.value ( "useDummyExe", 0 ).toBool()); - iniFile.endGroup (); - - settingsDirty = false; -} - -// -// Save the current Settings to the currently 'active' INI-file. -// -void FTControls::save() { - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - iniFile.beginGroup ( "FT" ); - iniFile.setValue ( "UsedInterface", ui.cbxSelectInterface->currentIndex()); - iniFile.endGroup (); - - iniFile.beginGroup ( "FTIR" ); - iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() ); - iniFile.setValue ( "useDummyExe", ui.chkStartDummy->isChecked() ); - iniFile.endGroup (); - - settingsDirty = false; + // + // Ask if changed Settings should be saved + // + if (s.b->modifiedp()) { + int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + + qDebug() << "doCancel says: answer =" << ret; + + switch (ret) { + case QMessageBox::Save: + s.b->save(); + this->close(); + break; + case QMessageBox::Discard: + s.b->revert(); + this->close(); + break; + case QMessageBox::Cancel: + // Cancel was clicked + break; + default: + // should never be reached + break; + } + } + else { + this->close(); + } } -// -// Select a NPClient.dll file, to repair the Location in the Registry. -// Several program distribute their own version of this file. -// void FTControls::selectDLL() { QString fileName = QFileDialog::getOpenFileName( this, tr("Select the desired NPClient DLL"), QCoreApplication::applicationDirPath() + "/NPClient.dll", tr("Dll file (*.dll);;All Files (*)")); - // - // Write the location of the file in the required Registry-key. - // - if (! fileName.isEmpty() ) { - if (fileName.endsWith("NPClient.dll", Qt::CaseInsensitive) ) { - QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) - QString aLocation = fileName.left(fileName.length() - 12); // Location of Client DLL - - settingsTIR.setValue( "Path" , aLocation ); - } - } + // + // Write the location of the file in the required Registry-key. + // + if (! fileName.isEmpty() ) { + if (fileName.endsWith("NPClient.dll", Qt::CaseInsensitive) ) { + QSettings settingsTIR("NaturalPoint", "NATURALPOINT\\NPClient Location"); // Registry settings (in HK_USER) + QString aLocation = fileName.left(fileName.length() - 12); // Location of Client DLL + + settingsTIR.setValue( "Path" , aLocation ); + } + } } - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol-settings dialog object. - -// Export both decorated and undecorated names. -// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language. extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( ) { return new FTControls; diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp index f4e4a40e..38f11211 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp @@ -23,24 +23,8 @@ * * ********************************************************************************/ #include "ftnoir_protocol_ft.h" -#include -FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { -} - -FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() -{ - -} - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol object. - -// Export both decorated and undecorated names. -// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language. extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; -} \ No newline at end of file +} -- cgit v1.2.3 From 698b9f80810861693183e7a0fd2899560c741bd5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 15 Jan 2014 19:01:18 +0100 Subject: remove harmless warning --- ftnoir_protocol_ft/ftnoir_protocol_ft.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ftnoir_protocol_ft/ftnoir_protocol_ft.h') diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h index 8f27b071..0af9ff07 100644 --- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h +++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h @@ -99,7 +99,7 @@ class FTControls: public QWidget, public IProtocolDialog Q_OBJECT public: explicit FTControls(); - void registerProtocol(IProtocol *protocol) {} + void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} private: Ui::UICFTControls ui; -- cgit v1.2.3