12 #include "ui_aircrafticaoform.h"
22 #include "gui/labelandicon.h"
29 using namespace swift::misc::aviation;
30 using namespace swift::misc::db;
33 namespace swift::gui::editors
38 this->setFocusProxy(ui->le_Id);
39 ui->lai_Id->set(CIcons::appAircraftIcao16(),
"Id:");
40 ui->le_Updated->setReadOnly(
true);
41 ui->le_Id->setValidator(
new QIntValidator(0, 999999, ui->le_Id));
42 ui->aircraft_Selector->displayWithIcaoDescription(
false);
43 connect(ui->aircraft_Selector, &CDbAircraftIcaoSelectorComponent::changedAircraftIcao,
this,
47 connect(ui->le_Id, &QLineEdit::returnPressed,
this, &CAircraftIcaoForm::idEntered);
52 ui->drop_DropData->setInfoText(
"<drop aircraft ICAO code>");
53 ui->drop_DropData->setAcceptedMetaTypeIds(
54 { qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>() });
61 if (icao == m_originalCode) {
return false; }
62 m_originalCode = icao;
65 ui->aircraft_Selector->setAircraftIcao(icao);
72 ui->cb_Military->setChecked(icao.
isMilitary());
87 if (json.isEmpty()) {
return; }
108 int k = this->getDbKeyFromGui();
121 const QString manufacturer(ui->le_Manufacturer->text().trimmed().toUpper());
122 const QString modelDescription(ui->le_ModelDescription->text().trimmed());
123 const QString iata(ui->le_Iata->text().trimmed().toUpper());
124 const QString family(ui->le_Family->text().trimmed().toUpper());
125 const QString wtc(ui->cb_Wtc->currentText().left(1));
126 const QString combined(ui->combined_TypeSelector->getCombinedType());
128 int rank = ui->cb_Rank->currentText().toInt(&ok);
129 if (!ok) { rank = 10; }
130 bool legacy = ui->cb_Legacy->isChecked();
131 bool military = ui->cb_Military->isChecked();
132 bool realWorld = ui->cb_RealWorld->isChecked();
149 ui->val_Indicator->setState(msgs);
160 ui->aircraft_Selector->setReadOnly(readOnly);
161 ui->le_Manufacturer->setReadOnly(readOnly);
162 ui->le_ModelDescription->setReadOnly(readOnly);
163 ui->le_Family->setReadOnly(readOnly);
164 ui->le_Iata->setReadOnly(readOnly);
165 ui->le_Id->setReadOnly(readOnly);
166 ui->tb_Paste->setVisible(!readOnly);
172 ui->cb_Wtc->setEnabled(!readOnly);
173 ui->cb_Rank->setEnabled(!readOnly);
174 ui->drop_DropData->setVisible(!readOnly);
175 ui->combined_TypeSelector->setReadOnly(readOnly);
183 ui->tb_Paste->setVisible(
true);
184 ui->aircraft_Selector->setReadOnly(
false);
185 ui->le_Id->setReadOnly(
false);
186 ui->drop_DropData->setVisible(
true);
200 if (icaoList.isEmpty()) {
return; }
201 icao = icaoList.front();
207 void CAircraftIcaoForm::idEntered()
215 const int id = ui->le_Id->text().toInt();
225 int CAircraftIcaoForm::getDbKeyFromGui()
const
227 QString key(ui->le_Id->text().trimmed());
228 return IDatastoreObjectWithIntegerKey::stringToDbKey(key);
bool hasWebDataServices() const
Web data services available?
CWebDataServices * getWebDataServices() const
Get the web data services.
swift::misc::aviation::CAircraftIcaoCode getAircraftIcaoCodeForDbKey(int id) const
ICAO code for id.
void droppedValueObject(const swift::misc::CVariant &droppedObject)
Dropped value object.
static void checkBoxReadOnly(QCheckBox *checkBox, bool readOnly)
Pseudo readonly state for checkbox.
static bool setComboBoxValueByStartingString(QComboBox *box, const QString &candidate, const QString &unspecified=QString())
Find best match in comboBox.
Thrown when a convertFromJson method encounters an unrecoverable error in JSON data.
reference front()
Access the first element.
bool isEmpty() const
Synonym for empty.
Status messages, e.g. from Core -> GUI.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
T value() const
Return the value converted to the type T.
void convertFromJson(const QJsonObject &json)
Assign from JSON object.
bool canConvert(int typeId) const
True if this variant can be converted to the type with the given metatype ID.
QString getFormattedUtcTimestampYmdhms() const
As yyyy MM dd HH mm ss.
Value object for ICAO classification.
CWakeTurbulenceCategory getWtc() const
Get WTC.
bool isRealWorld() const
Real world aircraft?
void setRank(int rank)
Ranking.
const QString & getFamily() const
Family (e.g. A350)
void setCodeFlags(bool military, bool legacy, bool realWorld)
Flags.
const QString & getDesignator() const
Get ICAO designator, e.g. "B737".
const QString & getModelDescription() const
Get IACO model description, e.g. "A-330-200".
void setIataCode(const QString &iata)
Set IATA code.
void setWtc(CWakeTurbulenceCategory wtc)
Set WTC.
void setManufacturer(const QString &manufacturer)
Set the manufacturer.
const QString & getIataCode() const
IATA code.
void setCombinedType(const QString &type)
Set type.
bool isMilitary() const
Military?
CStatusMessageList validate() const
Validate data.
void setModelDescription(const QString &modelDescription)
Set the model description (ICAO description)
const QString & getCombinedType() const
Get type, e.g. "L2J".
bool isLegacyAircraft() const
Legacy aircraft (no current ICAO code)
void setFamily(const QString &family)
Set family.
const QString & getManufacturer() const
Get manufacturer, e.g. "Airbus".
QString getRankString() const
Ranking.
Value object encapsulating a list of ICAO codes.
ICAO wake turbulence category.
QString getDbKeyAsString() const
DB key as string.
bool isLoadedFromDb() const
Loaded from DB.
bool hasValidDbKey() const
Has valid DB key.
QString toQString(bool i18n=false) const
Cast as QString.
QJsonObject jsonObjectFromString(const QString &json, bool acceptCacheFormat)
JSON Object from string.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Free functions in swift::misc.