mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	mobile: get GPS data from dive site name
When the user entered a dive site using autocompletion, it is a known site, of which we might have a GPS location already. Just fill the known site coordinates. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
		
							parent
							
								
									64704d6e5a
								
							
						
					
					
						commit
						806c7077f2
					
				
					 3 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -112,6 +112,9 @@ Item {
 | 
				
			||||||
					diveDetailsListView.currentItem.modelData.dive.locationList : null
 | 
										diveDetailsListView.currentItem.modelData.dive.locationList : null
 | 
				
			||||||
				inputMethodHints: Qt.ImhNoPredictiveText
 | 
									inputMethodHints: Qt.ImhNoPredictiveText
 | 
				
			||||||
				Layout.fillWidth: true
 | 
									Layout.fillWidth: true
 | 
				
			||||||
 | 
									onEditingFinished: {
 | 
				
			||||||
 | 
										gpsText = manager.getGpsFromSiteName(text)
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Controls.Label {
 | 
								Controls.Label {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1536,6 +1536,18 @@ QString QMLManager::getVersion() const
 | 
				
			||||||
	return versionRe.cap(1);
 | 
						return versionRe.cap(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QString QMLManager::getGpsFromSiteName(const QString& siteName)
 | 
				
			||||||
 | 
					{	uint32_t uuid;
 | 
				
			||||||
 | 
						struct dive_site *ds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uuid = get_dive_site_uuid_by_name(qPrintable(siteName), NULL);
 | 
				
			||||||
 | 
						if (uuid) {
 | 
				
			||||||
 | 
							ds = get_dive_site_by_uuid(uuid);
 | 
				
			||||||
 | 
							return QString(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return "";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString QMLManager::notificationText() const
 | 
					QString QMLManager::notificationText() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_notificationText;
 | 
						return m_notificationText;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,6 +184,7 @@ public slots:
 | 
				
			||||||
	QString getNumber(const QString& diveId);
 | 
						QString getNumber(const QString& diveId);
 | 
				
			||||||
	QString getDate(const QString& diveId);
 | 
						QString getDate(const QString& diveId);
 | 
				
			||||||
	QString getCurrentPosition();
 | 
						QString getCurrentPosition();
 | 
				
			||||||
 | 
						QString getGpsFromSiteName(const QString& siteName);
 | 
				
			||||||
	QString getVersion() const;
 | 
						QString getVersion() const;
 | 
				
			||||||
	void deleteGpsFix(quint64 when);
 | 
						void deleteGpsFix(quint64 when);
 | 
				
			||||||
	void revertToNoCloudIfNeeded();
 | 
						void revertToNoCloudIfNeeded();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue