Ref T111, renamed dummy driver to CSimulatorEmulated

This commit is contained in:
Klaus Basan
2017-08-05 18:22:56 +02:00
committed by Mathew Sutcliffe
parent 2ede2633b8
commit b70fb70d60
22 changed files with 158 additions and 159 deletions

View File

@@ -65,6 +65,5 @@ namespace BlackMisc
if (sim.xplane()) { sims.push_back(CSimulatorInfo(CSimulatorInfo::XPLANE)); }
return sims;
}
} // namespace
} // namespace

View File

@@ -50,9 +50,9 @@ namespace BlackMisc
return CSimulatorInfo(getSimulator());
}
bool CSimulatorPluginInfo::isSwiftPlugin() const
bool CSimulatorPluginInfo::isEmulatedPlugin() const
{
return this->getIdentifier() == swiftPluginIndentifier();
return this->getIdentifier() == emulatedPluginIndentifier();
}
QString CSimulatorPluginInfo::convertToQString(bool i18n) const
@@ -85,9 +85,9 @@ namespace BlackMisc
return s;
}
const QString &CSimulatorPluginInfo::swiftPluginIndentifier()
const QString &CSimulatorPluginInfo::emulatedPluginIndentifier()
{
static const QString s("org.swift-project.plugins.simulator.swift");
static const QString s("org.swift-project.plugins.simulator.emulated");
return s;
}
@@ -99,7 +99,7 @@ namespace BlackMisc
p3dPluginIndentifier(),
xplanePluginIndentifier(),
fs9PluginIndentifier(),
swiftPluginIndentifier()
emulatedPluginIndentifier()
});
return identifiers;
}

View File

@@ -63,7 +63,7 @@ namespace BlackMisc
BlackMisc::Simulation::CSimulatorInfo getSimulatorInfo() const;
//! Is this the pseudo swift driver?
bool isSwiftPlugin() const;
bool isEmulatedPlugin() const;
//! Description
const QString &getDescription() const { return m_description; }
@@ -83,8 +83,8 @@ namespace BlackMisc
//! Plugin identifier (XPlane)
static const QString &xplanePluginIndentifier();
//! Plugin identifier (swift pseudo driver)
static const QString &swiftPluginIndentifier();
//! Plugin identifier (emulated simulator plugin)
static const QString &emulatedPluginIndentifier();
//! All valid identifiers
static const QStringList &allIdentifiers();

View File

@@ -2,7 +2,7 @@ load(common_pre)
QT += core dbus gui widgets network xml
TARGET = simulatorswift
TARGET = simulatoremulated
TEMPLATE = lib
CONFIG += plugin shared
@@ -14,7 +14,7 @@ INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
FORMS += *.ui
DISTFILES += simulatorswift.json
DISTFILES += simulatoremulated.json
DESTDIR = $$DestRoot/bin/plugins/simulator

View File

@@ -7,7 +7,7 @@
* contained in the LICENSE file.
*/
#include "simulatorswift.h"
#include "simulatoremulated.h"
#include "blackgui/guiapplication.h"
#include "blackcore/context/contextsimulator.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
@@ -28,9 +28,9 @@ using namespace BlackCore::Context;
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
CSimulatorSwift::CSimulatorSwift(const CSimulatorPluginInfo &info,
CSimulatorEmulated::CSimulatorEmulated(const CSimulatorPluginInfo &info,
IOwnAircraftProvider *ownAircraftProvider,
IRemoteAircraftProvider *remoteAircraftProvider,
IWeatherGridProvider *weatherGridProvider,
@@ -39,24 +39,24 @@ namespace BlackSimPlugin
{
Q_ASSERT_X(sApp && sApp->getIContextSimulator(), Q_FUNC_INFO, "Need context");
CSimulatorSwift::registerHelp();
m_monitorWidget.reset(new CSimulatorSwiftMonitorDialog(this, sGui->mainApplicationWindow()));
connect(qApp, &QApplication::aboutToQuit, this, &CSimulatorSwift::closeMonitor);
CSimulatorEmulated::registerHelp();
m_monitorWidget.reset(new CSimulatorEmulatedMonitorDialog(this, sGui->mainApplicationWindow()));
connect(qApp, &QApplication::aboutToQuit, this, &CSimulatorEmulated::closeMonitor);
this->onSettingsChanged();
}
CSimulatorInfo CSimulatorSwift::getSimulatorInfo() const
CSimulatorInfo CSimulatorEmulated::getSimulatorInfo() const
{
const CSwiftPluginSettings s = m_settings.get();
return s.getEmulatedSimulator();
}
bool CSimulatorSwift::isTimeSynchronized() const
bool CSimulatorEmulated::isTimeSynchronized() const
{
return m_timeSyncronized;
}
bool CSimulatorSwift::connectTo()
bool CSimulatorEmulated::connectTo()
{
QTimer::singleShot(1000, this, [ = ]
{
@@ -68,38 +68,38 @@ namespace BlackSimPlugin
return true;
}
bool CSimulatorSwift::disconnectFrom()
bool CSimulatorEmulated::disconnectFrom()
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
m_renderedAircraft.clear();
return true;
}
bool CSimulatorSwift::logicallyAddRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
bool CSimulatorEmulated::logicallyAddRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, remoteAircraft.toQString());
return CSimulatorCommon::logicallyAddRemoteAircraft(remoteAircraft);
}
bool CSimulatorSwift::logicallyRemoveRemoteAircraft(const CCallsign &callsign)
bool CSimulatorEmulated::logicallyRemoveRemoteAircraft(const CCallsign &callsign)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, callsign.toQString());
return CSimulatorCommon::logicallyRemoveRemoteAircraft(callsign);
}
int CSimulatorSwift::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns)
int CSimulatorEmulated::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, callsigns.toQString());
return CSimulatorCommon::physicallyRemoveMultipleRemoteAircraft(callsigns);
}
bool CSimulatorSwift::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
bool CSimulatorEmulated::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, aircraft.toQString());
return true;
}
bool CSimulatorSwift::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
bool CSimulatorEmulated::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, aircraft.toQString());
const int c = m_renderedAircraft.setEnabled(aircraft.getCallsign(), aircraft.isEnabled(), true);
@@ -107,23 +107,23 @@ namespace BlackSimPlugin
return c > 0;
}
bool CSimulatorSwift::updateOwnSimulatorCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
bool CSimulatorEmulated::updateOwnSimulatorCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, aircraft.toQString(), originator.toQString());
return true;
}
void CSimulatorSwift::displayStatusMessage(const CStatusMessage &message) const
void CSimulatorEmulated::displayStatusMessage(const CStatusMessage &message) const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, message.toQString());
}
void CSimulatorSwift::displayTextMessage(const CTextMessage &message) const
void CSimulatorEmulated::displayTextMessage(const CTextMessage &message) const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, message.toQString());
}
bool CSimulatorSwift::setTimeSynchronization(bool enable, const CTime &offset)
bool CSimulatorEmulated::setTimeSynchronization(bool enable, const CTime &offset)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, boolToTrueFalse(enable), offset.toQString());
m_timeSyncronized = enable;
@@ -131,45 +131,45 @@ namespace BlackSimPlugin
return enable;
}
CTime CSimulatorSwift::getTimeSynchronizationOffset() const
CTime CSimulatorEmulated::getTimeSynchronizationOffset() const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return m_offsetTime;
}
bool CSimulatorSwift::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
bool CSimulatorEmulated::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, callsign.toQString());
return m_renderedAircraft.containsCallsign(callsign);
}
CCallsignSet CSimulatorSwift::physicallyRenderedAircraft() const
CCallsignSet CSimulatorEmulated::physicallyRenderedAircraft() const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return m_renderedAircraft.getCallsigns();
}
void CSimulatorSwift::highlightAircraft(const CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const CTime &displayTime)
void CSimulatorEmulated::highlightAircraft(const CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const CTime &displayTime)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, aircraftToHighlight.toQString(), boolToTrueFalse(enableHighlight), displayTime.toQString());
CSimulatorCommon::highlightAircraft(aircraftToHighlight, enableHighlight, displayTime);
}
bool CSimulatorSwift::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
bool CSimulatorEmulated::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, commandLine, originator.toQString());
return CSimulatorCommon::parseCommandLine(commandLine, originator);
}
void CSimulatorSwift::registerHelp()
void CSimulatorEmulated::registerHelp()
{
if (BlackMisc::CSimpleCommandParser::registered("BlackSimPlugin::Swift::CSimulatorSwift")) { return; }
if (BlackMisc::CSimpleCommandParser::registered("BlackSimPlugin::Swift::CSimulatorEmulated")) { return; }
BlackMisc::CSimpleCommandParser::registerCommand({".drv", "alias: .driver .plugin"});
BlackMisc::CSimpleCommandParser::registerCommand({".drv show", "show swift driver window"});
BlackMisc::CSimpleCommandParser::registerCommand({".drv hide", "hide swift driver window"});
}
void CSimulatorSwift::setCombinedStatus(bool connected, bool simulating, bool paused)
void CSimulatorEmulated::setCombinedStatus(bool connected, bool simulating, bool paused)
{
m_connected = connected;
m_simulating = simulating;
@@ -177,25 +177,25 @@ namespace BlackSimPlugin
this->emitSimulatorCombinedStatus();
}
bool CSimulatorSwift::isConnected() const
bool CSimulatorEmulated::isConnected() const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return m_connected;
}
bool CSimulatorSwift::isPaused() const
bool CSimulatorEmulated::isPaused() const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return m_paused;
}
bool CSimulatorSwift::isSimulating() const
bool CSimulatorEmulated::isSimulating() const
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return m_simulating;
}
bool CSimulatorSwift::physicallyAddRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
bool CSimulatorEmulated::physicallyAddRemoteAircraft(const CSimulatedAircraft &remoteAircraft)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, remoteAircraft.toQString());
CSimulatedAircraft aircraft(remoteAircraft);
@@ -205,26 +205,26 @@ namespace BlackSimPlugin
return true;
}
bool CSimulatorSwift::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
bool CSimulatorEmulated::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, callsign.toQString());
const int c = m_renderedAircraft.removeByCallsign(callsign);
return c > 0;
}
bool CSimulatorSwift::setInterpolatorMode(CInterpolatorMulti::Mode mode, const CCallsign &callsign)
bool CSimulatorEmulated::setInterpolatorMode(CInterpolatorMulti::Mode mode, const CCallsign &callsign)
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO, CInterpolatorMulti::modeToString(mode), callsign.toQString());
return false;
}
int CSimulatorSwift::physicallyRemoveAllRemoteAircraft()
int CSimulatorEmulated::physicallyRemoveAllRemoteAircraft()
{
if (canLog()) m_monitorWidget->appendFunctionCall(Q_FUNC_INFO);
return CSimulatorCommon::physicallyRemoveAllRemoteAircraft();
}
bool CSimulatorSwift::parseDetails(const CSimpleCommandParser &parser)
bool CSimulatorEmulated::parseDetails(const CSimpleCommandParser &parser)
{
if (m_monitorWidget && parser.isKnownCommand())
{
@@ -234,12 +234,12 @@ namespace BlackSimPlugin
return false;
}
bool CSimulatorSwift::canLog() const
bool CSimulatorEmulated::canLog() const
{
return sApp && !sApp->isShuttingDown() && m_log && m_monitorWidget;
}
void CSimulatorSwift::closeMonitor()
void CSimulatorEmulated::closeMonitor()
{
if (m_monitorWidget)
{
@@ -247,7 +247,7 @@ namespace BlackSimPlugin
}
}
void CSimulatorSwift::setOwnAircraftPosition(const QString &wgsLatitude, const QString &wgsLongitude, const CAltitude &altitude)
void CSimulatorEmulated::setOwnAircraftPosition(const QString &wgsLatitude, const QString &wgsLongitude, const CAltitude &altitude)
{
const CCoordinateGeodetic coordinate(
CLatitude::fromWgs84(wgsLatitude),
@@ -261,7 +261,7 @@ namespace BlackSimPlugin
this->updateOwnSituation(s);
}
void CSimulatorSwift::onSettingsChanged()
void CSimulatorEmulated::onSettingsChanged()
{
const CSwiftPluginSettings settings(m_settings.get());
m_log = settings.isLoggingFunctionCalls();
@@ -282,11 +282,11 @@ namespace BlackSimPlugin
this->updateOwnModel(settings.getOwnModel());
}
CSimulatorSwiftListener::CSimulatorSwiftListener(const CSimulatorPluginInfo &info)
CSimulatorEmulatedListener::CSimulatorEmulatedListener(const CSimulatorPluginInfo &info)
: ISimulatorListener(info)
{ }
void CSimulatorSwiftListener::startImpl()
void CSimulatorEmulatedListener::startImpl()
{
if (this->isShuttingDown()) { return; }
QTimer::singleShot(2000, this, [ = ]
@@ -296,7 +296,7 @@ namespace BlackSimPlugin
});
}
void CSimulatorSwiftListener::stopImpl()
void CSimulatorEmulatedListener::stopImpl()
{ }
} // ns
} // ns

View File

@@ -9,30 +9,30 @@
//! \file
#ifndef BLACKSIMPLUGIN_SWIFT_SIMULATORSWIFT_H
#define BLACKSIMPLUGIN_SWIFT_SIMULATORSWIFT_H
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATED_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATED_H
#include "blackcore/simulatorcommon.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include "blackmisc/simulation/settings/swiftpluginsettings.h"
#include "blackmisc/pq/time.h"
#include "simulatorswiftmonitordialog.h"
#include "simulatoremulatedmonitordialog.h"
#include <QScopedPointer>
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
//! swift simulator implementation
class CSimulatorSwift : public BlackCore::CSimulatorCommon
class CSimulatorEmulated : public BlackCore::CSimulatorCommon
{
Q_OBJECT
friend class CSimulatorSwiftMonitorDialog; //!< the monitor widget represents the simulator and needs access to internals (i.e. private/protected)
friend class CSimulatorEmulatedMonitorDialog; //!< the monitor widget represents the simulator and needs access to internals (i.e. private/protected)
public:
//! Constructor, parameters as in \sa BlackCore::ISimulatorFactory::create
CSimulatorSwift(
CSimulatorEmulated(
const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
@@ -67,8 +67,8 @@ namespace BlackSimPlugin
//! \addtogroup swiftdotcommands
//! @{
//! <pre>
//! .drv show show swift driver window BlackSimPlugin::Swift::CSimulatorSwift
//! .drv hide hide swift driver window BlackSimPlugin::Swift::CSimulatorSwift
//! .drv show show swift driver window BlackSimPlugin::Swift::CSimulatorEmulated
//! .drv hide hide swift driver window BlackSimPlugin::Swift::CSimulatorEmulated
//! </pre>
//! @}
//! \copydoc BlackCore::ISimulator::parseCommandLine
@@ -117,18 +117,18 @@ namespace BlackSimPlugin
BlackMisc::PhysicalQuantities::CTime m_offsetTime;
BlackMisc::Simulation::CSimulatedAircraftList m_renderedAircraft;
QScopedPointer<CSimulatorSwiftMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_settings { this, &CSimulatorSwift::onSettingsChanged };
QScopedPointer<CSimulatorEmulatedMonitorDialog> m_monitorWidget; //!< parent will be main window, so we need to destroy widget when destroyed
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSwiftPlugin> m_settings { this, &CSimulatorEmulated::onSettingsChanged };
};
//! Listener for swift
class CSimulatorSwiftListener : public BlackCore::ISimulatorListener
class CSimulatorEmulatedListener : public BlackCore::ISimulatorListener
{
Q_OBJECT
public:
//! Constructor
CSimulatorSwiftListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
CSimulatorEmulatedListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
protected:
//! \copydoc BlackCore::ISimulatorListener::startImpl

View File

@@ -0,0 +1,7 @@
{
"identifier" : "org.swift-project.plugins.simulator.emulated",
"name" : "Emulated simulator",
"simulator" : "emulated",
"description" : "Emulated simulator driver",
"config" : "org.swift-project.plugins.simulator.emulated.config"
}

View File

@@ -7,27 +7,27 @@
* contained in the LICENSE file.
*/
#include "simulatorswiftfactory.h"
#include "simulatorswift.h"
#include "simulatoremulatedfactory.h"
#include "simulatoremulated.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include <QTimer>
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
BlackCore::ISimulator *CSimulatorSwiftFactory::create(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackCore::ISimulator *CSimulatorEmulatedFactory::create(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider)
{
Q_ASSERT(ownAircraftProvider);
return new CSimulatorSwift(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, this);
return new CSimulatorEmulated(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, this);
}
BlackCore::ISimulatorListener *CSimulatorSwiftFactory::createListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info)
BlackCore::ISimulatorListener *CSimulatorEmulatedFactory::createListener(const BlackMisc::Simulation::CSimulatorPluginInfo &info)
{
return new CSimulatorSwiftListener(info);
return new CSimulatorEmulatedListener(info);
}
} // namespace
} // namespace

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_SWIFTFACTORY_H
#define BLACKSIMPLUGIN_SIMULATOR_SWIFTFACTORY_H
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDFACTORY_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDFACTORY_H
#include "blackcore/simulator.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
@@ -20,15 +20,15 @@
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
//! Factory implementation to create CSimulatorSwift instances
class CSimulatorSwiftFactory :
//! Factory implementation to create CSimulatorEmulated instances
class CSimulatorEmulatedFactory :
public QObject,
public BlackCore::ISimulatorFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.blackcore.simulatorinterface" FILE "simulatorswift.json")
Q_PLUGIN_METADATA(IID "org.swift-project.blackcore.simulatorinterface" FILE "simulatoremulated.json")
Q_INTERFACES(BlackCore::ISimulatorFactory)
public:

View File

@@ -7,9 +7,9 @@
* contained in the LICENSE file.
*/
#include "simulatorswiftmonitordialog.h"
#include "simulatorswift.h"
#include "ui_simulatorswiftmonitordialog.h"
#include "simulatoremulatedmonitordialog.h"
#include "simulatoremulated.h"
#include "ui_simulatoremulatedmonitordialog.h"
using namespace BlackMisc;
using namespace BlackMisc::Aviation;
@@ -17,17 +17,17 @@ using namespace BlackGui::Editors;
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
const CLogCategoryList &CSimulatorSwiftMonitorDialog::getLogCategories()
const CLogCategoryList &CSimulatorEmulatedMonitorDialog::getLogCategories()
{
static const BlackMisc::CLogCategoryList cats { CLogCategory::driver(), CLogCategory::plugin() };
return cats;
}
CSimulatorSwiftMonitorDialog::CSimulatorSwiftMonitorDialog(CSimulatorSwift *simulator, QWidget *parent) :
CSimulatorEmulatedMonitorDialog::CSimulatorEmulatedMonitorDialog(CSimulatorEmulated *simulator, QWidget *parent) :
QDialog(parent),
ui(new Ui::CSimulatorSwiftMonitorDialog)
ui(new Ui::CSimulatorEmulatedMonitorDialog)
{
Q_ASSERT_X(simulator, Q_FUNC_INFO, "Need simulator");
@@ -36,31 +36,31 @@ namespace BlackSimPlugin
ui->tw_SwiftMonitorDialog->setCurrentIndex(0);
this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(ui->cb_Connected, &QCheckBox::released, this, &CSimulatorSwiftMonitorDialog::onSimulatorValuesChanged);
connect(ui->cb_Paused, &QCheckBox::released, this, &CSimulatorSwiftMonitorDialog::onSimulatorValuesChanged);
connect(ui->cb_Simulating, &QCheckBox::released, this, &CSimulatorSwiftMonitorDialog::onSimulatorValuesChanged);
connect(ui->cb_Connected, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
connect(ui->cb_Paused, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
connect(ui->cb_Simulating, &QCheckBox::released, this, &CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged);
connect(ui->editor_Situation, &CSituationForm::changeAircraftSituation, this, &CSimulatorSwiftMonitorDialog::changeSituation);
connect(ui->editor_AircraftParts, &CAircraftPartsForm::changeAircraftParts, this, &CSimulatorSwiftMonitorDialog::changeParts);
connect(ui->editor_Situation, &CSituationForm::changeAircraftSituation, this, &CSimulatorEmulatedMonitorDialog::changeSituation);
connect(ui->editor_AircraftParts, &CAircraftPartsForm::changeAircraftParts, this, &CSimulatorEmulatedMonitorDialog::changeParts);
this->setSimulatorUiValues();
ui->editor_Situation->setSituation(m_simulator->getOwnAircraftSituation());
}
CSimulatorSwiftMonitorDialog::~CSimulatorSwiftMonitorDialog()
CSimulatorEmulatedMonitorDialog::~CSimulatorEmulatedMonitorDialog()
{ }
void CSimulatorSwiftMonitorDialog::appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage)
void CSimulatorEmulatedMonitorDialog::appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage)
{
ui->comp_LogComponent->appendStatusMessagesToList(statusMessage);
}
void CSimulatorSwiftMonitorDialog::appendStatusMessagesToList(const BlackMisc::CStatusMessageList &statusMessages)
void CSimulatorEmulatedMonitorDialog::appendStatusMessagesToList(const BlackMisc::CStatusMessageList &statusMessages)
{
ui->comp_LogComponent->appendStatusMessagesToList(statusMessages);
}
void CSimulatorSwiftMonitorDialog::appendFunctionCall(const QString &function, const QString &p1, const QString &p2, const QString &p3)
void CSimulatorEmulatedMonitorDialog::appendFunctionCall(const QString &function, const QString &p1, const QString &p2, const QString &p3)
{
static const QString c1("%1 %2");
static const QString c2("%1 %2 %3");
@@ -86,7 +86,7 @@ namespace BlackSimPlugin
this->appendStatusMessageToList(msg);
}
void CSimulatorSwiftMonitorDialog::onSimulatorValuesChanged()
void CSimulatorEmulatedMonitorDialog::onSimulatorValuesChanged()
{
m_simulator->setCombinedStatus(
ui->cb_Connected->isChecked(),
@@ -95,21 +95,21 @@ namespace BlackSimPlugin
);
}
void CSimulatorSwiftMonitorDialog::changeSituation()
void CSimulatorEmulatedMonitorDialog::changeSituation()
{
if (!m_simulator) { return; }
const CAircraftSituation s(ui->editor_Situation->getSituation());
m_simulator->updateOwnSituation(s);
}
void CSimulatorSwiftMonitorDialog::changeParts()
void CSimulatorEmulatedMonitorDialog::changeParts()
{
if (!m_simulator) { return; }
const CAircraftParts p(ui->editor_AircraftParts->getAircraftPartsFromGui());
m_simulator->updateOwnParts(p);
}
void CSimulatorSwiftMonitorDialog::setSimulatorUiValues()
void CSimulatorEmulatedMonitorDialog::setSimulatorUiValues()
{
ui->cb_Connected->setChecked(m_simulator->isConnected());
ui->cb_Paused->setChecked(m_simulator->isPaused());

View File

@@ -9,25 +9,25 @@
//! \file
#ifndef BLACKSIMPLUGIN_SWIFT_SIMULATORSWIFTMONITORDIALOG_H
#define BLACKSIMPLUGIN_SWIFT_SIMULATORSWIFTMONITORDIALOG_H
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDMONITORDIALOG_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDMONITORDIALOG_H
#include <QDialog>
#include <QScopedPointer>
#include "blackmisc/statusmessagelist.h"
#include "blackmisc/logcategorylist.h"
namespace Ui { class CSimulatorSwiftMonitorDialog; }
namespace Ui { class CSimulatorEmulatedMonitorDialog; }
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
class CSimulatorSwift;
class CSimulatorEmulated;
/**
* Monitor widget for the pseudo driver
*/
class CSimulatorSwiftMonitorDialog : public QDialog
class CSimulatorEmulatedMonitorDialog : public QDialog
{
Q_OBJECT
@@ -36,10 +36,10 @@ namespace BlackSimPlugin
static const BlackMisc::CLogCategoryList &getLogCategories();
//! Ctor
explicit CSimulatorSwiftMonitorDialog(CSimulatorSwift *simulator, QWidget *parent = nullptr);
explicit CSimulatorEmulatedMonitorDialog(CSimulatorEmulated *simulator, QWidget *parent = nullptr);
//! Dtor
virtual ~CSimulatorSwiftMonitorDialog();
virtual ~CSimulatorEmulatedMonitorDialog();
//! \copydoc BlackGui::Components::CLogComponent::appendStatusMessageToList
void appendStatusMessageToList(const BlackMisc::CStatusMessage &statusMessage);
@@ -63,8 +63,8 @@ namespace BlackSimPlugin
//! UI values
void setSimulatorUiValues();
QScopedPointer<Ui::CSimulatorSwiftMonitorDialog> ui;
CSimulatorSwift *m_simulator = nullptr;
QScopedPointer<Ui::CSimulatorEmulatedMonitorDialog> ui;
CSimulatorEmulated *m_simulator = nullptr;
};
} // ns
} // ns

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSimulatorSwiftMonitorDialog</class>
<widget class="QDialog" name="CSimulatorSwiftMonitorDialog">
<class>CSimulatorEmulatedMonitorDialog</class>
<widget class="QDialog" name="CSimulatorEmulatedMonitorDialog">
<property name="geometry">
<rect>
<x>0</x>
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>swift driver monitor</string>
<string>Emulated simulator monitor</string>
</property>
<layout class="QVBoxLayout" name="vl_Settings">
<item>
@@ -244,7 +244,7 @@
<connection>
<sender>bb_SwiftMonitorDialog</sender>
<signal>accepted()</signal>
<receiver>CSimulatorSwiftMonitorDialog</receiver>
<receiver>CSimulatorEmulatedMonitorDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
@@ -260,7 +260,7 @@
<connection>
<sender>bb_SwiftMonitorDialog</sender>
<signal>rejected()</signal>
<receiver>CSimulatorSwiftMonitorDialog</receiver>
<receiver>CSimulatorEmulatedMonitorDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">

View File

@@ -2,7 +2,7 @@ load(common_pre)
QT += core widgets dbus network
TARGET = simulatorswiftconfig
TARGET = simulatoremulatedconfig
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore blackgui
@@ -14,7 +14,7 @@ SOURCES += *.cpp
HEADERS += *.h
FORMS += *.ui
DISTFILES += simulatorswiftconfig.json
DISTFILES += simulatoremulatedconfig.json
DESTDIR = $$DestRoot/bin/plugins/simulator
win32 {

View File

@@ -7,21 +7,21 @@
* contained in the LICENSE file.
*/
#include "simulatorswiftconfig.h"
#include "swiftconfigwidget.h"
#include "simulatoremulatedconfig.h"
#include "simulatoremulatedconfigwidget.h"
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
CSimulatorSwiftConfig::CSimulatorSwiftConfig(QObject *parent) : QObject(parent)
CSimulatorEmulatedConfig::CSimulatorEmulatedConfig(QObject *parent) : QObject(parent)
{
// void
}
BlackGui::CPluginConfigWindow *CSimulatorSwiftConfig::createConfigWindow(QWidget *parent)
BlackGui::CPluginConfigWindow *CSimulatorEmulatedConfig::createConfigWindow(QWidget *parent)
{
return new CSwiftConfigWidget(parent);
return new CSimulatorEmulatedConfigWidget(parent);
}
}
}

View File

@@ -9,30 +9,30 @@
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_SWIFT_CONFIG_H
#define BLACKSIMPLUGIN_SIMULATOR_SWIFT_CONFIG_H
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDCONFIG_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDCONFIG_H
#include "blackgui/pluginconfig.h"
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
/*!
* Window for setting up the FSX plugin.
*/
class CSimulatorSwiftConfig : public QObject, public BlackGui::IPluginConfig
class CSimulatorEmulatedConfig : public QObject, public BlackGui::IPluginConfig
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.blackgui.pluginconfiginterface" FILE "simulatorswiftconfig.json")
Q_PLUGIN_METADATA(IID "org.swift-project.blackgui.pluginconfiginterface" FILE "simulatoremulatedconfig.json")
Q_INTERFACES(BlackGui::IPluginConfig)
public:
//! Ctor
CSimulatorSwiftConfig(QObject *parent = nullptr);
CSimulatorEmulatedConfig(QObject *parent = nullptr);
//! Dtor
virtual ~CSimulatorSwiftConfig() {}
virtual ~CSimulatorEmulatedConfig() {}
//! \copydoc BlackGui::IPluginConfig::createConfigWindow()
BlackGui::CPluginConfigWindow *createConfigWindow(QWidget *parent) override;

View File

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

View File

@@ -7,23 +7,23 @@
* contained in the LICENSE file.
*/
#include "swiftconfigwidget.h"
#include "ui_swiftconfigwidget.h"
#include "simulatoremulatedconfigwidget.h"
#include "ui_simulatoremulatedconfigwidget.h"
using namespace BlackGui;
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
CSwiftConfigWidget::CSwiftConfigWidget(QWidget *parent) :
CSimulatorEmulatedConfigWidget::CSimulatorEmulatedConfigWidget(QWidget *parent) :
BlackGui::CPluginConfigWindow(parent),
ui(new Ui::CSwiftConfigWidget)
ui(new Ui::CSimulatorEmulatedConfigWidget)
{
ui->setupUi(this);
}
CSwiftConfigWidget::~CSwiftConfigWidget()
CSimulatorEmulatedConfigWidget::~CSimulatorEmulatedConfigWidget()
{ }
} // ns
} // ns

View File

@@ -9,33 +9,33 @@
//! \file
#ifndef BLACKSIMPLUGIN_SWIFT_SWIFTCONFIGWIDGET_H
#define BLACKSIMPLUGIN_SWIFT_SWIFTCONFIGWIDGET_H
#ifndef BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDCONFIGWIDGET_H
#define BLACKSIMPLUGIN_EMULATED_SIMULATOREMULATEDCONFIGWIDGET_H
#include <blackgui/pluginconfigwindow.h>
#include <QScopedPointer>
namespace Ui { class CSwiftConfigWidget; }
namespace Ui { class CSimulatorEmulatedConfigWidget; }
namespace BlackSimPlugin
{
namespace Swift
namespace Emulated
{
/**
* Configuration window for CSimulatorSwiftConfig
* Configuration window for CSimulatorEmulatedConfig
*/
class Q_DECL_EXPORT CSwiftConfigWidget : public BlackGui::CPluginConfigWindow
class Q_DECL_EXPORT CSimulatorEmulatedConfigWidget : public BlackGui::CPluginConfigWindow
{
Q_OBJECT
public:
//! Ctor
explicit CSwiftConfigWidget(QWidget *parent = nullptr);
explicit CSimulatorEmulatedConfigWidget(QWidget *parent = nullptr);
//! Dtor
virtual ~CSwiftConfigWidget();
virtual ~CSimulatorEmulatedConfigWidget();
private:
QScopedPointer <Ui::CSwiftConfigWidget> ui;
QScopedPointer <Ui::CSimulatorEmulatedConfigWidget> ui;
};
} // ns
} // ns

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSwiftConfigWidget</class>
<widget class="QWidget" name="CSwiftConfigWidget">
<class>CSimulatorEmulatedConfigWidget</class>
<widget class="QWidget" name="CSimulatorEmulatedConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>swift pseudo driver</string>
<string>emulated simulator driver</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>

View File

@@ -3,8 +3,8 @@ load(common_pre)
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += swift
SUBDIRS += swiftconfig
SUBDIRS += emulated
SUBDIRS += emulatedconfig
contains(BLACK_CONFIG,FSX|FS9|P3D) {
SUBDIRS += fsuipc32

View File

@@ -1,7 +0,0 @@
{
"identifier" : "org.swift-project.plugins.simulator.swift",
"name" : "swift pseudo simulator",
"simulator" : "swift",
"description" : "swift testing driver",
"config" : "org.swift-project.plugins.simulator.swift.config"
}

View File

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