9 #include "ui_modelmappingform.h"
14 #include "gui/labelandicon.h"
21 using namespace swift::misc::network;
22 using namespace swift::misc::physical_quantities;
23 using namespace swift::misc::simulation;
26 namespace swift::gui::editors
31 ui->le_LastUpdated->setReadOnly(
true);
32 ui->le_Id->setReadOnly(
true);
33 ui->le_Parts->setPlaceholderText(
"Allowed: " + CAircraftModel::supportedParts());
34 ui->lai_Id->set(CIcons::appMappings16(),
"Id:");
37 ui->le_Parts->setValidator(uc);
39 connect(ui->le_CG, &QLineEdit::editingFinished,
this, &CModelMappingForm::onCgEditFinished);
54 model.
setName(ui->le_Name->text());
56 model.
setCG(this->getCGFromUI());
65 ui->val_Indicator->setState(msgs);
71 ui->le_Description->setReadOnly(readOnly);
72 ui->le_ModelKey->setReadOnly(readOnly);
73 ui->le_Name->setReadOnly(readOnly);
85 ui->le_Name->setText(model.
getName());
90 this->setCGtoUI(model.
getCG());
91 m_originalModel = model;
99 ui->selector_ModelMode->setValue(CAircraftModel::Include);
100 ui->selector_ModelMode->setReadOnly(
false);
102 else { ui->selector_ModelMode->setReadOnly(
true); }
107 CLength CModelMappingForm::getCGFromUI()
const
109 if (ui->le_CG->text().isEmpty()) {
return CLength::null(); }
110 const QString v = ui->le_CG->text();
116 const double cgv = v.toDouble(&ok);
117 if (!ok) {
return CLength::null(); }
118 return CLength(cgv, CLengthUnit::ft());
126 void CModelMappingForm::setCGtoUI(
const CLength &cg)
128 if (cg.
isNull()) { ui->le_CG->clear(); }
132 void CModelMappingForm::onCgEditFinished()
134 const CLength cg = this->getCGFromUI();
void setAllowedCharacters(const QString &chars)
Allowed characters.
Status messages, e.g. from Core -> GUI.
QString getFormattedUtcTimestampYmdhms() const
As yyyy MM dd HH mm ss.
QString getDbKeyAsString() const
DB key as string.
Value object encapsulating information of an authentiated user.
bool hasAdminRole() const
Admin?
Physical unit length (length)
void parseFromString(const QString &value)
Parse value from string.
bool isNull() const
Is quantity null?
QString valueRoundedWithUnit(const MU &unit, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
Value to QString with the given unit, e.g. "5.00m".
Aircraft model (used by another pilot, my models on disk)
void setName(const QString &name)
Name.
ModelMode getModelMode() const
Model mode.
const QString & getSupportedParts() const
Supported parts.
void setModelString(const QString &modelString)
Model string.
CSimulatorInfo getSimulator() const
Simulator info.
const QString & getModelString() const
Model key, either queried or loaded from simulator model.
void setSupportedParts(const QString &supportedParts)
Supported parts.
const physical_quantities::CLength & getCG() const
Get center of gravity.
const QString & getName() const
Name.
const QString & getDescription() const
Descriptive text.
void setDescription(const QString &description)
Descriptive text.
void setSimulator(const CSimulatorInfo &simulator)
Set simulator info.
void setCG(const physical_quantities::CLength &cg)
Get center of gravity.
CStatusMessageList validate(bool withNestedObjects) const
Validate.
void setModelMode(ModelMode mode)
Set model mode.
const QString & getFileName() const
File name (corresponding data for simulator, only available if representing simulator model.
High level reusable GUI components.
Free functions in swift::misc.
bool isDigitsOnlyString(const QString &testString)
String with digits only.