diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-11-16 12:00:53 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-11-16 12:00:53 +0000 |
commit | b3d3a1f1d4f9739a506990edefcd2d81502368d4 (patch) | |
tree | 3bf2d14c5294060757325d5c3d25c1713c06c714 /FTNoIR_Protocol_FSUIPC | |
parent | a04cfffdd5cf40a51a6becc3d4a09172864bf99d (diff) |
Added registerProtocol and unRegisterProtocol to the Protocol classes.
Now the Protocol Dialog can get data from the protocol, when the Tracker is running.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@192 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Protocol_FSUIPC')
-rw-r--r-- | FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp | 20 | ||||
-rw-r--r-- | FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h | 13 | ||||
-rw-r--r-- | FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp | 2 |
3 files changed, 22 insertions, 13 deletions
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp index 9bada9da..09911866 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.cpp @@ -33,7 +33,7 @@ #include "ftnoir_protocol_fsuipc.h"
/** constructor **/
-FTNoIR_Protocol_FSUIPC::FTNoIR_Protocol_FSUIPC()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
loadSettings();
ProgramName = "Microsoft FS2004";
@@ -47,7 +47,7 @@ FTNoIR_Protocol_FSUIPC::FTNoIR_Protocol_FSUIPC() }
/** destructor **/
-FTNoIR_Protocol_FSUIPC::~FTNoIR_Protocol_FSUIPC()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
//
// Free the DLL
@@ -56,12 +56,12 @@ FTNoIR_Protocol_FSUIPC::~FTNoIR_Protocol_FSUIPC() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_FSUIPC::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_FSUIPC::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -69,7 +69,7 @@ void FTNoIR_Protocol_FSUIPC::Initialize() //
// Scale the measured value to the Joystick values
//
-int FTNoIR_Protocol_FSUIPC::scale2AnalogLimits( float x, float min_x, float max_x ) {
+int FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
double local_x;
@@ -88,7 +88,7 @@ double local_x; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_FSUIPC::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -103,7 +103,7 @@ void FTNoIR_Protocol_FSUIPC::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_FSUIPC::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
DWORD result;
TFSState pitch;
TFSState yaw;
@@ -187,7 +187,7 @@ float virtRotZ; //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_FSUIPC::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
qDebug() << "checkServerInstallationOK says: Starting Function";
@@ -209,7 +209,7 @@ bool FTNoIR_Protocol_FSUIPC::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_FSUIPC::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "FS2002/2004");
return;
@@ -226,5 +226,5 @@ void FTNoIR_Protocol_FSUIPC::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_FSUIPC;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h index d073c823..ec99035b 100644 --- a/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h +++ b/FTNoIR_Protocol_FSUIPC/FTNoIR_Protocol_FSUIPC.h @@ -55,11 +55,11 @@ typedef struct } TFSState;
#pragma pack(pop)
-class FTNoIR_Protocol_FSUIPC : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_FSUIPC();
- ~FTNoIR_Protocol_FSUIPC();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -91,6 +91,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
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::UICFSUIPCControls ui;
@@ -99,6 +105,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp index 27d99e04..08c13c08 100644 --- a/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp +++ b/FTNoIR_Protocol_FSUIPC/ftnoir_protocol_FSUIPC_dialog.cpp @@ -49,6 +49,8 @@ QWidget() connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
connect(ui.btnFindDLL, SIGNAL(clicked()), this, SLOT(getLocationOfDLL()));
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
|