refs #432, adjusted originators

This commit is contained in:
Klaus Basan
2015-05-28 00:32:17 +02:00
parent a62cf48e18
commit 6c06ff5d46
20 changed files with 96 additions and 138 deletions

View File

@@ -28,10 +28,12 @@ using namespace BlackMisc::Simulation;
namespace BlackCore
{
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
IContextOwnAircraft(mode, runtime)
IContextOwnAircraft(mode, runtime),
COriginatorAware(this)
{
Q_ASSERT(this->getRuntime());
Q_ASSERT(this->getRuntime()->getIContextSettings());
this->setObjectName("CContextOwnAircraft");
// Init own aircraft
this->initOwnAircraft();
@@ -360,8 +362,7 @@ namespace BlackCore
{
if (CSelcal::isValidCode(parser.part(1)))
{
// todo RW: replace originator
this->updateSelcal(parser.part(1), COriginator("commandline"));
this->updateSelcal(parser.part(1), this->originator());
return true;
}
}

View File

@@ -19,6 +19,7 @@
#include "blackcore/dbus_server.h"
#include "blackmisc/aviation/atcstation.h"
#include "blackmisc/simulation/ownaircraftprovider.h"
#include "blackmisc/originatoraware.h"
namespace BlackCore
{
@@ -27,7 +28,8 @@ namespace BlackCore
//! Central instance of data for \sa IOwnAircraftProvider .
class BLACKCORE_EXPORT CContextOwnAircraft :
public IContextOwnAircraft,
public BlackMisc::Simulation::IOwnAircraftProvider
public BlackMisc::Simulation::IOwnAircraftProvider,
public BlackMisc::COriginatorAware
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTOWNAIRCRAFT_INTERFACENAME)

View File

@@ -29,14 +29,6 @@ namespace BlackCore
return status;
}
COriginator ISimulator::simulatorOriginator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("SIMULATOR"));
return m_originator;
}
QString ISimulator::statusToString(int status)
{
if (status > 0)

View File

@@ -26,19 +26,22 @@
#include "blackmisc/network/textmessage.h"
#include "blackmisc/network/client.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/originatoraware.h"
#include <QObject>
namespace BlackCore
{
//! Interface to a simulator.
class BLACKCORE_EXPORT ISimulator : public QObject
class BLACKCORE_EXPORT ISimulator :
public QObject,
public BlackMisc::COriginatorAware
{
Q_OBJECT
public:
//! ISimulator status
enum SimulatorStatus
enum SimulatorStatusFlag
{
Disconnected = 0,
Connected = 1 << 0, //!< Is the plugin connected to the simulator?
@@ -46,6 +49,8 @@ namespace BlackCore
Paused = 1 << 2, //!< Is the simulator paused?
};
Q_DECLARE_FLAGS(SimulatorStatus, SimulatorStatusFlag)
//! Render all aircraft if number of aircraft >= MaxAircraftInfinite
const int MaxAircraftInfinite = 100;
@@ -169,9 +174,6 @@ namespace BlackCore
//! Driver will be unloaded
virtual void unload() = 0;
//! Originator
BlackMisc::COriginator simulatorOriginator();
//! Status to string
static QString statusToString(int status);
@@ -196,7 +198,10 @@ namespace BlackCore
protected:
//! Default constructor
ISimulator(QObject *parent = nullptr) : QObject(parent) {}
ISimulator(QObject *parent = nullptr) :
QObject(parent),
BlackMisc::COriginatorAware(this)
{}
//! Are we connected to the simulator?
virtual bool isConnected() const = 0;
@@ -223,10 +228,6 @@ namespace BlackCore
//! Emit the combined status
//! \sa simulatorStatusChanged;
void emitSimulatorCombinedStatus();
private:
BlackMisc::COriginator m_originator;
};
//! Interface to a simulator listener.
@@ -287,5 +288,6 @@ namespace BlackCore
} // namespace
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
#endif // guard

View File

@@ -16,29 +16,19 @@ namespace BlackGui
{
CCommandInput::CCommandInput(QWidget *parent) :
QLineEdit(parent)
QLineEdit(parent),
COriginatorAware(this)
{
connect(this, &CCommandInput::returnPressed, this, &CCommandInput::validateCommand);
connect(this, &CCommandInput::returnPressed, this, &CCommandInput::ps_validateCommand);
}
void CCommandInput::validateCommand()
void CCommandInput::ps_validateCommand()
{
QString commandLine = text();
setText(QString());
QString commandLine(this->text().trimmed());
this->setText(QString());
if (commandLine.startsWith('.'))
{
emit commandEntered(commandLine, commandInputOriginator());
emit commandEntered(commandLine, originator());
}
}
COriginator CCommandInput::commandInputOriginator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("COMMANDINPUT"));
return m_originator;
}
}
} // ns

View File

@@ -13,44 +13,33 @@
#define BLACKGUI_COMMANDINPUT_H
#include "blackguiexport.h"
#include "blackmisc/originator.h"
#include "blackmisc/originatoraware.h"
#include <QLineEdit>
#include <QString>
namespace BlackGui
{
//! Specialized LineEdit for command inputs
class BLACKGUI_EXPORT CCommandInput : public QLineEdit
class BLACKGUI_EXPORT CCommandInput :
public QLineEdit,
public BlackMisc::COriginatorAware
{
Q_OBJECT
public:
//! Constructor
CCommandInput(QWidget *parent = nullptr);
//! Destructor
~CCommandInput() {}
//! Originator
BlackMisc::COriginator commandInputOriginator();
signals:
//! Command was entered
void commandEntered(const QString &command, const BlackMisc::COriginator &originator);
private slots:
//! Basic command validation
void validateCommand();
private:
BlackMisc::COriginator m_originator;
void ps_validateCommand();
};
}
#endif // CCOMMANDINPUT_H
#endif // guard

View File

@@ -29,6 +29,7 @@ namespace BlackGui
{
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
QTabWidget(parent),
COriginatorAware(this),
ui(new Ui::CAtcStationComponent),
m_updateTimer(new CUpdateTimer("CAtcStationComponent", &CAtcStationComponent::update, this))
{
@@ -275,14 +276,6 @@ namespace BlackGui
}
}
COriginator CAtcStationComponent::originator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("ATCSTATIOCOMPONENT"));
return m_originator;
}
void CAtcStationComponent::ps_onlineAtcStationSelected(QModelIndex index)
{
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset

View File

@@ -16,7 +16,7 @@
#include "blackgui/components/enableforruntime.h"
#include "blackgui/components/enablefordockwidgetinfoarea.h"
#include "blackgui/components/updatetimer.h"
#include "blackmisc/originator.h"
#include "blackmisc/originatoraware.h"
#include "blackmisc/aviation/atcstation.h"
#include <QTabWidget>
#include <QModelIndex>
@@ -32,7 +32,8 @@ namespace BlackGui
class BLACKGUI_EXPORT CAtcStationComponent :
public QTabWidget,
public CEnableForDockWidgetInfoArea,
public CEnableForRuntime
public CEnableForRuntime,
public BlackMisc::COriginatorAware
{
Q_OBJECT
@@ -112,16 +113,12 @@ namespace BlackGui
private:
void updateTreeView();
BlackMisc::COriginator originator();
QScopedPointer<Ui::CAtcStationComponent> ui;
QScopedPointer<CUpdateTimer> m_updateTimer;
QDateTime m_timestampLastReadOnlineStations = CUpdateTimer::epoch(); //!< stations read
QDateTime m_timestampOnlineStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
BlackMisc::COriginator m_originator;
};
} // namespace
} // namespace

View File

@@ -33,6 +33,7 @@ namespace BlackGui
{
CCockpitComComponent::CCockpitComComponent(QWidget *parent) :
QFrame(parent),
BlackMisc::COriginatorAware(this),
ui(new Ui::CCockpitMainComponent)
{
ui->setupUi(this);
@@ -62,7 +63,7 @@ namespace BlackGui
// init from aircraft
CAircraft ownAircraft = this->getOwnAircraft();
this->ps_updateCockpitFromContext(ownAircraft, COriginator("dummyInitialValues"));
this->ps_updateCockpitFromContext(ownAircraft, COriginator("dummyInitialValues")); // intentionally different name here
// SELCAL pairs in cockpit
this->ui->frp_ComPanelSelcalBottom->clear();
@@ -111,12 +112,12 @@ namespace BlackGui
void CCockpitComComponent::ps_guiChangedSelcal()
{
this->getIContextOwnAircraft()->updateSelcal(this->getSelcal(), cockpitOriginator());
this->getIContextOwnAircraft()->updateSelcal(this->getSelcal(), originator());
}
void CCockpitComComponent::ps_updateCockpitFromContext(const CAircraft &ownAircraft, const COriginator &originator)
{
if (originator == CCockpitComComponent::cockpitOriginator()) return; // comes from myself
if (isMyOriginator(originator)) { return; } // comes from myself
// update GUI elements
// avoid unnecessary change events as far as possible
@@ -184,7 +185,7 @@ namespace BlackGui
void CCockpitComComponent::ps_onChangedSelcal(const CSelcal &selcal, const COriginator &originator)
{
if (originator == CCockpitComComponent::cockpitOriginator()) return; // comes from myself
if (isMyOriginator(originator)) { return; } // comes from myself
this->ui->frp_ComPanelSelcalBottom->setSelcalCode(selcal);
}
@@ -246,7 +247,7 @@ namespace BlackGui
bool CCockpitComComponent::updateOwnCockpitInContext(const CAircraft &ownAircraft)
{
return this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), CCockpitComComponent::cockpitOriginator());
return this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), originator());
}
void CCockpitComComponent::updateFrequencyDisplaysFromComSystems(const CComSystem &com1, const CComSystem &com2)
@@ -286,13 +287,7 @@ namespace BlackGui
Q_UNUSED(connected);
}
COriginator CCockpitComComponent::cockpitOriginator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("COCKPITCOMCOMPONENT"));
return m_originator;
}
} // namespace
} // namespace

View File

@@ -13,7 +13,7 @@
#include "blackgui/blackguiexport.h"
#include "enablefordockwidgetinfoarea.h"
#include "enableforruntime.h"
#include "blackmisc/originator.h"
#include "blackmisc/originatoraware.h"
#include "blackmisc/aviation/aircraft.h"
#include "blackmisc/aviation/transponder.h"
#include "blackmisc/audio/voiceroomlist.h"
@@ -29,6 +29,7 @@ namespace BlackGui
//! The main cockpit area
class BLACKGUI_EXPORT CCockpitComComponent :
public QFrame,
public BlackMisc::COriginatorAware,
public CEnableForDockWidgetInfoArea,
public CEnableForRuntime
{
@@ -97,12 +98,8 @@ namespace BlackGui
//! COM frequencies displayed
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
//! Identifies sender of cockpit updates
BlackMisc::COriginator cockpitOriginator();
QScopedPointer<Ui::CCockpitMainComponent> ui;
BlackMisc::COriginator m_originator;
};
};
} // namespace
} // namespace

View File

@@ -22,6 +22,7 @@ namespace BlackGui
{
CCockpitTransponderModeLedsComponent::CCockpitTransponderModeLedsComponent(QWidget *parent) :
QFrame(parent),
COriginatorAware(this),
m_ledStandby(new CLedWidget(false, CLedWidget::Blue, CLedWidget::Black, CLedWidget::Rounded, "standby", "", LedWidth, this)),
m_ledModes(new CLedWidget(false, CLedWidget::Green, CLedWidget::Black, CLedWidget::Rounded, "mode C", "", LedWidth, this)),
m_ledIdent(new CLedWidget(false, CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Rounded, "ident", "", LedWidth, this))
@@ -38,7 +39,7 @@ namespace BlackGui
void CCockpitTransponderModeLedsComponent::ps_onAircraftCockpitChanged(const CAircraft &aircraft, const BlackMisc::COriginator &originator)
{
if (ledsOriginator() == originator) { return; }
if (isMyOriginator(originator)) { return; }
this->setMode(aircraft.getTransponderMode());
}
@@ -70,7 +71,7 @@ namespace BlackGui
this->setMode(mode);
CTransponder xpdr = ownAircraft.getTransponder();
xpdr.setTransponderMode(mode);
this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), xpdr, ledsOriginator());
this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), xpdr, originator());
}
void CCockpitTransponderModeLedsComponent::init(bool horizontal)
@@ -133,13 +134,5 @@ namespace BlackGui
return getIContextOwnAircraft()->getOwnAircraft();
}
BlackMisc::COriginator CCockpitTransponderModeLedsComponent::ledsOriginator()
{
if (m_originator.getName().isEmpty())
m_originator = COriginator(QStringLiteral("XPDRLEDSCOMCOMPONENT"));
return m_originator;
}
} // namespace
} // namespace

View File

@@ -15,7 +15,7 @@
#include "blackgui/blackguiexport.h"
#include "enableforruntime.h"
#include "../led.h"
#include "blackmisc/originator.h"
#include "blackmisc/originatoraware.h"
#include "blackmisc/aviation/aircraft.h"
#include "blackmisc/aviation/transponder.h"
#include <QFrame>
@@ -26,7 +26,10 @@ namespace BlackGui
{
//! LEDs representing transponder mode state
class BLACKGUI_EXPORT CCockpitTransponderModeLedsComponent : public QFrame, public CEnableForRuntime
class BLACKGUI_EXPORT CCockpitTransponderModeLedsComponent :
public QFrame,
public CEnableForRuntime,
public BlackMisc::COriginatorAware
{
Q_OBJECT
@@ -60,16 +63,10 @@ namespace BlackGui
//! Own Aircraft
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
//! Identifies sender of cockpit updates
BlackMisc::COriginator ledsOriginator();
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
QScopedPointer<BlackGui::CLedWidget> m_ledIdent;
BlackMisc::COriginator m_originator;
};
} // namespace
} // namespace

View File

@@ -60,11 +60,11 @@ namespace BlackSimPlugin
connect(lobbyClient.data(), &CLobbyClient::disconnected, this, std::bind(&CSimulatorFs9::simulatorStatusChanged, this, 0));
this->m_interpolator = new BlackCore::CInterpolatorLinear(remoteAircraftProvider, this);
m_modelMatcher.setDefaultModel(CAircraftModel(
"Boeing 737-400",
CAircraftModel::TypeModelMatchingDefaultModel,
"B737-400 default model",
CAircraftIcaoData(CAircraftIcaoCode("B734", "L2J"), CAirlineIcaoCode(), "FFFFFF")
));
"Boeing 737-400",
CAircraftModel::TypeModelMatchingDefaultModel,
"B737-400 default model",
CAircraftIcaoData(CAircraftIcaoCode("B734", "L2J"), CAirlineIcaoCode(), "FFFFFF")
));
}
bool CSimulatorFs9::isConnected() const
@@ -124,9 +124,9 @@ namespace BlackSimPlugin
// matched models
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraftCopy);
Q_ASSERT(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign());
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel, simulatorOriginator());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, simulatorOriginator());
CSimulatedAircraft aircraftAfterModelApplied (getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel, originator());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, originator());
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
aircraftAfterModelApplied.setRendered(true);
emit modelMatchingCompleted(aircraftAfterModelApplied);
@@ -136,7 +136,7 @@ namespace BlackSimPlugin
client->start();
m_hashFs9Clients.insert(callsign, client);
updateAircraftRendered(callsign, true, this->simulatorOriginator());
updateAircraftRendered(callsign, true, this->originator());
CLogMessage(this).info("FS9: Added aircraft %1") << callsign.toQString();
return true;
}
@@ -148,7 +148,7 @@ namespace BlackSimPlugin
auto fs9Client = m_hashFs9Clients.value(callsign);
fs9Client->quit();
m_hashFs9Clients.remove(callsign);
updateAircraftRendered(callsign, false, this->simulatorOriginator());
updateAircraftRendered(callsign, false, this->originator());
CLogMessage(this).info("FS9: Removed aircraft %1") << callsign.toQString();
return true;
}
@@ -173,7 +173,7 @@ namespace BlackSimPlugin
bool CSimulatorFs9::updateOwnSimulatorCockpit(const CAircraft &ownAircraft, const COriginator &originator)
{
if (originator == this->simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
if (!this->isSimulating()) { return false; }
// actually those data should be the same as ownAircraft
@@ -307,7 +307,7 @@ namespace BlackSimPlugin
simDataOwnAircraft.getCom1System(),
simDataOwnAircraft.getCom2System(),
simDataOwnAircraft.getTransponder(),
this->simulatorOriginator());
this->originator());
}
void CSimulatorFs9::disconnectAllClients()

View File

@@ -179,7 +179,7 @@ namespace BlackSimPlugin
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const COriginator &originator)
{
if (originator == simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
// remove upfront, and then enable / disable again
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
@@ -188,7 +188,7 @@ namespace BlackSimPlugin
bool CSimulatorFsCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
{
if (originator == simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
if (aircraft.isEnabled())
{
this->physicallyAddRemoteAircraft(aircraft);

View File

@@ -166,7 +166,7 @@ namespace BlackSimPlugin
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraft);
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
this->updateAircraftModel(callsign, aircraftModel, simulatorOriginator());
this->updateAircraftModel(callsign, aircraftModel, originator());
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
// create AI
@@ -190,7 +190,7 @@ namespace BlackSimPlugin
}
aircraftAfterModelApplied.setRendered(rendered);
this->updateAircraftRendered(callsign, rendered, simulatorOriginator());
this->updateAircraftRendered(callsign, rendered, originator());
emit modelMatchingCompleted(aircraftAfterModelApplied);
return rendered;
@@ -198,7 +198,7 @@ namespace BlackSimPlugin
bool CSimulatorFsx::updateOwnSimulatorCockpit(const CAircraft &ownAircraft, const COriginator &originator)
{
if (originator == this->simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
if (!this->isSimulating()) { return false; }
// actually those data should be the same as ownAircraft
@@ -435,7 +435,7 @@ namespace BlackSimPlugin
if (changedCom1 || changedCom2 || changedXpr)
{
this->updateCockpit(com1, com2, transponder, simulatorOriginator());
this->updateCockpit(com1, com2, transponder, originator());
}
}
else
@@ -460,7 +460,7 @@ namespace BlackSimPlugin
if (!changed) { return; }
CTransponder xpdr = myAircraft.getTransponder();
xpdr.setTransponderMode(newMode);
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), xpdr, this->simulatorOriginator());
this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), xpdr, this->originator());
}
void CSimulatorFsx::setSimConnectObjectID(DWORD requestID, DWORD objectID)
@@ -542,7 +542,7 @@ namespace BlackSimPlugin
bool CSimulatorFsx::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
{
// only remove from sim
Q_ASSERT(BlackCore::isCurrentThreadObjectThread(this));
Q_ASSERT_X(BlackCore::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thred");
if (!m_simConnectObjects.contains(callsign)) { return false; }
return physicallyRemoveRemoteAircraft(m_simConnectObjects.value(callsign));
}
@@ -564,7 +564,7 @@ namespace BlackSimPlugin
CCallsign callsign(simObject.getCallsign());
m_simConnectObjects.remove(callsign);
SimConnect_AIRemoveObject(m_hSimConnect, static_cast<SIMCONNECT_OBJECT_ID>(simObject.getObjectId()), static_cast<SIMCONNECT_DATA_REQUEST_ID>(simObject.getRequestId()));
updateAircraftRendered(callsign, false, simulatorOriginator());
updateAircraftRendered(callsign, false, originator());
CLogMessage(this).info("FSX: Removed aircraft %1") << simObject.getCallsign().toQString();
return true;
}

View File

@@ -110,7 +110,7 @@ namespace BlackSimPlugin
Aviation::CComSystem::getCom1System({ m_xplaneData.com1Active, CFrequencyUnit::kHz() }, { m_xplaneData.com1Standby, CFrequencyUnit::kHz() }),
Aviation::CComSystem::getCom2System({ m_xplaneData.com2Active, CFrequencyUnit::kHz() }, { m_xplaneData.com2Standby, CFrequencyUnit::kHz() }),
Aviation::CTransponder::getStandardTransponder(m_xplaneData.xpdrCode, xpdrMode(m_xplaneData.xpdrMode, m_xplaneData.xpdrIdent)),
simulatorOriginator()
originator()
);
}
}
@@ -319,7 +319,7 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &aircraft, const COriginator &originator)
{
Q_ASSERT(isConnected());
if (originator == this->simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
auto com1 = Aviation::CComSystem::getCom1System({ m_xplaneData.com1Active, CFrequencyUnit::kHz() }, { m_xplaneData.com1Standby, CFrequencyUnit::kHz() });
auto com2 = Aviation::CComSystem::getCom2System({ m_xplaneData.com2Active, CFrequencyUnit::kHz() }, { m_xplaneData.com2Standby, CFrequencyUnit::kHz() });
auto xpdr = Aviation::CTransponder::getStandardTransponder(m_xplaneData.xpdrCode, xpdrMode(m_xplaneData.xpdrMode, m_xplaneData.xpdrIdent));
@@ -353,7 +353,7 @@ namespace BlackSimPlugin
// Is there any model matching required ????
CAircraftIcaoData icao = newRemoteAircraft.getIcaoInfo();
m_traffic->addPlane(newRemoteAircraft.getCallsign().asString(), icao.getAircraftDesignator(), icao.getAirlineDesignator(), icao.getLivery());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, simulatorOriginator());
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, originator());
CLogMessage(this).info("XP: Added aircraft %1") << newRemoteAircraft.getCallsign().toQString();
return true;
}
@@ -388,7 +388,7 @@ namespace BlackSimPlugin
{
Q_ASSERT(isConnected());
m_traffic->removePlane(callsign.asString());
updateAircraftRendered(callsign, false, simulatorOriginator());
updateAircraftRendered(callsign, false, originator());
CLogMessage(this).info("XP: Removed aircraft %1") << callsign.toQString();
return true;
}
@@ -398,7 +398,7 @@ namespace BlackSimPlugin
//! \todo XP driver obtain number of removed aircraft
int r = getAircraftInRangeCount();
m_traffic->removeAllPlanes();
updateMarkAllAsNotRendered(simulatorOriginator());
updateMarkAllAsNotRendered(originator());
CLogMessage(this).info("XP: Removed all aircraft");
return r;
}
@@ -422,7 +422,7 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
{
if (originator == simulatorOriginator()) { return false; }
if (originator == this->originator()) { return false; }
if (aircraft.isEnabled())
{
this->physicallyAddRemoteAircraft(aircraft);

View File

@@ -27,6 +27,7 @@ using namespace BlackGui::Components;
CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
CSystemTrayWindow(CIcons::swiftNova24(), parent),
COriginatorAware(this),
ui(new Ui::CSwiftCore)
{
ui->setupUi(this);

View File

@@ -12,10 +12,12 @@
#ifndef SWIFTCORE_H
#define SWIFTCORE_H
#include "blackmisc/statusmessage.h"
#include "blackcore/context_runtime.h"
#include "blackgui/systemtraywindow.h"
#include "blackgui/components/enableforruntime.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/originatoraware.h"
#include <QScopedPointer>
namespace Ui { class CSwiftCore; }
@@ -23,6 +25,7 @@ namespace Ui { class CSwiftCore; }
//! swift core control
class CSwiftCore :
public BlackGui::CSystemTrayWindow,
public BlackMisc::COriginatorAware,
public BlackGui::Components::CEnableForRuntime
{
Q_OBJECT