diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-31 12:54:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-12-31 12:54:42 +0100 |
commit | edcdcaadb5920cebc9aaa34572cba74de5637241 (patch) | |
tree | d6d1b193cb0486445b391fbdc3bff58a0b6151fb /ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | |
parent | e1d96c01dc5d7707c7e3a260f49881e6bded832e (diff) |
udp: update to settings framework
Diffstat (limited to 'ftnoir_protocol_ftn/ftnoir_protocol_ftn.h')
-rw-r--r-- | ftnoir_protocol_ftn/ftnoir_protocol_ftn.h | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h index acccc9e7..d5dc2cfe 100644 --- a/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h +++ b/ftnoir_protocol_ftn/ftnoir_protocol_ftn.h @@ -26,8 +26,6 @@ * It is based on the (Linux) example made by Melchior FRANZ. * ********************************************************************************/ #pragma once -#ifndef INCLUDED_FTNSERVER_H -#define INCLUDED_FTNSERVER_H #include "ftnoir_protocol_base/ftnoir_protocol_base.h" #include "ftnoir_tracker_base/ftnoir_tracker_base.h" @@ -38,23 +36,34 @@ #include <QSettings> #include <math.h> #include "facetracknoir/global-settings.h" +#include "facetracknoir/options.h" +using namespace options; + +struct settings { + pbundle b; + value<int> ip1, ip2, ip3, ip4, port; + settings() : + b(bundle("udp-proto")), + ip1(b, "ip1", 192), + ip2(b, "ip2", 168), + ip3(b, "ip3", 0), + ip4(b, "ip4", 2), + port(b, "port", 4242) + {} +}; class FTNoIR_Protocol : public IProtocol { public: FTNoIR_Protocol(); - virtual ~FTNoIR_Protocol(); bool checkServerInstallationOK(); void sendHeadposeToGame(const double *headpose); QString getGameName() { return "UDP Tracker"; } - private: - QUdpSocket *outSocket; // Send to FaceTrackNoIR - QHostAddress destIP; // Destination IP-address - int destPort; // Destination port-number - void loadSettings(); + QUdpSocket outSocket; + settings s; }; // Widget that has controls for FTNoIR protocol client-settings. @@ -62,40 +71,23 @@ class FTNControls: public QWidget, public IProtocolDialog { Q_OBJECT public: - - explicit FTNControls(); + FTNControls(); void registerProtocol(IProtocol *) {} void unRegisterProtocol() {} - private: Ui::UICFTNControls ui; - void loadSettings(); - void save(); - - /** helper **/ - bool settingsDirty; - + settings s; private slots: void doOK(); void doCancel(); - void settingChanged() { settingsDirty = true; } }; -//******************************************************************************************************* -// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol -//******************************************************************************************************* class FTNoIR_ProtocolDll : public Metadata { public: - FTNoIR_ProtocolDll(); - ~FTNoIR_ProtocolDll(); - void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("UDP"); } void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("UDP"); } void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("opentrack UDP protocol"); } void getIcon(QIcon *icon) { *icon = QIcon(":/images/facetracknoir.png"); } }; - -#endif//INCLUDED_FTNSERVER_H -//END |