Modified GPS & map related signals and slots
[situare] / src / ui / mapviewscreen.cpp
index 3f0eeee..8e16f44 100644 (file)
@@ -29,8 +29,7 @@
 #include "panelsidebar.h"
 
 MapViewScreen::MapViewScreen(QWidget *parent)
-   : QWidget(parent),
-     m_autoCenteringEnabled(false)
+   : QWidget(parent)
 {
     MapView *mapView = new MapView(this);
     mapEngine = new MapEngine(this);
@@ -79,7 +78,13 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
             mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
 
-    connect(mapEngine, SIGNAL(mapScrolled()), this, SLOT(locationChanged()));
+    connect(mapEngine, SIGNAL(mapScrolledManually()),
+            this, SIGNAL(mapLocationChanged()));
+
+    connect(this, SIGNAL(positionReceived(QPointF,qreal)),
+            mapEngine, SLOT(gpsPositionUpdate(QPointF,qreal)));
+    connect(this, SIGNAL(enableAutoCentering(bool)),
+            mapEngine, SLOT(setAutoCentering(bool)));
 
     QHBoxLayout *mapViewLayout = new QHBoxLayout;
 
@@ -113,27 +118,3 @@ void MapViewScreen::drawOsmLicense(int width, int height)
     osmLicense->move(width - osmLicense->fontMetrics().width(OSM_LICENSE) - PANEL_PEEK_AMOUNT,
                      height - osmLicense->fontMetrics().height());
 }
-
-void MapViewScreen::locationChanged()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (m_autoCenteringEnabled)
-        emit mapLocationChanged();
-}
-
-void MapViewScreen::positionReceived(QPointF position, qreal accuracy)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (m_autoCenteringEnabled)
-        mapEngine->setViewLocation(position);
-}
-
-void MapViewScreen::enableAutoCentering(bool enabled)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_autoCenteringEnabled = enabled;
-    mapEngine->setAutoCentering(enabled);
-}