From 4395f96b1319a55dfe2e0f2e905774e036e8c78b Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 25 Jul 2018 09:27:14 +0100 Subject: [PATCH] Launcher: Fix helipad selection --- src/GUI/LauncherController.cxx | 4 +++- src/GUI/LauncherController.hxx | 3 ++- src/GUI/NavaidSearchModel.cxx | 21 +++++++++++++++------ src/GUI/NavaidSearchModel.hxx | 3 ++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/GUI/LauncherController.cxx b/src/GUI/LauncherController.cxx index c4f2e3ab5..6ce3b528d 100644 --- a/src/GUI/LauncherController.cxx +++ b/src/GUI/LauncherController.cxx @@ -411,7 +411,9 @@ void LauncherController::updateSelectedAircraft() m_selectedAircraftInfo->setUri(m_selectedAircraft); QModelIndex index = m_aircraftModel->indexOfAircraftURI(m_selectedAircraft); if (index.isValid()) { - m_aircraftType = Airplane; + // we have to default to unknown here, until we have an explicit + // way to determine if it's a regular aircraft or not + m_aircraftType = Unknown; if (index.data(AircraftIsHelicopterRole).toBool()) { m_aircraftType = Helicopter; } else if (index.data(AircraftIsSeaplaneRole).toBool()) { diff --git a/src/GUI/LauncherController.hxx b/src/GUI/LauncherController.hxx index 46564867c..5bbd28b9b 100644 --- a/src/GUI/LauncherController.hxx +++ b/src/GUI/LauncherController.hxx @@ -158,7 +158,8 @@ public: enum AircraftType { - Airplane = 0, + Unknown = 0, + Airplane, Seaplane, Helicopter, Airship diff --git a/src/GUI/NavaidSearchModel.cxx b/src/GUI/NavaidSearchModel.cxx index 0a996e5b6..f9040fd1d 100644 --- a/src/GUI/NavaidSearchModel.cxx +++ b/src/GUI/NavaidSearchModel.cxx @@ -115,14 +115,23 @@ public: addType(FGPositioned::NDB); } - if (aircraft == LauncherController::Helicopter) { - addType(FGPositioned::HELIPAD); - } + addType(FGPositioned::AIRPORT); - if (aircraft == LauncherController::Seaplane) { + switch (aircraft) { + case LauncherController::Airplane: + break; + + case LauncherController::Helicopter: + addType(FGPositioned::HELIPORT); + break; + + case LauncherController::Seaplane: + addType(FGPositioned::SEAPORT); + break; + + default: + addType(FGPositioned::HELIPORT); addType(FGPositioned::SEAPORT); - } else { - addType(FGPositioned::AIRPORT); } } }; diff --git a/src/GUI/NavaidSearchModel.hxx b/src/GUI/NavaidSearchModel.hxx index 84b849a9e..882e97e3f 100644 --- a/src/GUI/NavaidSearchModel.hxx +++ b/src/GUI/NavaidSearchModel.hxx @@ -54,6 +54,7 @@ public: enum AircraftType { + Unknown = LauncherController::Unknown, Airplane = LauncherController::Airplane, Seaplane = LauncherController::Seaplane, Helicopter = LauncherController::Helicopter, @@ -62,7 +63,7 @@ public: Q_ENUMS(AircraftType) - Q_INVOKABLE void setSearch(QString t, AircraftType aircraft); + Q_INVOKABLE void setSearch(QString t, AircraftType aircraft = Unknown); Q_INVOKABLE void clear();