summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/FaceTrackNoIR.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-04-15 17:21:31 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-04-15 17:21:31 +0000
commitf79e3f588e8bb112420da3a3912ee83dc28370c7 (patch)
treeaaca2b9bdfeef403a6ff3fac01de9c342eaf8441 /FaceTrackNoIR/FaceTrackNoIR.cpp
parenta2aae5ea082bf0075f76ca79443de4348cb74f3f (diff)
6DOF
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@75 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/FaceTrackNoIR.cpp')
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp142
1 files changed, 53 insertions, 89 deletions
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index 49a6aab2..8646c248 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -31,12 +31,6 @@
*/
#include "FaceTrackNoIR.h"
#include "tracker.h"
-//#include "PPJoyServer.h"
-#include "FSUIPCServer.h"
-//#include "FTIRServer.h"
-//#include "FGServer.h"
-#include "FTNServer.h"
-
//
// Setup the Main Dialog
@@ -50,7 +44,6 @@ QMainWindow(parent, flags)
// Initialize Widget handles, to prevent memory-access errors.
//
_engine_controls = 0;
- _server_controls = 0;
_keyboard_shortcuts = 0;
_preferences = 0;
_keyboard_shortcuts = 0;
@@ -160,6 +153,8 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
//Setup the timer for showing the headpose.
timUpdateHeadPose = new QTimer(this);
connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose()));
+ ui.txtTracking->setVisible(false);
+ ui.txtAxisReverse->setVisible(false);
}
/** destructor stops the engine and quits the faceapi **/
@@ -593,6 +588,8 @@ void FaceTrackNoIR::stopTracker( ) {
ui.lcdNumOutputRotX->setVisible(false);
ui.lcdNumOutputRotY->setVisible(false);
ui.lcdNumOutputRotZ->setVisible(false);
+ ui.txtTracking->setVisible(false);
+ ui.txtAxisReverse->setVisible(false);
//
// Delete the tracker (after stopping things and all).
@@ -689,6 +686,9 @@ THeadPoseData newdata;
ui.lcdNumRotY->display((double) (((int)(newdata.pitch * 10.0f))/10.0f));
ui.lcdNumRotZ->display((double) (((int)(newdata.roll * 10.0f))/10.0f));
+ ui.txtTracking->setVisible(Tracker::getTrackingActive());
+ ui.txtAxisReverse->setVisible(Tracker::getAxisReverse());
+
//
// Get the output-pose and also display it.
//
@@ -816,104 +816,68 @@ QLibrary *trackerLib;
void FaceTrackNoIR::showServerControls() {
importGetProtocolDialog getIT;
QLibrary *protocolLib;
-
+QString libName;
//
// Delete the existing QDialog
//
- if (_server_controls) {
- delete _server_controls;
- _server_controls = 0;
+ if (pProtocolDialog) {
+ pProtocolDialog.Release();
}
- // Create if new
- if (!_server_controls)
- {
+ // Show the appropriate Protocol-server Settings
+ libName.clear();
+ switch (ui.iconcomboBox->currentIndex()) {
+ case FREE_TRACK:
+ case SIMCONNECT:
+ break;
- // Show the appropriate Protocol-server Settings
- switch (ui.iconcomboBox->currentIndex()) {
- case FREE_TRACK:
- case SIMCONNECT:
- break;
+ case PPJOY:
+ libName = QString("FTNoIR_Protocol_PPJOY.dll");
+ break;
- case PPJOY:
- protocolLib = new QLibrary("FTNoIR_Protocol_PPJOY.dll");
+ case FSUIPC:
+ libName = QString("FTNoIR_Protocol_FSUIPC.dll");
+ break;
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
+ case TRACKIR:
+ libName = QString("FTNoIR_Protocol_FTIR.dll");
+ break;
- case FSUIPC:
- _server_controls = new FSUIPCControls( this, Qt::Dialog );
- break;
- case TRACKIR:
- protocolLib = new QLibrary("FTNoIR_Protocol_FTIR.dll");
+ case FLIGHTGEAR:
+ libName = QString("FTNoIR_Protocol_FG.dll");
+ break;
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
- }
- else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
+ case FTNOIR:
+ libName = QString("FTNoIR_Protocol_FTN.dll");
+ break;
- case FLIGHTGEAR:
- protocolLib = new QLibrary("FTNoIR_Protocol_FG.dll");
+ default:
+ break;
+ }
- getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
- if (getIT) {
- IProtocolDialogPtr ptrXyz(getIT());
- if (ptrXyz)
- {
- pProtocolDialog = ptrXyz;
- pProtocolDialog->Initialize( this );
- qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
- }
- else {
- qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
- }
+ //
+ // Load the Server-settings dialog (if any) and show it.
+ //
+ if (!libName.isEmpty()) {
+ protocolLib = new QLibrary(libName);
+
+ getIT = (importGetProtocolDialog) protocolLib->resolve("GetProtocolDialog");
+ if (getIT) {
+ IProtocolDialogPtr ptrXyz(getIT());
+ if (ptrXyz)
+ {
+ pProtocolDialog = ptrXyz;
+ pProtocolDialog->Initialize( this );
+ qDebug() << "FaceTrackNoIR::showServerControls GetProtocolDialog Function Resolved!";
}
else {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
- }
- break;
-
- case FTNOIR:
- _server_controls = new FTNServerControls( this, Qt::Dialog );
- break;
- default:
- break;
+ qDebug() << "FaceTrackNoIR::showServerControls Function NOT Resolved!";
+ }
+ }
+ else {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "DLL not loaded",QMessageBox::Ok,QMessageBox::NoButton);
}
- }
-
- // Show if already created
- if (_server_controls) {
- _server_controls->show();
- _server_controls->raise();
}
}