diff --git a/plugins/channelrx/demodadsb/CMakeLists.txt b/plugins/channelrx/demodadsb/CMakeLists.txt index 6d2e72368..331630c1d 100644 --- a/plugins/channelrx/demodadsb/CMakeLists.txt +++ b/plugins/channelrx/demodadsb/CMakeLists.txt @@ -60,7 +60,7 @@ if(NOT SERVER_MODE) ) set(TARGET_NAME demodadsb) - set(TARGET_LIB Qt::Widgets Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::TextToSpeech) + set(TARGET_LIB Qt::Widgets Qt::Quick Qt::QuickWidgets Qt::Positioning Qt::Location Qt::TextToSpeech) set(TARGET_LIB_GUI "sdrgui") set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR}) else() diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp index 0c170fdfe..64017ae34 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp @@ -16,6 +16,7 @@ /////////////////////////////////////////////////////////////////////////////////// #include +#include #include #include "adsbdemoddisplaydialog.h" @@ -28,6 +29,15 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid m_fontSize(settings->m_tableFontSize) { ui->setupUi(this); + + QStringList mapProviders = QGeoServiceProvider::availableServiceProviders(); + if (!mapProviders.contains("osm")) { + ui->mapProvider->removeItem(ui->mapProvider->findText("osm")); + } + if (!mapProviders.contains("mapboxgl")) { + ui->mapProvider->removeItem(ui->mapProvider->findText("mapboxgl")); + } + ui->timeout->setValue(settings->m_removeTimeout); ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom); ui->airportRange->setValue(settings->m_airportRange); @@ -46,7 +56,10 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid } } ui->airspaceRange->setValue(settings->m_airspaceRange); - ui->mapProvider->setCurrentText(settings->m_mapProvider); + int idx = ui->mapProvider->findText(settings->m_mapProvider); + if (idx != -1) { + ui->mapProvider->setCurrentText(settings->m_mapProvider); + } ui->mapType->setCurrentIndex((int)settings->m_mapType); ui->navAids->setChecked(settings->m_displayNavAids); ui->atcCallsigns->setChecked(settings->m_atcCallsigns); diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index c77b38f5e..a5737f5cb 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "ui_adsbdemodgui.h" #include "device/deviceapi.h" @@ -4725,14 +4726,24 @@ void ADSBDemodGUI::applyMapSettings() zoom = 10.0; } + // Check requested map provider is available - if not, try the other + QString mapProvider = m_settings.m_mapProvider; + QStringList mapProviders = QGeoServiceProvider::availableServiceProviders(); + if ((mapProvider == "osm") && (!mapProviders.contains(mapProvider))) { + mapProvider = "mapboxgl"; + } + if ((mapProvider == "mapboxgl") && (!mapProviders.contains(mapProvider))) { + mapProvider = "osm"; + } + // Create the map using the specified provider QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing()); QQmlProperty::write(item, "aircraftMinZoomLevel", m_settings.m_aircraftMinZoom); - QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider); + QQmlProperty::write(item, "mapProvider", mapProvider); QVariantMap parameters; QString mapType; - if (m_settings.m_mapProvider == "osm") + if (mapProvider == "osm") { // Use our repo, so we can append API key and redefine transmit maps parameters["osm.mapping.providersrepository.address"] = QString("http://127.0.0.1:%1/").arg(m_osmPort); @@ -4760,7 +4771,7 @@ void ADSBDemodGUI::applyMapSettings() break; } } - else if (m_settings.m_mapProvider == "mapboxgl") + else if (mapProvider == "mapboxgl") { switch (m_settings.m_mapType) {