6 #include <QDoubleSpinBox>
12 #include "ui_cockpitcomcomponent.h"
35 using namespace swift::gui::editors;
37 using namespace swift::core::context;
39 using namespace swift::misc::audio;
40 using namespace swift::misc::aviation;
41 using namespace swift::misc::simulation;
42 using namespace swift::misc::physical_quantities;
46 CCockpitComComponent::CCockpitComComponent(QWidget *parent)
52 this->forceCockpitUpdateFromOwnAircraftContext();
55 connect(ui->editor_Com, &CCockpitComForm::testSelcal,
this, &CCockpitComComponent::testSelcal);
56 connect(ui->editor_Com, &CCockpitComForm::changedCockpitValues,
this,
57 &CCockpitComComponent::updateOwnCockpitInContext);
58 connect(ui->editor_Com, &CCockpitComForm::changedSelcal,
this, &CCockpitComComponent::updateSelcalInContext);
59 connect(ui->editor_Com, &CCockpitComForm::requestCom1TextMessage,
this,
61 connect(ui->editor_Com, &CCockpitComForm::requestCom2TextMessage,
this,
65 connect(ui->editor_Com, &CCockpitComForm::transponderModeChanged,
this,
67 connect(ui->editor_Com, &CCockpitComForm::transponderStateIdentEnded,
this,
75 &CCockpitComComponent::updateCockpitFromContext, Qt::QueuedConnection);
77 &CCockpitComComponent::updateSelcalFromContext, Qt::QueuedConnection);
85 &CCockpitComComponent::onAtcStationsChanged, Qt::QueuedConnection);
87 QPointer<CCockpitComComponent> myself(
this);
91 this->updateCockpitFromContext(aircraft, CIdentifier::fake());
106 void CCockpitComComponent::updateCockpitFromContext(
const CSimulatedAircraft &ownAircraft,
118 ui->editor_Com->setFrequencies(com1, com2);
121 ui->editor_Com->setTransponder(transponder);
124 void CCockpitComComponent::testSelcal()
126 Q_ASSERT_X(
sGui, Q_FUNC_INFO,
"Need sGui");
127 const CSelcal selcal = ui->editor_Com->getSelcal();
133 void CCockpitComComponent::updateSelcalFromContext(
const CSelcal &selcal,
const CIdentifier &originator)
136 ui->editor_Com->setSelcal(selcal);
147 bool CCockpitComComponent::updateOwnCockpitInContext(
const CSimulatedAircraft &ownAircraft)
156 void CCockpitComComponent::forceCockpitUpdateFromOwnAircraftContext()
160 this->updateCockpitFromContext(ownAircraft,
164 void CCockpitComComponent::onAtcStationsChanged()
169 void CCockpitComComponent::updateSelcalInContext(
const CSelcal &selcal)
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
const context::CContextAudioBase * getCContextAudioBase() const
Direct access to contexts if a CCoreFacade has been initialized.
void playSelcalTone(const swift::misc::aviation::CSelcal &selcal)
SELCAL.
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.
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.
void requestCom1TextMessage()
Request COM text messages.
void transponderModeChanged(swift::misc::aviation::CTransponder::TransponderMode newMode)
Mode / state has been changed.
virtual ~CCockpitComComponent()
Destructor.
void setTransponderModeStateIdent()
Set to swift::misc::aviation::CTransponder::StateIdent.
virtual void paintEvent(QPaintEvent *event)
void requestCom2TextMessage()
Request COM text messages.
void transponderStateIdentEnded()
Ident phase ended.
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
bool isMyIdentifier(const CIdentifier &otherIdentifier) const
My identifier?
const CIdentifier & identifier() const
Get identifier.
Value object encapsulating information identifying a component of a modular distributed swift process...
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.
bool isValid() const
Is valid?
Comprehensive information of an aircraft.
const aviation::CComSystem & getCom2System() const
Get COM2 system.
const aviation::CTransponder & getTransponder() const
Get transponder.
const aviation::CComSystem & getCom1System() const
Get COM1 system.
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.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...