mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-27 11:00:31 -04:00 
			
		
		
		
	Fix positioning of Home antenna. Create cache directory on Linux.
This commit is contained in:
		
							parent
							
								
									56e9f4284f
								
							
						
					
					
						commit
						9eac758088
					
				| @ -2409,7 +2409,13 @@ void ADSBDemodGUI::applyMapSettings() | |||||||
|     // 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); | ||||||
|     // Use ADS-B specific cache, as we use different transmit maps
 |     // Use ADS-B specific cache, as we use different transmit maps
 | ||||||
|     parameters["osm.mapping.cache.directory"] = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/osm/sdrangel/adsb"; |     QString cachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/QtLocation/5.8/tiles/osm/sdrangel_adsb"; | ||||||
|  |     parameters["osm.mapping.cache.directory"] = cachePath; | ||||||
|  |     // On Linux, we need to create the directory
 | ||||||
|  |     QDir dir(cachePath); | ||||||
|  |     if (!dir.exists()) { | ||||||
|  |         dir.mkpath(cachePath); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     QString mapType; |     QString mapType; | ||||||
|     switch (m_settings.m_mapType) |     switch (m_settings.m_mapType) | ||||||
| @ -2427,17 +2433,49 @@ void ADSBDemodGUI::applyMapSettings() | |||||||
|         mapType = "Satellite Map"; |         mapType = "Satellite Map"; | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|     QMetaObject::invokeMethod(item, "createMap", | 
 | ||||||
|  |     QVariant retVal; | ||||||
|  |     if (!QMetaObject::invokeMethod(item, "createMap", Qt::DirectConnection, | ||||||
|  |                                 Q_RETURN_ARG(QVariant, retVal), | ||||||
|                                 Q_ARG(QVariant, QVariant::fromValue(parameters)), |                                 Q_ARG(QVariant, QVariant::fromValue(parameters)), | ||||||
|                                 Q_ARG(QVariant, mapType), |                                 Q_ARG(QVariant, mapType), | ||||||
|                                 Q_ARG(QVariant, QVariant::fromValue(this))); |                                 Q_ARG(QVariant, QVariant::fromValue(this)))) | ||||||
|  |     { | ||||||
|  |         qCritical() << "ADSBDemodGUI::applyMapSettings - Failed to invoke createMap"; | ||||||
|  |     } | ||||||
|  |     QObject *newMap = retVal.value<QObject *>(); | ||||||
| 
 | 
 | ||||||
|     // Restore position of map
 |     // Restore position of map
 | ||||||
|     object = item->findChild<QObject*>("map"); |     if (newMap != nullptr) | ||||||
|     if ((object != nullptr) && coords.isValid()) |  | ||||||
|     { |     { | ||||||
|         object->setProperty("zoomLevel", QVariant::fromValue(zoom)); |         if (coords.isValid()) | ||||||
|         object->setProperty("center", QVariant::fromValue(coords)); |         { | ||||||
|  |             newMap->setProperty("zoomLevel", QVariant::fromValue(zoom)); | ||||||
|  |             newMap->setProperty("center", QVariant::fromValue(coords)); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         qDebug() << "ADSBDemodGUI::applyMapSettings - createMap returned a nullptr"; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // Move antenna icon to My Position
 | ||||||
|  |     QObject *stationObject = newMap->findChild<QObject*>("station"); | ||||||
|  |     if(stationObject != NULL) | ||||||
|  |     { | ||||||
|  |         Real stationLatitude = MainCore::instance()->getSettings().getLatitude(); | ||||||
|  |         Real stationLongitude = MainCore::instance()->getSettings().getLongitude(); | ||||||
|  |         Real stationAltitude = MainCore::instance()->getSettings().getAltitude(); | ||||||
|  |         QGeoCoordinate coords = stationObject->property("coordinate").value<QGeoCoordinate>(); | ||||||
|  |         coords.setLatitude(stationLatitude); | ||||||
|  |         coords.setLongitude(stationLongitude); | ||||||
|  |         coords.setAltitude(stationAltitude); | ||||||
|  |         stationObject->setProperty("coordinate", QVariant::fromValue(coords)); | ||||||
|  |         stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName())); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         qDebug() << "ADSBDemodGUI::applyMapSettings - Couldn't find station"; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -2580,17 +2618,6 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb | |||||||
|         coords.setLongitude(stationLongitude); |         coords.setLongitude(stationLongitude); | ||||||
|         object->setProperty("center", QVariant::fromValue(coords)); |         object->setProperty("center", QVariant::fromValue(coords)); | ||||||
|     } |     } | ||||||
|     // Move antenna icon to My Position
 |  | ||||||
|     QObject *stationObject = item->findChild<QObject*>("station"); |  | ||||||
|     if(stationObject != NULL) |  | ||||||
|     { |  | ||||||
|         QGeoCoordinate coords = stationObject->property("coordinate").value<QGeoCoordinate>(); |  | ||||||
|         coords.setLatitude(stationLatitude); |  | ||||||
|         coords.setLongitude(stationLongitude); |  | ||||||
|         coords.setAltitude(stationAltitude); |  | ||||||
|         stationObject->setProperty("coordinate", QVariant::fromValue(coords)); |  | ||||||
|         stationObject->setProperty("stationName", QVariant::fromValue(MainCore::instance()->getSettings().getStationName())); |  | ||||||
|     } |  | ||||||
|     // Add airports within range of My Position
 |     // Add airports within range of My Position
 | ||||||
|     if (m_airportInfo != nullptr) { |     if (m_airportInfo != nullptr) { | ||||||
|         updateAirports(); |         updateAirports(); | ||||||
|  | |||||||
| @ -74,7 +74,7 @@ void ADSBDemodSettings::resetToDefaults() | |||||||
|     } |     } | ||||||
|     m_logFilename = "adsb_log.csv"; |     m_logFilename = "adsb_log.csv"; | ||||||
|     m_logEnabled = false; |     m_logEnabled = false; | ||||||
|     m_airspaces = QStringList({"A", "C", "TMZ"}); |     m_airspaces = QStringList({"A", "D", "TMZ"}); | ||||||
|     m_airspaceRange = 500.0f; |     m_airspaceRange = 500.0f; | ||||||
|     m_mapType = AVIATION_LIGHT; |     m_mapType = AVIATION_LIGHT; | ||||||
|     m_displayNavAids = true; |     m_displayNavAids = true; | ||||||
| @ -225,7 +225,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data) | |||||||
|         d.readString(36, &m_logFilename, "adsb_log.csv"); |         d.readString(36, &m_logFilename, "adsb_log.csv"); | ||||||
|         d.readBool(37, &m_logEnabled, false); |         d.readBool(37, &m_logEnabled, false); | ||||||
| 
 | 
 | ||||||
|         d.readString(38, &string, "A C TMZ"); |         d.readString(38, &string, "A D TMZ"); | ||||||
|         m_airspaces = string.split(" "); |         m_airspaces = string.split(" "); | ||||||
|         d.readFloat(39, &m_airspaceRange, 500.0f); |         d.readFloat(39, &m_airspaceRange, 500.0f); | ||||||
|         d.readS32(40, (int *)&m_mapType, (int)AVIATION_LIGHT); |         d.readS32(40, (int *)&m_mapType, (int)AVIATION_LIGHT); | ||||||
|  | |||||||
| @ -27,17 +27,14 @@ Item { | |||||||
|         var plugin = Qt.createQmlObject (pluginString, qmlMap) |         var plugin = Qt.createQmlObject (pluginString, qmlMap) | ||||||
| 
 | 
 | ||||||
|         if (mapPtr) { |         if (mapPtr) { | ||||||
|             // Objects aren't destroyed immediately, so rename the old |             // Objects aren't destroyed immediately, so don't call findChild("map") | ||||||
|             // map, so any C++ code that calls findChild("map") doesn't find |  | ||||||
|             // the old map |  | ||||||
|             mapPtr.objectName = "oldMap"; |  | ||||||
|             mapPtr.destroy() |             mapPtr.destroy() | ||||||
|             mapPtr = null |             mapPtr = null | ||||||
|         } |         } | ||||||
|         mapPtr = actualMapComponent.createObject(page) |         mapPtr = actualMapComponent.createObject(page) | ||||||
|         mapPtr.plugin = plugin; |         mapPtr.plugin = plugin | ||||||
|         mapPtr.forceActiveFocus() |         mapPtr.forceActiveFocus() | ||||||
|         mapPtr.objectName = "map"; |         return mapPtr | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Item { |     Item { | ||||||
| @ -50,6 +47,7 @@ Item { | |||||||
| 
 | 
 | ||||||
|         Map { |         Map { | ||||||
|             id: map |             id: map | ||||||
|  |             objectName: "map" | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             center: QtPositioning.coordinate(51.5, 0.125) // London |             center: QtPositioning.coordinate(51.5, 0.125) // London | ||||||
|             zoomLevel: 10 |             zoomLevel: 10 | ||||||
| @ -68,7 +66,6 @@ Item { | |||||||
|                 id: station |                 id: station | ||||||
|                 objectName: "station" |                 objectName: "station" | ||||||
|                 stationName: "Home" |                 stationName: "Home" | ||||||
|                 coordinate:  QtPositioning.coordinate(51.5, 0.125) |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             MapItemView { |             MapItemView { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user