summaryrefslogtreecommitdiffhomepage
path: root/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2013-02-09 15:29:53 +0000
committerWim Vriend <facetracknoir@gmail.com>2013-02-09 15:29:53 +0000
commit36f82a4f0dc4f002123cc313eab7c845dcd13572 (patch)
treec97146db8d0cf1f6b54a77650771b5e0824ed073 /FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
parent22cf655f0b1380cb0e948302f4a73bbfb5ec919b (diff)
Created a FaceTrackNoIR-version of FreeTrackClient.dll, because the existing one was crashing ArmA2. Made a 64-bit version too.
The FTReportName function was a trouble-maker. In the repo of FreeTrack it expects a pointer to a name, in reality, it should receive an integer... Cost me a while to figure out why ArmA kept crashing :( Also added the option to enable/disable FreeTrack or TrackIR in the FreeTrack 2.0 settings-dialog. Even more, added a button so users can 'repair' the location of NPClient.dll. Some users complained that their SW didn't work with TrackIR any more, after running FaceTrackNoIR... git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@270 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp')
-rw-r--r--FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
index 678b3a5f..9f6fdcb1 100644
--- a/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
+++ b/FTNoIR_Protocol_FT/ftnoir_protocol_FT_dialog.cpp
@@ -32,6 +32,7 @@
*/
#include "ftnoir_protocol_ft.h"
#include <QDebug>
+#include <QFileDialog>
//*******************************************************************************************************
// FaceTrackNoIR Client Settings-dialog.
@@ -52,6 +53,12 @@ QWidget()
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
connect(ui.chkTIRViews, SIGNAL(stateChanged(int)), this, SLOT(chkTIRViewsChanged()));
connect(ui.chkStartDummy, SIGNAL(stateChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.cbxSelectInterface, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged( int )));
+ connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));
+
+ ui.cbxSelectInterface->addItem("Enable both");
+ ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR");
+ ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack");
aFileName = QCoreApplication::applicationDirPath() + "/TIRViews.dll";
if ( !QFile::exists( aFileName ) ) {
@@ -147,7 +154,7 @@ 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" );
@@ -168,6 +175,7 @@ void FTControls::save() {
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "FT" );
+ iniFile.setValue ( "UsedInterface", ui.cbxSelectInterface->currentIndex());
iniFile.endGroup ();
iniFile.beginGroup ( "FTIR" );
@@ -178,6 +186,33 @@ void FTControls::save() {
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.