mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Location service: move files around to fit new directory layout
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
12a6a8f2b3
commit
9195f247c4
4 changed files with 3 additions and 3 deletions
32
qt-mobile/gpslocation.cpp
Normal file
32
qt-mobile/gpslocation.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "qt-mobile/gpslocation.h"
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
GpsLocation::GpsLocation(QObject *parent)
|
||||
{
|
||||
QGeoPositionInfoSource *gpsSource = QGeoPositionInfoSource::createDefaultSource(parent);
|
||||
if (gpsSource != 0) {
|
||||
qDebug() << "have position source" << gpsSource->sourceName();
|
||||
connect(gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
|
||||
connect(gpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
|
||||
lastPos = gpsSource->lastKnownPosition();
|
||||
gpsSource->requestUpdate(1000);
|
||||
QGeoCoordinate lastCoord = lastPos.coordinate();
|
||||
if (lastCoord.isValid()) {
|
||||
qDebug() << lastCoord.toString();
|
||||
} else {
|
||||
qDebug() << "invalid last position";
|
||||
}
|
||||
} else {
|
||||
qDebug() << "don't have GPS source";
|
||||
}
|
||||
}
|
||||
void GpsLocation::newPosition(QGeoPositionInfo pos)
|
||||
{
|
||||
qDebug() << "received new position" << pos.coordinate().toString();
|
||||
}
|
||||
|
||||
void GpsLocation::updateTimeout()
|
||||
{
|
||||
qDebug() << "request to get new position timed out";
|
||||
}
|
||||
25
qt-mobile/gpslocation.h
Normal file
25
qt-mobile/gpslocation.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef GPSLOCATION_H
|
||||
#define GPSLOCATION_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QGeoCoordinate>
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include <QGeoPositionInfo>
|
||||
|
||||
class GpsLocation : QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpsLocation(QObject *parent);
|
||||
|
||||
private:
|
||||
QGeoPositionInfo lastPos;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void newPosition(QGeoPositionInfo pos);
|
||||
void updateTimeout();
|
||||
};
|
||||
|
||||
#endif // GPSLOCATION_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue