summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_ft
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-02 19:43:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-02 19:43:51 +0200
commitd674f5fe1e87596dcb8bae588ae798b4473ce269 (patch)
tree3804985a4f7f7d6f5c694497028e9fa9222beade /ftnoir_protocol_ft
parent171c8cdc17ed6b443ff6de5d44b997399d0b03a2 (diff)
Build works now
Diffstat (limited to 'ftnoir_protocol_ft')
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.cpp6
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft.h11
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp76
-rw-r--r--ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp5
4 files changed, 75 insertions, 23 deletions
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
index b8461993..5616915a 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.cpp
@@ -505,9 +505,9 @@ void FTNoIR_Protocol::getNameFromGame( char *dest )
// 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")
+//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0")
-FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
+extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor()
{
- return new FTNoIR_Protocol;
+ return (IProtocol*) new FTNoIR_ProtocolDll;
}
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft.h b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
index c82c3e79..5b36ab5a 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft.h
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft.h
@@ -28,16 +28,17 @@
#ifndef INCLUDED_FTSERVER_H
#define INCLUDED_FTSERVER_H
-#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h"
-#include "ui_FTNoIR_FTcontrols.h"
-#include "FTTypes.h"
+#include "ftnoir_protocol_base/ftnoir_protocol_base.h"
+#include "ui_ftnoir_ftcontrols.h"
+#include "facetracknoir/global-settings.h"
+#include "fttypes.h"
#include <QMessageBox>
#include <QSettings>
#include <QLibrary>
#include <QProcess>
#include <QDebug>
#include <QFile>
-#include "Windows.h"
+#include <windows.h>
//#include "math.h"
//typedef char *(WINAPI *importProvider)(void);
@@ -125,7 +126,7 @@ private slots:
//*******************************************************************************************************
// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
//*******************************************************************************************************
-class FTNoIR_ProtocolDll : public IProtocolDll
+class FTNoIR_ProtocolDll : public Metadata
{
public:
FTNoIR_ProtocolDll();
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
index 46dd263f..ffdd7ddd 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dialog.cpp
@@ -32,7 +32,7 @@
*/
#include "ftnoir_protocol_ft.h"
#include <QDebug>
-#include "facetracknoir/global-settings.h"
+#include <QFileDialog>
//*******************************************************************************************************
// FaceTrackNoIR Client Settings-dialog.
@@ -51,12 +51,36 @@ QWidget()
// Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
-// connect(ui.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
+ 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 );
+ }
+
+
}
//
@@ -66,11 +90,6 @@ FTControls::~FTControls() {
qDebug() << "~FTControls() says: started";
}
-void FTControls::Release()
-{
- delete this;
-}
-
//
// Initialize tracker-client-dialog
//
@@ -142,7 +161,12 @@ void FTControls::loadSettings() {
qDebug() << "loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "FT" );
-// ui.chkTIRViews->setChecked (iniFile.value ( "useTIRViews", 0 ).toBool());
+ 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", 1 ).toBool());
iniFile.endGroup ();
settingsDirty = false;
@@ -158,12 +182,44 @@ void FTControls::save() {
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "FT" );
-// iniFile.setValue ( "useTIRViews", ui.chkTIRViews->isChecked() );
+ 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;
}
+//
+// Select a NPClient.dll file, to repair the Location in the Registry.
+// Several program distribute their own version of this file.
+//
+void FTControls::selectDLL() {
+ QFileDialog::Options options;
+ QFileDialog::FileMode mode;
+
+ options |= QFileDialog::DontUseNativeDialog;
+ mode = QFileDialog::ExistingFile;
+ QString selectedFilter;
+ 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 );
+ }
+ }
+}
+
+
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Protocol-settings dialog object.
@@ -171,8 +227,6 @@ void FTControls::save() {
// GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language.
-//#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0")
-
extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog( )
{
return (IProtocolDialog*) new FTControls;
diff --git a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp
index 1209e38b..5f821f59 100644
--- a/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp
+++ b/ftnoir_protocol_ft/ftnoir_protocol_ft_dll.cpp
@@ -32,7 +32,6 @@
*/
#include "ftnoir_protocol_ft.h"
#include <QDebug>
-#include "facetracknoir/global-settings.h"
FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
}
@@ -49,9 +48,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
// GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress
// Win32 API function.
// _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language.
-//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0")
-
extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
{
return new FTNoIR_ProtocolDll;
-}
+} \ No newline at end of file