--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QGeoPositionInfoSource>
+#include <QDebug>
+
+#include "gpsposition.h"
+
+GPSPosition::GPSPosition(QObject *parent)
+ : QObject(parent)
+{
+ m_gpsSource = QGeoPositionInfoSource::createDefaultSource(this);
+
+ if (m_gpsSource)
+ m_gpsSource->setUpdateInterval(10000);
+
+ connect(m_gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
+ this, SLOT(positionUpdated(QGeoPositionInfo)));
+}
+
+GPSPosition::~GPSPosition()
+{
+ stop();
+}
+
+void GPSPosition::start()
+{
+ if (m_gpsSource)
+ m_gpsSource->startUpdates();
+}
+
+void GPSPosition::stop()
+{
+ if (m_gpsSource)
+ m_gpsSource->stopUpdates();
+}
+
+void GPSPosition::requestUpdate()
+{
+
+}
+
+void GPSPosition::positionUpdated(QGeoPositionInfo positionInfo)
+{
+ qDebug() << positionInfo;
+
+ emit position(QPointF(positionInfo.coordinate().longitude(),
+ positionInfo.coordinate().latitude()));
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jussi Laitinen - jussi.laitinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef GPSPOSITION_H
+#define GPSPOSITION_H
+
+#include <QGeoPositionInfoSource>
+#include <QPointF>
+
+// Use the QtMobility namespace
+QTM_USE_NAMESPACE
+
+class GPSPosition : public QObject
+{
+ Q_OBJECT
+
+public:
+ GPSPosition(QObject *parent = 0);
+ ~GPSPosition();
+
+ void start();
+ void stop();
+
+private slots:
+ void requestUpdate();
+ void positionUpdated(QGeoPositionInfo positionInfo);
+
+signals:
+ void position(QPointF latLonCoordinate);
+
+private:
+ QGeoPositionInfoSource *m_gpsSource;
+};
+
+#endif // GPSPOSITION_H
#include "mapengine.h"
#include "maptile.h"
+#include "gps/gpsposition.h"
+
MapEngine::MapEngine(QObject *parent)
: QObject(parent)
, m_centerTile(QPoint(UNDEFINED, UNDEFINED))
connect(m_mapZoomPanel, SIGNAL(zoomOutPressed()), this, SLOT(zoomOut()));
m_ownLocation = new OwnLocationItem(QPointF());
+
+ //GPS
+ m_gps = new GPSPosition(this);
+ m_gps->start();
+ connect(m_gps, SIGNAL(position(QPointF)), this, SLOT(positionReceived(QPointF)));
}
MapEngine::~MapEngine()
friendGone = true;
}
}
+
+void MapEngine::positionReceived(QPointF position)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ setViewLocation(position);
+}
#include "friendlocationitem.h"
#include "user/user.h"
+class GPSPosition;
+
/**
* @brief Map engine
*
*/
void zoomOut();
+ void positionReceived(QPointF position);
+
/*******************************************************************************
* SIGNALS
******************************************************************************/
bool m_zoomedIn; ///< Flag for checking if zoomed in when zoom is finished
int m_zoomLevel; ///< Current zoom level
QList<FriendLocationItem *> m_friendItems; ///< List of friendLocationItems
+
+ GPSPosition *m_gps;
};
#endif // MAPENGINE_H
ui/situareuser.cpp \
engine/engine.cpp \
ui/settingsdialog.cpp \
- map/maptilerequest.cpp
+ map/maptilerequest.cpp \
+ gps/gpsposition.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
ui/listviewscreen.h \
ui/situareuser.h \
engine/engine.h \
ui/settingsdialog.h \
- map/maptilerequest.h
+ map/maptilerequest.h \
+ gps/gpsposition.h
QT += network \
webkit
+CONFIG += mobility
+MOBILITY = location
#DEFINES += QT_NO_DEBUG_OUTPUT
!maemo5 {
message(QJson built in)