mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Parse localized GPS string
Let's ALWAYS support the somewhat "international standard" N/S/W/E characters, but ALSO support localized versions. Fixes #315 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									a529285e9e
								
							
						
					
					
						commit
						917b47b79c
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -1,7 +1,9 @@ | |||
| #include "qthelper.h" | ||||
| #include "qt-ui/mainwindow.h" | ||||
| #include <QRegExp> | ||||
| #include <QDebug> | ||||
| 
 | ||||
| #define tr(_arg) mainWindow()->information()->tr(_arg) | ||||
| DiveComputerList::DiveComputerList() | ||||
| { | ||||
| 
 | ||||
|  | @ -105,7 +107,9 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude) | |||
| 		*longitude = 0.0; | ||||
| 		return true; | ||||
| 	} | ||||
| 	QRegExp r("\\s*([SN])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)\\.(\\d+)[^EW]*([EW])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)\\.(\\d+)"); | ||||
| 	QString regExp = QString("\\s*([NS%1%2])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)\\.(\\d+)[^EW%3%4]*([EW%6%7])\\s*(\\d+)[" UTF8_DEGREE "\\s]+(\\d+)\\.(\\d+)") | ||||
| 			.arg(tr("N")).arg(tr("S")).arg(tr("E")).arg(tr("W")).arg(tr("E")).arg(tr("W")); | ||||
| 	QRegExp r(regExp); | ||||
| 	if (r.indexIn(gps_text) != 8) { | ||||
| 		// qDebug() << "Hemisphere" << r.cap(1) << "deg" << r.cap(2) << "min" << r.cap(3) << "decimal" << r.cap(4);
 | ||||
| 		// qDebug() << "Hemisphere" << r.cap(5) << "deg" << r.cap(6) << "min" << r.cap(7) << "decimal" << r.cap(8);
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue