1
0
Fork 0

Fix wrong launcher aircraft name on startup

The mapping from aircraft URI to name was wrong for local (non-package)
aircraft, as spotted by Thorsten Renk. Note other data (thumbnail) is
still incorrect, but another change I have pending will replace this 
code anyway so only doing the simple fix for now.
This commit is contained in:
James Turner 2017-11-13 12:49:39 +01:00
parent 2bf5a96aec
commit b870b3f022

View file

@ -678,7 +678,12 @@ void LauncherMainWindow::updateSelectedAircraft()
if (index.isValid()) {
QPixmap pm = index.data(Qt::DecorationRole).value<QPixmap>();
m_ui->thumbnail->setPixmap(pm);
m_ui->aircraftName->setText(index.data(Qt::DisplayRole).toString());
// important to use this version to get the variant-specific name
// correct; the QModelIndex lookup doesn't do that.
// actually all the data is for the primary variant, but this will be
// fixed when enabling the LocalAircraftCache outside the AircaftModel
m_ui->aircraftName->setText(m_aircraftModel->nameForAircraftURI(m_selectedAircraft));
QVariant longDesc = index.data(AircraftLongDescriptionRole);
m_ui->aircraftDescription->setVisible(!longDesc.isNull());