Skip to content

Commit

Permalink
refactor: Remove flight plan component prefill method
Browse files Browse the repository at this point in the history
For the user this method is very opaque on what is actually does. To
avoid confusion and to simplify the component, this commit removes it.
  • Loading branch information
ltoenning committed Mar 24, 2024
1 parent ce5efaf commit 21a6a37
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 75 deletions.
57 changes: 0 additions & 57 deletions src/blackgui/components/flightplancomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ namespace BlackGui::Components
connect(ui->pb_Download, &QPushButton::pressed, this, &CFlightPlanComponent::loadFlightPlanFromNetwork, Qt::QueuedConnection);
connect(ui->pb_Reset, &QPushButton::pressed, this, &CFlightPlanComponent::resetFlightPlan, Qt::QueuedConnection);
connect(ui->tb_SyncWithSimulator, &QPushButton::released, this, &CFlightPlanComponent::syncWithSimulator, Qt::QueuedConnection);
connect(ui->pb_Prefill, &QPushButton::pressed, this, &CFlightPlanComponent::anticipateValues, Qt::QueuedConnection);
connect(ui->pb_SimBrief, &QPushButton::pressed, this, &CFlightPlanComponent::loadFromSimBrief, Qt::QueuedConnection);

connect(ui->pb_SaveTemplate, &QPushButton::released, this, &CFlightPlanComponent::saveTemplateToDisk, Qt::QueuedConnection);
Expand Down Expand Up @@ -812,62 +811,6 @@ namespace BlackGui::Components
return true;
}

void CFlightPlanComponent::anticipateValues()
{
if (!this->overrideRemarks()) { return; }
CStatusMessageList msgs;
const bool vfr = this->isVfr();
const bool airline = m_model.hasAirlineDesignator();

if (vfr)
{
ui->cb_NoSidsStarts->setChecked(true);
msgs.push_back(CStatusMessage(this).validationInfo(u"No SID/STARs"));
ui->cb_RequiredNavigationPerformance->setCurrentIndex(0);
ui->cb_PerformanceCategory->setCurrentIndex(0);
msgs.push_back(CStatusMessage(this).validationInfo(u"Set performance to VFR"));
}
else
{
// IFR
const CAircraftIcaoCode icao = this->getAircraftIcaoCode();
if (icao.isLoadedFromDb())
{
if (icao.getEnginesCount() >= 2 && icao.getEngineType() == "J")
{
// jet with >=2 engines
msgs.push_back(CStatusMessage(this).validationInfo(u"Jet >=2 engines"));
msgs.push_back(CStatusMessage(this).validationInfo(u"SID/STARs"));
ui->cb_NoSidsStarts->setChecked(false);
msgs.push_back(CStatusMessage(this).validationInfo(u"Capable of SIDs/STARs"));

// reset those values
ui->cb_RequiredNavigationPerformance->setCurrentIndex(0);
ui->cb_PerformanceCategory->setCurrentIndex(0);
}
} // ICAO
}

// further info if having model from DB
if (m_model.isLoadedFromDb())
{
if (airline)
{
ui->le_AirlineOperator->setText(m_model.getAirlineIcaoCode().getName());
}
}

// messages
this->showOverlayMessages(msgs, false, OverlayTimeoutMs);

// copy over
if (msgs.isSuccess())
{
this->buildRemarksString();
this->copyRemarks(false);
}
}

void CFlightPlanComponent::updateDirectorySettings(const QString &fileOrDirectory)
{
if (fileOrDirectory.isEmpty()) { return; }
Expand Down
3 changes: 0 additions & 3 deletions src/blackgui/components/flightplancomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ namespace BlackGui::Components
//! Override remarks message dialog
bool overrideRemarks();

//! Guess some FP values/setting
void anticipateValues();

//! Update the diretcory settings
void updateDirectorySettings(const QString &fileOrDirectory);

Expand Down
15 changes: 0 additions & 15 deletions src/blackgui/components/flightplancomponent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -743,20 +743,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pb_Prefill">
<property name="toolTip">
<string>Anticipate (guess) some values</string>
</property>
<property name="text">
<string>&amp;Prefill</string>
</property>
<property name="icon">
<iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/diagona/icons/diagona/icons/compass--pencil.png</normaloff>:/diagona/icons/diagona/icons/compass--pencil.png</iconset>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_SaveTemplate">
<property name="text">
Expand Down Expand Up @@ -1155,7 +1141,6 @@
<tabstop>le_PilotsName</tabstop>
<tabstop>le_PilotsHomeBase</tabstop>
<tabstop>le_LastSent</tabstop>
<tabstop>pb_Prefill</tabstop>
<tabstop>pb_Reset</tabstop>
<tabstop>pb_Send</tabstop>
<tabstop>pb_Download</tabstop>
Expand Down

0 comments on commit 21a6a37

Please sign in to comment.