mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
refs #432, adjusted originators
This commit is contained in:
@@ -21,10 +21,11 @@ using namespace BlackMisc::PhysicalQuantities;
|
|||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
|
|
||||||
Client::Client(QObject *parent)
|
Client::Client(QObject *parent)
|
||||||
: QObject(parent), COwnAircraftAware(COwnAircraftProviderDummy::instance()),
|
: QObject(parent),
|
||||||
|
COwnAircraftAware(COwnAircraftProviderDummy::instance()),
|
||||||
|
COriginatorAware("samples:cmdClient"),
|
||||||
m_net(new BlackCore::CNetworkVatlib(COwnAircraftProviderDummy::instance(), this))
|
m_net(new BlackCore::CNetworkVatlib(COwnAircraftProviderDummy::instance(), this))
|
||||||
{
|
{
|
||||||
|
|
||||||
connect(m_net, &INetwork::atcPositionUpdate, this, &Client::atcPositionUpdate);
|
connect(m_net, &INetwork::atcPositionUpdate, this, &Client::atcPositionUpdate);
|
||||||
connect(m_net, &INetwork::atcDisconnected, this, &Client::atcDisconnected);
|
connect(m_net, &INetwork::atcDisconnected, this, &Client::atcDisconnected);
|
||||||
connect(m_net, &INetwork::connectionStatusChanged, this, &Client::connectionStatusChanged);
|
connect(m_net, &INetwork::connectionStatusChanged, this, &Client::connectionStatusChanged);
|
||||||
@@ -339,7 +340,8 @@ void Client::setOwnAircraftCmd(QTextStream &args)
|
|||||||
BlackMisc::Aviation::CComSystem("COM1", BlackMisc::PhysicalQuantities::CFrequency(com1, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz())),
|
BlackMisc::Aviation::CComSystem("COM1", BlackMisc::PhysicalQuantities::CFrequency(com1, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz())),
|
||||||
BlackMisc::Aviation::CComSystem("COM2", BlackMisc::PhysicalQuantities::CFrequency(com2, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz())),
|
BlackMisc::Aviation::CComSystem("COM2", BlackMisc::PhysicalQuantities::CFrequency(com2, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz())),
|
||||||
BlackMisc::Aviation::CTransponder(xpdrCode, xpdrMode),
|
BlackMisc::Aviation::CTransponder(xpdrCode, xpdrMode),
|
||||||
COriginator("cmdClient"));
|
originator());
|
||||||
|
Q_UNUSED(aircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setOwnAircraftPositionCmd(QTextStream &args)
|
void Client::setOwnAircraftPositionCmd(QTextStream &args)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "blackcore/network.h"
|
#include "blackcore/network.h"
|
||||||
#include "blackmisc/simulation/ownaircraftproviderdummy.h"
|
#include "blackmisc/simulation/ownaircraftproviderdummy.h"
|
||||||
|
#include "blackmisc/originatoraware.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
@@ -21,7 +22,8 @@
|
|||||||
|
|
||||||
class Client :
|
class Client :
|
||||||
public QObject,
|
public QObject,
|
||||||
public BlackMisc::Simulation::COwnAircraftAware
|
public BlackMisc::Simulation::COwnAircraftAware,
|
||||||
|
public BlackMisc::COriginatorAware
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -29,9 +31,11 @@ public:
|
|||||||
Client(QObject *parent = nullptr);
|
Client(QObject *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
//! Terminated
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
//! Handle command
|
||||||
void command(QString line);
|
void command(QString line);
|
||||||
|
|
||||||
private: //commands
|
private: //commands
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ using namespace BlackMisc::Simulation;
|
|||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
|
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
|
||||||
IContextOwnAircraft(mode, runtime)
|
IContextOwnAircraft(mode, runtime),
|
||||||
|
COriginatorAware(this)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->getRuntime());
|
Q_ASSERT(this->getRuntime());
|
||||||
Q_ASSERT(this->getRuntime()->getIContextSettings());
|
Q_ASSERT(this->getRuntime()->getIContextSettings());
|
||||||
|
this->setObjectName("CContextOwnAircraft");
|
||||||
|
|
||||||
// Init own aircraft
|
// Init own aircraft
|
||||||
this->initOwnAircraft();
|
this->initOwnAircraft();
|
||||||
@@ -360,8 +362,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (CSelcal::isValidCode(parser.part(1)))
|
if (CSelcal::isValidCode(parser.part(1)))
|
||||||
{
|
{
|
||||||
// todo RW: replace originator
|
this->updateSelcal(parser.part(1), this->originator());
|
||||||
this->updateSelcal(parser.part(1), COriginator("commandline"));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "blackcore/dbus_server.h"
|
#include "blackcore/dbus_server.h"
|
||||||
#include "blackmisc/aviation/atcstation.h"
|
#include "blackmisc/aviation/atcstation.h"
|
||||||
#include "blackmisc/simulation/ownaircraftprovider.h"
|
#include "blackmisc/simulation/ownaircraftprovider.h"
|
||||||
|
#include "blackmisc/originatoraware.h"
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -27,7 +28,8 @@ namespace BlackCore
|
|||||||
//! Central instance of data for \sa IOwnAircraftProvider .
|
//! Central instance of data for \sa IOwnAircraftProvider .
|
||||||
class BLACKCORE_EXPORT CContextOwnAircraft :
|
class BLACKCORE_EXPORT CContextOwnAircraft :
|
||||||
public IContextOwnAircraft,
|
public IContextOwnAircraft,
|
||||||
public BlackMisc::Simulation::IOwnAircraftProvider
|
public BlackMisc::Simulation::IOwnAircraftProvider,
|
||||||
|
public BlackMisc::COriginatorAware
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTOWNAIRCRAFT_INTERFACENAME)
|
Q_CLASSINFO("D-Bus Interface", BLACKCORE_CONTEXTOWNAIRCRAFT_INTERFACENAME)
|
||||||
|
|||||||
@@ -29,14 +29,6 @@ namespace BlackCore
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
COriginator ISimulator::simulatorOriginator()
|
|
||||||
{
|
|
||||||
if (m_originator.getName().isEmpty())
|
|
||||||
m_originator = COriginator(QStringLiteral("SIMULATOR"));
|
|
||||||
|
|
||||||
return m_originator;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ISimulator::statusToString(int status)
|
QString ISimulator::statusToString(int status)
|
||||||
{
|
{
|
||||||
if (status > 0)
|
if (status > 0)
|
||||||
|
|||||||
@@ -26,19 +26,22 @@
|
|||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
#include "blackmisc/network/client.h"
|
#include "blackmisc/network/client.h"
|
||||||
#include "blackmisc/pixmap.h"
|
#include "blackmisc/pixmap.h"
|
||||||
|
#include "blackmisc/originatoraware.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Interface to a simulator.
|
//! Interface to a simulator.
|
||||||
class BLACKCORE_EXPORT ISimulator : public QObject
|
class BLACKCORE_EXPORT ISimulator :
|
||||||
|
public QObject,
|
||||||
|
public BlackMisc::COriginatorAware
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! ISimulator status
|
//! ISimulator status
|
||||||
enum SimulatorStatus
|
enum SimulatorStatusFlag
|
||||||
{
|
{
|
||||||
Disconnected = 0,
|
Disconnected = 0,
|
||||||
Connected = 1 << 0, //!< Is the plugin connected to the simulator?
|
Connected = 1 << 0, //!< Is the plugin connected to the simulator?
|
||||||
@@ -46,6 +49,8 @@ namespace BlackCore
|
|||||||
Paused = 1 << 2, //!< Is the simulator paused?
|
Paused = 1 << 2, //!< Is the simulator paused?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_FLAGS(SimulatorStatus, SimulatorStatusFlag)
|
||||||
|
|
||||||
//! Render all aircraft if number of aircraft >= MaxAircraftInfinite
|
//! Render all aircraft if number of aircraft >= MaxAircraftInfinite
|
||||||
const int MaxAircraftInfinite = 100;
|
const int MaxAircraftInfinite = 100;
|
||||||
|
|
||||||
@@ -169,9 +174,6 @@ namespace BlackCore
|
|||||||
//! Driver will be unloaded
|
//! Driver will be unloaded
|
||||||
virtual void unload() = 0;
|
virtual void unload() = 0;
|
||||||
|
|
||||||
//! Originator
|
|
||||||
BlackMisc::COriginator simulatorOriginator();
|
|
||||||
|
|
||||||
//! Status to string
|
//! Status to string
|
||||||
static QString statusToString(int status);
|
static QString statusToString(int status);
|
||||||
|
|
||||||
@@ -196,7 +198,10 @@ namespace BlackCore
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
ISimulator(QObject *parent = nullptr) : QObject(parent) {}
|
ISimulator(QObject *parent = nullptr) :
|
||||||
|
QObject(parent),
|
||||||
|
BlackMisc::COriginatorAware(this)
|
||||||
|
{}
|
||||||
|
|
||||||
//! Are we connected to the simulator?
|
//! Are we connected to the simulator?
|
||||||
virtual bool isConnected() const = 0;
|
virtual bool isConnected() const = 0;
|
||||||
@@ -223,10 +228,6 @@ namespace BlackCore
|
|||||||
//! Emit the combined status
|
//! Emit the combined status
|
||||||
//! \sa simulatorStatusChanged;
|
//! \sa simulatorStatusChanged;
|
||||||
void emitSimulatorCombinedStatus();
|
void emitSimulatorCombinedStatus();
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Interface to a simulator listener.
|
//! Interface to a simulator listener.
|
||||||
@@ -287,5 +288,6 @@ namespace BlackCore
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
|
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -16,29 +16,19 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
|
|
||||||
CCommandInput::CCommandInput(QWidget *parent) :
|
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();
|
QString commandLine(this->text().trimmed());
|
||||||
setText(QString());
|
this->setText(QString());
|
||||||
|
|
||||||
if (commandLine.startsWith('.'))
|
if (commandLine.startsWith('.'))
|
||||||
{
|
{
|
||||||
emit commandEntered(commandLine, commandInputOriginator());
|
emit commandEntered(commandLine, originator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // ns
|
||||||
COriginator CCommandInput::commandInputOriginator()
|
|
||||||
{
|
|
||||||
if (m_originator.getName().isEmpty())
|
|
||||||
m_originator = COriginator(QStringLiteral("COMMANDINPUT"));
|
|
||||||
|
|
||||||
return m_originator;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,44 +13,33 @@
|
|||||||
#define BLACKGUI_COMMANDINPUT_H
|
#define BLACKGUI_COMMANDINPUT_H
|
||||||
|
|
||||||
#include "blackguiexport.h"
|
#include "blackguiexport.h"
|
||||||
#include "blackmisc/originator.h"
|
#include "blackmisc/originatoraware.h"
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
|
|
||||||
//! Specialized LineEdit for command inputs
|
//! Specialized LineEdit for command inputs
|
||||||
class BLACKGUI_EXPORT CCommandInput : public QLineEdit
|
class BLACKGUI_EXPORT CCommandInput :
|
||||||
|
public QLineEdit,
|
||||||
|
public BlackMisc::COriginatorAware
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CCommandInput(QWidget *parent = nullptr);
|
CCommandInput(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CCommandInput() {}
|
~CCommandInput() {}
|
||||||
|
|
||||||
//! Originator
|
|
||||||
BlackMisc::COriginator commandInputOriginator();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
//! Command was entered
|
//! Command was entered
|
||||||
void commandEntered(const QString &command, const BlackMisc::COriginator &originator);
|
void commandEntered(const QString &command, const BlackMisc::COriginator &originator);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
//! Basic command validation
|
//! Basic command validation
|
||||||
void validateCommand();
|
void ps_validateCommand();
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif // guard
|
||||||
#endif // CCOMMANDINPUT_H
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
|
CAtcStationComponent::CAtcStationComponent(QWidget *parent) :
|
||||||
QTabWidget(parent),
|
QTabWidget(parent),
|
||||||
|
COriginatorAware(this),
|
||||||
ui(new Ui::CAtcStationComponent),
|
ui(new Ui::CAtcStationComponent),
|
||||||
m_updateTimer(new CUpdateTimer("CAtcStationComponent", &CAtcStationComponent::update, this))
|
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)
|
void CAtcStationComponent::ps_onlineAtcStationSelected(QModelIndex index)
|
||||||
{
|
{
|
||||||
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
this->ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "blackgui/components/enableforruntime.h"
|
#include "blackgui/components/enableforruntime.h"
|
||||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||||
#include "blackgui/components/updatetimer.h"
|
#include "blackgui/components/updatetimer.h"
|
||||||
#include "blackmisc/originator.h"
|
#include "blackmisc/originatoraware.h"
|
||||||
#include "blackmisc/aviation/atcstation.h"
|
#include "blackmisc/aviation/atcstation.h"
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
@@ -32,7 +32,8 @@ namespace BlackGui
|
|||||||
class BLACKGUI_EXPORT CAtcStationComponent :
|
class BLACKGUI_EXPORT CAtcStationComponent :
|
||||||
public QTabWidget,
|
public QTabWidget,
|
||||||
public CEnableForDockWidgetInfoArea,
|
public CEnableForDockWidgetInfoArea,
|
||||||
public CEnableForRuntime
|
public CEnableForRuntime,
|
||||||
|
public BlackMisc::COriginatorAware
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -112,16 +113,12 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateTreeView();
|
void updateTreeView();
|
||||||
BlackMisc::COriginator originator();
|
|
||||||
|
|
||||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||||
QScopedPointer<CUpdateTimer> m_updateTimer;
|
QScopedPointer<CUpdateTimer> m_updateTimer;
|
||||||
QDateTime m_timestampLastReadOnlineStations = CUpdateTimer::epoch(); //!< stations read
|
QDateTime m_timestampLastReadOnlineStations = CUpdateTimer::epoch(); //!< stations read
|
||||||
QDateTime m_timestampOnlineStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
QDateTime m_timestampOnlineStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||||
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
|
QDateTime m_timestampLastReadBookedStations = CUpdateTimer::epoch(); //!< stations read
|
||||||
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
QDateTime m_timestampBookedStationsChanged = CUpdateTimer::epoch(); //!< stations marked as changed
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CCockpitComComponent::CCockpitComComponent(QWidget *parent) :
|
CCockpitComComponent::CCockpitComComponent(QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
|
BlackMisc::COriginatorAware(this),
|
||||||
ui(new Ui::CCockpitMainComponent)
|
ui(new Ui::CCockpitMainComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -62,7 +63,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
// init from aircraft
|
// init from aircraft
|
||||||
CAircraft ownAircraft = this->getOwnAircraft();
|
CAircraft ownAircraft = this->getOwnAircraft();
|
||||||
this->ps_updateCockpitFromContext(ownAircraft, COriginator("dummyInitialValues"));
|
this->ps_updateCockpitFromContext(ownAircraft, COriginator("dummyInitialValues")); // intentionally different name here
|
||||||
|
|
||||||
// SELCAL pairs in cockpit
|
// SELCAL pairs in cockpit
|
||||||
this->ui->frp_ComPanelSelcalBottom->clear();
|
this->ui->frp_ComPanelSelcalBottom->clear();
|
||||||
@@ -111,12 +112,12 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CCockpitComComponent::ps_guiChangedSelcal()
|
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)
|
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
|
// update GUI elements
|
||||||
// avoid unnecessary change events as far as possible
|
// avoid unnecessary change events as far as possible
|
||||||
@@ -184,7 +185,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CCockpitComComponent::ps_onChangedSelcal(const CSelcal &selcal, const COriginator &originator)
|
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);
|
this->ui->frp_ComPanelSelcalBottom->setSelcalCode(selcal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
bool CCockpitComComponent::updateOwnCockpitInContext(const CAircraft &ownAircraft)
|
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)
|
void CCockpitComComponent::updateFrequencyDisplaysFromComSystems(const CComSystem &com1, const CComSystem &com2)
|
||||||
@@ -286,13 +287,7 @@ namespace BlackGui
|
|||||||
Q_UNUSED(connected);
|
Q_UNUSED(connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
COriginator CCockpitComComponent::cockpitOriginator()
|
|
||||||
{
|
|
||||||
if (m_originator.getName().isEmpty())
|
|
||||||
m_originator = COriginator(QStringLiteral("COCKPITCOMCOMPONENT"));
|
|
||||||
|
|
||||||
return m_originator;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "enablefordockwidgetinfoarea.h"
|
#include "enablefordockwidgetinfoarea.h"
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "blackmisc/originator.h"
|
#include "blackmisc/originatoraware.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
#include "blackmisc/aviation/aircraft.h"
|
||||||
#include "blackmisc/aviation/transponder.h"
|
#include "blackmisc/aviation/transponder.h"
|
||||||
#include "blackmisc/audio/voiceroomlist.h"
|
#include "blackmisc/audio/voiceroomlist.h"
|
||||||
@@ -29,6 +29,7 @@ namespace BlackGui
|
|||||||
//! The main cockpit area
|
//! The main cockpit area
|
||||||
class BLACKGUI_EXPORT CCockpitComComponent :
|
class BLACKGUI_EXPORT CCockpitComComponent :
|
||||||
public QFrame,
|
public QFrame,
|
||||||
|
public BlackMisc::COriginatorAware,
|
||||||
public CEnableForDockWidgetInfoArea,
|
public CEnableForDockWidgetInfoArea,
|
||||||
public CEnableForRuntime
|
public CEnableForRuntime
|
||||||
{
|
{
|
||||||
@@ -97,11 +98,7 @@ namespace BlackGui
|
|||||||
//! COM frequencies displayed
|
//! COM frequencies displayed
|
||||||
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||||
|
|
||||||
//! Identifies sender of cockpit updates
|
|
||||||
BlackMisc::COriginator cockpitOriginator();
|
|
||||||
|
|
||||||
QScopedPointer<Ui::CCockpitMainComponent> ui;
|
QScopedPointer<Ui::CCockpitMainComponent> ui;
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CCockpitTransponderModeLedsComponent::CCockpitTransponderModeLedsComponent(QWidget *parent) :
|
CCockpitTransponderModeLedsComponent::CCockpitTransponderModeLedsComponent(QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
|
COriginatorAware(this),
|
||||||
m_ledStandby(new CLedWidget(false, CLedWidget::Blue, CLedWidget::Black, CLedWidget::Rounded, "standby", "", LedWidth, 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_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))
|
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)
|
void CCockpitTransponderModeLedsComponent::ps_onAircraftCockpitChanged(const CAircraft &aircraft, const BlackMisc::COriginator &originator)
|
||||||
{
|
{
|
||||||
if (ledsOriginator() == originator) { return; }
|
if (isMyOriginator(originator)) { return; }
|
||||||
this->setMode(aircraft.getTransponderMode());
|
this->setMode(aircraft.getTransponderMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ namespace BlackGui
|
|||||||
this->setMode(mode);
|
this->setMode(mode);
|
||||||
CTransponder xpdr = ownAircraft.getTransponder();
|
CTransponder xpdr = ownAircraft.getTransponder();
|
||||||
xpdr.setTransponderMode(mode);
|
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)
|
void CCockpitTransponderModeLedsComponent::init(bool horizontal)
|
||||||
@@ -133,13 +134,5 @@ namespace BlackGui
|
|||||||
return getIContextOwnAircraft()->getOwnAircraft();
|
return getIContextOwnAircraft()->getOwnAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::COriginator CCockpitTransponderModeLedsComponent::ledsOriginator()
|
|
||||||
{
|
|
||||||
if (m_originator.getName().isEmpty())
|
|
||||||
m_originator = COriginator(QStringLiteral("XPDRLEDSCOMCOMPONENT"));
|
|
||||||
|
|
||||||
return m_originator;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "../led.h"
|
#include "../led.h"
|
||||||
#include "blackmisc/originator.h"
|
#include "blackmisc/originatoraware.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
#include "blackmisc/aviation/aircraft.h"
|
||||||
#include "blackmisc/aviation/transponder.h"
|
#include "blackmisc/aviation/transponder.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
@@ -26,7 +26,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
|
|
||||||
//! LEDs representing transponder mode state
|
//! 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
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -60,16 +63,10 @@ namespace BlackGui
|
|||||||
//! Own Aircraft
|
//! Own Aircraft
|
||||||
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
||||||
|
|
||||||
//! Identifies sender of cockpit updates
|
|
||||||
BlackMisc::COriginator ledsOriginator();
|
|
||||||
|
|
||||||
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
|
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
|
||||||
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
|
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
|
||||||
QScopedPointer<BlackGui::CLedWidget> m_ledIdent;
|
QScopedPointer<BlackGui::CLedWidget> m_ledIdent;
|
||||||
BlackMisc::COriginator m_originator;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ namespace BlackSimPlugin
|
|||||||
// matched models
|
// matched models
|
||||||
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraftCopy);
|
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraftCopy);
|
||||||
Q_ASSERT(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign());
|
Q_ASSERT(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign());
|
||||||
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel, simulatorOriginator());
|
updateAircraftModel(newRemoteAircraft.getCallsign(), aircraftModel, originator());
|
||||||
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, simulatorOriginator());
|
updateAircraftRendered(newRemoteAircraft.getCallsign(), true, originator());
|
||||||
CSimulatedAircraft aircraftAfterModelApplied (getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
|
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
|
||||||
aircraftAfterModelApplied.setRendered(true);
|
aircraftAfterModelApplied.setRendered(true);
|
||||||
emit modelMatchingCompleted(aircraftAfterModelApplied);
|
emit modelMatchingCompleted(aircraftAfterModelApplied);
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
client->start();
|
client->start();
|
||||||
m_hashFs9Clients.insert(callsign, client);
|
m_hashFs9Clients.insert(callsign, client);
|
||||||
updateAircraftRendered(callsign, true, this->simulatorOriginator());
|
updateAircraftRendered(callsign, true, this->originator());
|
||||||
CLogMessage(this).info("FS9: Added aircraft %1") << callsign.toQString();
|
CLogMessage(this).info("FS9: Added aircraft %1") << callsign.toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ namespace BlackSimPlugin
|
|||||||
auto fs9Client = m_hashFs9Clients.value(callsign);
|
auto fs9Client = m_hashFs9Clients.value(callsign);
|
||||||
fs9Client->quit();
|
fs9Client->quit();
|
||||||
m_hashFs9Clients.remove(callsign);
|
m_hashFs9Clients.remove(callsign);
|
||||||
updateAircraftRendered(callsign, false, this->simulatorOriginator());
|
updateAircraftRendered(callsign, false, this->originator());
|
||||||
CLogMessage(this).info("FS9: Removed aircraft %1") << callsign.toQString();
|
CLogMessage(this).info("FS9: Removed aircraft %1") << callsign.toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFs9::updateOwnSimulatorCockpit(const CAircraft &ownAircraft, const COriginator &originator)
|
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; }
|
if (!this->isSimulating()) { return false; }
|
||||||
|
|
||||||
// actually those data should be the same as ownAircraft
|
// actually those data should be the same as ownAircraft
|
||||||
@@ -307,7 +307,7 @@ namespace BlackSimPlugin
|
|||||||
simDataOwnAircraft.getCom1System(),
|
simDataOwnAircraft.getCom1System(),
|
||||||
simDataOwnAircraft.getCom2System(),
|
simDataOwnAircraft.getCom2System(),
|
||||||
simDataOwnAircraft.getTransponder(),
|
simDataOwnAircraft.getTransponder(),
|
||||||
this->simulatorOriginator());
|
this->originator());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFs9::disconnectAllClients()
|
void CSimulatorFs9::disconnectAllClients()
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsCommon::changeRemoteAircraftModel(const CSimulatedAircraft &aircraft, const COriginator &originator)
|
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
|
// remove upfront, and then enable / disable again
|
||||||
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
|
this->physicallyRemoveRemoteAircraft(aircraft.getCallsign());
|
||||||
@@ -188,7 +188,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
|
bool CSimulatorFsCommon::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
|
||||||
{
|
{
|
||||||
if (originator == simulatorOriginator()) { return false; }
|
if (originator == this->originator()) { return false; }
|
||||||
if (aircraft.isEnabled())
|
if (aircraft.isEnabled())
|
||||||
{
|
{
|
||||||
this->physicallyAddRemoteAircraft(aircraft);
|
this->physicallyAddRemoteAircraft(aircraft);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace BlackSimPlugin
|
|||||||
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraft);
|
CAircraftModel aircraftModel = getClosestMatch(newRemoteAircraft);
|
||||||
Q_ASSERT_X(newRemoteAircraft.getCallsign() == aircraftModel.getCallsign(), Q_FUNC_INFO, "mismatching callsigns");
|
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()));
|
CSimulatedAircraft aircraftAfterModelApplied(getAircraftInRangeForCallsign(newRemoteAircraft.getCallsign()));
|
||||||
|
|
||||||
// create AI
|
// create AI
|
||||||
@@ -190,7 +190,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
aircraftAfterModelApplied.setRendered(rendered);
|
aircraftAfterModelApplied.setRendered(rendered);
|
||||||
this->updateAircraftRendered(callsign, rendered, simulatorOriginator());
|
this->updateAircraftRendered(callsign, rendered, originator());
|
||||||
emit modelMatchingCompleted(aircraftAfterModelApplied);
|
emit modelMatchingCompleted(aircraftAfterModelApplied);
|
||||||
|
|
||||||
return rendered;
|
return rendered;
|
||||||
@@ -198,7 +198,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorFsx::updateOwnSimulatorCockpit(const CAircraft &ownAircraft, const COriginator &originator)
|
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; }
|
if (!this->isSimulating()) { return false; }
|
||||||
|
|
||||||
// actually those data should be the same as ownAircraft
|
// actually those data should be the same as ownAircraft
|
||||||
@@ -435,7 +435,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
if (changedCom1 || changedCom2 || changedXpr)
|
if (changedCom1 || changedCom2 || changedXpr)
|
||||||
{
|
{
|
||||||
this->updateCockpit(com1, com2, transponder, simulatorOriginator());
|
this->updateCockpit(com1, com2, transponder, originator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -460,7 +460,7 @@ namespace BlackSimPlugin
|
|||||||
if (!changed) { return; }
|
if (!changed) { return; }
|
||||||
CTransponder xpdr = myAircraft.getTransponder();
|
CTransponder xpdr = myAircraft.getTransponder();
|
||||||
xpdr.setTransponderMode(newMode);
|
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)
|
void CSimulatorFsx::setSimConnectObjectID(DWORD requestID, DWORD objectID)
|
||||||
@@ -542,7 +542,7 @@ namespace BlackSimPlugin
|
|||||||
bool CSimulatorFsx::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
bool CSimulatorFsx::physicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
// only remove from sim
|
// 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; }
|
if (!m_simConnectObjects.contains(callsign)) { return false; }
|
||||||
return physicallyRemoveRemoteAircraft(m_simConnectObjects.value(callsign));
|
return physicallyRemoveRemoteAircraft(m_simConnectObjects.value(callsign));
|
||||||
}
|
}
|
||||||
@@ -564,7 +564,7 @@ namespace BlackSimPlugin
|
|||||||
CCallsign callsign(simObject.getCallsign());
|
CCallsign callsign(simObject.getCallsign());
|
||||||
m_simConnectObjects.remove(callsign);
|
m_simConnectObjects.remove(callsign);
|
||||||
SimConnect_AIRemoveObject(m_hSimConnect, static_cast<SIMCONNECT_OBJECT_ID>(simObject.getObjectId()), static_cast<SIMCONNECT_DATA_REQUEST_ID>(simObject.getRequestId()));
|
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();
|
CLogMessage(this).info("FSX: Removed aircraft %1") << simObject.getCallsign().toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace BlackSimPlugin
|
|||||||
Aviation::CComSystem::getCom1System({ m_xplaneData.com1Active, CFrequencyUnit::kHz() }, { m_xplaneData.com1Standby, CFrequencyUnit::kHz() }),
|
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::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)),
|
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)
|
bool CSimulatorXPlane::updateOwnSimulatorCockpit(const BlackMisc::Aviation::CAircraft &aircraft, const COriginator &originator)
|
||||||
{
|
{
|
||||||
Q_ASSERT(isConnected());
|
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 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 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));
|
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 ????
|
// Is there any model matching required ????
|
||||||
CAircraftIcaoData icao = newRemoteAircraft.getIcaoInfo();
|
CAircraftIcaoData icao = newRemoteAircraft.getIcaoInfo();
|
||||||
m_traffic->addPlane(newRemoteAircraft.getCallsign().asString(), icao.getAircraftDesignator(), icao.getAirlineDesignator(), icao.getLivery());
|
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();
|
CLogMessage(this).info("XP: Added aircraft %1") << newRemoteAircraft.getCallsign().toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
Q_ASSERT(isConnected());
|
Q_ASSERT(isConnected());
|
||||||
m_traffic->removePlane(callsign.asString());
|
m_traffic->removePlane(callsign.asString());
|
||||||
updateAircraftRendered(callsign, false, simulatorOriginator());
|
updateAircraftRendered(callsign, false, originator());
|
||||||
CLogMessage(this).info("XP: Removed aircraft %1") << callsign.toQString();
|
CLogMessage(this).info("XP: Removed aircraft %1") << callsign.toQString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ namespace BlackSimPlugin
|
|||||||
//! \todo XP driver obtain number of removed aircraft
|
//! \todo XP driver obtain number of removed aircraft
|
||||||
int r = getAircraftInRangeCount();
|
int r = getAircraftInRangeCount();
|
||||||
m_traffic->removeAllPlanes();
|
m_traffic->removeAllPlanes();
|
||||||
updateMarkAllAsNotRendered(simulatorOriginator());
|
updateMarkAllAsNotRendered(originator());
|
||||||
CLogMessage(this).info("XP: Removed all aircraft");
|
CLogMessage(this).info("XP: Removed all aircraft");
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
bool CSimulatorXPlane::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
|
bool CSimulatorXPlane::changeRemoteAircraftEnabled(const CSimulatedAircraft &aircraft, const COriginator &originator)
|
||||||
{
|
{
|
||||||
if (originator == simulatorOriginator()) { return false; }
|
if (originator == this->originator()) { return false; }
|
||||||
if (aircraft.isEnabled())
|
if (aircraft.isEnabled())
|
||||||
{
|
{
|
||||||
this->physicallyAddRemoteAircraft(aircraft);
|
this->physicallyAddRemoteAircraft(aircraft);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using namespace BlackGui::Components;
|
|||||||
|
|
||||||
CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
|
CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
|
||||||
CSystemTrayWindow(CIcons::swiftNova24(), parent),
|
CSystemTrayWindow(CIcons::swiftNova24(), parent),
|
||||||
|
COriginatorAware(this),
|
||||||
ui(new Ui::CSwiftCore)
|
ui(new Ui::CSwiftCore)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|||||||
@@ -12,10 +12,12 @@
|
|||||||
#ifndef SWIFTCORE_H
|
#ifndef SWIFTCORE_H
|
||||||
#define SWIFTCORE_H
|
#define SWIFTCORE_H
|
||||||
|
|
||||||
#include "blackmisc/statusmessage.h"
|
|
||||||
#include "blackcore/context_runtime.h"
|
#include "blackcore/context_runtime.h"
|
||||||
#include "blackgui/systemtraywindow.h"
|
#include "blackgui/systemtraywindow.h"
|
||||||
#include "blackgui/components/enableforruntime.h"
|
#include "blackgui/components/enableforruntime.h"
|
||||||
|
#include "blackmisc/statusmessage.h"
|
||||||
|
#include "blackmisc/originatoraware.h"
|
||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
namespace Ui { class CSwiftCore; }
|
namespace Ui { class CSwiftCore; }
|
||||||
@@ -23,6 +25,7 @@ namespace Ui { class CSwiftCore; }
|
|||||||
//! swift core control
|
//! swift core control
|
||||||
class CSwiftCore :
|
class CSwiftCore :
|
||||||
public BlackGui::CSystemTrayWindow,
|
public BlackGui::CSystemTrayWindow,
|
||||||
|
public BlackMisc::COriginatorAware,
|
||||||
public BlackGui::Components::CEnableForRuntime
|
public BlackGui::Components::CEnableForRuntime
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
Reference in New Issue
Block a user