summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_ft
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-27 12:48:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-27 12:48:22 +0200
commit1edb87b13a58cbb87cbf99ee30cc5ee7eb15003a (patch)
tree2a50a92f0b206fc5eee43830606cded1c6eed68f /ftnoir_protocol_ft
parente70bef88fdb5ffdf1c2dcf99ac9e22181d18f5ac (diff)
Implement game name in the UI, lost previously due to refactoring.
Diffstat (limited to 'ftnoir_protocol_ft')
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp13
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.h26
2 files changed, 19 insertions, 20 deletions
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index a3deba7a..9c3c8461 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -211,6 +211,8 @@ float headRotZ;
start_dummy();
pMemData->GameID2 = pMemData->GameID;
intGameID = pMemData->GameID;
+ QMutexLocker((QMutex*)&this->game_name_mutex);
+ connected_game = gamename;
}
ReleaseMutex(hFTMutex);
@@ -395,17 +397,6 @@ void FTNoIR_Protocol::FTDestroyMapping()
}
-//
-// Return a name, if present the name from the Game, that is connected...
-//
-void FTNoIR_Protocol::getNameFromGame( char *dest )
-{
- QByteArray foo = game_name.toUtf8();
- memcpy(dest, foo.constData(), std::min<int>(foo.size(), 98));
- dest[foo.size()] = 0;
-}
-
-
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Protocol object.
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
index c02dfc03..e1e46876 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
@@ -40,6 +40,8 @@
#include <QFile>
#include <QString>
#include <windows.h>
+#include <QMutex>
+#include <QMutexLocker>
//#include "math.h"
//typedef char *(WINAPI *importProvider)(void);
@@ -57,7 +59,10 @@ public:
bool checkServerInstallationOK( );
void sendHeadposeToGame( double *headpose, double *rawheadpose );
- void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars...
+ QString getGameName() {
+ QMutexLocker((QMutex*)&game_name_mutex);
+ return connected_game;
+ }
private:
bool FTCreateMapping();
@@ -86,6 +91,9 @@ private:
void loadSettings();
void start_tirviews();
void start_dummy();
+
+ QString connected_game;
+ QMutex game_name_mutex;
};
// Widget that has controls for FTNoIR protocol client-settings.
@@ -102,10 +110,10 @@ public:
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;
@@ -120,8 +128,8 @@ private slots:
void selectDLL();
void doOK();
void doCancel();
- void settingChanged() { settingsDirty = true; };
- void settingChanged(int) { settingsDirty = true; };
+ void settingChanged() { settingsDirty = true; }
+ void settingChanged(int) { settingsDirty = true; }
};
//*******************************************************************************************************
@@ -133,11 +141,11 @@ 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 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 getIcon(QIcon *icon) { *icon = QIcon(":/images/freetrack.png"); }
};