mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Ref T690, aded SVFR and DVFR to FP
This commit is contained in:
committed by
Mat Sutcliffe
parent
4ecd8a78ad
commit
fba288edc3
@@ -83,6 +83,10 @@ namespace BlackGui
|
||||
this->setForceSmall(true);
|
||||
this->showKillButton(false);
|
||||
|
||||
// rules
|
||||
ui->cb_FlightRule->clear();
|
||||
ui->cb_FlightRule->addItems(CFlightPlan::flightRules());
|
||||
|
||||
// validators
|
||||
ui->le_Callsign->setValidator(new CUpperCaseValidator(ui->le_Callsign));
|
||||
ui->le_AircraftType->setValidator(new CUpperCaseValidator(ui->le_AircraftType));
|
||||
@@ -249,11 +253,18 @@ namespace BlackGui
|
||||
const CAltitude cruiseAlt = flightPlan.getCruiseAltitude();
|
||||
ui->lep_CrusingAltitude->setAltitude(cruiseAlt);
|
||||
|
||||
switch (flightPlan.getFlightRulesAsVFRorIFR())
|
||||
const QString r = flightPlan.getFlightRulesAsString();
|
||||
if (CFlightPlan::flightRules().contains(r, Qt::CaseInsensitive))
|
||||
{
|
||||
case CFlightPlan::VFR: ui->cb_FlightRule->setCurrentText("VFR"); break;
|
||||
default: ui->cb_FlightRule->setCurrentText("IFR"); break;
|
||||
ui->cb_FlightRule->setCurrentText(r);
|
||||
}
|
||||
else if (flightPlan.getFlightRules() == CFlightPlan::UNKNOWN)
|
||||
{
|
||||
ui->cb_FlightRule->setCurrentText(CFlightPlan::flightRulesToString(CFlightPlan::IFR));
|
||||
const CStatusMessage m = CStatusMessage(this).validationWarning(u"Unknown fligh rule, setting to default");
|
||||
this->showOverlayMessage(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const CLogCategoryList &CFlightPlanComponent::getLogCategories()
|
||||
@@ -270,8 +281,8 @@ namespace BlackGui
|
||||
const CStatusMessage::StatusSeverity severity = strict ? CStatusMessage::SeverityError : CStatusMessage::SeverityWarning;
|
||||
messages.push_back(CStatusMessage(this).validationInfo(strict ? QStringLiteral("Strict validation") : QStringLiteral("Lenient validation")));
|
||||
|
||||
const CFlightPlan::FlightRules rule = ui->cb_FlightRule->currentText().startsWith("I") ? CFlightPlan::IFR : CFlightPlan::VFR;
|
||||
flightPlan.setFlightRule(rule);
|
||||
const CFlightPlan::FlightRules rules = this->getFlightRules();
|
||||
flightPlan.setFlightRule(rules);
|
||||
|
||||
// callsign
|
||||
QString v;
|
||||
@@ -789,10 +800,16 @@ namespace BlackGui
|
||||
|
||||
bool CFlightPlanComponent::isVfr() const
|
||||
{
|
||||
const bool vfr = ui->cb_FlightRule->currentText().startsWith("V", Qt::CaseInsensitive);
|
||||
const bool vfr = CFlightPlan::isVFRRules(ui->cb_FlightRule->currentText());
|
||||
return vfr;
|
||||
}
|
||||
|
||||
CFlightPlan::FlightRules CFlightPlanComponent::getFlightRules() const
|
||||
{
|
||||
const CFlightPlan::FlightRules r = CFlightPlan::stringToFlightRules(ui->cb_FlightRule->currentText());
|
||||
return r;
|
||||
}
|
||||
|
||||
bool CFlightPlanComponent::overrideRemarks()
|
||||
{
|
||||
if (!ui->pte_Remarks->toPlainText().trimmed().isEmpty())
|
||||
|
||||
@@ -200,6 +200,9 @@ namespace BlackGui
|
||||
//! VFR rules?
|
||||
bool isVfr() const;
|
||||
|
||||
//! Get the FP flight rules
|
||||
BlackMisc::Aviation::CFlightPlan::FlightRules getFlightRules() const;
|
||||
|
||||
//! Override remarks message dialog
|
||||
bool overrideRemarks();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-137</y>
|
||||
<y>0</y>
|
||||
<width>383</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
@@ -723,6 +723,16 @@
|
||||
<string>VFR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SVFR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DVFR</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
|
||||
@@ -186,6 +186,12 @@ namespace BlackMisc
|
||||
m_equipmentSuffix = parts[2];
|
||||
}
|
||||
|
||||
void CFlightPlan::setFlightRule(const QString &flightRule)
|
||||
{
|
||||
const CFlightPlan::FlightRules r = CFlightPlan::stringToFlightRules(flightRule);
|
||||
this->setFlightRule(r);
|
||||
}
|
||||
|
||||
void CFlightPlan::setRoute(const QString &route)
|
||||
{
|
||||
QString r = route;
|
||||
@@ -508,7 +514,7 @@ namespace BlackMisc
|
||||
return CFlightPlan();
|
||||
}
|
||||
|
||||
const QString &CFlightPlan::flightRuleToString(CFlightPlan::FlightRules rule)
|
||||
const QString &CFlightPlan::flightRulesToString(CFlightPlan::FlightRules rules)
|
||||
{
|
||||
static const QString v("VFR");
|
||||
static const QString i("IFR");
|
||||
@@ -516,7 +522,7 @@ namespace BlackMisc
|
||||
static const QString d("DVFR");
|
||||
static const QString unknown("???");
|
||||
|
||||
switch (rule)
|
||||
switch (rules)
|
||||
{
|
||||
case VFR: return v;
|
||||
case IFR: return i;
|
||||
@@ -604,6 +610,34 @@ namespace BlackMisc
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
const QStringList &CFlightPlan::flightRules()
|
||||
{
|
||||
static const QStringList r({"VFR", "IFR", "SVFR", "DVFR" });
|
||||
return r;
|
||||
}
|
||||
|
||||
bool CFlightPlan::isVFRRules(CFlightPlan::FlightRules rule)
|
||||
{
|
||||
return rule == CFlightPlan::VFR || rule == CFlightPlan::DVFR || rule == CFlightPlan::SVFR;
|
||||
}
|
||||
|
||||
bool CFlightPlan::isVFRRules(const QString &rule)
|
||||
{
|
||||
const CFlightPlan::FlightRules r = CFlightPlan::stringToFlightRules(rule);
|
||||
return CFlightPlan::isVFRRules(r);
|
||||
}
|
||||
|
||||
bool CFlightPlan::isIFRRules(CFlightPlan::FlightRules rule)
|
||||
{
|
||||
return rule == CFlightPlan::IFR;
|
||||
}
|
||||
|
||||
bool CFlightPlan::isIFRRules(const QString &rule)
|
||||
{
|
||||
const CFlightPlan::FlightRules r = CFlightPlan::stringToFlightRules(rule);
|
||||
return CFlightPlan::isIFRRules(r);
|
||||
}
|
||||
|
||||
const QStringList &CFlightPlan::faaEquipmentCodes()
|
||||
{
|
||||
// List of FAA Aircraft Equipment Codes For US Domestic Flights
|
||||
|
||||
@@ -241,7 +241,10 @@ namespace BlackMisc
|
||||
void setCruiseTrueAirspeed(const PhysicalQuantities::CSpeed &cruiseTrueAirspeed) { m_cruiseTrueAirspeed = cruiseTrueAirspeed; }
|
||||
|
||||
//! Set flight rules (VFR or IFR)
|
||||
void setFlightRule(FlightRules flightRules) { m_flightRules = flightRules; }
|
||||
void setFlightRule(FlightRules flightRule) { m_flightRules = flightRule; }
|
||||
|
||||
//! Set flight rules (VFR or IFR)
|
||||
void setFlightRule(const QString &flightRule);
|
||||
|
||||
//! Set route string
|
||||
void setRoute(const QString &route);
|
||||
@@ -310,7 +313,7 @@ namespace BlackMisc
|
||||
FlightRules getFlightRulesAsVFRorIFR() const;
|
||||
|
||||
//! Get flight rules as in FlightRules as string
|
||||
QString getFlightRulesAsString() const { return CFlightPlan::flightRuleToString(this->getFlightRules()); }
|
||||
QString getFlightRulesAsString() const { return CFlightPlan::flightRulesToString(this->getFlightRules()); }
|
||||
|
||||
//! Get route string
|
||||
const QString &getRoute() const { return m_route; }
|
||||
@@ -385,11 +388,26 @@ namespace BlackMisc
|
||||
static CFlightPlan loadFromMultipleFormats(const QString &fileName, CStatusMessageList *msgs = nullptr);
|
||||
|
||||
//! Rules to string
|
||||
static const QString &flightRuleToString(FlightRules rule);
|
||||
static const QString &flightRulesToString(FlightRules rules);
|
||||
|
||||
//! String to flight rules
|
||||
static FlightRules stringToFlightRules(const QString &flightRules);
|
||||
|
||||
//! All rules as string
|
||||
static const QStringList &flightRules();
|
||||
|
||||
//! Is rule a VFR rule?
|
||||
//! @{
|
||||
static bool isVFRRules(FlightRules rule);
|
||||
static bool isVFRRules(const QString &rule);
|
||||
//! @}
|
||||
|
||||
//! Is rule a IFR rule?
|
||||
//! @{
|
||||
static bool isIFRRules(FlightRules rule);
|
||||
static bool isIFRRules(const QString &rule);
|
||||
//! @}
|
||||
|
||||
//! Get aircraft ICAO code from equipment code like
|
||||
//! \remark we expect something like "H/B772/F" "B773" "B773/F"
|
||||
static QString aircraftIcaoCodeFromEquipmentCode(const QString &equipmentCodeAndAircraft);
|
||||
|
||||
Reference in New Issue
Block a user