1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Merge pull request #2017 from srcejon/freq_scanner

2 Bug Fixes
This commit is contained in:
Edouard Griffiths 2024-03-12 19:29:08 +01:00 committed by GitHub
commit af8d63e94e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 14 deletions

View File

@ -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()

View File

@ -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);

View File

@ -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)
{

View File

@ -38,21 +38,18 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
{
auto mouseEvent = (QMouseEvent*) event;
if (mouseEvent->source() == Qt::MouseEventNotSynthesized) {
m_mousePressed = true;
} else {
m_mousePressed = false; // Mouse event generated from touch event
}
if (mouseEvent->button() == Qt::RightButton)
{
emit rightClick(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
if (mouseEvent->button() == Qt::LeftButton)
{
if (mouseEvent->source() == Qt::MouseEventNotSynthesized) {
m_mousePressed = true;
} else {
m_mousePressed = false; // Mouse event generated from touch event
}
}
}
else if (event->type() == QEvent::MouseButtonRelease)
{
@ -61,6 +58,7 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
if (mouseEvent->button() == Qt::RightButton)
{
mouseEvent->setAccepted(true);
m_mousePressed = false;
return true;
}