mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	main.qml: modify showMap() to not accept location
showMap() uses a location to open Google Maps in a browser. Make showMap() a generic function to push the mapPage on the view stack. Update the calls to this function from child widgets and pages. Also either call mapPage.centerOnLocation() or mapPage.centerOnDiveSiteUUID() depending if the caller wants the map to center on a dive site or on map coordinates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
		
							parent
							
								
									61c90efc6b
								
							
						
					
					
						commit
						68da4de643
					
				
					 4 changed files with 12 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -170,7 +170,8 @@ Kirigami.Page {
 | 
			
		|||
			name: "gps"
 | 
			
		||||
		}
 | 
			
		||||
		onTriggered: {
 | 
			
		||||
			showMap(currentItem.modelData.dive.gps_decimal)
 | 
			
		||||
			showMap()
 | 
			
		||||
			mapPage.centerOnDiveSiteUUID(currentItem.modelData.dive.dive_site_uuid)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,8 +51,8 @@ Item {
 | 
			
		|||
				anchors.fill: parent
 | 
			
		||||
				enabled: dive.gps_decimal !== ""
 | 
			
		||||
				onClicked: {
 | 
			
		||||
					if (dive.gps_decimal !== "")
 | 
			
		||||
						showMap(dive.gps_decimal)
 | 
			
		||||
					showMap()
 | 
			
		||||
					mapPage.centerOnDiveSiteUUID(dive.dive_site_uuid)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -62,8 +62,8 @@ Item {
 | 
			
		|||
			enabled: dive.gps !== ""
 | 
			
		||||
			text: qsTr("Map it")
 | 
			
		||||
			onClicked: {
 | 
			
		||||
				if (dive.gps_decimal !== "")
 | 
			
		||||
					showMap(dive.gps_decimal)
 | 
			
		||||
				showMap()
 | 
			
		||||
				mapPage.centerOnDiveSiteUUID(dive.dive_site_uuid)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		Row {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -86,7 +86,8 @@ Kirigami.ScrollablePage {
 | 
			
		|||
						name: "gps"
 | 
			
		||||
					}
 | 
			
		||||
					onTriggered: {
 | 
			
		||||
						showMap(latitude + " " + longitude)
 | 
			
		||||
						showMap()
 | 
			
		||||
						mapPage.centerOnLocation(latitude, longitude)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,12 +67,10 @@ Kirigami.ApplicationWindow {
 | 
			
		|||
		diveList.scrollToTop()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function showMap(location) {
 | 
			
		||||
		var urlPrefix = "https://www.google.com/maps/place/"
 | 
			
		||||
		var locationPair = location + "/@" + location
 | 
			
		||||
		var urlSuffix = ",5000m/data=!3m1!1e3!4m2!3m1!1s0x0:0x0"
 | 
			
		||||
		Qt.openUrlExternally(urlPrefix + locationPair + urlSuffix)
 | 
			
		||||
 | 
			
		||||
	function showMap() {
 | 
			
		||||
		globalDrawer.close()
 | 
			
		||||
		returnTopPage()
 | 
			
		||||
		stackView.push(mapPage)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function startAddDive() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue