From b3d3a1f1d4f9739a506990edefcd2d81502368d4 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Fri, 16 Nov 2012 12:00:53 +0000 Subject: 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 --- FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp | 18 +++++++++--------- FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h | 13 ++++++++++--- FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp | 2 ++ 3 files changed, 21 insertions(+), 12 deletions(-) (limited to 'FTNoIR_Protocol_FTN') diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp index bcda3dbce..cfb6c618c 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.cpp @@ -35,13 +35,13 @@ #include /** constructor **/ -FTNoIR_Protocol_FTN::FTNoIR_Protocol_FTN() +FTNoIR_Protocol::FTNoIR_Protocol() { loadSettings(); } /** destructor **/ -FTNoIR_Protocol_FTN::~FTNoIR_Protocol_FTN() +FTNoIR_Protocol::~FTNoIR_Protocol() { if (inSocket != 0) { inSocket->close(); @@ -55,12 +55,12 @@ FTNoIR_Protocol_FTN::~FTNoIR_Protocol_FTN() } /** helper to Auto-destruct **/ -void FTNoIR_Protocol_FTN::Release() +void FTNoIR_Protocol::Release() { delete this; } -void FTNoIR_Protocol_FTN::Initialize() +void FTNoIR_Protocol::Initialize() { return; } @@ -68,7 +68,7 @@ void FTNoIR_Protocol_FTN::Initialize() // // Load the current Settings from the currently 'active' INI-file. // -void FTNoIR_Protocol_FTN::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(); @@ -86,7 +86,7 @@ void FTNoIR_Protocol_FTN::loadSettings() { // // Update Headpose in Game. // -void FTNoIR_Protocol_FTN::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) { +void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) { int no_bytes; QHostAddress sender; quint16 senderPort; @@ -137,7 +137,7 @@ quint16 senderPort; // Check if the Client DLL exists and load it (to test it), if so. // Returns 'true' if all seems OK. // -bool FTNoIR_Protocol_FTN::checkServerInstallationOK( HANDLE handle ) +bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) { // Init. the data TestData.x = 0.0f; @@ -179,7 +179,7 @@ bool FTNoIR_Protocol_FTN::checkServerInstallationOK( HANDLE handle ) // // Return a name, if present the name from the Game, that is connected... // -void FTNoIR_Protocol_FTN::getNameFromGame( char *dest ) +void FTNoIR_Protocol::getNameFromGame( char *dest ) { sprintf_s(dest, 99, "FaceTrackNoIR"); return; @@ -196,5 +196,5 @@ void FTNoIR_Protocol_FTN::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() { - return new FTNoIR_Protocol_FTN; + return new FTNoIR_Protocol; } diff --git a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h index 3eb65f5f5..24f760c52 100644 --- a/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h +++ b/FTNoIR_Protocol_FTN/FTNoIR_Protocol_FTN.h @@ -39,11 +39,11 @@ #include "Windows.h" #include "math.h" -class FTNoIR_Protocol_FTN : public IProtocol +class FTNoIR_Protocol : public IProtocol { public: - FTNoIR_Protocol_FTN(); - ~FTNoIR_Protocol_FTN(); + FTNoIR_Protocol(); + ~FTNoIR_Protocol(); void Release(); void Initialize(); @@ -77,6 +77,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::UICFTNControls ui; @@ -85,6 +91,7 @@ private: /** helper **/ bool settingsDirty; + FTNoIR_Protocol *theProtocol; private slots: void doOK(); diff --git a/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp index a2e7813b6..58dbfbade 100644 --- a/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp +++ b/FTNoIR_Protocol_FTN/ftnoir_protocol_ftn_dialog.cpp @@ -59,6 +59,8 @@ QWidget() connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged())); connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged())); + theProtocol = NULL; + // Load the settings from the current .INI-file loadSettings(); } -- cgit v1.2.3