mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #726, flight plan fixes
* airports as normal 4 character fields * validation messsage if validation is OK
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a8834d0511
commit
d65c2dddfb
@@ -70,6 +70,9 @@ namespace BlackGui
|
||||
CUpperCaseValidator *ucv = new CUpperCaseValidator(this);
|
||||
ui->le_Callsign->setValidator(ucv);
|
||||
ui->le_AircraftType->setValidator(ucv);
|
||||
ui->le_DestinationAirport->setValidator(ucv);
|
||||
ui->le_AlternateAirport->setValidator(ucv);
|
||||
ui->le_OriginAirport->setValidator(ucv);
|
||||
|
||||
// connect
|
||||
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::ps_sendFlightPlan);
|
||||
@@ -261,17 +264,6 @@ namespace BlackGui
|
||||
flightPlan.setCruiseAltitude(cruisingAltitude);
|
||||
}
|
||||
|
||||
v = this->ui->le_AlternateAirport->text();
|
||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||
{
|
||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << this->ui->lbl_AlternateAirport->text());
|
||||
flightPlan.setAlternateAirportIcao(QString(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
flightPlan.setAlternateAirportIcao(v);
|
||||
}
|
||||
|
||||
v = this->ui->le_DestinationAirport->text();
|
||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -307,6 +299,26 @@ namespace BlackGui
|
||||
flightPlan.setOriginAirportIcao(v);
|
||||
}
|
||||
|
||||
// Optional fields
|
||||
v = this->ui->le_AlternateAirport->text();
|
||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||
{
|
||||
if (!messages.hasWarningOrErrorMessages())
|
||||
{
|
||||
messages.push_back(CLogMessage().validationInfo("Missing %1") << this->ui->lbl_AlternateAirport->text());
|
||||
}
|
||||
flightPlan.setAlternateAirportIcao(QString(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
flightPlan.setAlternateAirportIcao(v);
|
||||
}
|
||||
|
||||
// OK
|
||||
if (!messages.hasWarningOrErrorMessages())
|
||||
{
|
||||
messages.push_back(CLogMessage().validationInfo("Flight plan validation passed"));
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace BlackGui
|
||||
//! Set completers
|
||||
void initCompleters();
|
||||
|
||||
//! File name for load/save
|
||||
QString getDefaultFilename(bool load);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -130,9 +130,6 @@
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="le_OriginAirport">
|
||||
<property name="inputMask">
|
||||
<string>>AAAA</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -371,8 +368,8 @@
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLineEdit" name="le_DestinationAirport">
|
||||
<property name="inputMask">
|
||||
<string>>AAAA</string>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO, e.g. EDDF</string>
|
||||
@@ -474,8 +471,8 @@
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QLineEdit" name="le_AlternateAirport">
|
||||
<property name="inputMask">
|
||||
<string>>AAAA</string>
|
||||
<property name="maxLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>ICAO, e.g. EDDF</string>
|
||||
@@ -573,6 +570,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<spacer name="vs_2ndButoonRow">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user