mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #891, P3D driver / config
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5d8ed66931
commit
d280141563
37
src/plugins/simulator/p3d/p3d.pro
Normal file
37
src/plugins/simulator/p3d/p3d.pro
Normal 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)
|
||||
45
src/plugins/simulator/p3d/simulatorp3d.cpp
Normal file
45
src/plugins/simulator/p3d/simulatorp3d.cpp
Normal 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
|
||||
48
src/plugins/simulator/p3d/simulatorp3d.h
Normal file
48
src/plugins/simulator/p3d/simulatorp3d.h
Normal 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
|
||||
7
src/plugins/simulator/p3d/simulatorp3d.json
Normal file
7
src/plugins/simulator/p3d/simulatorp3d.json
Normal 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"
|
||||
}
|
||||
34
src/plugins/simulator/p3d/simulatorp3dfactory.cpp
Normal file
34
src/plugins/simulator/p3d/simulatorp3dfactory.cpp
Normal 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
|
||||
48
src/plugins/simulator/p3d/simulatorp3dfactory.h
Normal file
48
src/plugins/simulator/p3d/simulatorp3dfactory.h
Normal 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
|
||||
27
src/plugins/simulator/p3dconfig/p3dconfig.pro
Normal file
27
src/plugins/simulator/p3dconfig/p3dconfig.pro
Normal 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)
|
||||
27
src/plugins/simulator/p3dconfig/simulatorp3dconfig.cpp
Normal file
27
src/plugins/simulator/p3dconfig/simulatorp3dconfig.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/plugins/simulator/p3dconfig/simulatorp3dconfig.h
Normal file
43
src/plugins/simulator/p3dconfig/simulatorp3dconfig.h
Normal 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
|
||||
3
src/plugins/simulator/p3dconfig/simulatorp3dconfig.json
Normal file
3
src/plugins/simulator/p3dconfig/simulatorp3dconfig.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"identifier" : "org.swift-project.plugins.simulator.p3d.config"
|
||||
}
|
||||
Reference in New Issue
Block a user