8 #include <QStringBuilder>
13 #include "ui_remoteaircraftselector.h"
22 using namespace swift::misc::aviation;
23 using namespace swift::misc::simulation;
25 using namespace swift::core::context;
29 CRemoteAircraftSelector::CRemoteAircraftSelector(QWidget *parent)
34 &CRemoteAircraftSelector::onRemovedAircraft, Qt::QueuedConnection);
37 &CRemoteAircraftSelector::onAddedAircraft, Qt::QueuedConnection);
39 s = connect(ui->cb_RemoteAircraftSelector, &QComboBox::currentTextChanged,
this,
40 &CRemoteAircraftSelector::comboBoxChanged);
49 const int index = ui->cb_RemoteAircraftSelector->currentIndex();
50 if (index < 0 || index > m_aircraft.
size()) {
return empty; }
51 return m_aircraft[index].getCallsign();
60 QWidget::showEvent(event);
66 if (cs.isEmpty()) {
return; }
71 void CRemoteAircraftSelector::onRemovedAircraft(
const CCallsign &callsign)
73 if (callsign.
isEmpty()) {
return; }
80 void CRemoteAircraftSelector::comboBoxChanged(
const QString &text)
82 if (m_currentText == text) {
return; }
87 void CRemoteAircraftSelector::fillComboBox()
89 if (!this->isVisible()) {
return; }
94 ui->cb_RemoteAircraftSelector->clear();
95 if (m_aircraft.
isEmpty()) {
return; }
107 if (m_showPartsEnabled)
115 ui->cb_RemoteAircraftSelector->addItems(items);
118 if (currentSelection.isEmpty()) {
return; }
119 int index = m_aircraft.firstIndexOfCallsign(currentSelection);
120 if (index >= 0 && index < ui->cb_RemoteAircraftSelector->count())
122 ui->cb_RemoteAircraftSelector->setCurrentIndex(index);
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
virtual swift::misc::simulation::CSimulatedAircraftList getAircraftInRange() const =0
Aircraft list.
Select a remote aircraft.
swift::misc::aviation::CCallsign getSelectedCallsign() const
Selected callsign.
void changedCallsign()
Callsign changed.
virtual void showEvent(QShowEvent *event)
void indicatePartsEnabled(bool indicate)
Indicate if aircraft parts enabled aircraft.
virtual ~CRemoteAircraftSelector()
Destructor.
void inputSignal()
Received input signal, or manually trigger.
size_type size() const
Returns number of elements in the sequence.
bool isEmpty() const
Synonym for empty.
Value object encapsulating information of a callsign.
bool isEmpty() const
Is empty?
CONTAINER sortedByCallsign() const
Copy of list sorted by callsign.
bool containsCallsign(const CCallsign &callsign) const
Contains callsign?
QString toQString(bool i18n=false) const
Cast as QString.
Comprehensive information of an aircraft.
bool hasRealName() const
Has valid realname?
bool isPartsSynchronized() const
Have parts been synchronized with a remote client?
QString getPilotRealName() const
Get user's real name.
const aviation::CCallsign & getCallsign() const
Get callsign.
bool hasAircraftDesignator() const
Valid designator?
const aviation::CAircraftIcaoCode & getAircraftIcaoCode() const
Get aircraft ICAO info.
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.