mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
ADS-B: Only list available maps.
This commit is contained in:
parent
6336767097
commit
10c9864902
@ -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()
|
||||
|
@ -16,6 +16,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QFontDialog>
|
||||
#include <QGeoServiceProvider>
|
||||
#include <QDebug>
|
||||
|
||||
#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);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QQmlProperty>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QGeoServiceProvider>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user