11 #include "ui_atcbuttoncomponent.h"
18 using namespace swift::misc::aviation;
19 using namespace swift::misc::network;
21 using namespace swift::core::context;
31 &CAtcButtonComponent::onChangedAtcStations);
33 &CAtcButtonComponent::onConnectionStatusChanged);
47 if (m_maxNumber < 1) {
return; }
48 const int max = qMin(m_maxNumber, m_rows * m_cols);
50 if (stations.
isEmpty()) {
return; }
62 for (
const CAtcStation &station : std::as_const(stations))
67 if (!station.getCallsign().hasAtcSuffix()) {
continue; }
71 button->
setText(station.getCallsignAsString());
74 const CVariant atcv = CVariant::fromValue(station);
82 if (row == m_rows) {
break; }
88 const double a = added;
89 const double c = m_cols;
90 const int rows = qRound(ceil(a / c));
102 if (setMaxElements) { m_maxNumber = rows * cols; }
105 void CAtcButtonComponent::onChangedAtcStations()
107 if (!m_backgroundUpdates) {
return; }
118 void CAtcButtonComponent::onButtonClicked()
121 if (!button) {
return; }
123 if (!v.isValid() || !v.canConvert<
CAtcStation>()) {
return; }
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
virtual swift::misc::aviation::CAtcStationList getClosestAtcStationsOnline(int number) const =0
The ATC list with online ATC controllers.
static void deleteLayout(QLayout *layout, bool deleteWidgets)
Delete hierarchy of layouts.
Value object for icons. An icon is stored in the global icon repository and identified by its index....
QIcon toQIcon() const
A QIcon.
bool isEmpty() const
Synonym for empty.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
const QVariant & getQVariant() const
Return the internal QVariant.
Value object encapsulating information about an ATC station.
Value object for a list of ATC stations.
Value object encapsulating information about a connection status.
bool isDisconnected() const
Query status.
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.
void setText(const QString &text)
void setContentsMargins(const QMargins &margins)
virtual void setSpacing(int)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QVariant property(const char *name) const const
QObject * sender() const const
void setObjectName(QAnyStringView name)
bool setProperty(const char *name, QVariant &&value)