mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 15:25:34 +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);
|
CUpperCaseValidator *ucv = new CUpperCaseValidator(this);
|
||||||
ui->le_Callsign->setValidator(ucv);
|
ui->le_Callsign->setValidator(ucv);
|
||||||
ui->le_AircraftType->setValidator(ucv);
|
ui->le_AircraftType->setValidator(ucv);
|
||||||
|
ui->le_DestinationAirport->setValidator(ucv);
|
||||||
|
ui->le_AlternateAirport->setValidator(ucv);
|
||||||
|
ui->le_OriginAirport->setValidator(ucv);
|
||||||
|
|
||||||
// connect
|
// connect
|
||||||
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::ps_sendFlightPlan);
|
connect(this->ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::ps_sendFlightPlan);
|
||||||
@@ -261,17 +264,6 @@ namespace BlackGui
|
|||||||
flightPlan.setCruiseAltitude(cruisingAltitude);
|
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();
|
v = this->ui->le_DestinationAirport->text();
|
||||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
@@ -307,6 +299,26 @@ namespace BlackGui
|
|||||||
flightPlan.setOriginAirportIcao(v);
|
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;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ namespace BlackGui
|
|||||||
//! Set completers
|
//! Set completers
|
||||||
void initCompleters();
|
void initCompleters();
|
||||||
|
|
||||||
|
//! File name for load/save
|
||||||
QString getDefaultFilename(bool load);
|
QString getDefaultFilename(bool load);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -130,9 +130,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="le_OriginAirport">
|
<widget class="QLineEdit" name="le_OriginAirport">
|
||||||
<property name="inputMask">
|
|
||||||
<string>>AAAA</string>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -371,8 +368,8 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLineEdit" name="le_DestinationAirport">
|
<widget class="QLineEdit" name="le_DestinationAirport">
|
||||||
<property name="inputMask">
|
<property name="maxLength">
|
||||||
<string>>AAAA</string>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>ICAO, e.g. EDDF</string>
|
<string>ICAO, e.g. EDDF</string>
|
||||||
@@ -474,8 +471,8 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="7" column="3">
|
<item row="7" column="3">
|
||||||
<widget class="QLineEdit" name="le_AlternateAirport">
|
<widget class="QLineEdit" name="le_AlternateAirport">
|
||||||
<property name="inputMask">
|
<property name="maxLength">
|
||||||
<string>>AAAA</string>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>ICAO, e.g. EDDF</string>
|
<string>ICAO, e.g. EDDF</string>
|
||||||
@@ -573,6 +570,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user