mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-04 05:30:32 -05:00 
			
		
		
		
	
						commit
						af8d63e94e
					
				@ -60,7 +60,7 @@ if(NOT SERVER_MODE)
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set(TARGET_NAME demodadsb)
 | 
					    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(TARGET_LIB_GUI "sdrgui")
 | 
				
			||||||
    set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
 | 
					    set(INSTALL_FOLDER ${INSTALL_PLUGINS_DIR})
 | 
				
			||||||
else()
 | 
					else()
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
///////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QFontDialog>
 | 
					#include <QFontDialog>
 | 
				
			||||||
 | 
					#include <QGeoServiceProvider>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "adsbdemoddisplaydialog.h"
 | 
					#include "adsbdemoddisplaydialog.h"
 | 
				
			||||||
@ -28,6 +29,15 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid
 | 
				
			|||||||
    m_fontSize(settings->m_tableFontSize)
 | 
					    m_fontSize(settings->m_tableFontSize)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ui->setupUi(this);
 | 
					    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->timeout->setValue(settings->m_removeTimeout);
 | 
				
			||||||
    ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom);
 | 
					    ui->aircraftMinZoom->setValue(settings->m_aircraftMinZoom);
 | 
				
			||||||
    ui->airportRange->setValue(settings->m_airportRange);
 | 
					    ui->airportRange->setValue(settings->m_airportRange);
 | 
				
			||||||
@ -46,7 +56,10 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog(ADSBDemodSettings *settings, QWid
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ui->airspaceRange->setValue(settings->m_airspaceRange);
 | 
					    ui->airspaceRange->setValue(settings->m_airspaceRange);
 | 
				
			||||||
 | 
					    int idx = ui->mapProvider->findText(settings->m_mapProvider);
 | 
				
			||||||
 | 
					    if (idx != -1) {
 | 
				
			||||||
        ui->mapProvider->setCurrentText(settings->m_mapProvider);
 | 
					        ui->mapProvider->setCurrentText(settings->m_mapProvider);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ui->mapType->setCurrentIndex((int)settings->m_mapType);
 | 
					    ui->mapType->setCurrentIndex((int)settings->m_mapType);
 | 
				
			||||||
    ui->navAids->setChecked(settings->m_displayNavAids);
 | 
					    ui->navAids->setChecked(settings->m_displayNavAids);
 | 
				
			||||||
    ui->atcCallsigns->setChecked(settings->m_atcCallsigns);
 | 
					    ui->atcCallsigns->setChecked(settings->m_atcCallsigns);
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,7 @@
 | 
				
			|||||||
#include <QQmlProperty>
 | 
					#include <QQmlProperty>
 | 
				
			||||||
#include <QJsonDocument>
 | 
					#include <QJsonDocument>
 | 
				
			||||||
#include <QJsonObject>
 | 
					#include <QJsonObject>
 | 
				
			||||||
 | 
					#include <QGeoServiceProvider>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ui_adsbdemodgui.h"
 | 
					#include "ui_adsbdemodgui.h"
 | 
				
			||||||
#include "device/deviceapi.h"
 | 
					#include "device/deviceapi.h"
 | 
				
			||||||
@ -4725,14 +4726,24 @@ void ADSBDemodGUI::applyMapSettings()
 | 
				
			|||||||
        zoom = 10.0;
 | 
					        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
 | 
					    // Create the map using the specified provider
 | 
				
			||||||
    QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
 | 
					    QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
 | 
				
			||||||
    QQmlProperty::write(item, "aircraftMinZoomLevel", m_settings.m_aircraftMinZoom);
 | 
					    QQmlProperty::write(item, "aircraftMinZoomLevel", m_settings.m_aircraftMinZoom);
 | 
				
			||||||
    QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
 | 
					    QQmlProperty::write(item, "mapProvider", mapProvider);
 | 
				
			||||||
    QVariantMap parameters;
 | 
					    QVariantMap parameters;
 | 
				
			||||||
    QString mapType;
 | 
					    QString mapType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (m_settings.m_mapProvider == "osm")
 | 
					    if (mapProvider == "osm")
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // Use our repo, so we can append API key and redefine transmit maps
 | 
					        // 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);
 | 
					        parameters["osm.mapping.providersrepository.address"] = QString("http://127.0.0.1:%1/").arg(m_osmPort);
 | 
				
			||||||
@ -4760,7 +4771,7 @@ void ADSBDemodGUI::applyMapSettings()
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (m_settings.m_mapProvider == "mapboxgl")
 | 
					    else if (mapProvider == "mapboxgl")
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        switch (m_settings.m_mapType)
 | 
					        switch (m_settings.m_mapType)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
				
			|||||||
@ -38,20 +38,17 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        auto mouseEvent = (QMouseEvent*) event;
 | 
					        auto mouseEvent = (QMouseEvent*) 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) {
 | 
					        if (mouseEvent->source() == Qt::MouseEventNotSynthesized) {
 | 
				
			||||||
            m_mousePressed = true;
 | 
					            m_mousePressed = true;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            m_mousePressed = false; // Mouse event generated from touch event
 | 
					            m_mousePressed = false; // Mouse event generated from touch event
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (mouseEvent->button() == Qt::RightButton)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            emit rightClick(mouseEvent->globalPos());
 | 
				
			||||||
 | 
					            mouseEvent->setAccepted(true);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (event->type() == QEvent::MouseButtonRelease)
 | 
					    else if (event->type() == QEvent::MouseButtonRelease)
 | 
				
			||||||
@ -61,6 +58,7 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
 | 
				
			|||||||
        if (mouseEvent->button() == Qt::RightButton)
 | 
					        if (mouseEvent->button() == Qt::RightButton)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            mouseEvent->setAccepted(true);
 | 
					            mouseEvent->setAccepted(true);
 | 
				
			||||||
 | 
					            m_mousePressed = false;
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user