mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T215, using "COverlayMessagesTabWidget" for FP UI
This commit is contained in:
@@ -56,7 +56,7 @@ namespace BlackGui
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) :
|
CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) :
|
||||||
QTabWidget(parent),
|
COverlayMessagesTabWidget(parent),
|
||||||
ui(new Ui::CFlightPlanComponent)
|
ui(new Ui::CFlightPlanComponent)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui");
|
Q_ASSERT_X(sGui, Q_FUNC_INFO, "missing sGui");
|
||||||
@@ -77,41 +77,71 @@ namespace BlackGui
|
|||||||
ui->le_AlternateAirport->setValidator(ucv);
|
ui->le_AlternateAirport->setValidator(ucv);
|
||||||
ui->le_OriginAirport->setValidator(ucv);
|
ui->le_OriginAirport->setValidator(ucv);
|
||||||
|
|
||||||
|
ucv = new CUpperCaseValidator(true, 0, 1, ui->le_EquipmentSuffix);
|
||||||
|
ucv->setRestrictions(CFlightPlan::equipmentCodes());
|
||||||
|
ui->le_EquipmentSuffix->setValidator(ucv);
|
||||||
|
ui->le_EquipmentSuffix->setToolTip(ui->tbr_EquipmentCodes->toHtml());
|
||||||
|
QCompleter *completer = new QCompleter(CFlightPlan::equipmentCodesInfo(), ui->le_EquipmentSuffix);
|
||||||
|
completer->setMaxVisibleItems(10);
|
||||||
|
completer->popup()->setMinimumWidth(225);
|
||||||
|
completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||||
|
ui->le_EquipmentSuffix->setCompleter(completer);
|
||||||
|
|
||||||
// connect
|
// connect
|
||||||
connect(ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::ps_sendFlightPlan);
|
connect(ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan);
|
||||||
connect(ui->pb_Load, &QPushButton::pressed, this, &CFlightPlanComponent::ps_loadFlightPlanFromNetwork);
|
connect(ui->pb_Load, &QPushButton::pressed, this, &CFlightPlanComponent::loadFlightPlanFromNetwork);
|
||||||
connect(ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::ps_resetFlightPlan);
|
connect(ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::resetFlightPlan);
|
||||||
connect(ui->pb_ValidateFlightPlan, &QPushButton::pressed, this, &CFlightPlanComponent::ps_validateFlightPlan);
|
connect(ui->pb_ValidateFlightPlan, &QPushButton::pressed, this, &CFlightPlanComponent::validateFlightPlan);
|
||||||
|
connect(ui->pb_Prefill, &QPushButton::pressed, this, &CFlightPlanComponent::anticipateValues);
|
||||||
|
|
||||||
connect(ui->cb_VoiceCapabilities, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::ps_currentTextChangedToBuildRemarks);
|
connect(ui->cb_VoiceCapabilities, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::currentTextChangedToBuildRemarks);
|
||||||
connect(ui->cb_NavigationEquipment, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::ps_currentTextChangedToBuildRemarks);
|
connect(ui->cb_VoiceCapabilities, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::syncVoiceComboBoxes);
|
||||||
connect(ui->cb_PerformanceCategory, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::ps_currentTextChangedToBuildRemarks);
|
connect(ui->cb_VoiceCapabilitiesFirstPage, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::syncVoiceComboBoxes);
|
||||||
connect(ui->cb_PilotRating, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::ps_currentTextChangedToBuildRemarks);
|
connect(ui->cb_NavigationEquipment, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::currentTextChangedToBuildRemarks);
|
||||||
connect(ui->cb_RequiredNavigationPerformance, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::ps_currentTextChangedToBuildRemarks);
|
connect(ui->cb_PerformanceCategory, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::currentTextChangedToBuildRemarks);
|
||||||
|
connect(ui->cb_PilotRating, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::currentTextChangedToBuildRemarks);
|
||||||
|
connect(ui->cb_RequiredNavigationPerformance, &QComboBox::currentTextChanged, this, &CFlightPlanComponent::currentTextChangedToBuildRemarks);
|
||||||
|
|
||||||
connect(ui->pb_LoadDisk, &QPushButton::clicked, this, &CFlightPlanComponent::ps_loadFromDisk);
|
connect(ui->pb_LoadDisk, &QPushButton::clicked, this, &CFlightPlanComponent::loadFromDisk);
|
||||||
connect(ui->pb_SaveDisk, &QPushButton::clicked, this, &CFlightPlanComponent::ps_saveToDisk);
|
connect(ui->pb_SaveDisk, &QPushButton::clicked, this, &CFlightPlanComponent::saveToDisk);
|
||||||
|
|
||||||
bool c = connect(ui->le_AircraftRegistration, SIGNAL(textChanged(QString)), this, SLOT(ps_buildRemarksString()));
|
connect(ui->le_AircraftRegistration, &QLineEdit::textChanged, this, &CFlightPlanComponent::buildRemarksString);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "failed connect");
|
connect(ui->le_AirlineOperator, &QLineEdit::textChanged, this, &CFlightPlanComponent::buildRemarksString);
|
||||||
c = connect(ui->cb_NoSidsStarts, SIGNAL(toggled(bool)), this, SLOT(ps_buildRemarksString()));
|
connect(ui->cb_NoSidsStarts, &QCheckBox::released, this, &CFlightPlanComponent::buildRemarksString);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "failed connect");
|
|
||||||
c = connect(ui->le_AirlineOperator, SIGNAL(textChanged(QString)), this, SLOT(ps_buildRemarksString()));
|
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "failed connect");
|
|
||||||
Q_UNUSED(c);
|
|
||||||
|
|
||||||
connect(ui->pte_AdditionalRemarks, &QPlainTextEdit::textChanged, this, &CFlightPlanComponent::ps_buildRemarksString);
|
connect(ui->pte_AdditionalRemarks, &QPlainTextEdit::textChanged, this, &CFlightPlanComponent::buildRemarksString);
|
||||||
connect(ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::ps_buildRemarksString);
|
connect(ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::buildRemarksString);
|
||||||
connect(ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::ps_setSelcalInOwnAircraft);
|
connect(ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::setSelcalInOwnAircraft);
|
||||||
connect(ui->pb_CopyOver, &QPushButton::pressed, this, &CFlightPlanComponent::ps_copyRemarks);
|
connect(ui->pb_CopyOver, &QPushButton::pressed, this, &CFlightPlanComponent::copyRemarksConfirmed);
|
||||||
connect(ui->pb_RemarksGenerator, &QPushButton::clicked, this, &CFlightPlanComponent::ps_currentTabGenerator);
|
connect(ui->pb_GetFromGenerator, &QPushButton::pressed, this, &CFlightPlanComponent::copyRemarksConfirmed);
|
||||||
|
connect(ui->pb_RemarksGenerator, &QPushButton::clicked, this, &CFlightPlanComponent::currentTabGenerator);
|
||||||
|
connect(ui->tb_HelpEquipment, &QToolButton::clicked, this, &CFlightPlanComponent::showEquipmentCodesTab);
|
||||||
|
|
||||||
|
connect(ui->le_AircraftType, &QLineEdit::editingFinished, this, &CFlightPlanComponent::aircraftTypeChanged);
|
||||||
|
connect(ui->le_EquipmentSuffix, &QLineEdit::editingFinished, this, &CFlightPlanComponent::buildPrefixIcaoSuffix);
|
||||||
|
connect(ui->cb_Heavy, &QCheckBox::released, this, &CFlightPlanComponent::prefixCheckBoxChanged);
|
||||||
|
connect(ui->cb_Tcas, &QCheckBox::released, this, &CFlightPlanComponent::prefixCheckBoxChanged);
|
||||||
|
|
||||||
// web services
|
// web services
|
||||||
connect(sGui->getWebDataServices(), &CWebDataServices::allSwiftDbDataRead, this, &CFlightPlanComponent::ps_swiftWebDataRead);
|
connect(sGui->getWebDataServices(), &CWebDataServices::allSwiftDbDataRead, this, &CFlightPlanComponent::swiftWebDataRead);
|
||||||
|
|
||||||
// init GUI
|
// init GUI
|
||||||
this->ps_resetFlightPlan();
|
this->resetFlightPlan();
|
||||||
this->ps_buildRemarksString();
|
this->buildRemarksString();
|
||||||
|
|
||||||
|
// prefill some data derived from what was used last
|
||||||
|
if (sGui->getIContextSimulator()->isSimulatorSimulating())
|
||||||
|
{
|
||||||
|
this->prefillWithOwnAircraftData();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const CAircraftModel model = m_lastAircraftModel.get();
|
||||||
|
const CServer server = m_lastServer.get();
|
||||||
|
CSimulatedAircraft aircraft(model);
|
||||||
|
aircraft.setPilot(server.getUser());
|
||||||
|
this->prefillWithAircraftData(aircraft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFlightPlanComponent::~CFlightPlanComponent()
|
CFlightPlanComponent::~CFlightPlanComponent()
|
||||||
@@ -201,108 +231,111 @@ namespace BlackGui
|
|||||||
return m_flightPlan;
|
return m_flightPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(CFlightPlan &flightPlan)
|
CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(CFlightPlan &flightPlan)
|
||||||
{
|
{
|
||||||
BlackMisc::CStatusMessageList messages;
|
CStatusMessageList messages;
|
||||||
QString v;
|
QString v;
|
||||||
|
const bool strict = ui->cb_StrictCheck->isChecked();
|
||||||
|
const bool vfr = this->isVfr();
|
||||||
|
const CStatusMessage::StatusSeverity severity = strict ? CStatusMessage::SeverityError : CStatusMessage::SeverityWarning;
|
||||||
|
messages.push_back(CStatusMessage(this).validationInfo(strict ? "Strict validation" : "Lenient validation"));
|
||||||
|
|
||||||
CFlightPlan::FlightRules rule = CFlightPlan::IFR;
|
const CFlightPlan::FlightRules rule = ui->cb_FlightRule->currentText().startsWith("I") ? CFlightPlan::IFR : CFlightPlan::VFR;
|
||||||
if (ui->rb_TypeIfr->isChecked())
|
|
||||||
{
|
|
||||||
rule = CFlightPlan::IFR;
|
|
||||||
}
|
|
||||||
else if (ui->rb_TypeVfr->isChecked())
|
|
||||||
{
|
|
||||||
rule = CFlightPlan::VFR;
|
|
||||||
}
|
|
||||||
flightPlan.setFlightRule(rule);
|
flightPlan.setFlightRule(rule);
|
||||||
|
|
||||||
v = ui->le_Callsign->text().trimmed();
|
// callsign
|
||||||
|
v = ui->le_Callsign->text().trimmed().toUpper();
|
||||||
if (v.isEmpty())
|
if (v.isEmpty())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_Callsign->text());
|
messages.push_back(CStatusMessage(this).validationError("Missing '%1'") << ui->lbl_Callsign->text());
|
||||||
|
}
|
||||||
|
else if (!CCallsign::isValidAircraftCallsign(v))
|
||||||
|
{
|
||||||
|
messages.push_back(CStatusMessage(this).validationError("Invalid callsign '%1'") << v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// aircraft ICAO / aircraft type
|
||||||
|
v = ui->le_AircraftType->text().trimmed().toUpper();
|
||||||
|
if (v.isEmpty())
|
||||||
|
{
|
||||||
|
messages.push_back(CStatusMessage(this).validationError("Missing '%1'") << ui->lbl_AircraftType->text());
|
||||||
|
}
|
||||||
|
else if (!CAircraftIcaoCode::isValidDesignator(v))
|
||||||
|
{
|
||||||
|
messages.push_back(CStatusMessage(this).validationError("Invalid aircraft ICAO code '%1'") << v);
|
||||||
|
}
|
||||||
|
else if (sApp && sApp->hasWebDataServices() && !sApp->getWebDataServices()->containsAircraftIcaoDesignator(v))
|
||||||
|
{
|
||||||
|
messages.push_back(CStatusMessage(this).validationWarning("Are you sure '%1' is a valid type?") << v);
|
||||||
|
}
|
||||||
|
flightPlan.setAircraftIcao(this->getAircraftIcaoCode());
|
||||||
|
|
||||||
|
// route
|
||||||
v = ui->pte_Route->toPlainText().trimmed();
|
v = ui->pte_Route->toPlainText().trimmed();
|
||||||
if (v.isEmpty())
|
if (v.isEmpty())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing flight plan route"));
|
messages.push_back(CStatusMessage(this).validation(vfr ? CStatusMessage::SeverityInfo : CStatusMessage::SeverityError, "Missing '%1'") << ui->lbl_Route->text());
|
||||||
}
|
}
|
||||||
else if (v.length() > CFlightPlan::MaxRouteLength)
|
else if (v.length() > CFlightPlan::MaxRouteLength)
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Flight plan route length exceeded (%1 chars max.)") << CFlightPlan::MaxRouteLength);
|
messages.push_back(CStatusMessage(this).validationError("Flight plan route length exceeded (%1 chars max.)") << CFlightPlan::MaxRouteLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flightPlan.setRoute(v);
|
flightPlan.setRoute(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remarks
|
||||||
v = ui->pte_Remarks->toPlainText().trimmed();
|
v = ui->pte_Remarks->toPlainText().trimmed();
|
||||||
if (v.isEmpty())
|
if (v.isEmpty())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("No remarks, voice capabilities are mandatory"));
|
messages.push_back(CStatusMessage(this).validationError("No '%1', voice capabilities are mandatory") << ui->lbl_Remarks->text());
|
||||||
}
|
}
|
||||||
else if (v.length() > CFlightPlan::MaxRemarksLength)
|
else if (v.length() > CFlightPlan::MaxRemarksLength)
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Flight plan remarks length exceeded (%1 chars max.)") << CFlightPlan::MaxRemarksLength);
|
messages.push_back(CStatusMessage(this).validationError("Flight plan remarks length exceeded (%1 chars max.)") << CFlightPlan::MaxRemarksLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flightPlan.setRemarks(v);
|
flightPlan.setRemarks(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// time enroute
|
||||||
v = ui->le_EstimatedTimeEnroute->text();
|
v = ui->le_EstimatedTimeEnroute->text();
|
||||||
if (v.isEmpty() || v == defaultTime())
|
if (v.isEmpty() || v == defaultTime())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_EstimatedTimeEnroute->text());
|
messages.push_back(CStatusMessage(this).validation(severity, "Missing '%1'") << ui->lbl_EstimatedTimeEnroute->text());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
flightPlan.setEnrouteTime(v);
|
flightPlan.setEnrouteTime(v);
|
||||||
}
|
|
||||||
|
|
||||||
|
// fuel
|
||||||
v = ui->le_FuelOnBoard->text();
|
v = ui->le_FuelOnBoard->text();
|
||||||
if (v.isEmpty() || v == defaultTime())
|
if (v.isEmpty() || v == defaultTime())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_FuelOnBorad->text());
|
messages.push_back(CStatusMessage(this).validation(severity, "Missing '%1'") << ui->lbl_FuelOnBoard->text());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
flightPlan.setFuelTime(v);
|
flightPlan.setFuelTime(v);
|
||||||
}
|
|
||||||
|
|
||||||
|
// take off time
|
||||||
v = ui->le_TakeOffTimePlanned->text();
|
v = ui->le_TakeOffTimePlanned->text();
|
||||||
if (v.isEmpty() || v == defaultTime())
|
if (v.isEmpty() || v == defaultTime())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_TakeOffTimePlanned->text());
|
messages.push_back(CStatusMessage(this).validation(severity, "Missing '%1'") << ui->lbl_TakeOffTimePlanned->text());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
flightPlan.setTakeoffTimePlanned(v);
|
flightPlan.setTakeoffTimePlanned(v);
|
||||||
}
|
|
||||||
|
|
||||||
thread_local const QRegularExpression withUnit("\\D+");
|
// cruising alt
|
||||||
v = ui->le_CrusingAltitude->text().trimmed();
|
if (ui->lep_CrusingAltitude->isValid(&messages))
|
||||||
if (!v.isEmpty() && !withUnit.match(v).hasMatch())
|
|
||||||
{
|
|
||||||
v += "ft";
|
|
||||||
ui->le_CrusingAltitude->setText(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
CAltitude cruisingAltitude(v, CPqString::SeparatorsLocale);
|
|
||||||
if (v.isEmpty() || cruisingAltitude.isNull())
|
|
||||||
{
|
|
||||||
messages.push_back(CLogMessage().validationWarning("Wrong %1") << ui->lbl_CrusingAltitude->text());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
const CAltitude cruisingAltitude = ui->lep_CrusingAltitude->getAltitude();
|
||||||
flightPlan.setCruiseAltitude(cruisingAltitude);
|
flightPlan.setCruiseAltitude(cruisingAltitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// destination airport
|
||||||
v = ui->le_DestinationAirport->text();
|
v = ui->le_DestinationAirport->text();
|
||||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_DestinationAirport->text());
|
messages.push_back(CStatusMessage(this).validationError("Missing '%1'") << ui->lbl_DestinationAirport->text());
|
||||||
flightPlan.setDestinationAirportIcao(QString(""));
|
flightPlan.setDestinationAirportIcao(QString(""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -310,23 +343,11 @@ namespace BlackGui
|
|||||||
flightPlan.setDestinationAirportIcao(v);
|
flightPlan.setDestinationAirportIcao(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
v = ui->le_CruiseTrueAirspeed->text();
|
// origin airport
|
||||||
CSpeed cruiseTAS;
|
|
||||||
cruiseTAS.parseFromString(v, CPqString::SeparatorsLocale);
|
|
||||||
if (cruiseTAS.isNull())
|
|
||||||
{
|
|
||||||
messages.push_back(CLogMessage().validationWarning("Wrong TAS, %1") << ui->lbl_CruiseTrueAirspeed->text());
|
|
||||||
flightPlan.setDestinationAirportIcao(defaultIcao());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
flightPlan.setCruiseTrueAirspeed(cruiseTAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
v = ui->le_OriginAirport->text();
|
v = ui->le_OriginAirport->text();
|
||||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationWarning("Missing %1") << ui->lbl_OriginAirport->text());
|
messages.push_back(CStatusMessage(this).validationError("Missing '%1'") << ui->lbl_OriginAirport->text());
|
||||||
flightPlan.setOriginAirportIcao(defaultIcao());
|
flightPlan.setOriginAirportIcao(defaultIcao());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -334,13 +355,27 @@ namespace BlackGui
|
|||||||
flightPlan.setOriginAirportIcao(v);
|
flightPlan.setOriginAirportIcao(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TAS
|
||||||
|
v = ui->le_CruiseTrueAirspeed->text();
|
||||||
|
CSpeed cruiseTAS;
|
||||||
|
cruiseTAS.parseFromString(v, CPqString::SeparatorsLocale);
|
||||||
|
if (cruiseTAS.isNull())
|
||||||
|
{
|
||||||
|
messages.push_back(CStatusMessage(this).validationError("Wrong TAS, %1") << ui->lbl_CruiseTrueAirspeed->text());
|
||||||
|
flightPlan.setDestinationAirportIcao(defaultIcao());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flightPlan.setCruiseTrueAirspeed(cruiseTAS);
|
||||||
|
}
|
||||||
|
|
||||||
// Optional fields
|
// Optional fields
|
||||||
v = ui->le_AlternateAirport->text();
|
v = ui->le_AlternateAirport->text();
|
||||||
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
if (v.isEmpty() || v.endsWith(defaultIcao(), Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
if (!messages.hasWarningOrErrorMessages())
|
if (!messages.hasWarningOrErrorMessages())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationInfo("Missing %1") << ui->lbl_AlternateAirport->text());
|
messages.push_back(CStatusMessage(this).validationInfo("Missing %1") << ui->lbl_AlternateAirport->text());
|
||||||
}
|
}
|
||||||
flightPlan.setAlternateAirportIcao(QString(""));
|
flightPlan.setAlternateAirportIcao(QString(""));
|
||||||
}
|
}
|
||||||
@@ -352,15 +387,15 @@ namespace BlackGui
|
|||||||
// OK
|
// OK
|
||||||
if (!messages.hasWarningOrErrorMessages())
|
if (!messages.hasWarningOrErrorMessages())
|
||||||
{
|
{
|
||||||
messages.push_back(CLogMessage().validationInfo("Flight plan validation passed"));
|
messages.push_back(CStatusMessage(this).validationInfo("Flight plan validation passed"));
|
||||||
}
|
}
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_sendFlightPlan()
|
void CFlightPlanComponent::sendFlightPlan()
|
||||||
{
|
{
|
||||||
CFlightPlan flightPlan;
|
CFlightPlan flightPlan;
|
||||||
CStatusMessageList messages = this->validateAndInitializeFlightPlan(flightPlan);
|
const CStatusMessageList messages = this->validateAndInitializeFlightPlan(flightPlan);
|
||||||
if (!messages.hasWarningOrErrorMessages())
|
if (!messages.hasWarningOrErrorMessages())
|
||||||
{
|
{
|
||||||
// no error, send if possible
|
// no error, send if possible
|
||||||
@@ -381,16 +416,14 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_validateFlightPlan()
|
void CFlightPlanComponent::validateFlightPlan()
|
||||||
{
|
{
|
||||||
CFlightPlan flightPlan;
|
CFlightPlan flightPlan;
|
||||||
CStatusMessageList messages = this->validateAndInitializeFlightPlan(flightPlan);
|
const CStatusMessageList messages = this->validateAndInitializeFlightPlan(flightPlan);
|
||||||
messages.addCategories(this);
|
this->showOverlayMessages(messages);
|
||||||
messages.addCategory(CLogCategory::validation());
|
|
||||||
CLogMessage::preformatted(messages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_resetFlightPlan()
|
void CFlightPlanComponent::resetFlightPlan()
|
||||||
{
|
{
|
||||||
Q_ASSERT(sGui->getIContextNetwork());
|
Q_ASSERT(sGui->getIContextNetwork());
|
||||||
Q_ASSERT(sGui->getIContextOwnAircraft());
|
Q_ASSERT(sGui->getIContextOwnAircraft());
|
||||||
@@ -409,7 +442,7 @@ namespace BlackGui
|
|||||||
ui->le_TakeOffTimePlanned->setText(QDateTime::currentDateTimeUtc().addSecs(30 * 60).toString("hh:mm"));
|
ui->le_TakeOffTimePlanned->setText(QDateTime::currentDateTimeUtc().addSecs(30 * 60).toString("hh:mm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_loadFromDisk()
|
void CFlightPlanComponent::loadFromDisk()
|
||||||
{
|
{
|
||||||
CStatusMessage m;
|
CStatusMessage m;
|
||||||
const QString fileName = QFileDialog::getOpenFileName(nullptr,
|
const QString fileName = QFileDialog::getOpenFileName(nullptr,
|
||||||
@@ -454,7 +487,7 @@ namespace BlackGui
|
|||||||
if (m.isFailure()) { CLogMessage::preformatted(m); }
|
if (m.isFailure()) { CLogMessage::preformatted(m); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_saveToDisk()
|
void CFlightPlanComponent::saveToDisk()
|
||||||
{
|
{
|
||||||
CStatusMessage m;
|
CStatusMessage m;
|
||||||
const QString fileName = QFileDialog::getSaveFileName(nullptr,
|
const QString fileName = QFileDialog::getSaveFileName(nullptr,
|
||||||
@@ -485,14 +518,14 @@ namespace BlackGui
|
|||||||
if (m.isFailure()) { CLogMessage::preformatted(m); }
|
if (m.isFailure()) { CLogMessage::preformatted(m); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_setSelcalInOwnAircraft()
|
void CFlightPlanComponent::setSelcalInOwnAircraft()
|
||||||
{
|
{
|
||||||
if (!sGui->getIContextOwnAircraft()) return;
|
if (!sGui->getIContextOwnAircraft()) return;
|
||||||
if (!ui->frp_SelcalCode->hasValidCode()) return;
|
if (!ui->frp_SelcalCode->hasValidCode()) return;
|
||||||
sGui->getIContextOwnAircraft()->updateSelcal(ui->frp_SelcalCode->getSelcal(), flightPlanIdentifier());
|
sGui->getIContextOwnAircraft()->updateSelcal(ui->frp_SelcalCode->getSelcal(), flightPlanIdentifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_loadFlightPlanFromNetwork()
|
void CFlightPlanComponent::loadFlightPlanFromNetwork()
|
||||||
{
|
{
|
||||||
if (!sGui->getIContextNetwork())
|
if (!sGui->getIContextNetwork())
|
||||||
{
|
{
|
||||||
@@ -518,13 +551,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_buildRemarksString()
|
void CFlightPlanComponent::buildRemarksString()
|
||||||
{
|
{
|
||||||
QString rem;
|
|
||||||
QString v = ui->cb_VoiceCapabilities->currentText().toUpper();
|
QString v = ui->cb_VoiceCapabilities->currentText().toUpper();
|
||||||
if (v.contains("TEXT")) { rem.append("/T/ "); }
|
QString rem = CFlightPlanRemarks::textToVoiceCapabilities(v);
|
||||||
else if (v.contains("RECEIVE")) { rem.append("/R/ "); }
|
|
||||||
else if (v.contains("VOICE")) { rem.append("/V/ "); }
|
|
||||||
|
|
||||||
v = ui->le_AirlineOperator->text().trimmed();
|
v = ui->le_AirlineOperator->text().trimmed();
|
||||||
if (!v.isEmpty()) rem.append("OPR/").append(v).append(" ");
|
if (!v.isEmpty()) rem.append("OPR/").append(v).append(" ");
|
||||||
@@ -571,18 +601,18 @@ namespace BlackGui
|
|||||||
ui->pte_RemarksGenerated->setPlainText(rem);
|
ui->pte_RemarksGenerated->setPlainText(rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_copyRemarks()
|
void CFlightPlanComponent::copyRemarks()
|
||||||
{
|
{
|
||||||
ui->pte_Remarks->setPlainText(ui->pte_RemarksGenerated->toPlainText());
|
ui->pte_Remarks->setPlainText(ui->pte_RemarksGenerated->toPlainText());
|
||||||
CLogMessage(this).info("Copied remarks");
|
CLogMessage(this).info("Copied remarks");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_currentTabGenerator()
|
void CFlightPlanComponent::currentTabGenerator()
|
||||||
{
|
{
|
||||||
this->setCurrentWidget(ui->tb_RemarksGenerator);
|
this->setCurrentWidget(ui->tb_RemarksGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::ps_swiftWebDataRead()
|
void CFlightPlanComponent::swiftWebDataRead()
|
||||||
{
|
{
|
||||||
this->initCompleters();
|
this->initCompleters();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#ifndef BLACKGUI_COMPONENTS_FLIGHTPLANCOMPONENT_H
|
#ifndef BLACKGUI_COMPONENTS_FLIGHTPLANCOMPONENT_H
|
||||||
#define BLACKGUI_COMPONENTS_FLIGHTPLANCOMPONENT_H
|
#define BLACKGUI_COMPONENTS_FLIGHTPLANCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/overlaymessagesframe.h"
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackmisc/aviation/flightplan.h"
|
#include "blackmisc/aviation/flightplan.h"
|
||||||
#include "blackmisc/network/user.h"
|
#include "blackmisc/network/user.h"
|
||||||
@@ -25,8 +26,6 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Ui { class CFlightPlanComponent; }
|
namespace Ui { class CFlightPlanComponent; }
|
||||||
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -34,7 +33,7 @@ namespace BlackGui
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
//! Flight plan widget
|
//! Flight plan widget
|
||||||
class BLACKGUI_EXPORT CFlightPlanComponent : public QTabWidget
|
class BLACKGUI_EXPORT CFlightPlanComponent : public COverlayMessagesTabWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -88,42 +87,71 @@ namespace BlackGui
|
|||||||
//! File name for load/save
|
//! File name for load/save
|
||||||
QString getDefaultFilename(bool load);
|
QString getDefaultFilename(bool load);
|
||||||
|
|
||||||
private slots:
|
//! Call \sa buildRemarksString from combo box signal
|
||||||
//! Call \sa ps_buildRemarksString from combo box signal
|
void currentTextChangedToBuildRemarks(const QString &text) { this->buildRemarksString(); Q_UNUSED(text); }
|
||||||
void ps_currentTextChangedToBuildRemarks(const QString &text) { this->ps_buildRemarksString(); Q_UNUSED(text); }
|
|
||||||
|
|
||||||
//! Send flightplan
|
//! Send flightplan
|
||||||
void ps_sendFlightPlan();
|
void sendFlightPlan();
|
||||||
|
|
||||||
//! Reset Flightplan
|
//! Reset Flightplan
|
||||||
void ps_resetFlightPlan();
|
void resetFlightPlan();
|
||||||
|
|
||||||
//! Load from disk
|
//! Load from disk
|
||||||
void ps_loadFromDisk();
|
void loadFromDisk();
|
||||||
|
|
||||||
//! Save to disk
|
//! Save to disk
|
||||||
void ps_saveToDisk();
|
void saveToDisk();
|
||||||
|
|
||||||
//! Set SELCAL in own aircrafr
|
//! Set SELCAL in own aircrafr
|
||||||
void ps_setSelcalInOwnAircraft();
|
void setSelcalInOwnAircraft();
|
||||||
|
|
||||||
//! Load Flightplan
|
//! Load Flightplan
|
||||||
void ps_loadFlightPlanFromNetwork();
|
void loadFlightPlanFromNetwork();
|
||||||
|
|
||||||
//! Validate Flightplan
|
//! Validate Flightplan
|
||||||
void ps_validateFlightPlan();
|
void validateFlightPlan();
|
||||||
|
|
||||||
//! Remark
|
//! Remarks
|
||||||
void ps_buildRemarksString();
|
void buildRemarksString();
|
||||||
|
|
||||||
//! Copy over
|
//! Copy over
|
||||||
void ps_copyRemarks();
|
void copyRemarksConfirmed() { this->copyRemarks(true); }
|
||||||
|
|
||||||
|
//! Copy over
|
||||||
|
void copyRemarks(bool confirm = true);
|
||||||
|
|
||||||
//! Show generator tab page
|
//! Show generator tab page
|
||||||
void ps_currentTabGenerator();
|
void currentTabGenerator();
|
||||||
|
|
||||||
//! GUI init complete
|
//! GUI init complete
|
||||||
void ps_swiftWebDataRead();
|
void swiftWebDataRead();
|
||||||
|
|
||||||
|
//! Build "H/B737/F"
|
||||||
|
void buildPrefixIcaoSuffix();
|
||||||
|
|
||||||
|
//! Prefix check box changed
|
||||||
|
void prefixCheckBoxChanged();
|
||||||
|
|
||||||
|
//! Aircraft type changed
|
||||||
|
void aircraftTypeChanged();
|
||||||
|
|
||||||
|
//! Something like "H/B737/F"
|
||||||
|
QString getPrefixIcaoSuffix() const;
|
||||||
|
|
||||||
|
//! Aircraft type as ICAO code
|
||||||
|
BlackMisc::Aviation::CAircraftIcaoCode getAircraftIcaoCode() const;
|
||||||
|
|
||||||
|
//! Show tab of equipment codes
|
||||||
|
void showEquipmentCodesTab();
|
||||||
|
|
||||||
|
//! VFR rules?
|
||||||
|
bool isVfr() const;
|
||||||
|
|
||||||
|
//! Override remarks message dialog
|
||||||
|
bool overrideRemarks();
|
||||||
|
|
||||||
|
//! Guess some FP values/setting
|
||||||
|
void anticipateValues();
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -375,7 +375,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0" alignment="Qt::AlignTop">
|
||||||
<widget class="QPushButton" name="pb_RemarksGenerator">
|
<widget class="QPushButton" name="pb_RemarksGenerator">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>generator</string>
|
<string>generator</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user