Fixed flightplan assert,

see https://dev.vatsim-germany.org/issues/335#note-6
This commit is contained in:
Klaus Basan
2014-11-29 20:13:41 +00:00
committed by Roland Winklmeier
parent 0a016406b4
commit d3a4795845
2 changed files with 14 additions and 9 deletions

View File

@@ -25,7 +25,6 @@ namespace BlackGui
{ {
CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) : CFlightPlanComponent::CFlightPlanComponent(QWidget *parent) :
QTabWidget(parent), QTabWidget(parent),
CEnableForRuntime(nullptr, false),
ui(new Ui::CFlightPlanComponent) ui(new Ui::CFlightPlanComponent)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -58,9 +57,6 @@ namespace BlackGui
connect(this->ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::ps_setSelcalInOwnAircraft); connect(this->ui->frp_SelcalCode, &CSelcalCodeSelector::valueChanged, this, &CFlightPlanComponent::ps_setSelcalInOwnAircraft);
connect(this->ui->pb_CopyOver, &QPushButton::pressed, this, &CFlightPlanComponent::ps_copyRemarks); connect(this->ui->pb_CopyOver, &QPushButton::pressed, this, &CFlightPlanComponent::ps_copyRemarks);
connect(this->ui->pb_RemarksGenerator, &QPushButton::clicked, this, &CFlightPlanComponent::ps_currentTabGenerator); connect(this->ui->pb_RemarksGenerator, &QPushButton::clicked, this, &CFlightPlanComponent::ps_currentTabGenerator);
this->ps_resetFlightPlan();
this->ps_buildRemarksString();
} }
CFlightPlanComponent::~CFlightPlanComponent() CFlightPlanComponent::~CFlightPlanComponent()
@@ -68,6 +64,7 @@ namespace BlackGui
void CFlightPlanComponent::loginDataSet() void CFlightPlanComponent::loginDataSet()
{ {
if (this->m_flightPlan.wasSentOrLoaded()) { return; } // when loaded or sent do not override
if (!this->getIContextOwnAircraft()) { return; } if (!this->getIContextOwnAircraft()) { return; }
this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft()); this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft());
} }
@@ -117,6 +114,13 @@ namespace BlackGui
return this->m_flightPlan; return this->m_flightPlan;
} }
void CFlightPlanComponent::runtimeHasBeenSet()
{
// context dependent calls
this->ps_resetFlightPlan();
this->ps_buildRemarksString();
}
BlackMisc::CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(BlackMisc::Aviation::CFlightPlan &flightPlan) BlackMisc::CStatusMessageList CFlightPlanComponent::validateAndInitializeFlightPlan(BlackMisc::Aviation::CFlightPlan &flightPlan)
{ {
BlackMisc::CStatusMessageList messages; BlackMisc::CStatusMessageList messages;
@@ -299,10 +303,7 @@ namespace BlackGui
{ {
Q_ASSERT(this->getIContextNetwork()); Q_ASSERT(this->getIContextNetwork());
Q_ASSERT(this->getIContextOwnAircraft()); Q_ASSERT(this->getIContextOwnAircraft());
if (this->getIContextNetwork()) if (this->getIContextOwnAircraft()) { this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft()); }
{
this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft());
}
this->ui->le_AircraftRegistration->clear(); this->ui->le_AircraftRegistration->clear();
this->ui->le_AirlineOperator->clear(); this->ui->le_AirlineOperator->clear();
this->ui->le_CrusingAltitude->setText("FL70"); this->ui->le_CrusingAltitude->setText("FL70");
@@ -355,8 +356,8 @@ namespace BlackGui
QString rem; QString rem;
QString v = this->ui->cb_VoiceCapabilities->currentText().toUpper(); QString v = this->ui->cb_VoiceCapabilities->currentText().toUpper();
if (v.contains("TEXT")) { rem.append("/T/ "); } if (v.contains("TEXT")) { rem.append("/T/ "); }
else if (v.contains("VOICE")) { rem.append("/V/ "); }
else if (v.contains("RECEIVE")) { rem.append("/R/ "); } else if (v.contains("RECEIVE")) { rem.append("/R/ "); }
else if (v.contains("VOICE")) { rem.append("/V/ "); }
v = this->ui->le_AirlineOperator->text().trimmed(); v = this->ui->le_AirlineOperator->text().trimmed();
if (!v.isEmpty()) rem.append("OPR/").append(v).append(" "); if (!v.isEmpty()) rem.append("OPR/").append(v).append(" ");

View File

@@ -51,6 +51,10 @@ namespace BlackGui
//! Get this flight plan //! Get this flight plan
BlackMisc::Aviation::CFlightPlan getFlightPlan() const; BlackMisc::Aviation::CFlightPlan getFlightPlan() const;
protected:
//! \copydoc CEnableForRuntime::runtimeHasBeenSet
void runtimeHasBeenSet() override;
private: private:
QScopedPointer<Ui::CFlightPlanComponent> ui; QScopedPointer<Ui::CFlightPlanComponent> ui;