//
// Constructor for server-settings-dialog
//
FTControls::FTControls() :
    QWidget()
{
    QString aFileName;														// File Path and Name

    ui.setupUi( this );

    // Connect Qt signals to member-functions
    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
    connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));

    tie_setting(s.intUsedInterface, ui.cbxSelectInterface);
    tie_setting(s.useDummyExe, ui.chkStartDummy);
    tie_setting(s.useTIRViews, ui.chkTIRViews);

    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 ) ) {
        ui.chkTIRViews->setChecked( false );
        ui.chkTIRViews->setEnabled ( false );
    }
    else {
        ui.chkTIRViews->setEnabled ( true );
    }
}
//
// Constructor for server-settings-dialog
//
FTControls::FTControls() :
QWidget()
{
	QString aFileName;														// File Path and Name

	ui.setupUi( this );

	// Connect Qt signals to member-functions
    connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
    connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
	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 );
	}


}