6#include <QDoubleSpinBox>
12#include "ui_cockpitcomcomponent.h"
35using namespace swift::gui::editors;
37using namespace swift::core::context;
39using namespace swift::misc::audio;
40using namespace swift::misc::aviation;
41using namespace swift::misc::simulation;
42using namespace swift::misc::physical_quantities;
52 this->forceCockpitUpdateFromOwnAircraftContext();
57 &CCockpitComComponent::updateOwnCockpitInContext);
85 if (!sGui || sGui->isShuttingDown() || !myself)
105 void CCockpitComComponent::updateCockpitFromContext(
const CSimulatedAircraft &ownAircraft,
120 ui->editor_Com->setFrequencies(com1, com2);
123 ui->editor_Com->setTransponder(transponder);
126 void CCockpitComComponent::testSelcal()
128 Q_ASSERT_X(sGui, Q_FUNC_INFO,
"Need sGui");
129 const CSelcal selcal = ui->editor_Com->getSelcal();
134 else if (sGui->getCContextAudioBase())
136 sGui->getCContextAudioBase()->playSelcalTone(selcal);
140 CLogMessage().validationWarning(u
"No audio available");
144 void CCockpitComComponent::updateSelcalFromContext(
const CSelcal &selcal,
const CIdentifier &originator)
150 ui->editor_Com->setSelcal(selcal);
153 CSimulatedAircraft CCockpitComComponent::getOwnAircraft()
const
164 bool CCockpitComComponent::updateOwnCockpitInContext(
const CSimulatedAircraft &ownAircraft)
176 void CCockpitComComponent::forceCockpitUpdateFromOwnAircraftContext()
182 const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
183 this->updateCockpitFromContext(ownAircraft,
184 CIdentifier(
"dummyInitialValues"));
187 void CCockpitComComponent::updateSelcalInContext(
const CSelcal &selcal)
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
void changedAircraftCockpit(const swift::misc::simulation::CSimulatedAircraft &aircraft, const swift::misc::CIdentifier &originator)
Aircraft cockpit update.
virtual bool updateSelcal(const swift::misc::aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)=0
Own SELCAL code.
virtual swift::misc::simulation::CSimulatedAircraft getOwnAircraft() const =0
Get own aircraft.
void changedSelcal(const swift::misc::aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)
Changed SELCAL code.
virtual bool updateCockpit(const swift::misc::aviation::CComSystem &com1, const swift::misc::aviation::CComSystem &com2, const swift::misc::aviation::CTransponder &transponder, const swift::misc::CIdentifier &originator)=0
Update own cockpit.
static bool useStyleSheetInDerivedWidget(QWidget *derivedWidget, QStyle::PrimitiveElement element=QStyle::PE_Widget)
Use style sheets in derived widgets.
CCockpitComComponent(QWidget *parent=nullptr)
Constructor.
void requestCom1TextMessage()
Request COM text messages.
void transponderModeChanged(swift::misc::aviation::CTransponder::TransponderMode newMode)
Mode / state has been changed.
~CCockpitComComponent()
Destructor.
void setTransponderModeStateIdent()
Set to swift::misc::aviation::CTransponder::StateIdent.
void paintEvent(QPaintEvent *event)
void requestCom2TextMessage()
Request COM text messages.
void transponderStateIdentEnded()
Ident phase ended.
bool isMyIdentifier(const CIdentifier &otherIdentifier) const
My identifier?
CIdentifiable(const QString &objectName)
Use literal based object name.
const CIdentifier & identifier() const
Get identifier.
Value object encapsulating information identifying a component of a modular distributed swift process...
static const CIdentifier & fake()
Returns a fake identifier.
Class for emitting a log message.
Derived & validationWarning(const char16_t(&format)[N])
Set the severity to warning, providing a format string, and adding the validation category.
COM system (aka "radio").
bool isValid() const
Is valid?
Comprehensive information of an aircraft.
const aviation::CComSystem & getCom2System() const
Get COM2 system.
const aviation::CComSystem & getCom1System() const
Get COM1 system.
const aviation::CTransponder & getTransponder() const
Get transponder.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Free functions in swift::misc.
QFrame(QWidget *parent, Qt::WindowFlags f)
virtual bool event(QEvent *e) override
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const