refs #891, P3D driver / config

This commit is contained in:
Klaus Basan
2017-02-28 04:33:57 +01:00
committed by Mathew Sutcliffe
parent 5d8ed66931
commit d280141563
10 changed files with 319 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
load(common_pre)
REQUIRES += contains(BLACK_CONFIG,P3D)
QT += core dbus gui network concurrent xml
TARGET = simulatorp3d
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore
LIBS += -lsimulatorfscommon -lsimulatorfsxcommon -lSimConnect -lFSUIPC_User
# required for FSUIPC
win32:!win32-g++*: QMAKE_LFLAGS += /NODEFAULTLIB:LIBC.lib
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
LIBS += -ldxguid -lole32
SOURCES += *.cpp
HEADERS += *.h
DISTFILES += simulatorp3d.json
DESTDIR = $$DestRoot/bin/plugins/simulator
win32 {
dlltarget.path = $$PREFIX/bin/plugins/simulator
INSTALLS += dlltarget
} else {
target.path = $$PREFIX/bin/plugins/simulator
INSTALLS += target
}
load(common_post)

View File

@@ -0,0 +1,45 @@
/* Copyright (C) 2017
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "simulatorp3d.h"
#include "blackcore/application.h"
#include "blackmisc/threadutils.h"
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Geo;
using namespace BlackMisc::Network;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Simulation::FsCommon;
using namespace BlackMisc::Weather;
using namespace BlackCore;
namespace BlackSimPlugin
{
namespace P3D
{
CSimulatorP3D::CSimulatorP3D(const CSimulatorPluginInfo &info,
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IWeatherGridProvider *weatherGridProvider,
QObject *parent) :
CSimulatorFsxCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, parent)
{
//! \todo set P3D default model
m_defaultModel =
{
"Boeing 737-800 Paint1",
CAircraftModel::TypeModelMatchingDefaultModel,
"B737-800 default model",
CAircraftIcaoCode("B738", "L2J")
};
}
} // namespace
} // namespace

View File

@@ -0,0 +1,48 @@
/* Copyright (C) 2017
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_P3D_H
#define BLACKSIMPLUGIN_SIMULATOR_P3D_H
#include "../fsxcommon/simulatorfsxcommon.h"
namespace BlackSimPlugin
{
namespace P3D
{
//! P3D Simulator Implementation
class CSimulatorP3D : public BlackSimPlugin::FsxCommon::CSimulatorFsxCommon
{
Q_OBJECT
public:
//! Constructor, parameters as in \sa BlackCore::ISimulatorFactory::create
CSimulatorP3D(
const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
QObject *parent = nullptr);
};
//! Listener for P3D
class CSimulatorP3DListener : public BlackSimPlugin::FsxCommon::CSimulatorFsxCommonListener
{
Q_OBJECT
public:
//! Constructor
using CSimulatorFsxCommonListener::CSimulatorFsxCommonListener;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,7 @@
{
"identifier" : "org.swift-project.plugins.simulator.p3d",
"name" : "PREPAR3D",
"simulator" : "p3d",
"description" : "Lockheed Martin PREPAR3D (v1-v3)",
"config" : "org.swift-project.plugins.simulator.p3d.config"
}

View File

@@ -0,0 +1,34 @@
/* Copyright (C) 2017
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "simulatorp3dfactory.h"
#include "simulatorp3d.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include <QTimer>
namespace BlackSimPlugin
{
namespace P3D
{
BlackCore::ISimulator *CSimulatorP3DFactory::create(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider)
{
Q_ASSERT(ownAircraftProvider);
return new CSimulatorP3D(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, this);
}
BlackCore::ISimulatorListener *CSimulatorP3DFactory::createListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info)
{
return new CSimulatorP3DListener(info);
}
} // namespace
} // namespace

View File

@@ -0,0 +1,48 @@
/* Copyright (C) 2017
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_P3DFACTORY_H
#define BLACKSIMPLUGIN_SIMULATOR_P3DFACTORY_H
#include "blackcore/simulator.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include <simconnect/SimConnect.h>
#include <QObject>
#include <QtPlugin>
namespace BlackSimPlugin
{
namespace P3D
{
//! Factory implementation to create CSimulatorP3D instances
class CSimulatorP3DFactory :
public QObject,
public BlackCore::ISimulatorFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.blackcore.simulatorinterface" FILE "simulatorp3d.json")
Q_INTERFACES(BlackCore::ISimulatorFactory)
public:
//! \copydoc BlackCore::ISimulatorFactory::create
virtual BlackCore::ISimulator *create(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider) override;
//! \copydoc BlackCore::ISimulatorFactory::createListener
virtual BlackCore::ISimulatorListener *createListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info) override;
};
} // namespace
} // namespace
#endif // guard

View File

@@ -0,0 +1,27 @@
load(common_pre)
QT += core widgets dbus network
TARGET = simulatorp3dconfig
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
DISTFILES += simulatorp3dconfig.json
LIBS += -lsimulatorfsxcommon
DESTDIR = $$DestRoot/bin/plugins/simulator
win32 {
dlltarget.path = $$PREFIX/bin/plugins/simulator
INSTALLS += dlltarget
} else {
target.path = $$PREFIX/bin/plugins/simulator
INSTALLS += target
}
load(common_post)

View File

@@ -0,0 +1,27 @@
/* Copyright (C) 2017
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "simulatorp3dconfig.h"
#include "../fsxcommon/simulatorfsxconfigwindow.h"
namespace BlackSimPlugin
{
namespace P3D
{
CSimulatorP3DConfig::CSimulatorP3DConfig(QObject *parent) : QObject(parent)
{
// void
}
BlackGui::CPluginConfigWindow *CSimulatorP3DConfig::createConfigWindow(QWidget *parent)
{
return new BlackSimPlugin::FsxCommon::CSimulatorFsxConfigWindow("P3D", parent);
}
}
}

View File

@@ -0,0 +1,43 @@
/* Copyright (C) 2017
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIMPLUGIN_P3D_SIMULATORP3DCONFIG_H
#define BLACKSIMPLUGIN_P3D_SIMULATORP3DCONFIG_H
#include "blackgui/pluginconfig.h"
namespace BlackSimPlugin
{
namespace P3D
{
/*!
* Window for setting up the P3D plugin.
*/
class CSimulatorP3DConfig : public QObject, public BlackGui::IPluginConfig
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.blackgui.pluginconfiginterface" FILE "simulatorp3dconfig.json")
Q_INTERFACES(BlackGui::IPluginConfig)
public:
//! Ctor
CSimulatorP3DConfig(QObject *parent = nullptr);
//! Dtor
virtual ~CSimulatorP3DConfig() {}
//! \copydoc BlackGui::IPluginConfig::createConfigWindow()
BlackGui::CPluginConfigWindow *createConfigWindow(QWidget *parent) override;
};
}
}
#endif // guard

View File

@@ -0,0 +1,3 @@
{
"identifier" : "org.swift-project.plugins.simulator.p3d.config"
}