10 #include "ui_liveryform.h"
21 #include "gui/labelandicon.h"
27 using namespace swift::misc::aviation;
31 namespace swift::gui::editors
36 ui->le_Updated->setReadOnly(
true);
37 ui->le_Id->setValidator(
new QIntValidator(0, 999999, ui->le_Id));
38 ui->lai_Id->set(CIcons::appLiveries16(),
"Id:");
39 ui->comp_LiverySelector->withLiveryDescription(
false);
42 connect(ui->le_Id, &QLineEdit::returnPressed,
this, &CLiveryForm::onIdEntered);
45 connect(ui->comp_LiverySelector, &CDbLiverySelectorComponent::changedLivery,
this, &
CLiveryForm::setValue,
46 Qt::QueuedConnection);
51 ui->drop_DropData->setInfoText(
"<drop livery>");
52 ui->drop_DropData->setAcceptedMetaTypeIds({ qMetaTypeId<CLivery>(), qMetaTypeId<CLiveryList>() });
56 Qt::QueuedConnection);
59 connect(ui->pb_TempLivery, &QPushButton::pressed,
this, &CLiveryForm::setTemporaryLivery);
60 connect(ui->pb_SearchColor, &QPushButton::pressed,
this, &CLiveryForm::searchForColor);
68 const QString
id = ui->le_Id->text();
72 const int dbKey =
id.toInt(&ok);
77 if (!livery.
hasValidDbKey()) { livery = ui->comp_LiverySelector->getLivery(); }
96 if (m_originalLivery == livery) {
return false; }
98 m_originalLivery = livery;
99 ui->comp_LiverySelector->setLivery(livery);
105 ui->cb_Military->setChecked(livery.
isMilitary());
107 if (livery.
isColorLivery()) { ui->editor_AirlineIcao->clear(); }
114 if (json.isEmpty()) {
return; }
142 ui->val_Indicator->setState(msgs);
151 ui->comp_LiverySelector->allowDrop(
allowDrop);
152 ui->editor_AirlineIcao->allowDrop(
allowDrop);
160 ui->le_Id->setReadOnly(readOnly);
161 ui->comp_LiverySelector->setReadOnly(readOnly);
162 ui->le_Description->setReadOnly(readOnly);
163 ui->color_Fuselage->setReadOnly(readOnly);
164 ui->color_Tail->setReadOnly(readOnly);
165 ui->editor_AirlineIcao->setReadOnly(readOnly);
166 ui->pb_SearchColor->setVisible(!readOnly);
167 ui->pb_TempLivery->setVisible(!readOnly);
168 ui->drop_DropData->setVisible(!readOnly);
169 ui->tb_Paste->setVisible(!readOnly);
177 ui->comp_LiverySelector->setReadOnly(
false);
178 ui->le_Id->setReadOnly(
false);
179 ui->editor_AirlineIcao->setSelectOnly();
180 ui->drop_DropData->setVisible(
true);
181 ui->pb_SearchColor->setVisible(
true);
182 ui->pb_TempLivery->setVisible(
true);
183 ui->tb_Paste->setVisible(
true);
197 if (liveryList.isEmpty()) {
return; }
198 livery = liveryList.front();
215 if (stdLivery.hasValidDbKey()) { this->
setValue(stdLivery); }
218 void CLiveryForm::setTemporaryLivery()
225 void CLiveryForm::searchForColor()
230 m_colorSearch->setModal(
true);
232 const QDialog::DialogCode c =
static_cast<QDialog::DialogCode
>(m_colorSearch->exec());
233 if (c == QDialog::Rejected) {
return; }
238 void CLiveryForm::onIdEntered()
246 const int id = ui->le_Id->text().toInt();
bool hasWebDataServices() const
Web data services available?
bool isShuttingDown() const
Is application shutting down?
CWebDataServices * getWebDataServices() const
Get the web data services.
swift::misc::aviation::CLivery getTempLiveryOrDefault() const
The temp. livery if available.
swift::misc::aviation::CLiveryList getLiveries() const
Liveries.
swift::misc::aviation::CLivery getLiveryForDbKey(int id) const
Livery for id.
void droppedValueObject(const swift::misc::CVariant &droppedObject)
Dropped value object.
static void checkBoxReadOnly(QCheckBox *checkBox, bool readOnly)
Pseudo readonly state for checkbox.
Search for best matching color livery.
const swift::misc::aviation::CLivery & getLivery() const
Found livery if any, otherwise default.
Thrown when a convertFromJson method encounters an unrecoverable error in JSON data.
void push_back(const T &value)
Appends an element at the end of the sequence.
reference front()
Access the first element.
bool isEmpty() const
Synonym for empty.
Status messages, e.g. from Core -> GUI.
void removeWarningsAndBelow()
Remove warnings and below.
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.
bool hasCompleteData() const
Complete data.
Value object encapsulating information about an airpot.
bool isMilitary() const
Military livery.
const CRgbColor & getColorTail() const
Get tail color.
bool setAirlineIcaoCode(const CAirlineIcaoCode &airlineIcao)
Airline ICAO code.
CStatusMessageList validate() const
Validate data.
const CAirlineIcaoCode & getAirlineIcaoCode() const
Corresponding airline, if any.
void setMilitary(bool isMilitary)
Military aircraft?
bool hasCompleteData() const
Complete data?
const QString & getDescription() const
Get description.
bool isColorLivery() const
Color livery?
void setDescription(const QString &description)
Set description.
const CRgbColor & getColorFuselage() const
Get fuselage color.
Value object for a list of airports.
CLivery findStdLiveryByAirlineIcaoVDesignator(const QString &icao) const
Find livery by airline.
QString getDbKeyAsString() const
DB key as string.
bool isLoadedFromDb() const
Loaded from DB.
bool hasValidDbKey() const
Has valid DB key.
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.