mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +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->setForceSmall(true);
|
||||||
this->showKillButton(false);
|
this->showKillButton(false);
|
||||||
|
|
||||||
|
// rules
|
||||||
|
ui->cb_FlightRule->clear();
|
||||||
|
ui->cb_FlightRule->addItems(CFlightPlan::flightRules());
|
||||||
|
|
||||||
// validators
|
// validators
|
||||||
ui->le_Callsign->setValidator(new CUpperCaseValidator(ui->le_Callsign));
|
ui->le_Callsign->setValidator(new CUpperCaseValidator(ui->le_Callsign));
|
||||||
ui->le_AircraftType->setValidator(new CUpperCaseValidator(ui->le_AircraftType));
|
ui->le_AircraftType->setValidator(new CUpperCaseValidator(ui->le_AircraftType));
|
||||||
@@ -249,11 +253,18 @@ namespace BlackGui
|
|||||||
const CAltitude cruiseAlt = flightPlan.getCruiseAltitude();
|
const CAltitude cruiseAlt = flightPlan.getCruiseAltitude();
|
||||||
ui->lep_CrusingAltitude->setAltitude(cruiseAlt);
|
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;
|
ui->cb_FlightRule->setCurrentText(r);
|
||||||
default: ui->cb_FlightRule->setCurrentText("IFR"); break;
|
|
||||||
}
|
}
|
||||||
|
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()
|
const CLogCategoryList &CFlightPlanComponent::getLogCategories()
|
||||||
@@ -270,8 +281,8 @@ namespace BlackGui
|
|||||||
const CStatusMessage::StatusSeverity severity = strict ? CStatusMessage::SeverityError : CStatusMessage::SeverityWarning;
|
const CStatusMessage::StatusSeverity severity = strict ? CStatusMessage::SeverityError : CStatusMessage::SeverityWarning;
|
||||||
messages.push_back(CStatusMessage(this).validationInfo(strict ? QStringLiteral("Strict validation") : QStringLiteral("Lenient validation")));
|
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;
|
const CFlightPlan::FlightRules rules = this->getFlightRules();
|
||||||
flightPlan.setFlightRule(rule);
|
flightPlan.setFlightRule(rules);
|
||||||
|
|
||||||
// callsign
|
// callsign
|
||||||
QString v;
|
QString v;
|
||||||
@@ -789,10 +800,16 @@ namespace BlackGui
|
|||||||
|
|
||||||
bool CFlightPlanComponent::isVfr() const
|
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;
|
return vfr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFlightPlan::FlightRules CFlightPlanComponent::getFlightRules() const
|
||||||
|
{
|
||||||
|
const CFlightPlan::FlightRules r = CFlightPlan::stringToFlightRules(ui->cb_FlightRule->currentText());
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
bool CFlightPlanComponent::overrideRemarks()
|
bool CFlightPlanComponent::overrideRemarks()
|
||||||
{
|
{
|
||||||
if (!ui->pte_Remarks->toPlainText().trimmed().isEmpty())
|
if (!ui->pte_Remarks->toPlainText().trimmed().isEmpty())
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace BlackGui
|
|||||||
private:
|
private:
|
||||||
static constexpr int OverlayTimeoutMs = 5000;
|
static constexpr int OverlayTimeoutMs = 5000;
|
||||||
QScopedPointer<Ui::CFlightPlanComponent> ui;
|
QScopedPointer<Ui::CFlightPlanComponent> ui;
|
||||||
CAltitudeDialog *m_altitudeDialog = nullptr;
|
CAltitudeDialog *m_altitudeDialog = nullptr;
|
||||||
CStringListDialog *m_fpRemarksDialog = nullptr;
|
CStringListDialog *m_fpRemarksDialog = nullptr;
|
||||||
BlackMisc::Aviation::CFlightPlan m_sentFlightPlan; //!< My flight plan
|
BlackMisc::Aviation::CFlightPlan m_sentFlightPlan; //!< My flight plan
|
||||||
BlackMisc::Simulation::CAircraftModel m_model; //!< currently used model
|
BlackMisc::Simulation::CAircraftModel m_model; //!< currently used model
|
||||||
@@ -200,6 +200,9 @@ namespace BlackGui
|
|||||||
//! VFR rules?
|
//! VFR rules?
|
||||||
bool isVfr() const;
|
bool isVfr() const;
|
||||||
|
|
||||||
|
//! Get the FP flight rules
|
||||||
|
BlackMisc::Aviation::CFlightPlan::FlightRules getFlightRules() const;
|
||||||
|
|
||||||
//! Override remarks message dialog
|
//! Override remarks message dialog
|
||||||
bool overrideRemarks();
|
bool overrideRemarks();
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-137</y>
|
<y>0</y>
|
||||||
<width>383</width>
|
<width>383</width>
|
||||||
<height>480</height>
|
<height>480</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -723,6 +723,16 @@
|
|||||||
<string>VFR</string>
|
<string>VFR</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>SVFR</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>DVFR</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
|
|||||||
@@ -186,6 +186,12 @@ namespace BlackMisc
|
|||||||
m_equipmentSuffix = parts[2];
|
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)
|
void CFlightPlan::setRoute(const QString &route)
|
||||||
{
|
{
|
||||||
QString r = route;
|
QString r = route;
|
||||||
@@ -508,7 +514,7 @@ namespace BlackMisc
|
|||||||
return CFlightPlan();
|
return CFlightPlan();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CFlightPlan::flightRuleToString(CFlightPlan::FlightRules rule)
|
const QString &CFlightPlan::flightRulesToString(CFlightPlan::FlightRules rules)
|
||||||
{
|
{
|
||||||
static const QString v("VFR");
|
static const QString v("VFR");
|
||||||
static const QString i("IFR");
|
static const QString i("IFR");
|
||||||
@@ -516,7 +522,7 @@ namespace BlackMisc
|
|||||||
static const QString d("DVFR");
|
static const QString d("DVFR");
|
||||||
static const QString unknown("???");
|
static const QString unknown("???");
|
||||||
|
|
||||||
switch (rule)
|
switch (rules)
|
||||||
{
|
{
|
||||||
case VFR: return v;
|
case VFR: return v;
|
||||||
case IFR: return i;
|
case IFR: return i;
|
||||||
@@ -604,6 +610,34 @@ namespace BlackMisc
|
|||||||
return UNKNOWN;
|
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()
|
const QStringList &CFlightPlan::faaEquipmentCodes()
|
||||||
{
|
{
|
||||||
// List of FAA Aircraft Equipment Codes For US Domestic Flights
|
// 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; }
|
void setCruiseTrueAirspeed(const PhysicalQuantities::CSpeed &cruiseTrueAirspeed) { m_cruiseTrueAirspeed = cruiseTrueAirspeed; }
|
||||||
|
|
||||||
//! Set flight rules (VFR or IFR)
|
//! 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
|
//! Set route string
|
||||||
void setRoute(const QString &route);
|
void setRoute(const QString &route);
|
||||||
@@ -310,7 +313,7 @@ namespace BlackMisc
|
|||||||
FlightRules getFlightRulesAsVFRorIFR() const;
|
FlightRules getFlightRulesAsVFRorIFR() const;
|
||||||
|
|
||||||
//! Get flight rules as in FlightRules as string
|
//! 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
|
//! Get route string
|
||||||
const QString &getRoute() const { return m_route; }
|
const QString &getRoute() const { return m_route; }
|
||||||
@@ -385,11 +388,26 @@ namespace BlackMisc
|
|||||||
static CFlightPlan loadFromMultipleFormats(const QString &fileName, CStatusMessageList *msgs = nullptr);
|
static CFlightPlan loadFromMultipleFormats(const QString &fileName, CStatusMessageList *msgs = nullptr);
|
||||||
|
|
||||||
//! Rules to string
|
//! Rules to string
|
||||||
static const QString &flightRuleToString(FlightRules rule);
|
static const QString &flightRulesToString(FlightRules rules);
|
||||||
|
|
||||||
//! String to flight rules
|
//! String to flight rules
|
||||||
static FlightRules stringToFlightRules(const QString &flightRules);
|
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
|
//! Get aircraft ICAO code from equipment code like
|
||||||
//! \remark we expect something like "H/B772/F" "B773" "B773/F"
|
//! \remark we expect something like "H/B772/F" "B773" "B773/F"
|
||||||
static QString aircraftIcaoCodeFromEquipmentCode(const QString &equipmentCodeAndAircraft);
|
static QString aircraftIcaoCodeFromEquipmentCode(const QString &equipmentCodeAndAircraft);
|
||||||
|
|||||||
Reference in New Issue
Block a user