Ref T270, added CSimulatorPluginCommon as base class in driver project

* unlike BlackCore::CSimulatorCommon we can add also UI aspects here
* used by emulated driver, XP and the FS series
This commit is contained in:
Klaus Basan
2018-05-16 21:23:00 +02:00
parent afe4a09218
commit 2ae8f5b03f
17 changed files with 247 additions and 69 deletions

View File

@@ -8,16 +8,18 @@ TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui
DEPENDPATH += . $$SourceRoot/src
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
FORMS += *.ui
FORMS += *.ui
DISTFILES += simulatoremulated.json
DESTDIR = $$DestRoot/bin/plugins/simulator
LIBS *= -lsimulatorplugincommon
addStaticLibraryDependency(simulatorplugincommon)
win32 {
dlltarget.path = $$PREFIX/bin/plugins/simulator
INSTALLS += dlltarget

View File

@@ -36,7 +36,7 @@ namespace BlackSimPlugin
IWeatherGridProvider *weatherGridProvider,
IClientProvider *clientProvider,
QObject *parent) :
CSimulatorCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, parent)
CSimulatorPluginCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, parent)
{
Q_ASSERT_X(sApp && sApp->getIContextSimulator(), Q_FUNC_INFO, "Need context");
@@ -47,6 +47,7 @@ namespace BlackSimPlugin
m_monitorWidget.reset(new CSimulatorEmulatedMonitorDialog(this, sGui->mainApplicationWidget()));
connect(qApp, &QApplication::aboutToQuit, this, &CSimulatorEmulated::closeMonitor);
connect(sGui, &CGuiApplication::aboutToShutdown, this, &CSimulatorEmulated::closeMonitor);
connect(&m_interpolatorFetchTimer, &QTimer::timeout, this, &CSimulatorEmulated::fetchFromInterpolator);
// connect own signals for monitoring
@@ -180,7 +181,7 @@ namespace BlackSimPlugin
bool CSimulatorEmulated::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
{
if (canLog()) m_monitorWidget->appendReceivingCall(Q_FUNC_INFO, commandLine, originator.toQString());
return CSimulatorCommon::parseCommandLine(commandLine, originator);
return CSimulatorPluginCommon::parseCommandLine(commandLine, originator);
}
void CSimulatorEmulated::registerHelp()
@@ -316,7 +317,7 @@ namespace BlackSimPlugin
if (parser.matchesPart(1, "show")) { m_monitorWidget->show(); return true; }
if (parser.matchesPart(1, "hide")) { m_monitorWidget->hide(); return true; }
}
return false;
return CSimulatorPluginCommon::parseDetails(parser);
}
void CSimulatorEmulated::setObjectName(const CSimulatorInfo &info)

View File

@@ -12,7 +12,7 @@
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATED_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATED_H
#include "blackcore/simulatorcommon.h"
#include "../plugincommon/simulatorplugincommon.h"
#include "blackmisc/simulation/interpolatormulti.h"
#include "blackmisc/simulation/interpolationrenderingsetup.h"
#include "blackmisc/simulation/interpolationlogger.h"
@@ -31,7 +31,7 @@ namespace BlackSimPlugin
namespace Emulated
{
//! swift simulator implementation
class CSimulatorEmulated : public BlackCore::CSimulatorCommon
class CSimulatorEmulated : public Common::CSimulatorPluginCommon
{
Q_OBJECT
friend class CSimulatorEmulatedMonitorDialog; //!< the monitor widget represents the simulator and needs access to internals (i.e. private/protected)