summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_sc/ftnoir_protocol_sc.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-12-31 16:10:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2013-12-31 16:10:17 +0100
commit40f4c6944799bd696ccf358c5378b230ecc7f52b (patch)
tree5b4d8f8e61ba57800f8570ee195551ce1abecd18 /ftnoir_protocol_sc/ftnoir_protocol_sc.h
parent4abd0ca3b5090018a7db05e8c2e0f478d861d978 (diff)
sc: settings framework
Diffstat (limited to 'ftnoir_protocol_sc/ftnoir_protocol_sc.h')
-rw-r--r--ftnoir_protocol_sc/ftnoir_protocol_sc.h62
1 files changed, 23 insertions, 39 deletions
diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.h b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
index 7917c532..a13c0097 100644
--- a/ftnoir_protocol_sc/ftnoir_protocol_sc.h
+++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.h
@@ -27,8 +27,6 @@
* must be treated as such... *
********************************************************************************/
#pragma once
-#ifndef INCLUDED_SCSERVER_H
-#define INCLUDED_SCSERVER_H
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0502
#include "facetracknoir/global-settings.h"
@@ -48,7 +46,8 @@
#include <QProcess>
#include <QDebug>
#include <QFile>
-//#include "math.h"
+#include "facetracknoir/options.h"
+using namespace options;
typedef HRESULT (WINAPI *importSimConnect_Open)(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex);
typedef HRESULT (WINAPI *importSimConnect_Close)(HANDLE hSimConnect);
@@ -77,6 +76,15 @@ enum INPUT_ID
INPUT0=0,
};
+struct settings {
+ pbundle b;
+ value<int> sxs_manifest;
+ settings() :
+ b(bundle("proto-simconnect")),
+ sxs_manifest(b, "sxs-manifest-version", 0)
+ {}
+};
+
class FTNoIR_Protocol : public IProtocol
{
public:
@@ -87,11 +95,7 @@ public:
QString getGameName() {
return "FS2004/FSX";
}
-
private:
- // Private properties
- QString ProgramName;
-
static float virtSCPosX;
static float virtSCPosY;
static float virtSCPosZ;
@@ -121,7 +125,7 @@ private:
static HANDLE hSimConnect; // Handle to SimConnect
static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext);
- void loadSettings();
+ settings s;
};
// Widget that has controls for FTNoIR protocol client-settings.
@@ -129,28 +133,15 @@ class SCControls: public QWidget, public IProtocolDialog
{
Q_OBJECT
public:
-
- explicit SCControls();
- void registerProtocol(IProtocol *protocol) {
- theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
- }
- void unRegisterProtocol() {
- theProtocol = NULL; // Reset the pointer
- }
-
+ SCControls();
+ void registerProtocol(IProtocol *protocol) {}
+ void unRegisterProtocol() {}
private:
- Ui::UICSCControls ui;
- void loadSettings();
- void save();
-
- /** helper **/
- bool settingsDirty;
- FTNoIR_Protocol *theProtocol;
-
+ Ui::UICSCControls ui;
+ settings s;
private slots:
- void doOK();
- void doCancel();
- void settingChanged() { settingsDirty = true; };
+ void doOK();
+ void doCancel();
};
//*******************************************************************************************************
@@ -159,15 +150,8 @@ private slots:
class FTNoIR_ProtocolDll : public Metadata
{
public:
- FTNoIR_ProtocolDll();
- ~FTNoIR_ProtocolDll();
-
- void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); };
- void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); };
- void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); };
-
- void getIcon(QIcon *icon) { *icon = QIcon(":/images/fsx.png"); };
+ void getFullName(QString *strToBeFilled) { *strToBeFilled = QString("FSX SimConnect"); }
+ void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("SimConnect"); }
+ void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Microsoft SimConnect protocol"); }
+ void getIcon(QIcon *icon) { *icon = QIcon(":/images/fsx.png"); }
};
-
-#endif//INCLUDED_SCSERVER_H
-//END