diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-27 19:52:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-11-27 19:52:03 +0100 |
commit | 9990b05efb6fcd806ec5d996310f4a945a0b0fac (patch) | |
tree | cdfbacdd3b535ca594521265afaa4a1184c25201 /ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp | |
parent | 21dbb51ed05bffa69f036c6b82842aa0069b624f (diff) |
merge in the right hatire branch this time!
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
Diffstat (limited to 'ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp')
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp | 99 |
1 files changed, 83 insertions, 16 deletions
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp index a9466304..0be912f2 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp @@ -1,12 +1,38 @@ +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * +* * +* Copyright (C) 2012 FuraX49 (HAT Tracker plugins) * +* Homepage: http://hatire.sourceforge.net * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see <http://www.gnu.org/licenses/>. * +* * +********************************************************************************/ #include <QCoreApplication> #include <QSettings> +#include <QVariant> #include "ftnoir_tracker_hat_settings.h" void TrackerSettings::load_ini() { - qDebug("TrackerSettings::load_ini()"); - QSettings settings("opentrack"); + QSettings settings("opentrack"); // Registry settings (in HK_USER) QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) @@ -30,12 +56,33 @@ void TrackerSettings::load_ini() InvertZ = iniFile.value( "InvertZ", 0 ).toBool(); - RollAxis=iniFile.value("RollAxis",1).toInt(); - PitchAxis=iniFile.value("PitchAxis",2).toInt(); - YawAxis=iniFile.value("YawAxis",0).toInt(); - XAxis=iniFile.value("XAxis",1).toInt(); - YAxis=iniFile.value("YAxis",2).toInt(); - ZAxis=iniFile.value("ZAxis",0).toInt(); + RollAxe=iniFile.value("RollAxe",1).toInt(); + PitchAxe=iniFile.value("PitchAxe",2).toInt(); + YawAxe=iniFile.value("YawAxe",0).toInt(); + XAxe=iniFile.value("XAxe",1).toInt(); + YAxe=iniFile.value("YAxe",2).toInt(); + ZAxe=iniFile.value("ZAxe",0).toInt(); + + + CmdStart=iniFile.value ( "CmdStart").toString(); + CmdStop=iniFile.value ( "CmdStop" ).toString(); + CmdInit=iniFile.value ( "CmdInit" ).toString(); + CmdReset=iniFile.value ( "CmdReset" ).toString(); + CmdCenter=iniFile.value ( "CmdCenter" ).toString(); + CmdZero=iniFile.value ( "CmdZero" ).toString(); + + DelayInit=iniFile.value("DelayInit",0).toInt(); + DelayStart=iniFile.value("DelayStart",0).toInt(); + DelaySeq=iniFile.value("DelaySeq",0).toInt(); + + BigEndian=iniFile.value("BigEndian",0).toBool(); + + + pBaudRate=static_cast<QSerialPort::BaudRate>(iniFile.value("BaudRate",QSerialPort::Baud115200).toInt()); + pDataBits=static_cast<QSerialPort::DataBits>(iniFile.value("DataBits",QSerialPort::Data8).toInt()); + pParity=static_cast<QSerialPort::Parity>(iniFile.value("Parity",QSerialPort::NoParity).toInt()); + pStopBits=static_cast<QSerialPort::StopBits>(iniFile.value("StopBits",QSerialPort::OneStop).toInt()); + pFlowControl=static_cast<QSerialPort::FlowControl>(iniFile.value("FlowControl",QSerialPort::HardwareControl).toInt()); iniFile.endGroup(); } @@ -43,9 +90,8 @@ void TrackerSettings::load_ini() void TrackerSettings::save_ini() const { - qDebug("TrackerSettings::save_ini()"); - QSettings settings("opentrack"); + QSettings settings("opentrack"); // Registry settings (in HK_USER) QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) @@ -67,12 +113,33 @@ void TrackerSettings::save_ini() const iniFile.setValue( "InvertY", InvertY ); iniFile.setValue( "InvertZ", InvertZ ); - iniFile.setValue ( "RollAxis", RollAxis ); - iniFile.setValue ( "PitchAxis", PitchAxis ); - iniFile.setValue ( "YawAxis",YawAxis ); - iniFile.setValue ( "XAxis", XAxis ); - iniFile.setValue ( "YAxis", YAxis ); - iniFile.setValue ( "ZAxis", ZAxis ); + iniFile.setValue ( "RollAxe", RollAxe ); + iniFile.setValue ( "PitchAxe", PitchAxe ); + iniFile.setValue ( "YawAxe",YawAxe ); + iniFile.setValue ( "XAxe", XAxe ); + iniFile.setValue ( "YAxe", YAxe ); + iniFile.setValue ( "ZAxe", ZAxe ); + + iniFile.setValue ( "CmdStart",CmdStart.toLatin1()); + iniFile.setValue ( "CmdStop",CmdStop.toLatin1()); + iniFile.setValue ( "CmdInit",CmdInit.toLatin1()); + iniFile.setValue ( "CmdReset",CmdReset.toLatin1()); + iniFile.setValue ( "CmdCenter",CmdCenter.toLatin1() ); + iniFile.setValue ( "CmdZero",CmdZero.toLatin1() ); + + iniFile.setValue ( "DelayInit",DelayInit); + iniFile.setValue ( "DelayStart",DelayStart); + iniFile.setValue ( "DelaySeq",DelaySeq); + + iniFile.setValue("BigEndian",BigEndian); + + iniFile.setValue("BaudRate",pBaudRate); + iniFile.setValue("DataBits",pDataBits); + iniFile.setValue("Parity",pParity); + iniFile.setValue("StopBits",pStopBits); + iniFile.setValue("FlowControl",pFlowControl); + iniFile.endGroup(); } + |